@ls-stack/extended-lint 0.69.3 → 0.69.4
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 +18 -18
- package/dist/extended-lint.mjs +18 -18
- package/package.json +1 -1
package/dist/extended-lint.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var ti=Object.create;var ot=Object.defineProperty;var ni=Object.getOwnPropertyDescriptor;var ri=Object.getOwnPropertyNames;var ii=Object.getPrototypeOf,si=Object.prototype.hasOwnProperty;var oi=(e,t)=>{for(var r in t)ot(e,r,{get:t[r],enumerable:!0})},Nn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ri(t))!si.call(e,s)&&s!==r&&ot(e,s,{get:()=>t[s],enumerable:!(n=ni(t,s))||n.enumerable});return e};var he=(e,t,r)=>(r=e!=null?ti(ii(e)):{},Nn(t||!e||!e.__esModule?ot(r,"default",{value:e,enumerable:!0}):r,e)),ai=e=>Nn(ot({},"__esModule",{value:!0}),e);var ha={};oi(ha,{extendedLintPlugin:()=>Ta});module.exports=ai(ha);var le=require("@typescript-eslint/utils"),k=require("zod/v4");var Dn=require("@typescript-eslint/utils"),jn=he(require("zod/v4"));function M(e){let r=Dn.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function L(e){return jn.toJSONSchema(e)}var li=k.z.object({disallow:k.z.array(k.z.object({selector:k.z.string(),message:k.z.string(),replace:k.z.optional(k.z.union([k.z.string(),k.z.object({regex:k.z.string(),with:k.z.string()})])),replaceType:k.z.optional(k.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:k.z.optional(k.z.array(k.z.object({fn:k.z.string(),withArgs:k.z.optional(k.z.array(k.z.object({atIndex:k.z.number(),value:k.z.union([k.z.string(),k.z.number(),k.z.boolean()])}))),message:k.z.string(),replaceWith:k.z.optional(k.z.string()),ignoreRegex:k.z.optional(k.z.string())}))),__dev_simulateFileName:k.z.optional(k.z.string()),mustMatchSyntax:k.z.optional(k.z.array(k.z.object({includeRegex:k.z.string(),mustCallFn:k.z.optional(k.z.array(k.z.object({anyCall:k.z.array(k.z.object({fn:k.z.string(),withArgs:k.z.array(k.z.object({atIndex:k.z.number(),literal:k.z.union([k.z.string(),k.z.number(),k.z.boolean()])}))})),message:k.z.optional(k.z.string())}))),mustMatchSelector:k.z.optional(k.z.array(k.z.object({selector:k.z.string(),message:k.z.string()}))),mustHaveExport:k.z.optional(k.z.array(k.z.object({name:k.z.string(),type:k.z.enum(["function","variable","any"]).default("any"),message:k.z.string()})))})))}),At=M({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[L(li)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:s,disallow:o,disallowFnCalls:i}=t,p=s??e.filename,l=[],c=new Map,f=new Set,d=new Map,a=new Set,u=new Map;function m(S){for(let C of S.specifiers)C.type===le.AST_NODE_TYPES.ImportSpecifier&&C.imported.type===le.AST_NODE_TYPES.Identifier&&C.imported.name!==C.local.name&&u.set(C.local.name,C.imported.name)}function T(S){if(S.declaration){if(S.declaration.type===le.AST_NODE_TYPES.FunctionDeclaration&&S.declaration.id){let C=S.declaration.id.name;for(let w of Array.from(a)){let[I,O]=w.split(":");I===C&&(O==="function"||O==="any")&&a.delete(w)}}else if(S.declaration.type===le.AST_NODE_TYPES.VariableDeclaration){for(let C of S.declaration.declarations)if(C.id.type===le.AST_NODE_TYPES.Identifier){let w=C.id.name;for(let I of Array.from(a)){let[O,$]=I.split(":");O===w&&($==="variable"||$==="any")&&a.delete(I)}}}}for(let C of S.specifiers)if(C.exported.type===le.AST_NODE_TYPES.Identifier){let w=C.exported.name;for(let I of Array.from(a)){let[O,$]=I.split(":");O===w&&$==="any"&&a.delete(I)}}}function h(S){S.id.type===le.AST_NODE_TYPES.Identifier&&S.init?.type===le.AST_NODE_TYPES.Identifier&&u.set(S.id.name,S.init.name)}function y(S){return u.get(S)??S}function E(S,C){return y(S)===C||S===C}for(let{includeRegex:S,mustCallFn:C,mustMatchSelector:w,mustHaveExport:I}of n??[]){let $=function(ne){let Q=ne;for(let{name:se,value:ae}of O??[])Q=Q.replaceAll(se,ae);return Q};var b=$;let O=pi(p,new RegExp(S));if(O){for(let{anyCall:ne,message:Q}of C??[]){let se=`Expected file to call the function: ${ne.map(({fn:ae})=>ae).join(" or ")}`;f.add(se),l.push(ae=>{let{callee:Z}=ae;if(Z.type===le.AST_NODE_TYPES.Identifier){for(let{fn:be,withArgs:Je}of ne)if(Z.name===be){f.delete(se);for(let ce of Je){let Fe=ae.arguments[ce.atIndex],de=typeof ce.literal=="string"?$(ce.literal):ce.literal;if(!Fe){e.report({node:ae,messageId:"default",data:{message:`Missing argument with value "${de}" at index ${ce.atIndex}${Q?`: ${$(Q)}`:""}`}});continue}if(Fe.type!==le.AST_NODE_TYPES.Literal){e.report({node:Fe,messageId:"default",data:{message:`Argument at position ${ce.atIndex} should the literal "${de}"${Q?`: ${$(Q)}`:""}`}});continue}Fe.value!==de&&e.report({node:Fe,messageId:"default",data:{message:`Argument should have the value "${de}"${Q?`: ${$(Q)}`:""}`},fix:_e=>_e.replaceText(Fe,typeof de=="string"?`'${de}'`:String(de))})}break}}})}for(let{selector:ne,message:Q}of w??[])d.set(ne,$(Q)),c.set($(ne),()=>{d.delete(ne)});for(let{name:ne,type:Q,message:se}of I??[]){let ae=$(ne),Z=$(se);a.add(`${ae}:${Q}:${Z}`)}}}for(let{fn:S,withArgs:C,message:w,replaceWith:I,ignoreRegex:O}of i??[])O&&new RegExp(O).test(p)||l.push($=>{let{callee:ne}=$;if(ne.type!==le.AST_NODE_TYPES.Identifier||!E(ne.name,S))return;if(C)for(let se of C){let ae=$.arguments[se.atIndex];if(!ae){e.report({node:$,messageId:"default",data:{message:`Missing argument with value "${se.value}" at index ${se.atIndex}: ${w}`}});return}if(ae.type!==le.AST_NODE_TYPES.Literal||ae.value!==se.value)return}let Q=se=>I?se.replaceText($,I):null;e.report({node:$,messageId:"default",data:{message:w},suggest:I?[{messageId:"default",data:{message:`Replace with "${I}"`},fix:Q}]:void 0})});function x(S,C){let w=r[S];w?r[S]=I=>{w(I),C(I)}:r[S]=C}for(let{selector:S,message:C,replace:w,replaceType:I="suggestion"}of o??[]){if(S==="CallExpression"){l.push(O=>{g(w,O,C,I)});continue}r[S]=O=>{g(w,O,C,I)}}if(c.size>0)for(let[S,C]of c)x(S,C);return l.length>0&&(r.CallExpression=S=>{if(S.type===le.AST_NODE_TYPES.CallExpression)for(let C of l)C(S)}),r.ImportDeclaration=S=>{S.type===le.AST_NODE_TYPES.ImportDeclaration&&m(S)},r.ExportNamedDeclaration=S=>{S.type===le.AST_NODE_TYPES.ExportNamedDeclaration&&T(S)},r.VariableDeclarator=S=>{S.type===le.AST_NODE_TYPES.VariableDeclarator&&h(S)},r["Program:exit"]=S=>{for(let C of f)e.report({node:S,messageId:"default",data:{message:C}});for(let[,C]of d)e.report({node:S,messageId:"default",data:{message:C}});for(let C of a){let[w,I,O]=C.split(":");e.report({node:S,messageId:"default",data:{message:`Missing required export "${w}" of type ${I}: ${O}`}})}},r;function g(S,C,w,I){let O=$=>{if(!S)return null;if(typeof S=="string")return $.replaceText(C,S);{let ne=new RegExp(S.regex),Q=e.sourceCode.getText(C);return $.replaceText(C,Q.replace(ne,S.with))}};e.report({node:C,messageId:"default",data:{message:w},fix:S&&I==="autofix"?O:void 0,suggest:S&&I==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof S=="string"?S:S.with}"`},fix:O}]:void 0})}}});function pi(e,t){let r=[],n=t.exec(e);if(!n)return null;let[s,...o]=n;r.push({name:"$0_lowercase",value:s.toLowerCase()}),r.push({name:"$0_capitalize",value:Ln(s)}),r.push({name:"$0_uncapitalize",value:Mn(s)}),r.push({name:"$0",value:s});for(let i=0;i<o.length;i++){let p=`$${i+1}`,l=o[i];l!==void 0&&(r.push({name:`${p}_lowercase`,value:l.toLowerCase()}),r.push({name:`${p}_capitalize`,value:Ln(l)}),r.push({name:`${p}_uncapitalize`,value:Mn(l)}),r.push({name:p,value:l}))}return r}function Ln(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Mn(e){return e.charAt(0).toLowerCase()+e.slice(1)}var V=require("@typescript-eslint/utils"),Ne=require("zod/v4");var ci=V.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),$n="collapse-simple-objs-in-one-line",ui=Ne.z.object({maxLineLength:Ne.z.number().optional(),maxProperties:Ne.z.number().optional(),nestedObjMaxLineLength:Ne.z.number().optional(),nestedObjMaxProperties:Ne.z.number().optional(),ignoreTypesWithSuffix:Ne.z.array(Ne.z.string()).optional()}),fi=ci({name:$n,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:[L(ui)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],s=t.maxProperties??2,o=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function p(c){if(c.type===V.AST_NODE_TYPES.ObjectExpression){let f=c.parent.type===V.AST_NODE_TYPES.Property,d=f?i:s,a=c.properties.length;if(a>d)return!1;if(a===1){let m=c.properties[0];return!m||m.type===V.AST_NODE_TYPES.Property&&m.value.type===V.AST_NODE_TYPES.ObjectExpression||m.type===V.AST_NODE_TYPES.Property&&m.value.type===V.AST_NODE_TYPES.ArrayExpression&&!m.value.elements.every(h=>h&&It(h))?!1:{text:r.getText(m),isNested:f,propsSize:a}}let u=[];for(let m of c.properties){if(m.type===V.AST_NODE_TYPES.Property&&!It(m.value))return!1;u.push(r.getText(m))}return{text:u.join(", "),isNested:f,propsSize:a}}else{let f=c.parent.parent?.type===V.AST_NODE_TYPES.TSPropertySignature,d=f?i:s,a=c.members.length;if(a>d)return!1;if(n.length>0&&c.parent.type===V.AST_NODE_TYPES.TSTypeAliasDeclaration){let m=c.parent.id.name;if(n.some(T=>m.endsWith(T)))return!1}if(a===1){let m=c.members[0];return!m||m.type===V.AST_NODE_TYPES.TSPropertySignature&&m.typeAnnotation?.typeAnnotation.type===V.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(m),isNested:f,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 m of c.members){if(m.type!==V.AST_NODE_TYPES.TSPropertySignature)return!1;let T=m.typeAnnotation?.typeAnnotation;if(!T||T.type===V.AST_NODE_TYPES.TSTypeLiteral||!_n(T))return!1;if(T.type===V.AST_NODE_TYPES.TSTypeReference&&T.typeArguments){if(T.typeArguments.params.length>1)return!1;let y=T.typeArguments.params[0];if(!y||!_n(y))return!1}let h=r.getText(m).trim();(h.endsWith(";")||h.endsWith(","))&&(h=h.slice(0,-1)),u.push(h)}return{text:u.join("; "),isNested:f,propsSize:a}}}function l(c){if(c.loc.start.line===c.loc.end.line)return;if(c.parent.type!==V.AST_NODE_TYPES.JSXExpressionContainer){let T=0,h=!1,y=r.getTokenAfter(c,{filter:x=>x.type!==V.AST_TOKEN_TYPES.Punctuator||h?!0:x.value===","?(T++,!1):x.value===";"?(T++,h=!0,!1):x.value===")"||x.value==="}"?(T++,!1):!0});if(T>4)return;let E=y?.type===V.AST_TOKEN_TYPES.Template&&y.value.startsWith(`}
|
|
2
|
-
`);if(
|
|
3
|
-
`)||r.getCommentsInside(c).length>0)return;d.endsWith(";")&&(d=d.slice(0,-1));let a=`{ ${d} }`,u=yi(r,c),
|
|
4
|
-
`,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function yi(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var Rt={name:$n,rule:fi};var di=/eslint +react-compiler\/react-compiler: +\["error/,
|
|
1
|
+
"use strict";var ti=Object.create;var ot=Object.defineProperty;var ni=Object.getOwnPropertyDescriptor;var ri=Object.getOwnPropertyNames;var ii=Object.getPrototypeOf,si=Object.prototype.hasOwnProperty;var oi=(e,t)=>{for(var r in t)ot(e,r,{get:t[r],enumerable:!0})},Nn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ri(t))!si.call(e,s)&&s!==r&&ot(e,s,{get:()=>t[s],enumerable:!(n=ni(t,s))||n.enumerable});return e};var he=(e,t,r)=>(r=e!=null?ti(ii(e)):{},Nn(t||!e||!e.__esModule?ot(r,"default",{value:e,enumerable:!0}):r,e)),ai=e=>Nn(ot({},"__esModule",{value:!0}),e);var ha={};oi(ha,{extendedLintPlugin:()=>Ta});module.exports=ai(ha);var le=require("@typescript-eslint/utils"),k=require("zod/v4");var Dn=require("@typescript-eslint/utils"),jn=he(require("zod/v4"));function M(e){let r=Dn.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function L(e){return jn.toJSONSchema(e)}var li=k.z.object({disallow:k.z.array(k.z.object({selector:k.z.string(),message:k.z.string(),replace:k.z.optional(k.z.union([k.z.string(),k.z.object({regex:k.z.string(),with:k.z.string()})])),replaceType:k.z.optional(k.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:k.z.optional(k.z.array(k.z.object({fn:k.z.string(),withArgs:k.z.optional(k.z.array(k.z.object({atIndex:k.z.number(),value:k.z.union([k.z.string(),k.z.number(),k.z.boolean()])}))),message:k.z.string(),replaceWith:k.z.optional(k.z.string()),ignoreRegex:k.z.optional(k.z.string())}))),__dev_simulateFileName:k.z.optional(k.z.string()),mustMatchSyntax:k.z.optional(k.z.array(k.z.object({includeRegex:k.z.string(),mustCallFn:k.z.optional(k.z.array(k.z.object({anyCall:k.z.array(k.z.object({fn:k.z.string(),withArgs:k.z.array(k.z.object({atIndex:k.z.number(),literal:k.z.union([k.z.string(),k.z.number(),k.z.boolean()])}))})),message:k.z.optional(k.z.string())}))),mustMatchSelector:k.z.optional(k.z.array(k.z.object({selector:k.z.string(),message:k.z.string()}))),mustHaveExport:k.z.optional(k.z.array(k.z.object({name:k.z.string(),type:k.z.enum(["function","variable","any"]).default("any"),message:k.z.string()})))})))}),At=M({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[L(li)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:s,disallow:o,disallowFnCalls:i}=t,p=s??e.filename,l=[],c=new Map,y=new Set,d=new Map,a=new Set,u=new Map;function f(T){for(let C of T.specifiers)C.type===le.AST_NODE_TYPES.ImportSpecifier&&C.imported.type===le.AST_NODE_TYPES.Identifier&&C.imported.name!==C.local.name&&u.set(C.local.name,C.imported.name)}function S(T){if(T.declaration){if(T.declaration.type===le.AST_NODE_TYPES.FunctionDeclaration&&T.declaration.id){let C=T.declaration.id.name;for(let w of Array.from(a)){let[I,O]=w.split(":");I===C&&(O==="function"||O==="any")&&a.delete(w)}}else if(T.declaration.type===le.AST_NODE_TYPES.VariableDeclaration){for(let C of T.declaration.declarations)if(C.id.type===le.AST_NODE_TYPES.Identifier){let w=C.id.name;for(let I of Array.from(a)){let[O,$]=I.split(":");O===w&&($==="variable"||$==="any")&&a.delete(I)}}}}for(let C of T.specifiers)if(C.exported.type===le.AST_NODE_TYPES.Identifier){let w=C.exported.name;for(let I of Array.from(a)){let[O,$]=I.split(":");O===w&&$==="any"&&a.delete(I)}}}function h(T){T.id.type===le.AST_NODE_TYPES.Identifier&&T.init?.type===le.AST_NODE_TYPES.Identifier&&u.set(T.id.name,T.init.name)}function m(T){return u.get(T)??T}function E(T,C){return m(T)===C||T===C}for(let{includeRegex:T,mustCallFn:C,mustMatchSelector:w,mustHaveExport:I}of n??[]){let $=function(ne){let Q=ne;for(let{name:oe,value:ae}of O??[])Q=Q.replaceAll(oe,ae);return Q};var b=$;let O=pi(p,new RegExp(T));if(O){for(let{anyCall:ne,message:Q}of C??[]){let oe=`Expected file to call the function: ${ne.map(({fn:ae})=>ae).join(" or ")}`;y.add(oe),l.push(ae=>{let{callee:Z}=ae;if(Z.type===le.AST_NODE_TYPES.Identifier){for(let{fn:be,withArgs:Je}of ne)if(Z.name===be){y.delete(oe);for(let ce of Je){let Fe=ae.arguments[ce.atIndex],de=typeof ce.literal=="string"?$(ce.literal):ce.literal;if(!Fe){e.report({node:ae,messageId:"default",data:{message:`Missing argument with value "${de}" at index ${ce.atIndex}${Q?`: ${$(Q)}`:""}`}});continue}if(Fe.type!==le.AST_NODE_TYPES.Literal){e.report({node:Fe,messageId:"default",data:{message:`Argument at position ${ce.atIndex} should the literal "${de}"${Q?`: ${$(Q)}`:""}`}});continue}Fe.value!==de&&e.report({node:Fe,messageId:"default",data:{message:`Argument should have the value "${de}"${Q?`: ${$(Q)}`:""}`},fix:_e=>_e.replaceText(Fe,typeof de=="string"?`'${de}'`:String(de))})}break}}})}for(let{selector:ne,message:Q}of w??[])d.set(ne,$(Q)),c.set($(ne),()=>{d.delete(ne)});for(let{name:ne,type:Q,message:oe}of I??[]){let ae=$(ne),Z=$(oe);a.add(`${ae}:${Q}:${Z}`)}}}for(let{fn:T,withArgs:C,message:w,replaceWith:I,ignoreRegex:O}of i??[])O&&new RegExp(O).test(p)||l.push($=>{let{callee:ne}=$;if(ne.type!==le.AST_NODE_TYPES.Identifier||!E(ne.name,T))return;if(C)for(let oe of C){let ae=$.arguments[oe.atIndex];if(!ae){e.report({node:$,messageId:"default",data:{message:`Missing argument with value "${oe.value}" at index ${oe.atIndex}: ${w}`}});return}if(ae.type!==le.AST_NODE_TYPES.Literal||ae.value!==oe.value)return}let Q=oe=>I?oe.replaceText($,I):null;e.report({node:$,messageId:"default",data:{message:w},suggest:I?[{messageId:"default",data:{message:`Replace with "${I}"`},fix:Q}]:void 0})});function x(T,C){let w=r[T];w?r[T]=I=>{w(I),C(I)}:r[T]=C}for(let{selector:T,message:C,replace:w,replaceType:I="suggestion"}of o??[]){if(T==="CallExpression"){l.push(O=>{g(w,O,C,I)});continue}r[T]=O=>{g(w,O,C,I)}}if(c.size>0)for(let[T,C]of c)x(T,C);return l.length>0&&(r.CallExpression=T=>{if(T.type===le.AST_NODE_TYPES.CallExpression)for(let C of l)C(T)}),r.ImportDeclaration=T=>{T.type===le.AST_NODE_TYPES.ImportDeclaration&&f(T)},r.ExportNamedDeclaration=T=>{T.type===le.AST_NODE_TYPES.ExportNamedDeclaration&&S(T)},r.VariableDeclarator=T=>{T.type===le.AST_NODE_TYPES.VariableDeclarator&&h(T)},r["Program:exit"]=T=>{for(let C of y)e.report({node:T,messageId:"default",data:{message:C}});for(let[,C]of d)e.report({node:T,messageId:"default",data:{message:C}});for(let C of a){let[w,I,O]=C.split(":");e.report({node:T,messageId:"default",data:{message:`Missing required export "${w}" of type ${I}: ${O}`}})}},r;function g(T,C,w,I){let O=$=>{if(!T)return null;if(typeof T=="string")return $.replaceText(C,T);{let ne=new RegExp(T.regex),Q=e.sourceCode.getText(C);return $.replaceText(C,Q.replace(ne,T.with))}};e.report({node:C,messageId:"default",data:{message:w},fix:T&&I==="autofix"?O:void 0,suggest:T&&I==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof T=="string"?T:T.with}"`},fix:O}]:void 0})}}});function pi(e,t){let r=[],n=t.exec(e);if(!n)return null;let[s,...o]=n;r.push({name:"$0_lowercase",value:s.toLowerCase()}),r.push({name:"$0_capitalize",value:Ln(s)}),r.push({name:"$0_uncapitalize",value:Mn(s)}),r.push({name:"$0",value:s});for(let i=0;i<o.length;i++){let p=`$${i+1}`,l=o[i];l!==void 0&&(r.push({name:`${p}_lowercase`,value:l.toLowerCase()}),r.push({name:`${p}_capitalize`,value:Ln(l)}),r.push({name:`${p}_uncapitalize`,value:Mn(l)}),r.push({name:p,value:l}))}return r}function Ln(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Mn(e){return e.charAt(0).toLowerCase()+e.slice(1)}var V=require("@typescript-eslint/utils"),Ne=require("zod/v4");var ci=V.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),$n="collapse-simple-objs-in-one-line",ui=Ne.z.object({maxLineLength:Ne.z.number().optional(),maxProperties:Ne.z.number().optional(),nestedObjMaxLineLength:Ne.z.number().optional(),nestedObjMaxProperties:Ne.z.number().optional(),ignoreTypesWithSuffix:Ne.z.array(Ne.z.string()).optional()}),fi=ci({name:$n,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:[L(ui)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],s=t.maxProperties??2,o=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function p(c){if(c.type===V.AST_NODE_TYPES.ObjectExpression){let y=c.parent.type===V.AST_NODE_TYPES.Property,d=y?i:s,a=c.properties.length;if(a>d)return!1;if(a===1){let f=c.properties[0];return!f||f.type===V.AST_NODE_TYPES.Property&&f.value.type===V.AST_NODE_TYPES.ObjectExpression||f.type===V.AST_NODE_TYPES.Property&&f.value.type===V.AST_NODE_TYPES.ArrayExpression&&!f.value.elements.every(h=>h&&It(h))?!1:{text:r.getText(f),isNested:y,propsSize:a}}let u=[];for(let f of c.properties){if(f.type===V.AST_NODE_TYPES.Property&&!It(f.value))return!1;u.push(r.getText(f))}return{text:u.join(", "),isNested:y,propsSize:a}}else{let y=c.parent.parent?.type===V.AST_NODE_TYPES.TSPropertySignature,d=y?i:s,a=c.members.length;if(a>d)return!1;if(n.length>0&&c.parent.type===V.AST_NODE_TYPES.TSTypeAliasDeclaration){let f=c.parent.id.name;if(n.some(S=>f.endsWith(S)))return!1}if(a===1){let f=c.members[0];return!f||f.type===V.AST_NODE_TYPES.TSPropertySignature&&f.typeAnnotation?.typeAnnotation.type===V.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(f),isNested:y,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 f of c.members){if(f.type!==V.AST_NODE_TYPES.TSPropertySignature)return!1;let S=f.typeAnnotation?.typeAnnotation;if(!S||S.type===V.AST_NODE_TYPES.TSTypeLiteral||!_n(S))return!1;if(S.type===V.AST_NODE_TYPES.TSTypeReference&&S.typeArguments){if(S.typeArguments.params.length>1)return!1;let m=S.typeArguments.params[0];if(!m||!_n(m))return!1}let h=r.getText(f).trim();(h.endsWith(";")||h.endsWith(","))&&(h=h.slice(0,-1)),u.push(h)}return{text:u.join("; "),isNested:y,propsSize:a}}}function l(c){if(c.loc.start.line===c.loc.end.line)return;if(c.parent.type!==V.AST_NODE_TYPES.JSXExpressionContainer){let S=0,h=!1,m=r.getTokenAfter(c,{filter:x=>x.type!==V.AST_TOKEN_TYPES.Punctuator||h?!0:x.value===","?(S++,!1):x.value===";"?(S++,h=!0,!1):x.value===")"||x.value==="}"?(S++,!1):!0});if(S>4)return;let E=m?.type===V.AST_TOKEN_TYPES.Template&&m.value.startsWith(`}
|
|
2
|
+
`);if(m?.loc.start.line===c.loc.end.line&&!E)return}let y=p(c);if(!y)return;let d=y.text;if(d.includes(`
|
|
3
|
+
`)||r.getCommentsInside(c).length>0)return;d.endsWith(";")&&(d=d.slice(0,-1));let a=`{ ${d} }`,u=yi(r,c),f=y.isNested&&y.propsSize>2?o:t.maxLineLength;f&&a.length+u.length+mi(c,r)>f||e.report({node:c,messageId:"singleLineProp",fix:S=>S.replaceText(c,a)})}return{TSTypeLiteral:l,ObjectExpression:l}}});function _n(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 It(e,t){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||!t&&e.type===V.AST_NODE_TYPES.ArrayExpression&&e.elements.every(r=>r&&It(r,!0)))}function mi(e,t){let r=t.getLastToken(e);if(!r)return 0;let n=t.text.indexOf(`
|
|
4
|
+
`,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function yi(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var Rt={name:$n,rule:fi};var di=/eslint +react-compiler\/react-compiler: +\["error/,zn={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"}}}]},create(e){let t=!1,r=typeof e.getSource=="function"?m=>r(m):m=>e.sourceCode.getText(m),n=typeof e.getScope=="function"?()=>n():m=>e.sourceCode.getScope(m),s=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,o=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:s,enableDangerousAutofixThisMayCauseInfiniteLoops:o};function p(m){o&&Array.isArray(m.suggest)&&m.suggest.length>0&&(m.fix=m.suggest[0].fix),e.report(m)}let l=e.getSourceCode().scopeManager,c=new WeakMap,y=new WeakSet,d=new WeakMap,a=new WeakMap,u=new WeakSet;function f(m,E){return function(x){if(E.has(x))return E.get(x);let g=m(x);return E.set(x,g),g}}function S(m,E,x,g,b){b&&m.async&&p({node:m,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 S=l.acquire(y),C=new Set,w=null;{let A=S.upper;for(;A&&(C.add(A),A.type!=="function");)A=A.upper;if(!A)return;w=A}let I=Array.isArray;function O(A){if(!I(A.defs))return!1;let R=A.defs[0];if(R==null||R.node.type!=="VariableDeclarator")return!1;let P=R.node.init;if(P==null)return!1;for(;P.type==="TSAsExpression";)P=P.expression;let N=R.node.parent;if(N==null&&(vt(w.block,R.node.id),N=R.node.parent,N==null))return!1;if(N.kind==="const"&&P.type==="Literal"&&(typeof P.value=="string"||typeof P.value=="number"||P.value===null))return!0;if(P.type!=="CallExpression")return!1;let j=P.callee;if(j.type==="MemberExpression"&&j.object.name==="React"&&j.property!=null&&!j.computed&&(j=j.property),j.type!=="Identifier")return!1;let D=R.node.id,{name:U}=j;if(U==="useRef"&&D.type==="Identifier")return!0;if(Ei(j)&&D.type==="Identifier"){for(let W of A.references)W!==D&&u.add(W.identifier);return!0}else if(U==="useState"||U==="useReducer"){if(D.type==="ArrayPattern"&&D.elements.length===2&&I(A.identifiers)){if(D.elements[1]===A.identifiers[0]){if(U==="useState"){let W=A.references,ge=0;for(let Re=0;Re<W.length;Re++){if(W[Re].isWrite()&&ge++,ge>1)return!1;c.set(W[Re].identifier,D.elements[0])}}return!0}else if(D.elements[0]===A.identifiers[0]){if(U==="useState"){let W=A.references;for(let ge=0;ge<W.length;ge++)f.add(W[ge].identifier)}return!1}}}else if(U==="useTransition"&&D.type==="ArrayPattern"&&D.elements.length===2&&Array.isArray(A.identifiers)&&D.elements[1]===A.identifiers[0])return!0;return!1}function $(A){if(!I(A.defs))return!1;let R=A.defs[0];if(R==null||R.node==null||R.node.id==null)return!1;let P=R.node,N=w.childScopes,j=null,D;for(D=0;D<N.length;D++){let U=N[D],W=U.block;if(P.type==="FunctionDeclaration"&&W===P||P.type==="VariableDeclarator"&&W.parent===P){j=U;break}}if(j==null)return!1;for(D=0;D<j.through.length;D++){let U=j.through[D];if(U.resolved!=null&&C.has(U.resolved.scope)&&!ne(U.resolved))return!1}return!0}let ne=m(O,d),Q=m($,a),se=new Map;function ae(A){let R=A.from,P=!1;for(;R.block!==y;)R.type==="function"&&(P=R.block.parent!=null&&R.block.parent.type==="ReturnStatement"),R=R.upper;return P}let Z=new Map,be=new Map;Je(S);function Je(A){for(let R of A.references){if(!R.resolved||!C.has(R.resolved.scope))continue;let P=vt(y,R.identifier),N=zn(P),j=we(N,be);if(b&&N.type==="Identifier"&&(N.parent.type==="MemberExpression"||N.parent.type==="OptionalMemberExpression")&&!N.parent.computed&&N.parent.property.type==="Identifier"&&N.parent.property.name==="current"&&ae(R)&&se.set(j,{reference:R,dependencyNode:N}),N.parent.type==="TSTypeQuery"||N.parent.type==="TSTypeReference")continue;let D=R.resolved.defs[0];if(D!=null&&!(D.node!=null&&D.node.init===y.parent)&&D.type!=="TypeParameter")if(Z.has(j))Z.get(j).references.push(R);else{let U=R.resolved,W=ne(U)||Q(U);Z.set(j,{isStable:W,references:[R]})}}for(let R of A.childScopes)Je(R)}se.forEach(({reference:A,dependencyNode:R},P)=>{let N=A.resolved.references,j=!1;for(let D=0;D<N.length;D++){let{identifier:U}=N[D],{parent:W}=U;if(W!=null&&W.type==="MemberExpression"&&!W.computed&&W.property.type==="Identifier"&&W.property.name==="current"&&W.parent.type==="AssignmentExpression"&&W.parent.left===W){j=!0;break}}j||p({node:R.parent.property,message:`The ref value '${P}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${P}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ce=new Set;function Fe(A,R){ce.has(R)||(ce.add(R),p({node:A,message:`Assignments to the '${R}' variable from inside React Hook ${r(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 ${r(x)}.`}))}let de=new Set;if(Z.forEach(({isStable:A,references:R},P)=>{A&&de.add(P),R.forEach(N=>{N.writeExpr&&Fe(N.writeExpr,P)})}),ce.size>0)return;if(!E){let A=null;if(Z.forEach(({isStable:R,references:P},N)=>{A||P.forEach(j=>{if(A)return;let D=j.identifier;if(!c.has(D))return;let W=j.from;for(;W.type!=="function";)W=W.upper;W.block===y&&(A=N)})}),A){let{suggestedDependencies:R}=wt({dependencies:Z,declaredDependencies:[],stableDependencies:de,externalDependencies:new Set,isEffect:!0});p({node:x,message:`React Hook ${g} contains a call to '${A}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+R.join(", ")+`] as a second argument to the ${g} Hook.`,suggest:[{desc:`Add dependencies array: [${R.join(", ")}]`,fix(P){return P.insertTextAfter(y,`, [${R.join(", ")}]`)}}]})}return}let _e=[],Ze=new Set;E.type!=="ArrayExpression"?p({node:E,message:`React Hook ${r(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(A=>{if(A===null)return;if(A.type==="SpreadElement"){p({node:A,message:`React Hook ${r(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(A)&&p({node:A,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(A)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(A)}\``,fix(j){return j.removeRange(A.range)}}]});let R;try{R=we(A,be)}catch(j){if(/Unsupported node type/.test(j.message)){A.type==="Literal"?Z.has(A.value)?p({node:A,message:`The ${A.raw} literal is not a valid dependency because it never changes. Did you mean to include ${A.value} in the array instead?`}):p({node:A,message:`The ${A.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):p({node:A,message:`React Hook ${r(x)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw j}let P=A;for(;P.type==="MemberExpression"||P.type==="OptionalMemberExpression"||P.type==="ChainExpression";)P=P.object||P.expression.object;let N=!w.through.some(j=>j.identifier===P);_e.push({key:R,node:A}),N||Ze.add(R)});let{suggestedDependencies:Gr,unnecessaryDependencies:it,missingDependencies:Oe,duplicateDependencies:Pn}=wt({dependencies:Z,declaredDependencies:_e,stableDependencies:de,externalDependencies:Ze,isEffect:b}),st=Gr;if(Pn.size+Oe.size+it.size===0){if(t)return;gi({declaredDependencies:_e,declaredDependenciesNode:E,componentScope:w,scope:S}).forEach(({construction:R,isUsedOutsideOfHook:P,depType:N})=>{let j=N==="function"?"useCallback":"useMemo",D=N==="function"?"definition":"initialization",U=`wrap the ${D} of '${R.name.name}' in its own ${j}() Hook.`,W=P?`To fix this, ${U}`:`Move it inside the ${g} callback. Alternatively, ${U}`,ge=N==="conditional"||N==="logical expression"?"could make":"makes",Re=`The '${R.name.name}' ${N} ${ge} the dependencies of ${g} Hook (at line ${E.loc.start.line}) change on every render. ${W}`,Fn;P&&R.type==="Variable"&&N==="function"&&(Fn=[{desc:`Wrap the ${D} of '${R.name.name}' in its own ${j}() Hook.`,fix(On){let[Qr,ei]=j==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[On.insertTextBefore(R.node.init,Qr),On.insertTextAfter(R.node.init,ei)]}}]),p({node:R.node,message:Re,suggest:Fn})});return}!b&&Oe.size>0&&(st=wt({dependencies:Z,declaredDependencies:[],stableDependencies:de,externalDependencies:Ze,isEffect:b}).suggestedDependencies);function Kr(){if(_e.length===0)return!0;let A=_e.map(P=>P.key),R=A.slice().sort();return A.join(",")===R.join(",")}Kr()&&st.sort();function xt(A){let R=A.split("."),P="";for(let N=0;N<R.length;N++){if(N!==0){let j=R.slice(0,N+1).join("."),D=be.get(j)===!0;P+=D?"?.":"."}P+=R[N]}return P}function Ct(A,R,P,N){return A.size===0?null:(A.size>1?"":R+" ")+P+" "+(A.size>1?"dependencies":"dependency")+": "+Ti(Array.from(A).sort().map(j=>"'"+xt(j)+"'"))+`. Either ${N} ${A.size>1?"them":"it"} or remove the dependency array.`}let Te="";if(it.size>0){let A=null;if(Array.from(it.keys()).forEach(R=>{A===null&&R.endsWith(".current")&&(A=R)}),A!==null)Te=` Mutable values like '${A}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Ze.size>0){let R=Array.from(Ze)[0];S.set.has(R)||(Te=` Outer scope values like '${R}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!Te&&Oe.has("props")){let A=Z.get("props");if(A==null)return;let R=A.references;if(!Array.isArray(R))return;let P=!0;for(let N=0;N<R.length;N++){let j=R[N],D=vt(w.block,j.identifier);if(!D){P=!1;break}let U=D.parent;if(U==null){P=!1;break}if(U.type!=="MemberExpression"&&U.type!=="OptionalMemberExpression"){P=!1;break}}P&&(Te=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${g} call and refer to those specific props inside ${r(x)}.`)}if(!Te&&Oe.size>0){let A=null;Oe.forEach(R=>{if(A)return;let P=w.set.get(R),N=Z.get(R);if(N.references[0].resolved!==P)return;let j=P.defs[0];if(j==null||j.name==null||j.type!=="Parameter")return;let D=!1,U;for(let W=0;W<N.references.length;W++)if(U=N.references[W].identifier,U!=null&&U.parent!=null&&(U.parent.type==="CallExpression"||U.parent.type==="OptionalCallExpression")&&U.parent.callee===U){D=!0;break}D&&(A=R)}),A!==null&&(Te=` If '${A}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!Te&&Oe.size>0){let A=null;if(Oe.forEach(R=>{if(A!==null)return;let N=Z.get(R).references,j,D;for(let U=0;U<N.length;U++){for(j=N[U].identifier,D=j.parent;D!=null&&D!==w.block;){if(D.type==="CallExpression"){let W=c.get(D.callee);if(W!=null){if(W.name===R)A={missingDep:R,setter:D.callee.name,form:"updater"};else if(f.has(j))A={missingDep:R,setter:D.callee.name,form:"reducer"};else{let ge=N[U].resolved;if(ge!=null){let Re=ge.defs[0];Re!=null&&Re.type==="Parameter"&&(A={missingDep:R,setter:D.callee.name,form:"inlineReducer"})}}break}}D=D.parent}if(A!==null)break}}),A!==null)switch(A.form){case"reducer":Te=` You can also replace multiple useState variables with useReducer if '${A.setter}' needs the current value of '${A.missingDep}'.`;break;case"inlineReducer":Te=` If '${A.setter}' needs the current value of '${A.missingDep}', you can also switch to useReducer instead of useState and read '${A.missingDep}' in the reducer.`;break;case"updater":Te=` You can also do a functional update '${A.setter}(${A.missingDep.slice(0,1)} => ...)' if you only need '${A.missingDep}' in the '${A.setter}' call.`;break;default:throw new Error("Unknown case.")}}p({node:E,message:`React Hook ${r(x)} has `+(Ct(Oe,"a","missing","include")||Ct(it,"an","unnecessary","exclude")||Ct(Pn,"a","duplicate","omit"))+Te,suggest:[{desc:`Update the dependencies array to be: [${st.map(xt).join(", ")}]`,fix(A){return A.replaceText(E,`[${st.map(xt).join(", ")}]`)}}]})}function h(y){let E=Si(y.callee,i);if(E===-1)return;let x=y.arguments[E],g=y.callee,b=Jn(g).name,S=y.arguments[E+1],C=/Effect($|[^a-z])/g.test(b);if(!x){p({node:g,message:`React Hook ${b} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!C)){if(!S&&!C){(b==="useMemo"||b==="useCallback")&&p({node:g,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":T(x,S,g,b,C);return;case"Identifier":if(!S||S.elements&&S.elements.some(O=>O&&O.type==="Identifier"&&O.name===x.name))return;let w=n(y).set.get(x.name);if(w==null||w.defs==null)return;let I=w.defs[0];if(!I||!I.node||I.type!=="Variable"&&I.type!=="FunctionName")break;switch(I.node.type){case"FunctionDeclaration":T(I.node,S,g,b,C);return;case"VariableDeclarator":let O=I.node.init;if(!O)break;switch(O.type){case"ArrowFunctionExpression":case"FunctionExpression":T(O,S,g,b,C);return}break}break;default:p({node:g,message:`React Hook ${b} received a function whose dependencies are unknown. Pass an inline function instead.`});return}p({node:g,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 y of e.sourceCode.getAllComments())if(di.test(y.value))return t=!0,{CallExpression:E=>h(E,!0)}}return{CallExpression:y=>h(y)}}};function wt({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:s}){let o=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((T,h)=>{let y=p(o,h);y.isUsed=!0,l(o,h,E=>{E.isSubtreeUsed=!0})}),t.forEach(({key:T})=>{let h=p(o,T);h.isSatisfiedRecursively=!0}),r.forEach(T=>{let h=p(o,T);h.isSatisfiedRecursively=!0});function p(T,h){let y=h.split("."),E=T;for(let x of y){let g=E.children.get(x);g||(g=i(),E.children.set(x,g)),E=g}return E}function l(T,h,y){let E=h.split("."),x=T;for(let g of E){let b=x.children.get(g);if(!b)return;y(b),x=b}}let c=new Set,f=new Set;d(o,c,f,T=>T);function d(T,h,y,E){T.children.forEach((x,g)=>{let b=E(g);if(x.isSatisfiedRecursively){x.isSubtreeUsed&&y.add(b);return}if(x.isUsed){h.add(b);return}d(x,h,y,S=>b+"."+S)})}let a=[],u=new Set,m=new Set;return t.forEach(({key:T})=>{f.has(T)?a.indexOf(T)===-1?a.push(T):m.add(T):u.add(T)}),c.forEach(T=>{a.push(T)}),{suggestedDependencies:a,unnecessaryDependencies:u,duplicateDependencies:m,missingDependencies:c}}function De(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 De(e.consequent)!=null||De(e.alternate)!=null?"conditional":null;case"LogicalExpression":return De(e.left)!=null||De(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return De(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return De(e.expression);case"TSAsExpression":return De(e.expression)}return null}function gi({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let s=e.map(({key:i})=>{let p=r.variables.find(c=>c.name===i);if(p==null)return null;let l=p.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let c=De(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 o(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 f=c.from;for(;f!==n&&f!=null;)f=f.upper;if(f!==n&&!Vn(t,c.identifier))return!0}return!1}return s.map(([i,p])=>({construction:i.defs[0],depType:p,isUsedOutsideOfHook:o(i)}))}function zn(e){return(e.parent.type==="MemberExpression"||e.parent.type==="OptionalMemberExpression")&&e.parent.object===e&&e.parent.property.name!=="current"&&!e.parent.computed&&!(e.parent.parent!=null&&(e.parent.parent.type==="CallExpression"||e.parent.parent.type==="OptionalCallExpression")&&e.parent.parent.callee===e.parent)?zn(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function kt(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function we(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return t&&t.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=we(e.object,t),n=we(e.property,null),s=`${r}.${n}`;return kt(e,t,s),s}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=we(e.object,t),n=we(e.property,null),s=`${r}.${n}`;return kt(e,t,s),s}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let n=we(r.object,t),s=we(r.property,null),o=`${n}.${s}`;return kt(r,t,o),o}else throw new Error(`Unsupported node type: ${e.type}`)}function Jn(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Si(e,t){let r=Jn(e);if(r.type!=="Identifier")return-1;switch(r.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(r===e&&t&&t.additionalHooks){let n;try{n=we(r,null)}catch(s){if(/Unsupported node type/.test(s.message))return 0;throw s}return t.additionalHooks.test(n)?0:-1}else return-1}}function vt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),hi(n,t))return n;if(Vn(n,t))for(let[s,o]of Object.entries(n))s!=="parent"&&(Un(o)?(o.parent=n,r.push(o)):Array.isArray(o)&&o.forEach(i=>{Un(i)&&(i.parent=n,r.push(i))}))}return null}function Ti(e){let t="";for(let r=0;r<e.length;r++)t+=e[r],r===0&&e.length===2?t+=" and ":r===e.length-2&&e.length>2?t+=", and ":r<e.length-1&&(t+=", ");return t}function Un(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function hi(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function Vn(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function Ei(e){return!1}var K=require("@typescript-eslint/utils"),re=he(require("typescript")),Yn=require("zod/v4");var Pt=require("@typescript-eslint/utils");function Ve(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:Ve(e.parent,t,r===1/0?r:r-1)}function*Ft(e){yield e,e.parent&&(yield*Ft(e.parent))}function Ot(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function Hn(e,t,r){let s=r.getDeclaredVariables(e).find(o=>o.name===t||o.identifiers[0]?.parent.type===Pt.AST_NODE_TYPES.Property&&o.identifiers[0].parent.key.type===Pt.AST_NODE_TYPES.Identifier&&o.identifiers[0].parent.key.name===t);return s?s.references.filter(o=>!o.init):[]}function Xn(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function bi(e,t){return e[t]}function je(e,t,r){let n=r.visitorKeys,s=new Set;function o(i){if(s.has(i))return!1;if(s.add(i),t(i)===!0)return!0;let l=n[i.type];if(l)for(let c of l){let f=bi(i,c);if(f){if(Array.isArray(f)){for(let d of f)if(Xn(d)&&o(d))return!0}else if(Xn(f)&&o(f))return!0}}return!1}o(e)}var xi=K.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Bn="improved-no-unnecessary-condition",Ci=Yn.z.object({}),Ai=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Ii=new Set(Ai),Nt={name:Bn,rule:xi({name:Bn,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:[L(Ci)]},defaultOptions:[{}],create(e){let t=K.ESLintUtils.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(a){return a.type===K.AST_NODE_TYPES.UnaryExpression&&a.operator==="typeof"}function s(a){return a.flags&re.default.TypeFlags.Any||a.flags&re.default.TypeFlags.Unknown?null:a.flags&re.default.TypeFlags.StringLike?["string"]:a.flags&re.default.TypeFlags.NumberLike?["number"]:a.flags&re.default.TypeFlags.BigIntLike?["bigint"]:a.flags&re.default.TypeFlags.BooleanLike?["boolean"]:a.flags&re.default.TypeFlags.ESSymbolLike?["symbol"]:a.flags&re.default.TypeFlags.Undefined||a.flags&re.default.TypeFlags.Void?["undefined"]:a.flags&re.default.TypeFlags.Null?["object"]:a.getCallSignatures().length>0?["function"]:a.flags&re.default.TypeFlags.Object?a.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:a.flags&re.default.TypeFlags.NonPrimitive?["object"]:a.flags&re.default.TypeFlags.Never?["never"]:null}function o(a){if(!r)return null;let u=t.esTreeNodeToTSNodeMap.get(a),m=r.getTypeAtLocation(u.expression);if(m.flags&re.default.TypeFlags.Any||m.flags&re.default.TypeFlags.Unknown)return null;let T=[];if(m.isUnion()){for(let y of m.types){let E=s(y);if(E)T.push(...E);else return null}return T}let h=s(m);return h?(T.push(...h),T):null}function i(a){if(!(a.operator==="==="||a.operator==="!=="))return;let m=null,T=null;if(n(a.left)?(m=a.left,T=a.right.type===K.AST_NODE_TYPES.Literal&&typeof a.right.value=="string"?a.right.value:null):n(a.right)&&(m=a.right,T=a.left.type===K.AST_NODE_TYPES.Literal&&typeof a.left.value=="string"?a.left.value:null),!m||!T||!Ri(T,Ii))return;let h=o(m);if(!h)return;let y=a.operator==="!==",E=h.includes(T);h.length===1?E&&!y?e.report({node:a,messageId:"unnecessaryTypeofCondition",data:{name:Xe(m,e),type:T}}):!E&&y?e.report({node:a,messageId:"unnecessaryTypeofCondition",data:{name:Xe(m,e),type:Array.from(h)[0]}}):!E&&!y?e.report({node:a,messageId:"alwaysFalseTypeofCondition",data:{name:Xe(m,e),actualType:at(h),conditionType:T}}):E&&y&&e.report({node:a,messageId:"alwaysFalseTypeofCondition",data:{name:Xe(m,e),actualType:at(h),conditionType:T}}):!E&&!y?e.report({node:a,messageId:"alwaysFalseTypeofCondition",data:{name:Xe(m,e),actualType:at(h),conditionType:T}}):!E&&y&&e.report({node:a,messageId:"unnecessaryTypeofCondition",data:{name:Xe(m,e),type:at(h)}})}function p(a){if(a.flags&re.default.TypeFlags.Any||a.flags&re.default.TypeFlags.Unknown)return null;if(a.isUnion()){let u=[];for(let m of a.types)if(m.flags&re.default.TypeFlags.StringLiteral){let T=m.value;u.push(T)}else return null;return u}return a.flags&re.default.TypeFlags.StringLiteral?[a.value]:null}function l(a){if(!r)return null;let u=t.esTreeNodeToTSNodeMap.get(a),m=r.getTypeAtLocation(u),T=p(m);if(T)return T;let h=r.getSymbolAtLocation(u);if(h){let y=r.getTypeOfSymbolAtLocation(h,u),E=p(y);if(E)return E}return null}function c(a){let u=e.sourceCode.ast,m=null;return je(u,T=>{if(T.type===K.AST_NODE_TYPES.VariableDeclarator&&T.id.type===K.AST_NODE_TYPES.Identifier&&T.id.name===a.name&&T.id.typeAnnotation){let h=T.id.typeAnnotation.typeAnnotation;if(h.type===K.AST_NODE_TYPES.TSUnionType){let y=[];for(let E of h.types)if(E.type===K.AST_NODE_TYPES.TSLiteralType&&E.literal.type===K.AST_NODE_TYPES.Literal&&typeof E.literal.value=="string")y.push(E.literal.value);else return!0;return m=y,!0}if(h.type===K.AST_NODE_TYPES.TSLiteralType&&h.literal.type===K.AST_NODE_TYPES.Literal&&typeof h.literal.value=="string")return m=[h.literal.value],!0}return!1},e.sourceCode),m}function f(a){if(a.callee.type!==K.AST_NODE_TYPES.MemberExpression||a.callee.property.type!==K.AST_NODE_TYPES.Identifier||a.callee.computed)return;let u=a.callee.property.name;if(u!=="startsWith"&&u!=="endsWith"&&u!=="includes"||a.arguments.length!==1)return;let[m]=a.arguments;if(!m||m.type!==K.AST_NODE_TYPES.Literal||typeof m.value!="string")return;let T=a.callee.object,h=l(T);if(!h&&T.type===K.AST_NODE_TYPES.Identifier&&(h=c(T)),!h||h.length===0)return;let y=m.value;if(u==="includes"&&h.length>1)return;let E=0,x=0;for(let g of h)if((u==="startsWith"?g.startsWith(y):u==="endsWith"?g.endsWith(y):g.includes(y))?E++:x++,E>0&&x>0)return;if(E>0&&x===0){let g=u==="startsWith"?"unnecessaryStartsWithCondition":u==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:a,messageId:g})}else if(x>0&&E===0){let g=u==="startsWith"?"alwaysFalseStartsWithCondition":u==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:a,messageId:g})}}function d(a){if(!new Set(["===","!==",">",">=","<","<="]).has(a.operator))return;function m(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,C=l(S);if(!C||C.length===0)return null;let w=[];for(let I of C)w.push(I.length);return{values:w}}let T=m(a.left),h=m(a.right),y=null,E=null;if(T?a.right.type===K.AST_NODE_TYPES.Literal&&typeof a.right.value=="number"&&(y=T.values,E=a.right.value):h&&a.left.type===K.AST_NODE_TYPES.Literal&&typeof a.left.value=="number"&&(y=h.values,E=a.left.value),!y||E===null)return;let x=0,g=0;for(let b of y){let S=!1;if(a.operator==="==="?S=b===E:a.operator==="!=="?S=b!==E:a.operator===">"?S=b>E:a.operator===">="?S=b>=E:a.operator==="<"?S=b<E:a.operator==="<="&&(S=b<=E),S?x++:g++,x>0&&g>0)return}x>0&&g===0?e.report({node:a,messageId:"unnecessaryLengthCondition"}):g>0&&x===0&&e.report({node:a,messageId:"alwaysFalseLengthCondition"})}return{BinaryExpression(a){i(a),d(a)},CallExpression:f}}})};function at(e){return Array.from(new Set(e)).join(" | ")||"never"}function Xe(e,t){let r=e.argument;return r.type===K.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function Ri(e,t){return t.has(e)}var pt=require("@typescript-eslint/utils"),lt=require("zod/v4");var wi=pt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),qn="no-call-with-explicit-generics",ki=lt.z.object({functions:lt.z.array(lt.z.string())}),vi=wi({name:qn,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:[L(ki)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:s}=n;s.type===pt.AST_NODE_TYPES.Identifier&&r.has(s.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:s.name}})}}}}),Dt={name:qn,rule:vi};var $e=require("@typescript-eslint/utils"),Pi=$e.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Zn="no-call-with-inferred-generics",Fi=Pi({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,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:s}=n;if(s.type!==$e.AST_NODE_TYPES.Identifier)return;let o=r.get(s.name);if(!o)return;let{minGenerics:i=1,allowAny:p,disallowTypes:l=t.disallowTypes}=o;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:s.name,minGenerics:i||0}}),!(p&&!l)&&n.typeArguments?.params.some(f=>!p&&f.type===$e.AST_NODE_TYPES.TSAnyKeyword||l&&f.type===$e.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===$e.AST_NODE_TYPES.Identifier&&l.includes(f.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:s.name}})}}}}),jt={name:Zn,rule:Fi};var Qn=require("@typescript-eslint/utils"),Oi=Qn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),er="no-commented-out-code",Ni=["function ","class ","interface ","type ","enum ","namespace ","import ","export ","const ","let ","var ","return ","throw ","break","continue","try {","catch (","finally {","async ","await ","case ","switch (","while (","for (","default:"],Di=/^\s*return\s+/,ji=/\w=("|'|`)/,Li=/\w+:\s*('|"|`)/,Mi=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,_i=/\w+-\w+:/,$i=/\w+_\w+:/,Ui=/\?\s+\w/,Wi=/:\s+\w/,zi=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,Ji=/^\s*\d+[,}]/,Vi=/^\s*\[[^\]]*\][,}]/,Xi=/^\s*\{[^}]*\}[,}]/,Hi=/\.\w+\(/,Bi=/\[\w+\]/,Yi=/^\s*(['"`]).+?\1\s*:/,qi=/^<[A-Z]\w*(\s|>|\/)/,Zi=/^<[a-z]+(\s|>|\/)/,Gi=/<[A-Z]\w*(\s.*)?>/,Ki=/<\/[A-Z]\w*>/,Qi=/<[a-z]+(\s.*)?>/,es=/<\/[a-z]+>/,ts=/^\s*[*\s]*$/,ns=/^[a-zA-Z]/,rs=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,is=/```[\s\S]*?```/g,ss=/`[^`]*`/g,Gn=/[a-zA-Z0-9]/,os=/\.[A-Za-z_][A-Za-z0-9_]*\(/,as=/[{}[\]()`=<>]/,ls=/:\s*(['"`[{(]|\w+\s*=>)/,ps=/\bif\s*\(|\belse\b|=>/,ee={returnStatement:Di,stringAssignment:ji,objectPropertyWithQuotes:Li,computedPropertyAssignment:Mi,kebabCaseProperty:_i,snakeCaseProperty:$i,ternaryOperator:Ui,colonWithWord:Wi,quotedString:zi,numberWithComma:Ji,arrayWithComma:Vi,objectWithComma:Xi,methodCall:Hi,arrayAccess:Bi,quotedPropertyKey:Yi,jsxSelfClosing:qi,jsxElement:Zi,jsxOpeningTag:Gi,jsxClosingTag:Ki,htmlOpeningTag:Qi,htmlClosingTag:es,jsdocComment:ts};function cs(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&ns.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||os.test(t)||as.test(t)||ls.test(t)||ps.test(t)?!1:!!(t.includes(":")&&rs.test(t))}var us=[") {","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],fs=["/>","</",ee.jsxSelfClosing,ee.jsxElement,ee.jsxOpeningTag,ee.jsxClosingTag,ee.htmlOpeningTag,ee.htmlClosingTag],Kn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],ms=Oi({name:er,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(n,s){if(n.startsWith("/"))return!1;let o=n.trimStart();if(n.startsWith("*")||o.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||ee.jsdocComment.test(n))return!1;for(let i of Kn)if(o.startsWith(i))return!1;if(n.includes("https://")||cs(o))return!1;if(s==="Block"){for(let i of fs)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of Ni)if(o.startsWith(i))return{wrongPattern:i};for(let i of us)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,s){let o=n,i=o.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return o;if(s==="Block"&&o.includes("```")){let c=o.split(is);c.some(d=>Gn.test(d))&&(o=c.join(""))}if(!o.includes("`"))return o;let p=o.split(ss);return p.some(c=>Gn.test(c))?p.join(""):o}return{Program(){let s=e.sourceCode.getAllComments();for(let o of s){let i=r(o.value,o.type),p=t(i,o.type);p&&e.report({node:o,messageId:"commentedOutCode",data:{wrongPattern:p.wrongPattern,allowedPrefixes:Kn.join(", ")}})}}}}}),Lt={name:er,rule:ms};var ct=require("@typescript-eslint/utils"),ys=ct.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),tr="no-default-export",ds=ys({name:tr,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let r of t.specifiers)r.exported.type===ct.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),Mt={name:tr,rule:ds};var nr=require("@typescript-eslint/utils"),gs=nr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),rr="no-leaked-text-in-jsx",Ss=[",",";","[","]","(",")"],Ts=gs({name:rr,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(t){let r=t.value.trim();if(!r)return;let n="";Ss.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),_t={name:rr,rule:Ts};var Le=require("@typescript-eslint/utils"),hs=Le.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),sr="no-non-camel-case-functions",Es=/^(\$?[a-z][a-zA-Z0-9]*)$/;function ir(e){if(e.typeName.type!==Le.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Le.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var bs=hs({name:sr,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!Es.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Le.AST_NODE_TYPES.TSTypeReference?ir(r):r.type===Le.AST_NODE_TYPES.TSUnionType&&r.types.some(s=>s.type===Le.AST_NODE_TYPES.TSTypeReference&&ir(s))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),$t={name:sr,rule:bs};var B=require("@typescript-eslint/utils");var xs=B.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),or="no-optional-root-props",Cs=xs({name:or,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function t(n){let o=e.sourceCode.getDeclaredVariables(n)[0];if(!o||o.references.length!==1)return!1;let i=o.references[0];if(!i)return!1;for(let p of Ft(i.identifier)){if("returnType"in p||p.type===B.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=p.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 f=Ve(l.parent.parent,B.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!f)return!1;let d=ut(f,e.sourceCode);return d?!(d.parent.type===B.TSESTree.AST_NODE_TYPES.CallExpression&&d.parent.callee.type===B.TSESTree.AST_NODE_TYPES.Identifier&&d.parent.callee.name==="memo"):!1}if(p.type===B.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===B.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let c=Ve(l,B.TSESTree.AST_NODE_TYPES.VariableDeclaration);return c?!!ut(c,e.sourceCode):!1}if(l.type===B.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!ut(l,e.sourceCode)}return!1}function r(n){n.key.type!==B.TSESTree.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:s=>{let o=Ve(n,B.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!o)return null;let i=e.sourceCode.getText(o);return s.replaceText(o,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===B.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(ft(n)||!t(n)))for(let s of n.typeAnnotation.members)s.type===B.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSInterfaceDeclaration(n){if(!(ft(n)||!t(n)))for(let s of n.body.body)s.type===B.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSTypeReference(n){if(n.typeName.type!==B.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let s=n.typeArguments.params[0];if(s.type!==B.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let o=Ve(n.parent,B.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!o)return;let i=ut(o,e.sourceCode);if(!(!i||i.parent.type===B.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===B.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of s.members)l.type===B.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function ft(e){return e?e.parent?.type===B.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===B.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function ut(e,t){if(ft(e))return;let r;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&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let n=t.getScope(e);e.type===B.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let s=n.variables.find(i=>i.identifiers.includes(r));if(!s)return;let o=s.references.filter(i=>i.identifier!==r);if(!(o.length!==1||!o[0])&&!ft(o[0].identifier.parent.parent))return o[0].identifier}var Ut={name:or,rule:Cs};var Ge=require("@typescript-eslint/utils");var Ke=M({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let t=new Set;function r(n){return n?n.type===Ge.AST_NODE_TYPES.Identifier?t.has(n.name):n.type===Ge.AST_NODE_TYPES.MemberExpression?r(n.object):!1:!1}return{ImportDeclaration(n){for(let s of n.specifiers)t.add(s.local.name)},ExportNamedDeclaration(n){if(n.source){e.report({node:n,messageId:"noReexport"});return}if(n.declaration?.type===Ge.AST_NODE_TYPES.VariableDeclaration)for(let s of n.declaration.declarations)r(s.init)&&e.report({node:n,messageId:"noReexport"});n.specifiers.length>0&&e.report({node:n,messageId:"noReexport"})},ExportDefaultDeclaration(n){n.declaration.type===Ge.AST_NODE_TYPES.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});var ar=require("@typescript-eslint/utils"),mt=he(require("path")),ke=require("zod/v4");var As=ar.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),lr="no-relative-imports",Is=ke.z.object({find:ke.z.string(),replacement:ke.z.string()}),Rs=ke.z.object({aliases:ke.z.array(Is),rootDir:ke.z.string().optional(),allowNotFoundAliases:ke.z.boolean().optional(),_dev_simulateFileName:ke.z.string().optional()}),ws=As({name:lr,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:[L(Rs)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function s(i,p){let l=mt.default.dirname(p);return mt.default.resolve(l,i)}function o(i){let p=t.rootDir??process.cwd(),l=mt.default.relative(p,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:c,replacement:f}of t.aliases)if(l.startsWith(f)){let d=l.replace(f,c);return{alias:c,newPath:d}}return null}return{ImportDeclaration(i){let p=i.source.value;if(!n(p))return;let l=s(p,r),c=o(l);!c&&t.allowNotFoundAliases||e.report({node:i,messageId:c?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:c?.alias},fix:c?f=>f.replaceText(i.source,`'${c.newPath}'`):void 0})}}}}),Wt={name:lr,rule:ws};var te=require("@typescript-eslint/utils"),zt=require("zod/v4");var ks=zt.z.object({customMessage:zt.z.string().optional()}),Jt=M({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[L(ks)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case te.AST_NODE_TYPES.Literal:return!0;case te.AST_NODE_TYPES.ObjectExpression:return n.properties.every(s=>s.type===te.AST_NODE_TYPES.Property?s.computed||s.value.type===te.AST_NODE_TYPES.Identifier&&s.key.type===te.AST_NODE_TYPES.Identifier&&s.key.name===s.value.name?!1:r(s.value):!1);case te.AST_NODE_TYPES.ArrayExpression:return n.elements.every(s=>s?s.type===te.AST_NODE_TYPES.SpreadElement?!1:r(s):!0);case te.AST_NODE_TYPES.TemplateLiteral:return n.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(n){if(n.name.type===te.AST_NODE_TYPES.JSXIdentifier&&n.name.name==="style"&&n.value){let s=null;n.value.type===te.AST_NODE_TYPES.JSXExpressionContainer?n.value.expression.type!==te.AST_NODE_TYPES.JSXEmptyExpression&&(s=n.value.expression):n.value.type===te.AST_NODE_TYPES.Literal&&(s=n.value),s&&r(s)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var Qe=require("@typescript-eslint/utils"),Ue=he(require("zod/v4"));var vs=Ue.object({alternativeMsgs:Ue.object({inArrayFind:Ue.string().optional(),inArrayFilter:Ue.string().optional()}).optional(),__dev_simulateFileName:Ue.string().optional()});function Ps(e){return e.typeAnnotation.type!==Qe.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var Fs=/(typeGuards|type-guards)\.(ts|tsx)$/;function Os(e){return Fs.test(e)}function Ns(e){let t=e.parent;for(;t;){if(t.type===Qe.AST_NODE_TYPES.CallExpression&&t.callee.type===Qe.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===Qe.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var Vt=M({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:[L(vs)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(Os(r))return{};function n(s){if(!Ps(s))return;let o=Ns(s);if(t.alternativeMsgs&&o){let i=o.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let p=o.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:s,messageId:p,data:{message:i}});return}}e.report({node:s,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});var We=require("@typescript-eslint/utils");var Ds="no-unnecessary-async-on-jsx-props";function js(e){if(e.body.type!==We.AST_NODE_TYPES.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let r=t[0];return!r||r.type!==We.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===We.AST_NODE_TYPES.AwaitExpression}var Xt=M({name:Ds,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function t(r){js(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let s=e.sourceCode,o=[],i=s.getFirstToken(r,l=>l.value==="async");if(i){let l=s.getTokenAfter(i);l?o.push(n.replaceTextRange([i.range[0],l.range[0]],"")):o.push(n.remove(i))}function p(l){if(l.type===We.AST_NODE_TYPES.AwaitExpression){let c=s.getFirstToken(l);if(c&&c.value==="await"){let f=s.getTokenAfter(c);f?o.push(n.replaceTextRange([c.range[0],f.range[0]],"")):o.push(n.remove(c))}}if(l.type===We.AST_NODE_TYPES.BlockStatement)for(let c of l.body)p(c);else l.type===We.AST_NODE_TYPES.ExpressionStatement&&p(l.expression)}return p(r.body),o}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var ve=require("@typescript-eslint/utils"),Ht=he(require("typescript")),He=he(require("zod/v4"));var Ls=ve.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pr="no-unnecessary-casting",Ms=He.default.object({additionalCastFunctions:He.default.array(He.default.object({name:He.default.string(),expectedType:He.default.enum(["string","number"])})).optional()}),Bt={name:pr,rule:Ls({name:pr,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:[L(Ms)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],s=ve.ESLintUtils.getParserServices(e,!0),o=s.program?.getTypeChecker();if(!o||!s.program)throw new Error("TypeScript services or program not available");function i(f,d){switch(f.type){case ve.AST_NODE_TYPES.Literal:return d==="number"?typeof f.value=="number":typeof f.value=="string";case ve.AST_NODE_TYPES.TemplateLiteral:return d==="string";case ve.AST_NODE_TYPES.UnaryExpression:return d==="number"?f.operator==="+"||f.operator==="-"||f.operator==="~":!1;default:return!1}}function p(f,d){return d==="number"?!!(f.flags&Ht.TypeFlags.NumberLike):!!(f.flags&Ht.TypeFlags.StringLike)}function l(f,d){return a=>a.replaceText(f,e.sourceCode.getText(d))}function c(f){if(!o||f.arguments.length!==1)return;let d=f.arguments[0];if(!d||d.type===ve.AST_NODE_TYPES.SpreadElement)return;let{callee:a}=f;if(a.type!==ve.AST_NODE_TYPES.Identifier)return;let u=a.name,m=n.find(h=>h.name===u);if(!m)return;if(i(d,m.expectedType)||p(o.getTypeAtLocation(s.esTreeNodeToTSNodeMap.get(d)),m.expectedType)){let h,y;u==="Number"?h="unnecessaryNumberCasting":u==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",y={name:m.name,type:m.expectedType}),e.report({node:f,messageId:h,...y?{data:y}:{},fix:l(f,d)})}}return{CallExpression:c}}})};var ye=require("@typescript-eslint/utils"),yt=he(require("zod/v4"));var _s=yt.object({ignoreWithDescription:yt.string().optional()}),Yt=M({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:[L(_s)]},defaultOptions:[{}],create(e,[t]){let r=e.getSourceCode(),n=r.ast;function s(l){let c=l.arguments[0];return c&&c.type===ye.AST_NODE_TYPES.Literal&&typeof c.value=="string"?c.value:null}function o(l){return!l||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(l)}function i(l){return l.length!==1?!1:n.body.filter(f=>{if(f.type===ye.AST_NODE_TYPES.ExpressionStatement){let d=f.expression;if(d.type===ye.AST_NODE_TYPES.CallExpression&&d.callee.type===ye.AST_NODE_TYPES.Identifier){let a=d.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(a)}}return!1}).length===0}function p(l){let c=l.arguments[1];if(c&&(c.type===ye.AST_NODE_TYPES.FunctionExpression||c.type===ye.AST_NODE_TYPES.ArrowFunctionExpression)&&c.body.type===ye.AST_NODE_TYPES.BlockStatement){let f=c.body.body;return f.length===0?"":f.map(a=>r.text.slice(a.range[0],a.range[1])).join(`
|
|
15
|
+
Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let T=l.acquire(m),C=new Set,w=null;{let A=T.upper;for(;A&&(C.add(A),A.type!=="function");)A=A.upper;if(!A)return;w=A}let I=Array.isArray;function O(A){if(!I(A.defs))return!1;let R=A.defs[0];if(R==null||R.node.type!=="VariableDeclarator")return!1;let P=R.node.init;if(P==null)return!1;for(;P.type==="TSAsExpression";)P=P.expression;let N=R.node.parent;if(N==null&&(vt(w.block,R.node.id),N=R.node.parent,N==null))return!1;if(N.kind==="const"&&P.type==="Literal"&&(typeof P.value=="string"||typeof P.value=="number"||P.value===null))return!0;if(P.type!=="CallExpression")return!1;let j=P.callee;if(j.type==="MemberExpression"&&j.object.name==="React"&&j.property!=null&&!j.computed&&(j=j.property),j.type!=="Identifier")return!1;let D=R.node.id,{name:U}=j;if(U==="useRef"&&D.type==="Identifier")return!0;if(Ei(j)&&D.type==="Identifier"){for(let z of A.references)z!==D&&u.add(z.identifier);return!0}else if(U==="useState"||U==="useReducer"){if(D.type==="ArrayPattern"&&D.elements.length===2&&I(A.identifiers)){if(D.elements[1]===A.identifiers[0]){if(U==="useState"){let z=A.references,ge=0;for(let Re=0;Re<z.length;Re++){if(z[Re].isWrite()&&ge++,ge>1)return!1;c.set(z[Re].identifier,D.elements[0])}}return!0}else if(D.elements[0]===A.identifiers[0]){if(U==="useState"){let z=A.references;for(let ge=0;ge<z.length;ge++)y.add(z[ge].identifier)}return!1}}}else if(U==="useTransition"&&D.type==="ArrayPattern"&&D.elements.length===2&&Array.isArray(A.identifiers)&&D.elements[1]===A.identifiers[0])return!0;return!1}function $(A){if(!I(A.defs))return!1;let R=A.defs[0];if(R==null||R.node==null||R.node.id==null)return!1;let P=R.node,N=w.childScopes,j=null,D;for(D=0;D<N.length;D++){let U=N[D],z=U.block;if(P.type==="FunctionDeclaration"&&z===P||P.type==="VariableDeclarator"&&z.parent===P){j=U;break}}if(j==null)return!1;for(D=0;D<j.through.length;D++){let U=j.through[D];if(U.resolved!=null&&C.has(U.resolved.scope)&&!ne(U.resolved))return!1}return!0}let ne=f(O,d),Q=f($,a),oe=new Map;function ae(A){let R=A.from,P=!1;for(;R.block!==m;)R.type==="function"&&(P=R.block.parent!=null&&R.block.parent.type==="ReturnStatement"),R=R.upper;return P}let Z=new Map,be=new Map;Je(T);function Je(A){for(let R of A.references){if(!R.resolved||!C.has(R.resolved.scope))continue;let P=vt(m,R.identifier),N=Wn(P),j=we(N,be);if(b&&N.type==="Identifier"&&(N.parent.type==="MemberExpression"||N.parent.type==="OptionalMemberExpression")&&!N.parent.computed&&N.parent.property.type==="Identifier"&&N.parent.property.name==="current"&&ae(R)&&oe.set(j,{reference:R,dependencyNode:N}),N.parent.type==="TSTypeQuery"||N.parent.type==="TSTypeReference")continue;let D=R.resolved.defs[0];if(D!=null&&!(D.node!=null&&D.node.init===m.parent)&&D.type!=="TypeParameter")if(Z.has(j))Z.get(j).references.push(R);else{let U=R.resolved,z=ne(U)||Q(U);Z.set(j,{isStable:z,references:[R]})}}for(let R of A.childScopes)Je(R)}oe.forEach(({reference:A,dependencyNode:R},P)=>{let N=A.resolved.references,j=!1;for(let D=0;D<N.length;D++){let{identifier:U}=N[D],{parent:z}=U;if(z!=null&&z.type==="MemberExpression"&&!z.computed&&z.property.type==="Identifier"&&z.property.name==="current"&&z.parent.type==="AssignmentExpression"&&z.parent.left===z){j=!0;break}}j||p({node:R.parent.property,message:`The ref value '${P}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${P}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ce=new Set;function Fe(A,R){ce.has(R)||(ce.add(R),p({node:A,message:`Assignments to the '${R}' variable from inside React Hook ${r(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 ${r(x)}.`}))}let de=new Set;if(Z.forEach(({isStable:A,references:R},P)=>{A&&de.add(P),R.forEach(N=>{N.writeExpr&&Fe(N.writeExpr,P)})}),ce.size>0)return;if(!E){let A=null;if(Z.forEach(({isStable:R,references:P},N)=>{A||P.forEach(j=>{if(A)return;let D=j.identifier;if(!c.has(D))return;let z=j.from;for(;z.type!=="function";)z=z.upper;z.block===m&&(A=N)})}),A){let{suggestedDependencies:R}=wt({dependencies:Z,declaredDependencies:[],stableDependencies:de,externalDependencies:new Set,isEffect:!0});p({node:x,message:`React Hook ${g} contains a call to '${A}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+R.join(", ")+`] as a second argument to the ${g} Hook.`,suggest:[{desc:`Add dependencies array: [${R.join(", ")}]`,fix(P){return P.insertTextAfter(m,`, [${R.join(", ")}]`)}}]})}return}let _e=[],Ze=new Set;E.type!=="ArrayExpression"?p({node:E,message:`React Hook ${r(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(A=>{if(A===null)return;if(A.type==="SpreadElement"){p({node:A,message:`React Hook ${r(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(A)&&p({node:A,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(A)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(A)}\``,fix(j){return j.removeRange(A.range)}}]});let R;try{R=we(A,be)}catch(j){if(/Unsupported node type/.test(j.message)){A.type==="Literal"?Z.has(A.value)?p({node:A,message:`The ${A.raw} literal is not a valid dependency because it never changes. Did you mean to include ${A.value} in the array instead?`}):p({node:A,message:`The ${A.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):p({node:A,message:`React Hook ${r(x)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw j}let P=A;for(;P.type==="MemberExpression"||P.type==="OptionalMemberExpression"||P.type==="ChainExpression";)P=P.object||P.expression.object;let N=!w.through.some(j=>j.identifier===P);_e.push({key:R,node:A}),N||Ze.add(R)});let{suggestedDependencies:Gr,unnecessaryDependencies:it,missingDependencies:Oe,duplicateDependencies:Pn}=wt({dependencies:Z,declaredDependencies:_e,stableDependencies:de,externalDependencies:Ze,isEffect:b}),st=Gr;if(Pn.size+Oe.size+it.size===0){if(t)return;gi({declaredDependencies:_e,declaredDependenciesNode:E,componentScope:w,scope:T}).forEach(({construction:R,isUsedOutsideOfHook:P,depType:N})=>{let j=N==="function"?"useCallback":"useMemo",D=N==="function"?"definition":"initialization",U=`wrap the ${D} of '${R.name.name}' in its own ${j}() Hook.`,z=P?`To fix this, ${U}`:`Move it inside the ${g} callback. Alternatively, ${U}`,ge=N==="conditional"||N==="logical expression"?"could make":"makes",Re=`The '${R.name.name}' ${N} ${ge} the dependencies of ${g} Hook (at line ${E.loc.start.line}) change on every render. ${z}`,Fn;P&&R.type==="Variable"&&N==="function"&&(Fn=[{desc:`Wrap the ${D} of '${R.name.name}' in its own ${j}() Hook.`,fix(On){let[Qr,ei]=j==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[On.insertTextBefore(R.node.init,Qr),On.insertTextAfter(R.node.init,ei)]}}]),p({node:R.node,message:Re,suggest:Fn})});return}!b&&Oe.size>0&&(st=wt({dependencies:Z,declaredDependencies:[],stableDependencies:de,externalDependencies:Ze,isEffect:b}).suggestedDependencies);function Kr(){if(_e.length===0)return!0;let A=_e.map(P=>P.key),R=A.slice().sort();return A.join(",")===R.join(",")}Kr()&&st.sort();function xt(A){let R=A.split("."),P="";for(let N=0;N<R.length;N++){if(N!==0){let j=R.slice(0,N+1).join("."),D=be.get(j)===!0;P+=D?"?.":"."}P+=R[N]}return P}function Ct(A,R,P,N){return A.size===0?null:(A.size>1?"":R+" ")+P+" "+(A.size>1?"dependencies":"dependency")+": "+Ti(Array.from(A).sort().map(j=>"'"+xt(j)+"'"))+`. Either ${N} ${A.size>1?"them":"it"} or remove the dependency array.`}let Te="";if(it.size>0){let A=null;if(Array.from(it.keys()).forEach(R=>{A===null&&R.endsWith(".current")&&(A=R)}),A!==null)Te=` Mutable values like '${A}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Ze.size>0){let R=Array.from(Ze)[0];T.set.has(R)||(Te=` Outer scope values like '${R}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!Te&&Oe.has("props")){let A=Z.get("props");if(A==null)return;let R=A.references;if(!Array.isArray(R))return;let P=!0;for(let N=0;N<R.length;N++){let j=R[N],D=vt(w.block,j.identifier);if(!D){P=!1;break}let U=D.parent;if(U==null){P=!1;break}if(U.type!=="MemberExpression"&&U.type!=="OptionalMemberExpression"){P=!1;break}}P&&(Te=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${g} call and refer to those specific props inside ${r(x)}.`)}if(!Te&&Oe.size>0){let A=null;Oe.forEach(R=>{if(A)return;let P=w.set.get(R),N=Z.get(R);if(N.references[0].resolved!==P)return;let j=P.defs[0];if(j==null||j.name==null||j.type!=="Parameter")return;let D=!1,U;for(let z=0;z<N.references.length;z++)if(U=N.references[z].identifier,U!=null&&U.parent!=null&&(U.parent.type==="CallExpression"||U.parent.type==="OptionalCallExpression")&&U.parent.callee===U){D=!0;break}D&&(A=R)}),A!==null&&(Te=` If '${A}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!Te&&Oe.size>0){let A=null;if(Oe.forEach(R=>{if(A!==null)return;let N=Z.get(R).references,j,D;for(let U=0;U<N.length;U++){for(j=N[U].identifier,D=j.parent;D!=null&&D!==w.block;){if(D.type==="CallExpression"){let z=c.get(D.callee);if(z!=null){if(z.name===R)A={missingDep:R,setter:D.callee.name,form:"updater"};else if(y.has(j))A={missingDep:R,setter:D.callee.name,form:"reducer"};else{let ge=N[U].resolved;if(ge!=null){let Re=ge.defs[0];Re!=null&&Re.type==="Parameter"&&(A={missingDep:R,setter:D.callee.name,form:"inlineReducer"})}}break}}D=D.parent}if(A!==null)break}}),A!==null)switch(A.form){case"reducer":Te=` You can also replace multiple useState variables with useReducer if '${A.setter}' needs the current value of '${A.missingDep}'.`;break;case"inlineReducer":Te=` If '${A.setter}' needs the current value of '${A.missingDep}', you can also switch to useReducer instead of useState and read '${A.missingDep}' in the reducer.`;break;case"updater":Te=` You can also do a functional update '${A.setter}(${A.missingDep.slice(0,1)} => ...)' if you only need '${A.missingDep}' in the '${A.setter}' call.`;break;default:throw new Error("Unknown case.")}}p({node:E,message:`React Hook ${r(x)} has `+(Ct(Oe,"a","missing","include")||Ct(it,"an","unnecessary","exclude")||Ct(Pn,"a","duplicate","omit"))+Te,suggest:[{desc:`Update the dependencies array to be: [${st.map(xt).join(", ")}]`,fix(A){return A.replaceText(E,`[${st.map(xt).join(", ")}]`)}}]})}function h(m){let E=Si(m.callee,i);if(E===-1)return;let x=m.arguments[E],g=m.callee,b=Jn(g).name,T=m.arguments[E+1],C=/Effect($|[^a-z])/g.test(b);if(!x){p({node:g,message:`React Hook ${b} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!C)){if(!T&&!C){(b==="useMemo"||b==="useCallback")&&p({node:g,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":S(x,T,g,b,C);return;case"Identifier":if(!T||T.elements&&T.elements.some(O=>O&&O.type==="Identifier"&&O.name===x.name))return;let w=n(m).set.get(x.name);if(w==null||w.defs==null)return;let I=w.defs[0];if(!I||!I.node||I.type!=="Variable"&&I.type!=="FunctionName")break;switch(I.node.type){case"FunctionDeclaration":S(I.node,T,g,b,C);return;case"VariableDeclarator":let O=I.node.init;if(!O)break;switch(O.type){case"ArrowFunctionExpression":case"FunctionExpression":S(O,T,g,b,C);return}break}break;default:p({node:g,message:`React Hook ${b} received a function whose dependencies are unknown. Pass an inline function instead.`});return}p({node:g,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(T,`[${x.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let m of e.sourceCode.getAllComments())if(di.test(m.value))return t=!0,{CallExpression:E=>h(E,!0)}}return{CallExpression:m=>h(m)}}};function wt({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:s}){let o=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((S,h)=>{let m=p(o,h);m.isUsed=!0,l(o,h,E=>{E.isSubtreeUsed=!0})}),t.forEach(({key:S})=>{let h=p(o,S);h.isSatisfiedRecursively=!0}),r.forEach(S=>{let h=p(o,S);h.isSatisfiedRecursively=!0});function p(S,h){let m=h.split("."),E=S;for(let x of m){let g=E.children.get(x);g||(g=i(),E.children.set(x,g)),E=g}return E}function l(S,h,m){let E=h.split("."),x=S;for(let g of E){let b=x.children.get(g);if(!b)return;m(b),x=b}}let c=new Set,y=new Set;d(o,c,y,S=>S);function d(S,h,m,E){S.children.forEach((x,g)=>{let b=E(g);if(x.isSatisfiedRecursively){x.isSubtreeUsed&&m.add(b);return}if(x.isUsed){h.add(b);return}d(x,h,m,T=>b+"."+T)})}let a=[],u=new Set,f=new Set;return t.forEach(({key:S})=>{y.has(S)?a.indexOf(S)===-1?a.push(S):f.add(S):u.add(S)}),c.forEach(S=>{a.push(S)}),{suggestedDependencies:a,unnecessaryDependencies:u,duplicateDependencies:f,missingDependencies:c}}function De(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 De(e.consequent)!=null||De(e.alternate)!=null?"conditional":null;case"LogicalExpression":return De(e.left)!=null||De(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return De(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return De(e.expression);case"TSAsExpression":return De(e.expression)}return null}function gi({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let s=e.map(({key:i})=>{let p=r.variables.find(c=>c.name===i);if(p==null)return null;let l=p.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let c=De(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 o(i){let p=!1;for(let l=0;l<i.references.length;l++){let c=i.references[l];if(c.writeExpr){if(p)return!0;p=!0;continue}let y=c.from;for(;y!==n&&y!=null;)y=y.upper;if(y!==n&&!Vn(t,c.identifier))return!0}return!1}return s.map(([i,p])=>({construction:i.defs[0],depType:p,isUsedOutsideOfHook:o(i)}))}function Wn(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)?Wn(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function kt(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function we(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return t&&t.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=we(e.object,t),n=we(e.property,null),s=`${r}.${n}`;return kt(e,t,s),s}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=we(e.object,t),n=we(e.property,null),s=`${r}.${n}`;return kt(e,t,s),s}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let n=we(r.object,t),s=we(r.property,null),o=`${n}.${s}`;return kt(r,t,o),o}else throw new Error(`Unsupported node type: ${e.type}`)}function Jn(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Si(e,t){let r=Jn(e);if(r.type!=="Identifier")return-1;switch(r.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(r===e&&t&&t.additionalHooks){let n;try{n=we(r,null)}catch(s){if(/Unsupported node type/.test(s.message))return 0;throw s}return t.additionalHooks.test(n)?0:-1}else return-1}}function vt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),hi(n,t))return n;if(Vn(n,t))for(let[s,o]of Object.entries(n))s!=="parent"&&(Un(o)?(o.parent=n,r.push(o)):Array.isArray(o)&&o.forEach(i=>{Un(i)&&(i.parent=n,r.push(i))}))}return null}function Ti(e){let t="";for(let r=0;r<e.length;r++)t+=e[r],r===0&&e.length===2?t+=" and ":r===e.length-2&&e.length>2?t+=", and ":r<e.length-1&&(t+=", ");return t}function Un(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function hi(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function Vn(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function Ei(e){return!1}var K=require("@typescript-eslint/utils"),re=he(require("typescript")),Yn=require("zod/v4");var Pt=require("@typescript-eslint/utils");function Ve(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:Ve(e.parent,t,r===1/0?r:r-1)}function*Ft(e){yield e,e.parent&&(yield*Ft(e.parent))}function Ot(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function Hn(e,t,r){let s=r.getDeclaredVariables(e).find(o=>o.name===t||o.identifiers[0]?.parent.type===Pt.AST_NODE_TYPES.Property&&o.identifiers[0].parent.key.type===Pt.AST_NODE_TYPES.Identifier&&o.identifiers[0].parent.key.name===t);return s?s.references.filter(o=>!o.init):[]}function Xn(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function bi(e,t){return e[t]}function je(e,t,r){let n=r.visitorKeys,s=new Set;function o(i){if(s.has(i))return!1;if(s.add(i),t(i)===!0)return!0;let l=n[i.type];if(l)for(let c of l){let y=bi(i,c);if(y){if(Array.isArray(y)){for(let d of y)if(Xn(d)&&o(d))return!0}else if(Xn(y)&&o(y))return!0}}return!1}o(e)}var xi=K.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Bn="improved-no-unnecessary-condition",Ci=Yn.z.object({}),Ai=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Ii=new Set(Ai),Nt={name:Bn,rule:xi({name:Bn,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:[L(Ci)]},defaultOptions:[{}],create(e){let t=K.ESLintUtils.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(a){return a.type===K.AST_NODE_TYPES.UnaryExpression&&a.operator==="typeof"}function s(a){return a.flags&re.default.TypeFlags.Any||a.flags&re.default.TypeFlags.Unknown?null:a.flags&re.default.TypeFlags.StringLike?["string"]:a.flags&re.default.TypeFlags.NumberLike?["number"]:a.flags&re.default.TypeFlags.BigIntLike?["bigint"]:a.flags&re.default.TypeFlags.BooleanLike?["boolean"]:a.flags&re.default.TypeFlags.ESSymbolLike?["symbol"]:a.flags&re.default.TypeFlags.Undefined||a.flags&re.default.TypeFlags.Void?["undefined"]:a.flags&re.default.TypeFlags.Null?["object"]:a.getCallSignatures().length>0?["function"]:a.flags&re.default.TypeFlags.Object?a.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:a.flags&re.default.TypeFlags.NonPrimitive?["object"]:a.flags&re.default.TypeFlags.Never?["never"]:null}function o(a){if(!r)return null;let u=t.esTreeNodeToTSNodeMap.get(a),f=r.getTypeAtLocation(u.expression);if(f.flags&re.default.TypeFlags.Any||f.flags&re.default.TypeFlags.Unknown)return null;let S=[];if(f.isUnion()){for(let m of f.types){let E=s(m);if(E)S.push(...E);else return null}return S}let h=s(f);return h?(S.push(...h),S):null}function i(a){if(!(a.operator==="==="||a.operator==="!=="))return;let f=null,S=null;if(n(a.left)?(f=a.left,S=a.right.type===K.AST_NODE_TYPES.Literal&&typeof a.right.value=="string"?a.right.value:null):n(a.right)&&(f=a.right,S=a.left.type===K.AST_NODE_TYPES.Literal&&typeof a.left.value=="string"?a.left.value:null),!f||!S||!Ri(S,Ii))return;let h=o(f);if(!h)return;let m=a.operator==="!==",E=h.includes(S);h.length===1?E&&!m?e.report({node:a,messageId:"unnecessaryTypeofCondition",data:{name:Xe(f,e),type:S}}):!E&&m?e.report({node:a,messageId:"unnecessaryTypeofCondition",data:{name:Xe(f,e),type:Array.from(h)[0]}}):!E&&!m?e.report({node:a,messageId:"alwaysFalseTypeofCondition",data:{name:Xe(f,e),actualType:at(h),conditionType:S}}):E&&m&&e.report({node:a,messageId:"alwaysFalseTypeofCondition",data:{name:Xe(f,e),actualType:at(h),conditionType:S}}):!E&&!m?e.report({node:a,messageId:"alwaysFalseTypeofCondition",data:{name:Xe(f,e),actualType:at(h),conditionType:S}}):!E&&m&&e.report({node:a,messageId:"unnecessaryTypeofCondition",data:{name:Xe(f,e),type:at(h)}})}function p(a){if(a.flags&re.default.TypeFlags.Any||a.flags&re.default.TypeFlags.Unknown)return null;if(a.isUnion()){let u=[];for(let f of a.types)if(f.flags&re.default.TypeFlags.StringLiteral){let S=f.value;u.push(S)}else return null;return u}return a.flags&re.default.TypeFlags.StringLiteral?[a.value]:null}function l(a){if(!r)return null;let u=t.esTreeNodeToTSNodeMap.get(a),f=r.getTypeAtLocation(u),S=p(f);if(S)return S;let h=r.getSymbolAtLocation(u);if(h){let m=r.getTypeOfSymbolAtLocation(h,u),E=p(m);if(E)return E}return null}function c(a){let u=e.sourceCode.ast,f=null;return je(u,S=>{if(S.type===K.AST_NODE_TYPES.VariableDeclarator&&S.id.type===K.AST_NODE_TYPES.Identifier&&S.id.name===a.name&&S.id.typeAnnotation){let h=S.id.typeAnnotation.typeAnnotation;if(h.type===K.AST_NODE_TYPES.TSUnionType){let m=[];for(let E of h.types)if(E.type===K.AST_NODE_TYPES.TSLiteralType&&E.literal.type===K.AST_NODE_TYPES.Literal&&typeof E.literal.value=="string")m.push(E.literal.value);else return!0;return f=m,!0}if(h.type===K.AST_NODE_TYPES.TSLiteralType&&h.literal.type===K.AST_NODE_TYPES.Literal&&typeof h.literal.value=="string")return f=[h.literal.value],!0}return!1},e.sourceCode),f}function y(a){if(a.callee.type!==K.AST_NODE_TYPES.MemberExpression||a.callee.property.type!==K.AST_NODE_TYPES.Identifier||a.callee.computed)return;let u=a.callee.property.name;if(u!=="startsWith"&&u!=="endsWith"&&u!=="includes"||a.arguments.length!==1)return;let[f]=a.arguments;if(!f||f.type!==K.AST_NODE_TYPES.Literal||typeof f.value!="string")return;let S=a.callee.object,h=l(S);if(!h&&S.type===K.AST_NODE_TYPES.Identifier&&(h=c(S)),!h||h.length===0)return;let m=f.value;if(u==="includes"&&h.length>1)return;let E=0,x=0;for(let g of h)if((u==="startsWith"?g.startsWith(m):u==="endsWith"?g.endsWith(m):g.includes(m))?E++:x++,E>0&&x>0)return;if(E>0&&x===0){let g=u==="startsWith"?"unnecessaryStartsWithCondition":u==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:a,messageId:g})}else if(x>0&&E===0){let g=u==="startsWith"?"alwaysFalseStartsWithCondition":u==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:a,messageId:g})}}function d(a){if(!new Set(["===","!==",">",">=","<","<="]).has(a.operator))return;function f(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 T=b.object,C=l(T);if(!C||C.length===0)return null;let w=[];for(let I of C)w.push(I.length);return{values:w}}let S=f(a.left),h=f(a.right),m=null,E=null;if(S?a.right.type===K.AST_NODE_TYPES.Literal&&typeof a.right.value=="number"&&(m=S.values,E=a.right.value):h&&a.left.type===K.AST_NODE_TYPES.Literal&&typeof a.left.value=="number"&&(m=h.values,E=a.left.value),!m||E===null)return;let x=0,g=0;for(let b of m){let T=!1;if(a.operator==="==="?T=b===E:a.operator==="!=="?T=b!==E:a.operator===">"?T=b>E:a.operator===">="?T=b>=E:a.operator==="<"?T=b<E:a.operator==="<="&&(T=b<=E),T?x++:g++,x>0&&g>0)return}x>0&&g===0?e.report({node:a,messageId:"unnecessaryLengthCondition"}):g>0&&x===0&&e.report({node:a,messageId:"alwaysFalseLengthCondition"})}return{BinaryExpression(a){i(a),d(a)},CallExpression:y}}})};function at(e){return Array.from(new Set(e)).join(" | ")||"never"}function Xe(e,t){let r=e.argument;return r.type===K.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function Ri(e,t){return t.has(e)}var pt=require("@typescript-eslint/utils"),lt=require("zod/v4");var wi=pt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),qn="no-call-with-explicit-generics",ki=lt.z.object({functions:lt.z.array(lt.z.string())}),vi=wi({name:qn,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:[L(ki)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:s}=n;s.type===pt.AST_NODE_TYPES.Identifier&&r.has(s.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:s.name}})}}}}),Dt={name:qn,rule:vi};var $e=require("@typescript-eslint/utils"),Pi=$e.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Zn="no-call-with-inferred-generics",Fi=Pi({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,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:s}=n;if(s.type!==$e.AST_NODE_TYPES.Identifier)return;let o=r.get(s.name);if(!o)return;let{minGenerics:i=1,allowAny:p,disallowTypes:l=t.disallowTypes}=o;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:s.name,minGenerics:i||0}}),!(p&&!l)&&n.typeArguments?.params.some(y=>!p&&y.type===$e.AST_NODE_TYPES.TSAnyKeyword||l&&y.type===$e.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===$e.AST_NODE_TYPES.Identifier&&l.includes(y.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:s.name}})}}}}),jt={name:Zn,rule:Fi};var Qn=require("@typescript-eslint/utils"),Oi=Qn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),er="no-commented-out-code",Ni=["function ","class ","interface ","type ","enum ","namespace ","import ","export ","const ","let ","var ","return ","throw ","break","continue","try {","catch (","finally {","async ","await ","case ","switch (","while (","for (","default:"],Di=/^\s*return\s+/,ji=/\w=("|'|`)/,Li=/\w+:\s*('|"|`)/,Mi=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,_i=/\w+-\w+:/,$i=/\w+_\w+:/,Ui=/\?\s+\w/,zi=/:\s+\w/,Wi=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,Ji=/^\s*\d+[,}]/,Vi=/^\s*\[[^\]]*\][,}]/,Xi=/^\s*\{[^}]*\}[,}]/,Hi=/\.\w+\(/,Bi=/\[\w+\]/,Yi=/^\s*(['"`]).+?\1\s*:/,qi=/^<[A-Z]\w*(\s|>|\/)/,Zi=/^<[a-z]+(\s|>|\/)/,Gi=/<[A-Z]\w*(\s.*)?>/,Ki=/<\/[A-Z]\w*>/,Qi=/<[a-z]+(\s.*)?>/,es=/<\/[a-z]+>/,ts=/^\s*[*\s]*$/,ns=/^[a-zA-Z]/,rs=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,is=/```[\s\S]*?```/g,ss=/`[^`]*`/g,Gn=/[a-zA-Z0-9]/,os=/\.[A-Za-z_][A-Za-z0-9_]*\(/,as=/[{}[\]()`=<>]/,ls=/:\s*(['"`[{(]|\w+\s*=>)/,ps=/\bif\s*\(|\belse\b|=>/,ee={returnStatement:Di,stringAssignment:ji,objectPropertyWithQuotes:Li,computedPropertyAssignment:Mi,kebabCaseProperty:_i,snakeCaseProperty:$i,ternaryOperator:Ui,colonWithWord:zi,quotedString:Wi,numberWithComma:Ji,arrayWithComma:Vi,objectWithComma:Xi,methodCall:Hi,arrayAccess:Bi,quotedPropertyKey:Yi,jsxSelfClosing:qi,jsxElement:Zi,jsxOpeningTag:Gi,jsxClosingTag:Ki,htmlOpeningTag:Qi,htmlClosingTag:es,jsdocComment:ts};function cs(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&ns.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||os.test(t)||as.test(t)||ls.test(t)||ps.test(t)?!1:!!(t.includes(":")&&rs.test(t))}var us=[") {","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],fs=["/>","</",ee.jsxSelfClosing,ee.jsxElement,ee.jsxOpeningTag,ee.jsxClosingTag,ee.htmlOpeningTag,ee.htmlClosingTag],Kn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],ms=Oi({name:er,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(n,s){if(n.startsWith("/"))return!1;let o=n.trimStart();if(n.startsWith("*")||o.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||ee.jsdocComment.test(n))return!1;for(let i of Kn)if(o.startsWith(i))return!1;if(n.includes("https://")||cs(o))return!1;if(s==="Block"){for(let i of fs)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of Ni)if(o.startsWith(i))return{wrongPattern:i};for(let i of us)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,s){let o=n,i=o.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return o;if(s==="Block"&&o.includes("```")){let c=o.split(is);c.some(d=>Gn.test(d))&&(o=c.join(""))}if(!o.includes("`"))return o;let p=o.split(ss);return p.some(c=>Gn.test(c))?p.join(""):o}return{Program(){let s=e.sourceCode.getAllComments();for(let o of s){let i=r(o.value,o.type),p=t(i,o.type);p&&e.report({node:o,messageId:"commentedOutCode",data:{wrongPattern:p.wrongPattern,allowedPrefixes:Kn.join(", ")}})}}}}}),Lt={name:er,rule:ms};var ct=require("@typescript-eslint/utils"),ys=ct.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),tr="no-default-export",ds=ys({name:tr,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let r of t.specifiers)r.exported.type===ct.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),Mt={name:tr,rule:ds};var nr=require("@typescript-eslint/utils"),gs=nr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),rr="no-leaked-text-in-jsx",Ss=[",",";","[","]","(",")"],Ts=gs({name:rr,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(t){let r=t.value.trim();if(!r)return;let n="";Ss.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),_t={name:rr,rule:Ts};var Le=require("@typescript-eslint/utils"),hs=Le.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),sr="no-non-camel-case-functions",Es=/^(\$?[a-z][a-zA-Z0-9]*)$/;function ir(e){if(e.typeName.type!==Le.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Le.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var bs=hs({name:sr,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!Es.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Le.AST_NODE_TYPES.TSTypeReference?ir(r):r.type===Le.AST_NODE_TYPES.TSUnionType&&r.types.some(s=>s.type===Le.AST_NODE_TYPES.TSTypeReference&&ir(s))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),$t={name:sr,rule:bs};var B=require("@typescript-eslint/utils");var xs=B.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),or="no-optional-root-props",Cs=xs({name:or,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function t(n){let o=e.sourceCode.getDeclaredVariables(n)[0];if(!o||o.references.length!==1)return!1;let i=o.references[0];if(!i)return!1;for(let p of Ft(i.identifier)){if("returnType"in p||p.type===B.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=p.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 y=Ve(l.parent.parent,B.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!y)return!1;let d=ut(y,e.sourceCode);return d?!(d.parent.type===B.TSESTree.AST_NODE_TYPES.CallExpression&&d.parent.callee.type===B.TSESTree.AST_NODE_TYPES.Identifier&&d.parent.callee.name==="memo"):!1}if(p.type===B.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===B.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let c=Ve(l,B.TSESTree.AST_NODE_TYPES.VariableDeclaration);return c?!!ut(c,e.sourceCode):!1}if(l.type===B.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!ut(l,e.sourceCode)}return!1}function r(n){n.key.type!==B.TSESTree.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:s=>{let o=Ve(n,B.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!o)return null;let i=e.sourceCode.getText(o);return s.replaceText(o,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===B.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(ft(n)||!t(n)))for(let s of n.typeAnnotation.members)s.type===B.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSInterfaceDeclaration(n){if(!(ft(n)||!t(n)))for(let s of n.body.body)s.type===B.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSTypeReference(n){if(n.typeName.type!==B.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let s=n.typeArguments.params[0];if(s.type!==B.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let o=Ve(n.parent,B.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!o)return;let i=ut(o,e.sourceCode);if(!(!i||i.parent.type===B.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===B.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of s.members)l.type===B.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function ft(e){return e?e.parent?.type===B.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===B.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function ut(e,t){if(ft(e))return;let r;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&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let n=t.getScope(e);e.type===B.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let s=n.variables.find(i=>i.identifiers.includes(r));if(!s)return;let o=s.references.filter(i=>i.identifier!==r);if(!(o.length!==1||!o[0])&&!ft(o[0].identifier.parent.parent))return o[0].identifier}var Ut={name:or,rule:Cs};var Ge=require("@typescript-eslint/utils");var Ke=M({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let t=new Set;function r(n){return n?n.type===Ge.AST_NODE_TYPES.Identifier?t.has(n.name):n.type===Ge.AST_NODE_TYPES.MemberExpression?r(n.object):!1:!1}return{ImportDeclaration(n){for(let s of n.specifiers)t.add(s.local.name)},ExportNamedDeclaration(n){if(n.source){e.report({node:n,messageId:"noReexport"});return}if(n.declaration?.type===Ge.AST_NODE_TYPES.VariableDeclaration)for(let s of n.declaration.declarations)r(s.init)&&e.report({node:n,messageId:"noReexport"});n.specifiers.length>0&&e.report({node:n,messageId:"noReexport"})},ExportDefaultDeclaration(n){n.declaration.type===Ge.AST_NODE_TYPES.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});var ar=require("@typescript-eslint/utils"),mt=he(require("path")),ke=require("zod/v4");var As=ar.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),lr="no-relative-imports",Is=ke.z.object({find:ke.z.string(),replacement:ke.z.string()}),Rs=ke.z.object({aliases:ke.z.array(Is),rootDir:ke.z.string().optional(),allowNotFoundAliases:ke.z.boolean().optional(),_dev_simulateFileName:ke.z.string().optional()}),ws=As({name:lr,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:[L(Rs)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function s(i,p){let l=mt.default.dirname(p);return mt.default.resolve(l,i)}function o(i){let p=t.rootDir??process.cwd(),l=mt.default.relative(p,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:c,replacement:y}of t.aliases)if(l.startsWith(y)){let d=l.replace(y,c);return{alias:c,newPath:d}}return null}return{ImportDeclaration(i){let p=i.source.value;if(!n(p))return;let l=s(p,r),c=o(l);!c&&t.allowNotFoundAliases||e.report({node:i,messageId:c?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:c?.alias},fix:c?y=>y.replaceText(i.source,`'${c.newPath}'`):void 0})}}}}),zt={name:lr,rule:ws};var te=require("@typescript-eslint/utils"),Wt=require("zod/v4");var ks=Wt.z.object({customMessage:Wt.z.string().optional()}),Jt=M({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[L(ks)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case te.AST_NODE_TYPES.Literal:return!0;case te.AST_NODE_TYPES.ObjectExpression:return n.properties.every(s=>s.type===te.AST_NODE_TYPES.Property?s.computed||s.value.type===te.AST_NODE_TYPES.Identifier&&s.key.type===te.AST_NODE_TYPES.Identifier&&s.key.name===s.value.name?!1:r(s.value):!1);case te.AST_NODE_TYPES.ArrayExpression:return n.elements.every(s=>s?s.type===te.AST_NODE_TYPES.SpreadElement?!1:r(s):!0);case te.AST_NODE_TYPES.TemplateLiteral:return n.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(n){if(n.name.type===te.AST_NODE_TYPES.JSXIdentifier&&n.name.name==="style"&&n.value){let s=null;n.value.type===te.AST_NODE_TYPES.JSXExpressionContainer?n.value.expression.type!==te.AST_NODE_TYPES.JSXEmptyExpression&&(s=n.value.expression):n.value.type===te.AST_NODE_TYPES.Literal&&(s=n.value),s&&r(s)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var Qe=require("@typescript-eslint/utils"),Ue=he(require("zod/v4"));var vs=Ue.object({alternativeMsgs:Ue.object({inArrayFind:Ue.string().optional(),inArrayFilter:Ue.string().optional()}).optional(),__dev_simulateFileName:Ue.string().optional()});function Ps(e){return e.typeAnnotation.type!==Qe.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var Fs=/(typeGuards|type-guards)\.(ts|tsx)$/;function Os(e){return Fs.test(e)}function Ns(e){let t=e.parent;for(;t;){if(t.type===Qe.AST_NODE_TYPES.CallExpression&&t.callee.type===Qe.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===Qe.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var Vt=M({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:[L(vs)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(Os(r))return{};function n(s){if(!Ps(s))return;let o=Ns(s);if(t.alternativeMsgs&&o){let i=o.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let p=o.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:s,messageId:p,data:{message:i}});return}}e.report({node:s,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});var ze=require("@typescript-eslint/utils");var Ds="no-unnecessary-async-on-jsx-props";function js(e){if(e.body.type!==ze.AST_NODE_TYPES.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let r=t[0];return!r||r.type!==ze.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===ze.AST_NODE_TYPES.AwaitExpression}var Xt=M({name:Ds,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function t(r){js(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let s=e.sourceCode,o=[],i=s.getFirstToken(r,l=>l.value==="async");if(i){let l=s.getTokenAfter(i);l?o.push(n.replaceTextRange([i.range[0],l.range[0]],"")):o.push(n.remove(i))}function p(l){if(l.type===ze.AST_NODE_TYPES.AwaitExpression){let c=s.getFirstToken(l);if(c&&c.value==="await"){let y=s.getTokenAfter(c);y?o.push(n.replaceTextRange([c.range[0],y.range[0]],"")):o.push(n.remove(c))}}if(l.type===ze.AST_NODE_TYPES.BlockStatement)for(let c of l.body)p(c);else l.type===ze.AST_NODE_TYPES.ExpressionStatement&&p(l.expression)}return p(r.body),o}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var ve=require("@typescript-eslint/utils"),Ht=he(require("typescript")),He=he(require("zod/v4"));var Ls=ve.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pr="no-unnecessary-casting",Ms=He.default.object({additionalCastFunctions:He.default.array(He.default.object({name:He.default.string(),expectedType:He.default.enum(["string","number"])})).optional()}),Bt={name:pr,rule:Ls({name:pr,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:[L(Ms)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],s=ve.ESLintUtils.getParserServices(e,!0),o=s.program?.getTypeChecker();if(!o||!s.program)throw new Error("TypeScript services or program not available");function i(y,d){switch(y.type){case ve.AST_NODE_TYPES.Literal:return d==="number"?typeof y.value=="number":typeof y.value=="string";case ve.AST_NODE_TYPES.TemplateLiteral:return d==="string";case ve.AST_NODE_TYPES.UnaryExpression:return d==="number"?y.operator==="+"||y.operator==="-"||y.operator==="~":!1;default:return!1}}function p(y,d){return d==="number"?!!(y.flags&Ht.TypeFlags.NumberLike):!!(y.flags&Ht.TypeFlags.StringLike)}function l(y,d){return a=>a.replaceText(y,e.sourceCode.getText(d))}function c(y){if(!o||y.arguments.length!==1)return;let d=y.arguments[0];if(!d||d.type===ve.AST_NODE_TYPES.SpreadElement)return;let{callee:a}=y;if(a.type!==ve.AST_NODE_TYPES.Identifier)return;let u=a.name,f=n.find(h=>h.name===u);if(!f)return;if(i(d,f.expectedType)||p(o.getTypeAtLocation(s.esTreeNodeToTSNodeMap.get(d)),f.expectedType)){let h,m;u==="Number"?h="unnecessaryNumberCasting":u==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",m={name:f.name,type:f.expectedType}),e.report({node:y,messageId:h,...m?{data:m}:{},fix:l(y,d)})}}return{CallExpression:c}}})};var ye=require("@typescript-eslint/utils"),yt=he(require("zod/v4"));var _s=yt.object({ignoreWithDescription:yt.string().optional()}),Yt=M({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:[L(_s)]},defaultOptions:[{}],create(e,[t]){let r=e.getSourceCode(),n=r.ast;function s(l){let c=l.arguments[0];return c&&c.type===ye.AST_NODE_TYPES.Literal&&typeof c.value=="string"?c.value:null}function o(l){return!l||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(l)}function i(l){return l.length!==1?!1:n.body.filter(y=>{if(y.type===ye.AST_NODE_TYPES.ExpressionStatement){let d=y.expression;if(d.type===ye.AST_NODE_TYPES.CallExpression&&d.callee.type===ye.AST_NODE_TYPES.Identifier){let a=d.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(a)}}return!1}).length===0}function p(l){let c=l.arguments[1];if(c&&(c.type===ye.AST_NODE_TYPES.FunctionExpression||c.type===ye.AST_NODE_TYPES.ArrowFunctionExpression)&&c.body.type===ye.AST_NODE_TYPES.BlockStatement){let y=c.body.body;return y.length===0?"":y.map(a=>r.text.slice(a.range[0],a.range[1])).join(`
|
|
16
16
|
|
|
17
|
-
`)}return""}return{Program(){let l=[];for(let a of n.body)a.type===ye.AST_NODE_TYPES.ExpressionStatement&&a.expression.type===ye.AST_NODE_TYPES.CallExpression&&a.expression.callee.type===ye.AST_NODE_TYPES.Identifier&&a.expression.callee.name==="describe"&&a.expression.arguments.length===2&&l.push(a.expression);if(!i(l))return;let[c]=l;if(!c)return;let f=s(c);if(o(f))return;let d=n.body.find(a=>a.type===ye.AST_NODE_TYPES.ExpressionStatement&&a.expression===c);!d||d.type!==ye.AST_NODE_TYPES.ExpressionStatement||e.report({node:c,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(a){let u=p(c);return u?a.replaceText(d,u):null}}]})}}}});var et=require("@typescript-eslint/utils"),xe=he(require("zod/v4"));var $s=xe.object({methods:xe.union([xe.array(xe.string()),xe.literal("array")])}),qt=M({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:[L($s)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function s(p){return Array.isArray(r)?r.includes(p):n.has(p)}function o(p){let{callee:l}=p;if(l.type===et.AST_NODE_TYPES.MemberExpression){let c=l.property;if(c.type===et.AST_NODE_TYPES.Identifier)return c.name}return null}function i(p,l){if(p.type!==et.AST_NODE_TYPES.Identifier||!p.typeAnnotation)return;let c=l.parent;if(c.type===et.AST_NODE_TYPES.CallExpression){let f=o(c);f&&s(f)&&c.arguments.indexOf(l)===0&&e.report({node:p.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(a){return p.typeAnnotation?a.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 me=require("@typescript-eslint/utils");var Zt=M({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===me.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==me.AST_NODE_TYPES.ObjectExpression||t.id.type===me.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===me.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===me.AST_NODE_TYPES.Property&&i.key.type===me.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==me.AST_NODE_TYPES.Identifier)return;let n=Us(t,e.sourceCode);if(n.length===0)return;let s=t.init.properties.some(i=>i.type!==me.AST_NODE_TYPES.Property?!1:i.value.type===me.AST_NODE_TYPES.FunctionExpression),o=new Set;for(let i of n){if(i.identifier.parent.type!==me.AST_NODE_TYPES.MemberExpression)return;let p=i.identifier.parent;if(p.object!==i.identifier)return;if(p.computed)if(p.property.type===me.AST_NODE_TYPES.Literal&&typeof p.property.value=="string")o.add(p.property.value);else return;else{if(p.property.type!==me.AST_NODE_TYPES.Identifier)return;o.add(p.property.name)}if(p.parent.type===me.AST_NODE_TYPES.CallExpression&&s)return}for(let[i,p]of r)o.has(i)||e.report({node:p,messageId:"unusedObjectProperty",data:{name:i}})}}}});function Us(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(s=>s.identifier!==e.id):[]}var z=require("@typescript-eslint/utils"),Gt=require("zod/v4");var Ws=Gt.z.object({ignoreArgsMatching:Gt.z.string().optional()}),Kt=M({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:[L(Ws)]},defaultOptions:[{}],create(e,[t]){let r=[];function n(i){return t.ignoreArgsMatching?new RegExp(t.ignoreArgsMatching).test(i):!1}function s(i){return i.type===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 o(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 f=c.name;if(!n(f)){if(c.optional&&c.typeAnnotation&&c.typeAnnotation.typeAnnotation.type===z.AST_NODE_TYPES.TSTypeLiteral){let d=c.typeAnnotation.typeAnnotation,a=[];for(let u of d.members)u.type===z.AST_NODE_TYPES.TSPropertySignature&&u.key.type===z.AST_NODE_TYPES.Identifier&&a.push({name:u.key.name,optional:u.optional===!0});a.some(u=>u.optional)?p.push({param:c,index:l,name:f,isObjectParam:!0,objectProps:a}):p.push({param:c,index:l,name:f,isObjectParam:!1})}else if(c.optional)p.push({param:c,index:l,name:f,isObjectParam:!1});else if(c.typeAnnotation&&c.typeAnnotation.typeAnnotation.type===z.AST_NODE_TYPES.TSTypeLiteral){let d=c.typeAnnotation.typeAnnotation,a=[];for(let u of d.members)u.type===z.AST_NODE_TYPES.TSPropertySignature&&u.key.type===z.AST_NODE_TYPES.Identifier&&a.push({name:u.key.name,optional:u.optional===!0});a.some(u=>u.optional)&&p.push({param:c,index:l,name:f,isObjectParam:!0,objectProps:a})}}}return p}return{FunctionDeclaration(i){if(s(i))return;let p=o(i.params);p.length!==0&&r.push({node:i,declarationNode:i,optionalParams:p})},VariableDeclarator(i){if(i.id.type!==z.AST_NODE_TYPES.Identifier||!i.init||i.init.type!==z.AST_NODE_TYPES.ArrowFunctionExpression&&i.init.type!==z.AST_NODE_TYPES.FunctionExpression||s(i.parent.parent))return;let l=[...o(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 f=c.typeArguments;if(f&&f.params.length===1){let d=f.params[0];if(d&&d.type===z.AST_NODE_TYPES.TSTypeLiteral){let a=[];for(let u of d.members)u.type===z.AST_NODE_TYPES.TSPropertySignature&&u.key.type===z.AST_NODE_TYPES.Identifier&&a.push({name:u.key.name,optional:u.optional===!0});a.some(u=>u.optional)&&l.push({param:i.id,index:0,name:"props",isObjectParam:!0,objectProps:a})}}}}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(a=>a.identifier!==l.identifiers[0]);if(c.length===0)continue;let f=!1;for(let a of c){let u=a.identifier.parent;if(u.type===z.AST_NODE_TYPES.CallExpression&&a.identifier.type===z.AST_NODE_TYPES.Identifier&&u.arguments.includes(a.identifier)){f=!0;break}if(u.type===z.AST_NODE_TYPES.ReturnStatement){f=!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){f=!0;break}if(u.type===z.AST_NODE_TYPES.JSXExpressionContainer){f=!0;break}}if(f)continue;let d=[];for(let a of c){let u=a.identifier.parent;if(u.type===z.AST_NODE_TYPES.CallExpression&&u.callee===a.identifier){let m=u.arguments.length,T=u.arguments.some(y=>y.type===z.AST_NODE_TYPES.SpreadElement);if(T){f=!0;break}let h={argCount:m,hasSpread:T};for(let y of i.optionalParams)if(y.isObjectParam&&y.index<m){let E=u.arguments[y.index];if(E?.type===z.AST_NODE_TYPES.ObjectExpression){let x={};for(let g of E.properties)g.type===z.AST_NODE_TYPES.Property&&g.key.type===z.AST_NODE_TYPES.Identifier&&(x[g.key.name]=!0);h.objectArgs||(h.objectArgs=[]),h.objectArgs[y.index]=x}else if(E){f=!0;break}}d.push(h)}else if(u.type===z.AST_NODE_TYPES.JSXOpeningElement&&u.name===a.identifier){let m=u.attributes.some(h=>h.type===z.AST_NODE_TYPES.JSXSpreadAttribute);if(m){f=!0;break}let T={argCount:1,hasSpread:m};for(let h of i.optionalParams)if(h.isObjectParam&&h.index===0){let y={};for(let E of u.attributes)E.type===z.AST_NODE_TYPES.JSXAttribute&&E.name.type===z.AST_NODE_TYPES.JSXIdentifier&&(y[E.name.name]=!0);T.objectArgs||(T.objectArgs=[]),T.objectArgs[0]=y}d.push(T)}}if(!(f||d.length===0))for(let a of i.optionalParams)if(a.isObjectParam&&a.objectProps)for(let u of a.objectProps){if(!u.optional)continue;let m=!1;for(let T of d)if(T.objectArgs&&T.objectArgs[a.index]){let h=T.objectArgs[a.index];if(h&&h[u.name]){m=!0;break}}m||e.report({node:a.param,messageId:"unusedOptionalProp",data:{name:u.name}})}else{let u=!1;for(let m of d)if(m.argCount>a.index){u=!0;break}u||e.report({node:a.param,messageId:"unusedOptionalArg",data:{name:a.name}})}}}}}});var Y=require("@typescript-eslint/utils"),Me=require("zod/v4");var zs=Me.z.object({selectors:Me.z.array(Me.z.object({name:Me.z.string(),selectorProp:Me.z.string().optional(),selectorArgPos:Me.z.number().optional(),returnProp:Me.z.string().optional()}))}),Js=Y.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cr="no-unused-selected-values",Qt={name:cr,rule:Js({name:cr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[L(zs)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(s=>[s.name,s]));return{VariableDeclarator(s){let o=null;if(s.init?.type===Y.AST_NODE_TYPES.CallExpression&&(o=s.init),!o)return;let i=Xs(o);if(!i)return;let p=n.get(i);if(!p)return;let l=Vs(o,p.selectorArgPos??0,p.selectorProp);if(!l)return;let c=Hs(l);if(!c)return;let f=ur(c.properties,void 0);if(!f)return;if(s.id.type===Y.AST_NODE_TYPES.ObjectPattern){let u=ur(s.id.properties,p.returnProp);if(!u)return;for(let[m,T]of f)u.has(m)||e.report({node:T,messageId:"unusedSelectedValue",data:{name:m}});return}if(s.id.type!==Y.AST_NODE_TYPES.Identifier||p.returnProp)return;let d=Bs(s,e.sourceCode);if(d.length===0)return;let a=new Set;for(let u of d){if(u.identifier.parent.type!==Y.AST_NODE_TYPES.MemberExpression)return;let m=u.identifier.parent.property;if(m.type!==Y.AST_NODE_TYPES.Identifier)return;a.add(m.name)}for(let[u,m]of f)a.has(u)||e.report({node:m,messageId:"unusedSelectedValue",data:{name:u}})}}}})};function Vs(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===Y.AST_NODE_TYPES.ArrowFunctionExpression||n.type===Y.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===Y.AST_NODE_TYPES.ObjectExpression){let s=n.properties.find(i=>i.type===Y.AST_NODE_TYPES.Property&&i.key.type===Y.AST_NODE_TYPES.Identifier&&i.key.name===r);if(s?.type!==Y.AST_NODE_TYPES.Property)return null;let o=s.value;if(o.type===Y.AST_NODE_TYPES.ArrowFunctionExpression||o.type===Y.AST_NODE_TYPES.FunctionExpression)return o}return null}function Xs(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 Hs(e){if(e.body.type===Y.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===Y.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===Y.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==Y.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function ur(e,t){let r=e;if(t){let s=e.find(o=>o.type===Y.AST_NODE_TYPES.Property&&o.key.type===Y.AST_NODE_TYPES.Identifier&&o.key.name===t);if(s?.type!==Y.AST_NODE_TYPES.Property||s.value.type!==Y.AST_NODE_TYPES.ObjectPattern)return null;r=s.value.properties}let n=new Map;for(let s of r){if(s.type!==Y.AST_NODE_TYPES.Property||s.key.type!==Y.AST_NODE_TYPES.Identifier)return null;n.set(s.key.name,s)}return n.size>0?n:null}function Bs(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(s=>s.identifier!==e.id):[]}var q=require("@typescript-eslint/utils");var en=M({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(o=>o.type===q.AST_NODE_TYPES.ImportDeclaration&&o.source.value==="t-state-form"))return{};let n=null,s=!1;return{CallExpression(o){if(s)return;if(!n){let p=Ys(o);p&&(n=p);return}let i=qs(o,e.sourceCode);if(i){s=!0;for(let p of i)n.delete(p);if(n.size!==0)for(let[p,l]of n)e.report({node:l,messageId:"unusedField",data:{name:p}})}}}}});function Ys(e){if(!(e.callee.type===q.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==q.AST_NODE_TYPES.ObjectExpression)return null;let n=Ot(r.properties,o=>o.type!==q.AST_NODE_TYPES.Property||o.key.type!==q.AST_NODE_TYPES.Identifier||o.key.name!=="initialConfig"?null:o.value.type===q.AST_NODE_TYPES.ObjectExpression?o.value:o.value.type===q.AST_NODE_TYPES.ArrowFunctionExpression||o.value.type===q.AST_NODE_TYPES.FunctionExpression?Zs(o.value):null);if(!n)return null;let s=new Map;for(let o of n.properties)o.type===q.AST_NODE_TYPES.Property&&o.key.type===q.AST_NODE_TYPES.Identifier&&s.set(o.key.name,o);return s}function qs(e,t){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||!Ot(e.parent.id.properties,i=>i.type===q.AST_NODE_TYPES.Property&&i.key.type===q.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let s=Hn(e.parent,"formFields",t),o=new Set;for(let{identifier:i}of s){if(i.type!==q.AST_NODE_TYPES.Identifier||i.parent.type===q.AST_NODE_TYPES.Property&&i.parent.parent.type===q.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===q.AST_NODE_TYPES.ReturnStatement||i.parent.type===q.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===q.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==q.AST_NODE_TYPES.Identifier||i.parent.property.type!==q.AST_NODE_TYPES.Identifier)return null;o.add(i.parent.property.name)}}return o}function Zs(e){if(e.body.type===q.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===q.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===q.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==q.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var H=require("@typescript-eslint/utils"),tt=require("zod/v4");var Gs=H.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function fr(e){let t=[];for(let r of e.members)r.type===H.AST_NODE_TYPES.TSPropertySignature&&r.key.type===H.AST_NODE_TYPES.Identifier&&t.push([r.key.name,r]);return t}function mr(e,...t){for(let r of t)e.set(...r);return e}var Ks=tt.z.object({forceCheckOnFCPropTypesWithName:tt.z.array(tt.z.string()).optional(),alwaysCheckFunctionOptionTypes:tt.z.boolean().optional()}),yr="no-unused-type-props-in-args",tn=null,Qs=Gs({name:yr,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:[L(Ks)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!tn&&(tn=r.map(l=>new RegExp(l)));function s(l,c,f,d,a=!0,u=!1){let m=f.name,T=e.sourceCode.getScope(c).references.find(g=>g.identifier.name===m)?.resolved,h=l&&tn?.some(g=>g.test(m)),y=u&&n;if(!T||!h&&T.references.filter(g=>g.isTypeReference).length>1||!T.defs[0])return;let E=T.defs[0].node,x=E.parent?.type===H.AST_NODE_TYPES.ExportNamedDeclaration;if(!(a&&x&&!y)){if(E.type===H.AST_NODE_TYPES.TSTypeAliasDeclaration){o(l,c,d,E.typeAnnotation,!0,u);return}if(E.type===H.AST_NODE_TYPES.TSInterfaceDeclaration){o(l,c,d,E.body,!0,u);return}}}function o(l,c,f,d,a,u=!1){if(d.type===H.AST_NODE_TYPES.TSInterfaceBody){for(let m of d.body)m.type===H.AST_NODE_TYPES.TSPropertySignature&&m.key.type===H.AST_NODE_TYPES.Identifier&&f.set(m.key.name,m);return}if(d.type===H.AST_NODE_TYPES.TSTypeLiteral){mr(f,...fr(d));return}if(d.type===H.AST_NODE_TYPES.TSIntersectionType){for(let m of d.types)o(l,c,f,m,!0,u);return}a||d.type===H.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===H.AST_NODE_TYPES.Identifier&&s(l,c,d.typeName,f,!0,u)}function i(l,c,f,d=!1){for(let a of f)if(a.type===H.AST_NODE_TYPES.ObjectPattern&&a.typeAnnotation){let u=new Map;if(o(l,c,u,a.typeAnnotation.typeAnnotation,!1,d),u.size===0)continue;p(a,u)}else a.type===H.AST_NODE_TYPES.AssignmentPattern&&a.left.type===H.AST_NODE_TYPES.ObjectPattern&&i(l,c,[a.left],d)}function p(l,c){let f=[];if(l.properties.at(-1)?.type===H.AST_NODE_TYPES.RestElement)return;for(let m of l.properties)m.type===H.AST_NODE_TYPES.Property&&m.key.type===H.AST_NODE_TYPES.Identifier&&f.push(m.key.name);let a=[],u=[];for(let[m,T]of c)f.includes(m)||(u.push(m),a.push({node:T,messageId:"unusedObjectTypeProperty",data:{propertyName:m}}));for(let[m,T]of a.entries())e.report({...T,fix:m===a.length-1?h=>{let y=l.properties.at(-1),E=u.join(", ");return y?y.type===H.AST_NODE_TYPES.RestElement?null:h.insertTextAfter(y,`, ${E}`):h.insertTextBeforeRange([l.range[0]+1,l.range[1]],E)}:void 0})}return{VariableDeclaration(l){let c=l.declarations[0],f=new Map,d=c.id.type===H.AST_NODE_TYPES.Identifier&&c.id.typeAnnotation?.typeAnnotation.type===H.AST_NODE_TYPES.TSTypeReference&&c.id.typeAnnotation.typeAnnotation.typeName.type===H.AST_NODE_TYPES.Identifier&&c.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&c.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(d){if(d.type===H.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===H.AST_NODE_TYPES.Identifier)s(!0,l,d.typeName,f,!1);else if(d.type===H.AST_NODE_TYPES.TSTypeLiteral)mr(f,...fr(d));else if(d.type===H.AST_NODE_TYPES.TSIntersectionType)for(let a of d.types)a.type===H.AST_NODE_TYPES.TSTypeReference&&a.typeName.type===H.AST_NODE_TYPES.Identifier?s(!0,l,a.typeName,f,!1):o(!0,l,f,a,!0);if(f.size!==0&&c.init?.type===H.AST_NODE_TYPES.ArrowFunctionExpression){let a=c.init.params[0];if(!a){e.report({node:c.init,messageId:"missingComponentParam"});return}a.type===H.AST_NODE_TYPES.ObjectPattern&&p(a,f)}}},FunctionDeclaration(l){i(!1,l,l.params,n)},ArrowFunctionExpression(l){i(!1,l,l.params,n)}}}}),nn={name:yr,rule:Qs};var Se=require("@typescript-eslint/utils");var rn=M({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let t=new Set;function r(n){return n.callee.type===Se.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===Se.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===Se.AST_NODE_TYPES.Identifier&&n.callee.property.type===Se.AST_NODE_TYPES.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let s of n.specifiers)s.type===Se.AST_NODE_TYPES.ImportSpecifier&&s.imported.type===Se.AST_NODE_TYPES.Identifier&&s.imported.name==="useRef"&&t.add(s.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===Se.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===Se.AST_NODE_TYPES.Identifier){let o=e.sourceCode.getScope(n).set.get(n.id.name);if(o){let i=!1;for(let p of o.references){let c=p.identifier.parent;if(c!==n&&!(c.type===Se.AST_NODE_TYPES.JSXExpressionContainer&&c.parent.type===Se.AST_NODE_TYPES.JSXAttribute&&c.parent.name.type===Se.AST_NODE_TYPES.JSXIdentifier&&c.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var Be=require("@typescript-eslint/utils"),eo=Be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),gr="prefer-named-functions",dr=new Map,to=eo({name:gr,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[t]){let r=null;if(t.ignoreRegex){let n=dr.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),dr.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===Be.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===Be.AST_NODE_TYPES.Identifier){let s=n.id.name;if(n.id.typeAnnotation||r&&r.test(s)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==Be.AST_NODE_TYPES.BlockStatement)return;let o=n.parent,i=n.init.params,p=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:s,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:c=>c.replaceText(o,`${l.async?"async ":""}function ${s}(${i.map(f=>e.sourceCode.getText(f)).join(", ")||""}) ${e.sourceCode.getText(p)}`)}]})}}}}}),sn={name:gr,rule:to};var _=require("@typescript-eslint/utils"),Ce=require("zod/v4");var no=Ce.z.object({disallowedFunctions:Ce.z.array(Ce.z.object({name:Ce.z.string(),allowUsingWithArgs:Ce.z.boolean().optional(),hookAlternative:Ce.z.string().optional(),message:Ce.z.string().optional(),allowUseInside:Ce.z.array(Ce.z.string()).optional()}))}),ro=/^use[A-Z]/,io=/^[A-Z]/;function dt(e){return ro.test(e)}function Sr(e){return io.test(e)}function so(e){return e.type===_.AST_NODE_TYPES.Identifier?dt(e.name):e.type===_.AST_NODE_TYPES.MemberExpression&&e.property.type===_.AST_NODE_TYPES.Identifier?dt(e.property.name):!1}function Tr(e,t){return e.type===_.AST_NODE_TYPES.Identifier?e.name===t:e.type===_.AST_NODE_TYPES.MemberExpression&&e.object.type===_.AST_NODE_TYPES.Identifier&&e.property.type===_.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function hr(e){return!!(e.parent&&e.parent.type===_.AST_NODE_TYPES.CallExpression&&Tr(e.parent.callee,"forwardRef"))}function Er(e){return!!(e.parent&&e.parent.type===_.AST_NODE_TYPES.CallExpression&&Tr(e.parent.callee,"memo"))}function on(e){if(e.type===_.AST_NODE_TYPES.FunctionDeclaration||e.type===_.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===_.AST_NODE_TYPES.FunctionExpression||e.type===_.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===_.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===_.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===_.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===_.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function oo(e){let t=e.parent,r=!1;for(;t;){if(t.type===_.AST_NODE_TYPES.FunctionDeclaration||t.type===_.AST_NODE_TYPES.FunctionExpression||t.type===_.AST_NODE_TYPES.ArrowFunctionExpression){let n=on(t);if(n&&n.type===_.AST_NODE_TYPES.Identifier){if(Sr(n.name)||dt(n.name))return!r;r=!0}else{if(hr(t)||Er(t))return!r;if(t.parent.type===_.AST_NODE_TYPES.CallExpression){let s=t.parent;so(s.callee)||(r=!0)}else t.parent.type===_.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function br(e){return e.callee.type===_.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===_.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===_.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function ao(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===_.AST_NODE_TYPES.FunctionDeclaration||r.type===_.AST_NODE_TYPES.FunctionExpression||r.type===_.AST_NODE_TYPES.ArrowFunctionExpression){let n=on(r);if(n&&n.type===_.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===_.AST_NODE_TYPES.CallExpression){let n=br(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function lo(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===_.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function po(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===_.AST_NODE_TYPES.FunctionDeclaration||n.type===_.AST_NODE_TYPES.FunctionExpression||n.type===_.AST_NODE_TYPES.ArrowFunctionExpression){let s=on(n);if(s&&s.type===_.AST_NODE_TYPES.Identifier){if(Sr(s.name)||dt(s.name)){r=!0;break}}else if(hr(n)||Er(n)){r=!0;break}}n=n.parent}return r?t.length===0?oo(e):!ao(e,t):!1}var an=M({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:[L(no)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(s=>[s.name,s]));return{CallExpression(s){let o=br(s);if(!o)return;let i=n.get(o);if(!i||i.allowUsingWithArgs&&lo(s))return;let p=i.allowUseInside||[];po(s,p)&&e.report({node:s,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:l=>{let c=i.hookAlternative;return c?s.callee.type===_.AST_NODE_TYPES.Identifier?l.replaceText(s.callee,c):s.callee.type===_.AST_NODE_TYPES.MemberExpression&&s.callee.property.type===_.AST_NODE_TYPES.Identifier?l.replaceText(s.callee.property,c):null:null}}]:[]})}}}});var G=require("@typescript-eslint/utils"),gt=he(require("zod/v4"));var co=G.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cr="prefer-single-line-if",uo=gt.default.object({maxLineLength:gt.default.number().optional(),maxNonSimpleConditionLength:gt.default.number().optional()}),fo=co({name:Cr,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[L(uo)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==G.AST_NODE_TYPES.BlockStatement||n.loc.start.line===n.loc.end.line||r.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let o=n.consequent.body[0];if(!o)return;if(o.type===G.AST_NODE_TYPES.ReturnStatement){if(!Ir(o))return}else if(!(o.type===G.AST_NODE_TYPES.ContinueStatement||o.type===G.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===G.AST_NODE_TYPES.LogicalExpression||n.test.type===G.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let d=xr(n.test);if(!d&&n.test.type===G.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let a=n.test.argument;xr(a)&&(d=!0)}if(d&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let p=r.getText(o);if(i.includes(`
|
|
18
|
-
`))return;let l=r.getTokenAfter(n);if(l&&l.type===G.AST_TOKEN_TYPES.Punctuator&&l.value==="}"){let d=r.getTokenAfter(l);if(d&&d.type===G.AST_TOKEN_TYPES.Keyword&&(d.value==="else"||d.value==="catch"))return}let c=mo(r,n),
|
|
17
|
+
`)}return""}return{Program(){let l=[];for(let a of n.body)a.type===ye.AST_NODE_TYPES.ExpressionStatement&&a.expression.type===ye.AST_NODE_TYPES.CallExpression&&a.expression.callee.type===ye.AST_NODE_TYPES.Identifier&&a.expression.callee.name==="describe"&&a.expression.arguments.length===2&&l.push(a.expression);if(!i(l))return;let[c]=l;if(!c)return;let y=s(c);if(o(y))return;let d=n.body.find(a=>a.type===ye.AST_NODE_TYPES.ExpressionStatement&&a.expression===c);!d||d.type!==ye.AST_NODE_TYPES.ExpressionStatement||e.report({node:c,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(a){let u=p(c);return u?a.replaceText(d,u):null}}]})}}}});var et=require("@typescript-eslint/utils"),xe=he(require("zod/v4"));var $s=xe.object({methods:xe.union([xe.array(xe.string()),xe.literal("array")])}),qt=M({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:[L($s)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function s(p){return Array.isArray(r)?r.includes(p):n.has(p)}function o(p){let{callee:l}=p;if(l.type===et.AST_NODE_TYPES.MemberExpression){let c=l.property;if(c.type===et.AST_NODE_TYPES.Identifier)return c.name}return null}function i(p,l){if(p.type!==et.AST_NODE_TYPES.Identifier||!p.typeAnnotation)return;let c=l.parent;if(c.type===et.AST_NODE_TYPES.CallExpression){let y=o(c);y&&s(y)&&c.arguments.indexOf(l)===0&&e.report({node:p.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(a){return p.typeAnnotation?a.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 me=require("@typescript-eslint/utils");var Zt=M({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===me.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==me.AST_NODE_TYPES.ObjectExpression||t.id.type===me.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===me.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===me.AST_NODE_TYPES.Property&&i.key.type===me.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==me.AST_NODE_TYPES.Identifier)return;let n=Us(t,e.sourceCode);if(n.length===0)return;let s=t.init.properties.some(i=>i.type!==me.AST_NODE_TYPES.Property?!1:i.value.type===me.AST_NODE_TYPES.FunctionExpression),o=new Set;for(let i of n){if(i.identifier.parent.type!==me.AST_NODE_TYPES.MemberExpression)return;let p=i.identifier.parent;if(p.object!==i.identifier)return;if(p.computed)if(p.property.type===me.AST_NODE_TYPES.Literal&&typeof p.property.value=="string")o.add(p.property.value);else return;else{if(p.property.type!==me.AST_NODE_TYPES.Identifier)return;o.add(p.property.name)}if(p.parent.type===me.AST_NODE_TYPES.CallExpression&&s)return}for(let[i,p]of r)o.has(i)||e.report({node:p,messageId:"unusedObjectProperty",data:{name:i}})}}}});function Us(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(s=>s.identifier!==e.id):[]}var W=require("@typescript-eslint/utils"),Gt=require("zod/v4");var zs=Gt.z.object({ignoreArgsMatching:Gt.z.string().optional()}),Kt=M({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:[L(zs)]},defaultOptions:[{}],create(e,[t]){let r=[];function n(i){return t.ignoreArgsMatching?new RegExp(t.ignoreArgsMatching).test(i):!1}function s(i){return i.type===W.AST_NODE_TYPES.ExportNamedDeclaration||i.type===W.AST_NODE_TYPES.ExportDefaultDeclaration||i.parent?.type===W.AST_NODE_TYPES.ExportNamedDeclaration||i.parent?.type===W.AST_NODE_TYPES.ExportDefaultDeclaration}function o(i){let p=[];for(let l=0;l<i.length;l++){let c=i[l];if(!c||c.type!==W.AST_NODE_TYPES.Identifier)continue;let y=c.name;if(!n(y)){if(c.optional&&c.typeAnnotation&&c.typeAnnotation.typeAnnotation.type===W.AST_NODE_TYPES.TSTypeLiteral){let d=c.typeAnnotation.typeAnnotation,a=[];for(let u of d.members)u.type===W.AST_NODE_TYPES.TSPropertySignature&&u.key.type===W.AST_NODE_TYPES.Identifier&&a.push({name:u.key.name,optional:u.optional===!0});a.some(u=>u.optional)?p.push({param:c,index:l,name:y,isObjectParam:!0,objectProps:a}):p.push({param:c,index:l,name:y,isObjectParam:!1})}else if(c.optional)p.push({param:c,index:l,name:y,isObjectParam:!1});else if(c.typeAnnotation&&c.typeAnnotation.typeAnnotation.type===W.AST_NODE_TYPES.TSTypeLiteral){let d=c.typeAnnotation.typeAnnotation,a=[];for(let u of d.members)u.type===W.AST_NODE_TYPES.TSPropertySignature&&u.key.type===W.AST_NODE_TYPES.Identifier&&a.push({name:u.key.name,optional:u.optional===!0});a.some(u=>u.optional)&&p.push({param:c,index:l,name:y,isObjectParam:!0,objectProps:a})}}}return p}return{FunctionDeclaration(i){if(s(i))return;let p=o(i.params);p.length!==0&&r.push({node:i,declarationNode:i,optionalParams:p})},VariableDeclarator(i){if(i.id.type!==W.AST_NODE_TYPES.Identifier||!i.init||i.init.type!==W.AST_NODE_TYPES.ArrowFunctionExpression&&i.init.type!==W.AST_NODE_TYPES.FunctionExpression||s(i.parent.parent))return;let l=[...o(i.init.params)];if(i.id.typeAnnotation&&i.id.typeAnnotation.typeAnnotation.type===W.AST_NODE_TYPES.TSTypeReference){let c=i.id.typeAnnotation.typeAnnotation;if(c.typeName.type===W.AST_NODE_TYPES.Identifier&&c.typeName.name==="FC"){let y=c.typeArguments;if(y&&y.params.length===1){let d=y.params[0];if(d&&d.type===W.AST_NODE_TYPES.TSTypeLiteral){let a=[];for(let u of d.members)u.type===W.AST_NODE_TYPES.TSPropertySignature&&u.key.type===W.AST_NODE_TYPES.Identifier&&a.push({name:u.key.name,optional:u.optional===!0});a.some(u=>u.optional)&&l.push({param:i.id,index:0,name:"props",isObjectParam:!0,objectProps:a})}}}}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(a=>a.identifier!==l.identifiers[0]);if(c.length===0)continue;let y=!1;for(let a of c){let u=a.identifier.parent;if(u.type===W.AST_NODE_TYPES.CallExpression&&a.identifier.type===W.AST_NODE_TYPES.Identifier&&u.arguments.includes(a.identifier)){y=!0;break}if(u.type===W.AST_NODE_TYPES.ReturnStatement){y=!0;break}if(u.type===W.AST_NODE_TYPES.Property&&u.parent.type===W.AST_NODE_TYPES.ObjectExpression&&u.parent.parent.type===W.AST_NODE_TYPES.ReturnStatement){y=!0;break}if(u.type===W.AST_NODE_TYPES.JSXExpressionContainer){y=!0;break}}if(y)continue;let d=[];for(let a of c){let u=a.identifier.parent;if(u.type===W.AST_NODE_TYPES.CallExpression&&u.callee===a.identifier){let f=u.arguments.length,S=u.arguments.some(m=>m.type===W.AST_NODE_TYPES.SpreadElement);if(S){y=!0;break}let h={argCount:f,hasSpread:S};for(let m of i.optionalParams)if(m.isObjectParam&&m.index<f){let E=u.arguments[m.index];if(E?.type===W.AST_NODE_TYPES.ObjectExpression){let x={};for(let g of E.properties)g.type===W.AST_NODE_TYPES.Property&&g.key.type===W.AST_NODE_TYPES.Identifier&&(x[g.key.name]=!0);h.objectArgs||(h.objectArgs=[]),h.objectArgs[m.index]=x}else if(E){y=!0;break}}d.push(h)}else if(u.type===W.AST_NODE_TYPES.JSXOpeningElement&&u.name===a.identifier){let f=u.attributes.some(h=>h.type===W.AST_NODE_TYPES.JSXSpreadAttribute);if(f){y=!0;break}let S={argCount:1,hasSpread:f};for(let h of i.optionalParams)if(h.isObjectParam&&h.index===0){let m={};for(let E of u.attributes)E.type===W.AST_NODE_TYPES.JSXAttribute&&E.name.type===W.AST_NODE_TYPES.JSXIdentifier&&(m[E.name.name]=!0);S.objectArgs||(S.objectArgs=[]),S.objectArgs[0]=m}d.push(S)}}if(!(y||d.length===0))for(let a of i.optionalParams)if(a.isObjectParam&&a.objectProps)for(let u of a.objectProps){if(!u.optional)continue;let f=!1;for(let S of d)if(S.objectArgs&&S.objectArgs[a.index]){let h=S.objectArgs[a.index];if(h&&h[u.name]){f=!0;break}}f||e.report({node:a.param,messageId:"unusedOptionalProp",data:{name:u.name}})}else{let u=!1;for(let f of d)if(f.argCount>a.index){u=!0;break}u||e.report({node:a.param,messageId:"unusedOptionalArg",data:{name:a.name}})}}}}}});var Y=require("@typescript-eslint/utils"),Me=require("zod/v4");var Ws=Me.z.object({selectors:Me.z.array(Me.z.object({name:Me.z.string(),selectorProp:Me.z.string().optional(),selectorArgPos:Me.z.number().optional(),returnProp:Me.z.string().optional()}))}),Js=Y.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cr="no-unused-selected-values",Qt={name:cr,rule:Js({name:cr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[L(Ws)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(s=>[s.name,s]));return{VariableDeclarator(s){let o=null;if(s.init?.type===Y.AST_NODE_TYPES.CallExpression&&(o=s.init),!o)return;let i=Xs(o);if(!i)return;let p=n.get(i);if(!p)return;let l=Vs(o,p.selectorArgPos??0,p.selectorProp);if(!l)return;let c=Hs(l);if(!c)return;let y=ur(c.properties,void 0);if(!y)return;if(s.id.type===Y.AST_NODE_TYPES.ObjectPattern){let u=ur(s.id.properties,p.returnProp);if(!u)return;for(let[f,S]of y)u.has(f)||e.report({node:S,messageId:"unusedSelectedValue",data:{name:f}});return}if(s.id.type!==Y.AST_NODE_TYPES.Identifier||p.returnProp)return;let d=Bs(s,e.sourceCode);if(d.length===0)return;let a=new Set;for(let u of d){if(u.identifier.parent.type!==Y.AST_NODE_TYPES.MemberExpression)return;let f=u.identifier.parent.property;if(f.type!==Y.AST_NODE_TYPES.Identifier)return;a.add(f.name)}for(let[u,f]of y)a.has(u)||e.report({node:f,messageId:"unusedSelectedValue",data:{name:u}})}}}})};function Vs(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===Y.AST_NODE_TYPES.ArrowFunctionExpression||n.type===Y.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===Y.AST_NODE_TYPES.ObjectExpression){let s=n.properties.find(i=>i.type===Y.AST_NODE_TYPES.Property&&i.key.type===Y.AST_NODE_TYPES.Identifier&&i.key.name===r);if(s?.type!==Y.AST_NODE_TYPES.Property)return null;let o=s.value;if(o.type===Y.AST_NODE_TYPES.ArrowFunctionExpression||o.type===Y.AST_NODE_TYPES.FunctionExpression)return o}return null}function Xs(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 Hs(e){if(e.body.type===Y.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===Y.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===Y.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==Y.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function ur(e,t){let r=e;if(t){let s=e.find(o=>o.type===Y.AST_NODE_TYPES.Property&&o.key.type===Y.AST_NODE_TYPES.Identifier&&o.key.name===t);if(s?.type!==Y.AST_NODE_TYPES.Property||s.value.type!==Y.AST_NODE_TYPES.ObjectPattern)return null;r=s.value.properties}let n=new Map;for(let s of r){if(s.type!==Y.AST_NODE_TYPES.Property||s.key.type!==Y.AST_NODE_TYPES.Identifier)return null;n.set(s.key.name,s)}return n.size>0?n:null}function Bs(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(s=>s.identifier!==e.id):[]}var q=require("@typescript-eslint/utils");var en=M({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(o=>o.type===q.AST_NODE_TYPES.ImportDeclaration&&o.source.value==="t-state-form"))return{};let n=null,s=!1;return{CallExpression(o){if(s)return;if(!n){let p=Ys(o);p&&(n=p);return}let i=qs(o,e.sourceCode);if(i){s=!0;for(let p of i)n.delete(p);if(n.size!==0)for(let[p,l]of n)e.report({node:l,messageId:"unusedField",data:{name:p}})}}}}});function Ys(e){if(!(e.callee.type===q.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==q.AST_NODE_TYPES.ObjectExpression)return null;let n=Ot(r.properties,o=>o.type!==q.AST_NODE_TYPES.Property||o.key.type!==q.AST_NODE_TYPES.Identifier||o.key.name!=="initialConfig"?null:o.value.type===q.AST_NODE_TYPES.ObjectExpression?o.value:o.value.type===q.AST_NODE_TYPES.ArrowFunctionExpression||o.value.type===q.AST_NODE_TYPES.FunctionExpression?Zs(o.value):null);if(!n)return null;let s=new Map;for(let o of n.properties)o.type===q.AST_NODE_TYPES.Property&&o.key.type===q.AST_NODE_TYPES.Identifier&&s.set(o.key.name,o);return s}function qs(e,t){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||!Ot(e.parent.id.properties,i=>i.type===q.AST_NODE_TYPES.Property&&i.key.type===q.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let s=Hn(e.parent,"formFields",t),o=new Set;for(let{identifier:i}of s){if(i.type!==q.AST_NODE_TYPES.Identifier||i.parent.type===q.AST_NODE_TYPES.Property&&i.parent.parent.type===q.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===q.AST_NODE_TYPES.ReturnStatement||i.parent.type===q.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===q.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==q.AST_NODE_TYPES.Identifier||i.parent.property.type!==q.AST_NODE_TYPES.Identifier)return null;o.add(i.parent.property.name)}}return o}function Zs(e){if(e.body.type===q.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===q.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===q.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==q.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var H=require("@typescript-eslint/utils"),tt=require("zod/v4");var Gs=H.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function fr(e){let t=[];for(let r of e.members)r.type===H.AST_NODE_TYPES.TSPropertySignature&&r.key.type===H.AST_NODE_TYPES.Identifier&&t.push([r.key.name,r]);return t}function mr(e,...t){for(let r of t)e.set(...r);return e}var Ks=tt.z.object({forceCheckOnFCPropTypesWithName:tt.z.array(tt.z.string()).optional(),alwaysCheckFunctionOptionTypes:tt.z.boolean().optional()}),yr="no-unused-type-props-in-args",tn=null,Qs=Gs({name:yr,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:[L(Ks)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!tn&&(tn=r.map(l=>new RegExp(l)));function s(l,c,y,d,a=!0,u=!1){let f=y.name,S=e.sourceCode.getScope(c).references.find(g=>g.identifier.name===f)?.resolved,h=l&&tn?.some(g=>g.test(f)),m=u&&n;if(!S||!h&&S.references.filter(g=>g.isTypeReference).length>1||!S.defs[0])return;let E=S.defs[0].node,x=E.parent?.type===H.AST_NODE_TYPES.ExportNamedDeclaration;if(!(a&&x&&!m)){if(E.type===H.AST_NODE_TYPES.TSTypeAliasDeclaration){o(l,c,d,E.typeAnnotation,!0,u);return}if(E.type===H.AST_NODE_TYPES.TSInterfaceDeclaration){o(l,c,d,E.body,!0,u);return}}}function o(l,c,y,d,a,u=!1){if(d.type===H.AST_NODE_TYPES.TSInterfaceBody){for(let f of d.body)f.type===H.AST_NODE_TYPES.TSPropertySignature&&f.key.type===H.AST_NODE_TYPES.Identifier&&y.set(f.key.name,f);return}if(d.type===H.AST_NODE_TYPES.TSTypeLiteral){mr(y,...fr(d));return}if(d.type===H.AST_NODE_TYPES.TSIntersectionType){for(let f of d.types)o(l,c,y,f,!0,u);return}a||d.type===H.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===H.AST_NODE_TYPES.Identifier&&s(l,c,d.typeName,y,!0,u)}function i(l,c,y,d=!1){for(let a of y)if(a.type===H.AST_NODE_TYPES.ObjectPattern&&a.typeAnnotation){let u=new Map;if(o(l,c,u,a.typeAnnotation.typeAnnotation,!1,d),u.size===0)continue;p(a,u)}else a.type===H.AST_NODE_TYPES.AssignmentPattern&&a.left.type===H.AST_NODE_TYPES.ObjectPattern&&i(l,c,[a.left],d)}function p(l,c){let y=[];if(l.properties.at(-1)?.type===H.AST_NODE_TYPES.RestElement)return;for(let f of l.properties)f.type===H.AST_NODE_TYPES.Property&&f.key.type===H.AST_NODE_TYPES.Identifier&&y.push(f.key.name);let a=[],u=[];for(let[f,S]of c)y.includes(f)||(u.push(f),a.push({node:S,messageId:"unusedObjectTypeProperty",data:{propertyName:f}}));for(let[f,S]of a.entries())e.report({...S,fix:f===a.length-1?h=>{let m=l.properties.at(-1),E=u.join(", ");return m?m.type===H.AST_NODE_TYPES.RestElement?null:h.insertTextAfter(m,`, ${E}`):h.insertTextBeforeRange([l.range[0]+1,l.range[1]],E)}:void 0})}return{VariableDeclaration(l){let c=l.declarations[0],y=new Map,d=c.id.type===H.AST_NODE_TYPES.Identifier&&c.id.typeAnnotation?.typeAnnotation.type===H.AST_NODE_TYPES.TSTypeReference&&c.id.typeAnnotation.typeAnnotation.typeName.type===H.AST_NODE_TYPES.Identifier&&c.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&c.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(d){if(d.type===H.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===H.AST_NODE_TYPES.Identifier)s(!0,l,d.typeName,y,!1);else if(d.type===H.AST_NODE_TYPES.TSTypeLiteral)mr(y,...fr(d));else if(d.type===H.AST_NODE_TYPES.TSIntersectionType)for(let a of d.types)a.type===H.AST_NODE_TYPES.TSTypeReference&&a.typeName.type===H.AST_NODE_TYPES.Identifier?s(!0,l,a.typeName,y,!1):o(!0,l,y,a,!0);if(y.size!==0&&c.init?.type===H.AST_NODE_TYPES.ArrowFunctionExpression){let a=c.init.params[0];if(!a){e.report({node:c.init,messageId:"missingComponentParam"});return}a.type===H.AST_NODE_TYPES.ObjectPattern&&p(a,y)}}},FunctionDeclaration(l){i(!1,l,l.params,n)},ArrowFunctionExpression(l){i(!1,l,l.params,n)}}}}),nn={name:yr,rule:Qs};var Se=require("@typescript-eslint/utils");var rn=M({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let t=new Set;function r(n){return n.callee.type===Se.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===Se.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===Se.AST_NODE_TYPES.Identifier&&n.callee.property.type===Se.AST_NODE_TYPES.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let s of n.specifiers)s.type===Se.AST_NODE_TYPES.ImportSpecifier&&s.imported.type===Se.AST_NODE_TYPES.Identifier&&s.imported.name==="useRef"&&t.add(s.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===Se.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===Se.AST_NODE_TYPES.Identifier){let o=e.sourceCode.getScope(n).set.get(n.id.name);if(o){let i=!1;for(let p of o.references){let c=p.identifier.parent;if(c!==n&&!(c.type===Se.AST_NODE_TYPES.JSXExpressionContainer&&c.parent.type===Se.AST_NODE_TYPES.JSXAttribute&&c.parent.name.type===Se.AST_NODE_TYPES.JSXIdentifier&&c.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var Be=require("@typescript-eslint/utils"),eo=Be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),gr="prefer-named-functions",dr=new Map,to=eo({name:gr,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[t]){let r=null;if(t.ignoreRegex){let n=dr.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),dr.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===Be.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===Be.AST_NODE_TYPES.Identifier){let s=n.id.name;if(n.id.typeAnnotation||r&&r.test(s)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==Be.AST_NODE_TYPES.BlockStatement)return;let o=n.parent,i=n.init.params,p=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:s,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:c=>c.replaceText(o,`${l.async?"async ":""}function ${s}(${i.map(y=>e.sourceCode.getText(y)).join(", ")||""}) ${e.sourceCode.getText(p)}`)}]})}}}}}),sn={name:gr,rule:to};var _=require("@typescript-eslint/utils"),Ce=require("zod/v4");var no=Ce.z.object({disallowedFunctions:Ce.z.array(Ce.z.object({name:Ce.z.string(),allowUsingWithArgs:Ce.z.boolean().optional(),hookAlternative:Ce.z.string().optional(),message:Ce.z.string().optional(),allowUseInside:Ce.z.array(Ce.z.string()).optional()}))}),ro=/^use[A-Z]/,io=/^[A-Z]/;function dt(e){return ro.test(e)}function Sr(e){return io.test(e)}function so(e){return e.type===_.AST_NODE_TYPES.Identifier?dt(e.name):e.type===_.AST_NODE_TYPES.MemberExpression&&e.property.type===_.AST_NODE_TYPES.Identifier?dt(e.property.name):!1}function Tr(e,t){return e.type===_.AST_NODE_TYPES.Identifier?e.name===t:e.type===_.AST_NODE_TYPES.MemberExpression&&e.object.type===_.AST_NODE_TYPES.Identifier&&e.property.type===_.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function hr(e){return!!(e.parent&&e.parent.type===_.AST_NODE_TYPES.CallExpression&&Tr(e.parent.callee,"forwardRef"))}function Er(e){return!!(e.parent&&e.parent.type===_.AST_NODE_TYPES.CallExpression&&Tr(e.parent.callee,"memo"))}function on(e){if(e.type===_.AST_NODE_TYPES.FunctionDeclaration||e.type===_.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===_.AST_NODE_TYPES.FunctionExpression||e.type===_.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===_.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===_.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===_.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===_.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function oo(e){let t=e.parent,r=!1;for(;t;){if(t.type===_.AST_NODE_TYPES.FunctionDeclaration||t.type===_.AST_NODE_TYPES.FunctionExpression||t.type===_.AST_NODE_TYPES.ArrowFunctionExpression){let n=on(t);if(n&&n.type===_.AST_NODE_TYPES.Identifier){if(Sr(n.name)||dt(n.name))return!r;r=!0}else{if(hr(t)||Er(t))return!r;if(t.parent.type===_.AST_NODE_TYPES.CallExpression){let s=t.parent;so(s.callee)||(r=!0)}else t.parent.type===_.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function br(e){return e.callee.type===_.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===_.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===_.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function ao(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===_.AST_NODE_TYPES.FunctionDeclaration||r.type===_.AST_NODE_TYPES.FunctionExpression||r.type===_.AST_NODE_TYPES.ArrowFunctionExpression){let n=on(r);if(n&&n.type===_.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===_.AST_NODE_TYPES.CallExpression){let n=br(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function lo(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===_.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function po(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===_.AST_NODE_TYPES.FunctionDeclaration||n.type===_.AST_NODE_TYPES.FunctionExpression||n.type===_.AST_NODE_TYPES.ArrowFunctionExpression){let s=on(n);if(s&&s.type===_.AST_NODE_TYPES.Identifier){if(Sr(s.name)||dt(s.name)){r=!0;break}}else if(hr(n)||Er(n)){r=!0;break}}n=n.parent}return r?t.length===0?oo(e):!ao(e,t):!1}var an=M({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:[L(no)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(s=>[s.name,s]));return{CallExpression(s){let o=br(s);if(!o)return;let i=n.get(o);if(!i||i.allowUsingWithArgs&&lo(s))return;let p=i.allowUseInside||[];po(s,p)&&e.report({node:s,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:l=>{let c=i.hookAlternative;return c?s.callee.type===_.AST_NODE_TYPES.Identifier?l.replaceText(s.callee,c):s.callee.type===_.AST_NODE_TYPES.MemberExpression&&s.callee.property.type===_.AST_NODE_TYPES.Identifier?l.replaceText(s.callee.property,c):null:null}}]:[]})}}}});var G=require("@typescript-eslint/utils"),gt=he(require("zod/v4"));var co=G.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cr="prefer-single-line-if",uo=gt.default.object({maxLineLength:gt.default.number().optional(),maxNonSimpleConditionLength:gt.default.number().optional()}),fo=co({name:Cr,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[L(uo)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==G.AST_NODE_TYPES.BlockStatement||n.loc.start.line===n.loc.end.line||r.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let o=n.consequent.body[0];if(!o)return;if(o.type===G.AST_NODE_TYPES.ReturnStatement){if(!Ir(o))return}else if(!(o.type===G.AST_NODE_TYPES.ContinueStatement||o.type===G.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===G.AST_NODE_TYPES.LogicalExpression||n.test.type===G.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let d=xr(n.test);if(!d&&n.test.type===G.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let a=n.test.argument;xr(a)&&(d=!0)}if(d&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let p=r.getText(o);if(i.includes(`
|
|
18
|
+
`))return;let l=r.getTokenAfter(n);if(l&&l.type===G.AST_TOKEN_TYPES.Punctuator&&l.value==="}"){let d=r.getTokenAfter(l);if(d&&d.type===G.AST_TOKEN_TYPES.Keyword&&(d.value==="else"||d.value==="catch"))return}let c=mo(r,n),y=`if (${i}) ${p}`;t.maxLineLength&&y.length+c.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:d=>d.replaceText(n,y)})}}}});function xr(e){return e.type===G.AST_NODE_TYPES.CallExpression||e.type===G.AST_NODE_TYPES.BinaryExpression||e.type===G.AST_NODE_TYPES.MemberExpression&&Ar(e)}function Ar(e){return e.object.type===G.AST_NODE_TYPES.MemberExpression?Ar(e.object):e.object.type!==G.AST_NODE_TYPES.Identifier}function mo(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Ir(e){if(!e.argument)return!0;let t=e.argument;return t.type===G.AST_NODE_TYPES.ArrayExpression&&t.elements.length===0||t.type===G.AST_NODE_TYPES.ObjectExpression&&t.properties.length===0||t.type===G.AST_NODE_TYPES.Literal||t.type===G.AST_NODE_TYPES.Identifier||t.type===G.AST_NODE_TYPES.TemplateLiteral||t.type===G.AST_NODE_TYPES.TaggedTemplateExpression?!0:t.type===G.AST_NODE_TYPES.CallExpression?t.arguments.length===0:t.type===G.AST_NODE_TYPES.UnaryExpression?Ir(t):!1}var ln={name:Cr,rule:fo};var F=require("@typescript-eslint/utils"),cn=require("zod/v4");var yo=F.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),vr="react-compiler-extra",go=cn.z.object({runOnlyWithEnableCompilerDirective:cn.z.boolean().optional()}),So=/eslint +react-compiler\/react-compiler: +\["error/;function Pr(e){return e.type===F.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):!1}function To(e){return e.type===F.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===F.AST_NODE_TYPES.MemberExpression&&e.property.type===F.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}function Ae(e){if(!e)return!1;switch(e.type){case F.AST_NODE_TYPES.JSXElement:case F.AST_NODE_TYPES.JSXFragment:return!0;case F.AST_NODE_TYPES.ConditionalExpression:return Ae(e.consequent)||Ae(e.alternate);case F.AST_NODE_TYPES.LogicalExpression:return e.operator==="&&"?Ae(e.right):e.operator==="||"?Ae(e.left)||Ae(e.right):!1;case F.AST_NODE_TYPES.CallExpression:if(e.callee.type===F.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===F.AST_NODE_TYPES.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===F.AST_NODE_TYPES.Identifier&&e.callee.property.name==="createElement")return!0;for(let t of e.arguments)if(t.type!==F.AST_NODE_TYPES.SpreadElement&&Ae(t))return!0;return!1;default:return!1}}function ho(e){let t=e.typeAnnotation;if(t.type===F.AST_NODE_TYPES.TSTypeReference){if(t.typeName.type===F.AST_NODE_TYPES.Identifier)return t.typeName.name==="FC";if(t.typeName.type===F.AST_NODE_TYPES.TSQualifiedName&&t.typeName.left.type===F.AST_NODE_TYPES.Identifier&&t.typeName.right.type===F.AST_NODE_TYPES.Identifier)return t.typeName.left.name==="React"&&t.typeName.right.name==="FC"}return!1}var Eo=/^[A-Z][a-zA-Z0-9]*$/;function rt(e){return Eo.test(e)}function un(e){return e.startsWith("use")&&e.length>3}function fn(e,t,r,n){if(r&&ho(r))return t?rt(t.name):e.type===F.AST_NODE_TYPES.FunctionDeclaration&&e.id?rt(e.id.name):!0;if(t&&un(t.name)||e.type===F.AST_NODE_TYPES.FunctionDeclaration&&e.id&&un(e.id.name))return!0;if(n){let s=t?.name||e.type===F.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;if(s&&rt(s)&&Fr(e.body,n).containsJSX)return!0}return!1}function nt(e){if(e.body.type===F.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===F.AST_NODE_TYPES.ExpressionStatement&&t.expression.type===F.AST_NODE_TYPES.Literal&&typeof t.expression.value=="string"&&t.expression.value==="use memo")return!0}return!1}function Fr(e,t){let r={containsJSX:!1,containsHookCalls:!1};return je(e,n=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(n.type){case F.AST_NODE_TYPES.JSXElement:case F.AST_NODE_TYPES.JSXFragment:r.containsJSX=!0;break;case F.AST_NODE_TYPES.CallExpression:Pr(n.callee)&&(r.containsHookCalls=!0),Ae(n)&&(r.containsJSX=!0);break;case F.AST_NODE_TYPES.ReturnStatement:n.argument&&Ae(n.argument)&&(r.containsJSX=!0);break;case F.AST_NODE_TYPES.VariableDeclarator:n.init&&Ae(n.init)&&(r.containsJSX=!0);break;case F.AST_NODE_TYPES.AssignmentExpression:Ae(n.right)&&(r.containsJSX=!0);break}},t),r}function Rr(e,t){let r=e.body,n=Fr(r,t);return n.containsJSX||n.containsHookCalls}var bo=/\bthis[.[]/;function wr(e){return bo.test(e)}function xo(e,t){let r={containsJSX:!1,containsHookCalls:!1};return je(e,n=>{if(r.containsHookCalls||(n.type===F.AST_NODE_TYPES.FunctionDeclaration||n.type===F.AST_NODE_TYPES.FunctionExpression||n.type===F.AST_NODE_TYPES.ArrowFunctionExpression)&&n!==e)return!0;n.type===F.AST_NODE_TYPES.CallExpression&&To(n.callee)&&(r.containsHookCalls=!0)},t),r}function kr(e){return rt(e)||un(e)}function pn(e,t,r,n){if(!xo(e.body,t).containsHookCalls)return!1;let o=fn(e,r,n,t);if(!o&&n){let i=r?.name||e.type===F.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;i&&rt(i)&&(o=!0)}return!o}var Co=yo({name:vr,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:[L(go)]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let o of e.sourceCode.getAllComments())if(So.test(o.value)){r=!0;break}if(!r)return{}}function n(o){for(let i of o.properties)if(i.type===F.AST_NODE_TYPES.Property&&i.method&&i.value.type===F.AST_NODE_TYPES.FunctionExpression){let p=e.sourceCode,l=p.getText(i.key),c=i.value,y=p.getText(c.body);if(wr(y))e.report({node:i,messageId:"thisKeywordInMethod"});else{let d=c.params.map(u=>p.getText(u)).join(", "),a="";c.generator?a=`${l}: function* (${d}) ${y}`:a=`${l}: (${d}) => ${y}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:u=>u.replaceText(i,a)})}}}function s(o){for(let i of o.properties)if(i.type===F.AST_NODE_TYPES.Property&&i.value.type===F.AST_NODE_TYPES.ObjectExpression){for(let p of i.value.properties)if(p.type===F.AST_NODE_TYPES.Property&&p.method&&p.value.type===F.AST_NODE_TYPES.FunctionExpression){let c=e.sourceCode.getText(p.value.body);wr(c)&&e.report({node:p,messageId:"thisKeywordInMethod"})}}}return{CallExpression(o){if(Pr(o.callee))for(let i of o.arguments){if(i.type===F.AST_NODE_TYPES.ObjectExpression&&(n(i),s(i)),i.type===F.AST_NODE_TYPES.ArrowFunctionExpression&&(i.body.type===F.AST_NODE_TYPES.ObjectExpression&&(n(i.body),s(i.body)),i.body.type===F.AST_NODE_TYPES.BlockStatement))for(let p of i.body.body)p.type===F.AST_NODE_TYPES.ReturnStatement&&p.argument?.type===F.AST_NODE_TYPES.ObjectExpression&&(n(p.argument),s(p.argument));if(i.type===F.AST_NODE_TYPES.FunctionExpression)for(let p of i.body.body)p.type===F.AST_NODE_TYPES.ReturnStatement&&p.argument?.type===F.AST_NODE_TYPES.ObjectExpression&&(n(p.argument),s(p.argument))}},VariableDeclarator(o){if(o.id.type===F.AST_NODE_TYPES.Identifier&&o.init&&(o.init.type===F.AST_NODE_TYPES.ArrowFunctionExpression||o.init.type===F.AST_NODE_TYPES.FunctionExpression)){let i=o.init,p=o.id,l=o.id.typeAnnotation;if(nt(i)&&!kr(p.name)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(pn(i,e.sourceCode,p,l)){e.report({node:i,messageId:"functionCallingHooksMustBeComponent"});return}if(fn(i,p,l,e.sourceCode)){let c=Rr(i,e.sourceCode),y=nt(i);!c&&!y&&e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(d){if(i.body.type===F.AST_NODE_TYPES.BlockStatement){let a=i.body.range[0]+1;return d.insertTextAfterRange([a,a],`
|
|
19
19
|
"use memo"
|
|
20
20
|
`)}return null}}]})}}},FunctionDeclaration(o){if(o.id&&nt(o)&&!kr(o.id.name)){e.report({node:o,messageId:"useMemoDirectiveNaming"});return}if(pn(o,e.sourceCode)){e.report({node:o,messageId:"functionCallingHooksMustBeComponent"});return}if(fn(o,void 0,void 0,e.sourceCode)){let i=Rr(o,e.sourceCode),p=nt(o);!i&&!p&&e.report({node:o,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(l){let c=o.body.range[0]+1;return l.insertTextAfterRange([c,c],`
|
|
21
21
|
"use memo"
|
|
22
|
-
`)}}]})}},FunctionExpression(o){if(nt(o)){e.report({node:o,messageId:"useMemoDirectiveNaming"});return}pn(o,e.sourceCode)&&e.report({node:o,messageId:"functionCallingHooksMustBeComponent"})}}}}),mn={name:vr,rule:Co};var ue=require("@typescript-eslint/utils"),Ee=require("zod/v4");var Ao=ue.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Or="react-compiler-migration",Io=Ee.z.object({disallowHooks:Ee.z.array(Ee.z.object({name:Ee.z.string(),replacement:Ee.z.string()})).optional(),disallowMethods:Ee.z.array(Ee.z.object({name:Ee.z.string(),replacement:Ee.z.string().optional(),requireTrueProp:Ee.z.string().optional()})).optional()}),Ro=/eslint +react-compiler\/react-compiler: +\["error/;function wo(e){return e.type===ue.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===ue.AST_NODE_TYPES.MemberExpression&&e.property.type===ue.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var ko=Ao({name:Or,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:[L(Io)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(Ro.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let s=null,o=null;if(n.callee.type===ue.AST_NODE_TYPES.Identifier?(s=n.callee.name,o=n.callee):n.callee.type===ue.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===ue.AST_NODE_TYPES.Identifier&&(s=n.callee.property.name,o=n.callee.property),s){let i=t.disallowHooks.find(p=>p.name===s);i&&o&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:p=>p.replaceText(o,i.replacement)}]})}}if(t.disallowMethods?.length&&wo(n.callee)){for(let s of n.arguments)if(s.type===ue.AST_NODE_TYPES.ObjectExpression){for(let o of s.properties)if(o.type===ue.AST_NODE_TYPES.Property&&o.key.type===ue.AST_NODE_TYPES.Identifier){let i=o.key.name,p=t.disallowMethods.find(l=>l.name===i);if(p){if(p.requireTrueProp){let l=p.requireTrueProp,c=!1;for(let
|
|
23
|
-
`),l=i.map(d=>d.name).join(", "),c=s.getText(t),
|
|
22
|
+
`)}}]})}},FunctionExpression(o){if(nt(o)){e.report({node:o,messageId:"useMemoDirectiveNaming"});return}pn(o,e.sourceCode)&&e.report({node:o,messageId:"functionCallingHooksMustBeComponent"})}}}}),mn={name:vr,rule:Co};var ue=require("@typescript-eslint/utils"),Ee=require("zod/v4");var Ao=ue.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Or="react-compiler-migration",Io=Ee.z.object({disallowHooks:Ee.z.array(Ee.z.object({name:Ee.z.string(),replacement:Ee.z.string()})).optional(),disallowMethods:Ee.z.array(Ee.z.object({name:Ee.z.string(),replacement:Ee.z.string().optional(),requireTrueProp:Ee.z.string().optional()})).optional()}),Ro=/eslint +react-compiler\/react-compiler: +\["error/;function wo(e){return e.type===ue.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===ue.AST_NODE_TYPES.MemberExpression&&e.property.type===ue.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var ko=Ao({name:Or,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:[L(Io)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(Ro.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let s=null,o=null;if(n.callee.type===ue.AST_NODE_TYPES.Identifier?(s=n.callee.name,o=n.callee):n.callee.type===ue.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===ue.AST_NODE_TYPES.Identifier&&(s=n.callee.property.name,o=n.callee.property),s){let i=t.disallowHooks.find(p=>p.name===s);i&&o&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:p=>p.replaceText(o,i.replacement)}]})}}if(t.disallowMethods?.length&&wo(n.callee)){for(let s of n.arguments)if(s.type===ue.AST_NODE_TYPES.ObjectExpression){for(let o of s.properties)if(o.type===ue.AST_NODE_TYPES.Property&&o.key.type===ue.AST_NODE_TYPES.Identifier){let i=o.key.name,p=t.disallowMethods.find(l=>l.name===i);if(p){if(p.requireTrueProp){let l=p.requireTrueProp,c=!1;for(let y of s.properties)if(y.type===ue.AST_NODE_TYPES.Property&&y.key.type===ue.AST_NODE_TYPES.Identifier&&y.key.name===l&&y.value.type===ue.AST_NODE_TYPES.Literal&&y.value.value===!0){c=!0;break}if(!c){e.report({node:o,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:p.name,requireTrueProp:l}});continue}}p.replacement&&e.report({node:o,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:p.name,replacement:p.replacement},suggest:[{messageId:"replace",data:{replacement:p.replacement},fix:l=>p.replacement?l.replaceText(o.key,p.replacement):null}]})}}}}}}:{}}}),yn={name:Or,rule:ko};var v=require("@typescript-eslint/utils"),gn=require("zod");var vo=gn.z.object({runOnlyWithEnableCompilerDirective:gn.z.boolean().optional()}),Po=/eslint +react-compiler\/react-compiler: +\["error/,Fo=/^\d+$/,Oo=/[\s_-]+/,No=/[a-z][A-Z]/,Do=/^(.+?)([A-Z][a-z]+s?)$/,jo=/^[a-z][a-zA-Z]*$/;function Nr(e,t){let r=[];if(e.type===v.AST_NODE_TYPES.JSXElement){for(let n of e.openingElement.attributes)if(n.type===v.AST_NODE_TYPES.JSXAttribute&&n.name.type===v.AST_NODE_TYPES.JSXIdentifier&&n.value?.type===v.AST_NODE_TYPES.JSXExpressionContainer&&n.value.expression.type!==v.AST_NODE_TYPES.JSXEmptyExpression){let s=n.name.name,o=n.value.expression,i=!1;je(o,p=>{switch(p.type){case v.AST_NODE_TYPES.ObjectExpression:case v.AST_NODE_TYPES.ArrowFunctionExpression:case v.AST_NODE_TYPES.FunctionExpression:case v.AST_NODE_TYPES.ArrayExpression:return i=!0,!0}return!1},t),i&&r.push(s)}}return{hasUnstable:r.length>0,problematicProps:r}}function Lo(e){if(e.body.type===v.AST_NODE_TYPES.JSXElement||e.body.type===v.AST_NODE_TYPES.JSXFragment)return!0;if(e.body.type===v.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===v.AST_NODE_TYPES.ReturnStatement&&t.argument&&(t.argument.type===v.AST_NODE_TYPES.JSXElement||t.argument.type===v.AST_NODE_TYPES.JSXFragment))return!0}return!1}function Mo(e,t){let r=e.callee;if(r.type===v.AST_NODE_TYPES.MemberExpression){let n=r.object;if(n.type===v.AST_NODE_TYPES.Identifier){let s=n.name,o=_o(s);if(o!==s)return Sn(o)}}if(t.length>0){let n=t[0];if(n&&n.type===v.AST_NODE_TYPES.Identifier)return Sn(n.name)}return"ListItem"}function _o(e){let r={people:"person",children:"child",feet:"foot",teeth:"tooth",mice:"mouse",men:"man",women:"woman"}[e.toLowerCase()];if(r)return r;if(e.match(No)){let n=e.match(Do);if(n){let s=n[1],o=n[2];if(!s||!o)return dn(e);let i=dn(o);if(i!==o)return s+i}}return dn(e)}function dn(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 Sn(e){return e.match(jo)?e.charAt(0).toUpperCase()+e.slice(1):e.split(Oo).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function Dr(e,t,r){let n=[],s=new Set,o=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);je(e,i=>{if(i.type===v.AST_NODE_TYPES.Identifier&&!t.includes(i.name)&&!o.has(i.name)&&!Fo.test(i.name)){let p=i.parent;if(p.type===v.AST_NODE_TYPES.Property&&p.key===i||p.type===v.AST_NODE_TYPES.MemberExpression&&p.property===i&&!p.computed||p.type===v.AST_NODE_TYPES.JSXOpeningElement||p.type===v.AST_NODE_TYPES.JSXClosingElement||p.type===v.AST_NODE_TYPES.JSXAttribute&&p.name.type===v.AST_NODE_TYPES.JSXIdentifier&&p.name.name===i.name)return!1;s.add(i.name)}return!1},r);for(let i of s)t.includes(i)||n.push({name:i,type:"unknown"});return n}function jr(e,t,r,n,s){let i=[...r.map(d=>d.type===v.AST_NODE_TYPES.Identifier?d.name:"item").map((d,a)=>({name:d,type:a===0?`${e}Type`:a===1?"number":"unknown"})),...n],p=i.map(d=>{let a=d.type;return d.name.includes("on")&&a==="any"&&(a="unknown"),` ${d.name}: ${a};`}).join(`
|
|
23
|
+
`),l=i.map(d=>d.name).join(", "),c=s.getText(t),y=`${e}Props`;return`type ${y} = {
|
|
24
24
|
${p}
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
const ${e}: FC<${
|
|
27
|
+
const ${e}: FC<${y}> = ({ ${l} }) => {
|
|
28
28
|
return (
|
|
29
29
|
${c}
|
|
30
30
|
);
|
|
31
|
-
};`}function $o(e,t,r,n){let s=t.map(i=>i.type===v.AST_NODE_TYPES.Identifier?i.name:"item"),o=[n?`key={${n}}`:`key={${s[0]}.id}`,...s.map(i=>`${i}={${i}}`),...r.map(i=>`${i.name}={${i.name}}`)].filter(Boolean);return`<${e} ${o.join(" ")} />`}function Uo(e){if(e.type===v.AST_NODE_TYPES.JSXElement&&e.openingElement.name.type===v.AST_NODE_TYPES.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return Sn(t)}return"ListItem"}function
|
|
31
|
+
};`}function $o(e,t,r,n){let s=t.map(i=>i.type===v.AST_NODE_TYPES.Identifier?i.name:"item"),o=[n?`key={${n}}`:`key={${s[0]}.id}`,...s.map(i=>`${i}={${i}}`),...r.map(i=>`${i.name}={${i.name}}`)].filter(Boolean);return`<${e} ${o.join(" ")} />`}function Uo(e){if(e.type===v.AST_NODE_TYPES.JSXElement&&e.openingElement.name.type===v.AST_NODE_TYPES.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return Sn(t)}return"ListItem"}function zo(e,t,r){let n=[r?`key={${r}}`:"",...t.map(s=>`${s.name}={${s.name}}`)].filter(Boolean);return`<${e}${n.length>0?` ${n.join(" ")}`:""} />`}function Lr(e,t){for(let r of e.openingElement.attributes)if(r.type===v.AST_NODE_TYPES.JSXAttribute&&r.name.type===v.AST_NODE_TYPES.JSXIdentifier&&r.name.name==="key"&&r.value&&r.value.type===v.AST_NODE_TYPES.JSXExpressionContainer&&r.value.expression.type!==v.AST_NODE_TYPES.JSXEmptyExpression)return t.getText(r.value.expression);return null}var Tn=M({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:[L(vo)],hasSuggestions:!0},defaultOptions:[{runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let{sourceCode:r}=e;if(t.runOnlyWithEnableCompilerDirective){let n=!1;for(let s of r.getAllComments())if(Po.test(s.value)){n=!0;break}if(!n)return{}}return{CallExpression(n){n.callee.type===v.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===v.AST_NODE_TYPES.Identifier&&(n.callee.property.name==="map"||n.callee.property.name==="push")&&(n.callee.property.name==="map"?Wo(n,r,e):Jo(n,r,e))}}}});function Wo(e,t,r){let n=e.arguments[0];if(!n||n.type!==v.AST_NODE_TYPES.ArrowFunctionExpression&&n.type!==v.AST_NODE_TYPES.FunctionExpression||!Lo(n))return;let s=null;if(n.body.type===v.AST_NODE_TYPES.JSXElement||n.body.type===v.AST_NODE_TYPES.JSXFragment?s=n.body:n.body.type===v.AST_NODE_TYPES.BlockStatement&&n.body.body[0]?.type===v.AST_NODE_TYPES.ReturnStatement&&n.body.body[0].argument&&(n.body.body[0].argument.type===v.AST_NODE_TYPES.JSXElement||n.body.body[0].argument.type===v.AST_NODE_TYPES.JSXFragment)&&(s=n.body.body[0].argument),!s)return;let o=Nr(s,t);if(!o.hasUnstable)return;let i=Mo(e,n.params),p=n.params.map(d=>d.type===v.AST_NODE_TYPES.Identifier?d.name:"item"),l=Dr(s,p,t),c=s.type===v.AST_NODE_TYPES.JSXElement?Lr(s,t):null,y=o.problematicProps.length===1?`prop "${o.problematicProps[0]}"`:`props "${o.problematicProps.join('", "')}"`;r.report({node:s,messageId:"unstableValueInMap",data:{problematicProps:y},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:d=>{let a=jr(i,s,n.params,l,t),u=$o(i,n.params,l,c),f=e;for(;f.parent.type!==v.AST_NODE_TYPES.Program&&!(f.type===v.AST_NODE_TYPES.FunctionDeclaration||f.type===v.AST_NODE_TYPES.VariableDeclarator&&f.init&&(f.init.type===v.AST_NODE_TYPES.ArrowFunctionExpression||f.init.type===v.AST_NODE_TYPES.FunctionExpression));)f=f.parent;let S=[];return S.push(d.insertTextAfter(f,`
|
|
32
32
|
|
|
33
|
-
${a}`)),
|
|
33
|
+
${a}`)),S.push(d.replaceText(s,u)),S}}]})}function Jo(e,t,r){let n=e.arguments[0];if(!n||n.type!==v.AST_NODE_TYPES.JSXElement&&n.type!==v.AST_NODE_TYPES.JSXFragment)return;let s=n,o=Nr(s,t);if(!o.hasUnstable)return;let i=Uo(s),p=Dr(s,[],t),l=s.type===v.AST_NODE_TYPES.JSXElement?Lr(s,t):null,c=o.problematicProps.length===1?`prop "${o.problematicProps[0]}"`:`props "${o.problematicProps.join('", "')}"`;r.report({node:s,messageId:"unstableValueInMap",data:{problematicProps:c},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:y=>{let d=jr(i,s,[],p,t),a=zo(i,p,l),u=e;for(;u.parent.type!==v.AST_NODE_TYPES.Program&&!(u.type===v.AST_NODE_TYPES.FunctionDeclaration||u.type===v.AST_NODE_TYPES.VariableDeclarator&&u.init&&(u.init.type===v.AST_NODE_TYPES.ArrowFunctionExpression||u.init.type===v.AST_NODE_TYPES.FunctionExpression));)u=u.parent;let f=[];return f.push(y.insertTextAfter(u,`
|
|
34
34
|
|
|
35
|
-
${d}`)),m.push(f.replaceText(s,a)),m}}]})}var St=require("@typescript-eslint/utils"),Vo=St.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mr="require-description",Xo=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Ho=/^eslint-disable-(next-)?line$/u,Bo=Vo({name:Mr,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let s of r.getAllComments()){let o=Yo(s);o!=null&&(n.has(o.kind)||o.description||e.report({loc:Go(s.loc),messageId:"missingDescription"}))}}}}}),_r={name:Mr,rule:Bo};function Yo(e){let{text:t,description:r}=Zo(e.value);if(!t)return null;let n=Xo.exec(t);if(!n)return null;let s=n[1];if(!s)return null;let o=Ho.test(s);if(e.type===St.TSESTree.AST_TOKEN_TYPES.Line&&!o||o&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+s.length);return{kind:s,value:i.trim(),description:r}}var qo=/\s-{2,}\s/u;function Zo(e){let t=e.split(qo);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Go(e){return{start:{line:e.start.line,column:-1},end:e.end}}var J=require("@typescript-eslint/utils"),Ie=require("zod/v4");var Ko=Ie.z.object({varsToCheck:Ie.z.array(Ie.z.object({selector:Ie.z.string().optional(),fromFnCall:Ie.z.string().optional(),prop:Ie.z.string().or(Ie.z.array(Ie.z.string())),errorMsg:Ie.z.string().optional()}))}),hn=M({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:[L(Ko)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,p,l,c){let f=new Set;for(let a of i.properties)a.type===J.AST_NODE_TYPES.Property&&a.key.type===J.AST_NODE_TYPES.Identifier&&f.add(a.key.name);let d=p.filter(a=>!f.has(a));if(d.length>0)if(d.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:d[0],fnName:c,customMsg:l||""}});else{let a=d.map(u=>`"${u}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:a,fnName:c,customMsg:l||""}})}}function s(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 o={};for(let i of t.varsToCheck)i.selector&&(o[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:s(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];n(p.id,l,i.errorMsg,s(p))}});for(let i of t.varsToCheck)if(i.fromFnCall){let p=i.fromFnCall;if(p.startsWith("*.")){let c=`VariableDeclarator > CallExpression > MemberExpression[property.name="${p.slice(2)}"]`;o[c]=f=>{if(f.type!==J.AST_NODE_TYPES.MemberExpression||f.parent.type!==J.AST_NODE_TYPES.CallExpression)return;let d=f.parent;if(d.parent.type!==J.AST_NODE_TYPES.VariableDeclarator)return;let a=d.parent;if(a.id.type===J.AST_NODE_TYPES.Identifier)r.set(a.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:a.id,fnName:i.fromFnCall||"unknown function"});else if(a.id.type===J.AST_NODE_TYPES.ObjectPattern){let u=Array.isArray(i.prop)?i.prop:[i.prop];n(a.id,u,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(p.includes(".")){let[l,c]=p.split("."),f=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${c}"]`;o[f]=d=>{if(d.type!==J.AST_NODE_TYPES.MemberExpression||d.parent.type!==J.AST_NODE_TYPES.CallExpression)return;let a=d.parent;if(a.parent.type!==J.AST_NODE_TYPES.VariableDeclarator)return;let u=a.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 m=Array.isArray(i.prop)?i.prop:[i.prop];n(u.id,m,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${p}"]`;o[l]=c=>{if(c.type!==J.AST_NODE_TYPES.Identifier||c.parent.type!==J.AST_NODE_TYPES.CallExpression)return;let f=c.parent;if(f.parent.type!==J.AST_NODE_TYPES.VariableDeclarator)return;let d=f.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 a=Array.isArray(i.prop)?i.prop:[i.prop];n(d.id,a,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...o,"Program:exit"(){for(let[i,{props:p,errorMsg:l,node:c,fnName:f}]of r){let a=e.sourceCode.getScope(c).set.get(i);if(a){let u=new Set(p);for(let m of a.references){let T=m.identifier,h=T.parent;if(!(h.type===J.AST_NODE_TYPES.VariableDeclarator&&h.id===T)){if(h.type===J.AST_NODE_TYPES.MemberExpression&&h.object===T&&h.property.type===J.AST_NODE_TYPES.Identifier&&u.has(h.property.name)){if(u.delete(h.property.name),u.size===0)break;continue}if(h.type===J.AST_NODE_TYPES.VariableDeclarator&&h.init===T&&h.id.type===J.AST_NODE_TYPES.ObjectPattern){for(let y of h.id.properties)y.type===J.AST_NODE_TYPES.Property&&y.key.type===J.AST_NODE_TYPES.Identifier&&u.has(y.key.name)&&u.delete(y.key.name);if(u.size===0)break;continue}if(!(h.type===J.AST_NODE_TYPES.MemberExpression&&h.object===T&&h.property.type===J.AST_NODE_TYPES.Identifier&&!p.includes(h.property.name))){u.clear();break}}}if(u.size>0){let m=Array.from(u);if(m.length===1)e.report({node:c,messageId:"propNotRead",data:{prop:m[0],fnName:f,customMsg:l||""}});else{let T=m.map(h=>`"${h}"`).join(", ");e.report({node:c,messageId:"propsNotRead",data:{props:T,fnName:f,customMsg:l||""}})}}}}}}}});function Wr(e){return/^use[A-Z0-9]/.test(e)}function Tt(e){return e.type==="Identifier"?Wr(e.name):e.type==="MemberExpression"&&!e.computed&&Tt(e.property)?e.object.type==="Identifier":!1}function zr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Jr(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Vr(e){return!!(e.parent&&e.parent.callee&&Jr(e.parent.callee,"forwardRef"))}function Xr(e){return!!(e.parent&&e.parent.callee&&Jr(e.parent.callee,"memo"))}function En(e){for(;e;){let t=Br(e);if(t&&(zr(t)||Tt(t))||Vr(e)||Xr(e))return!0;e=e.parent}return!1}function $r(e){return!1}function bn(e){return!1}var Qo=/eslint +react-compiler\/react-compiler: +\["error/,Hr={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(Qo.test(l.value))return{CallExpression(c){let f=null;c.callee.name==="useMemo"?f="useMemo":c.callee.name==="useCallback"&&(f="useCallback"),f&&e.report({node:c,message:`"${f}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?l=>t(l):l=>e.sourceCode.getText(l),r=typeof e.getScope=="function"?()=>r():l=>e.sourceCode.getScope(l),n=null,s=[],o=[],i=new WeakSet;function p(l){for(let c of l.references){let f=c.identifier.parent;if(f.type==="VariableDeclarator"&&f.init&&f.init.type==="CallExpression"&&f.init.callee&&$r(f.init.callee))for(let d of c.resolved.references)d!==c&&i.add(d.identifier)}}return{onCodePathSegmentStart:l=>o.push(l),onCodePathSegmentEnd:()=>o.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(l,c){let f=s.pop();if(f.size===0)return;let d=new Set;function a(g,b){let{cache:S}=a,C=S.get(g.id),w=new Set(b);if(w.has(g.id)){let I=[...w],O=I.slice(I.indexOf(g.id)+1);for(let $ of O)d.add($);return BigInt("0")}if(w.add(g.id),C!==void 0)return C;if(l.thrownSegments.includes(g))C=BigInt("0");else if(g.prevSegments.length===0)C=BigInt("1");else{C=BigInt("0");for(let I of g.prevSegments)C+=a(I,w)}return g.reachable&&C===BigInt("0")?S.delete(g.id):S.set(g.id,C),C}function u(g,b){let{cache:S}=u,C=S.get(g.id),w=new Set(b);if(w.has(g.id)){let I=Array.from(w),O=I.slice(I.indexOf(g.id)+1);for(let $ of O)d.add($);return BigInt("0")}if(w.add(g.id),C!==void 0)return C;if(l.thrownSegments.includes(g))C=BigInt("0");else if(g.nextSegments.length===0)C=BigInt("1");else{C=BigInt("0");for(let I of g.nextSegments)C+=u(I,w)}return S.set(g.id,C),C}function m(g){let{cache:b}=m,S=b.get(g.id);if(S===null)return 1/0;if(S!==void 0)return S;if(b.set(g.id,null),g.prevSegments.length===0)S=1;else{S=1/0;for(let C of g.prevSegments){let w=m(C);w<S&&(S=w)}S+=1}return b.set(g.id,S),S}a.cache=new Map,u.cache=new Map,m.cache=new Map;let T=u(l.initialSegment),h=Br(c),y=En(c),E=h?zr(h)||Tt(h):Vr(c)||Xr(c),x=1/0;for(let g of l.finalSegments){if(!g.reachable)continue;let b=m(g);b<x&&(x=b)}for(let[g,b]of f){if(!g.reachable)continue;let S=g.nextSegments.length===0?x<=m(g):x<m(g),C=a(g)*u(g),w=d.has(g.id);for(let I of b)if(w&&!bn(I)&&e.report({node:I,message:`React Hook "${t(I)}" 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(c.async&&e.report({node:I,message:`React Hook "${t(I)}" cannot be called in an async function.`}),!w&&C!==T&&!bn(I)){let $=`React Hook "${t(I)}" 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:I,message:$})}}else if(c.parent&&(c.parent.type==="MethodDefinition"||c.parent.type==="ClassProperty")&&c.parent.value===c){let O=`React Hook "${t(I)}" 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:I,message:O})}else if(h){let O=`React Hook "${t(I)}" is called in function "${t(h)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:I,message:O})}else if(c.type==="Program"){let O=`React Hook "${t(I)}" 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:I,message:O})}else if(y&&!bn(I)){if(c.parent.type==="CallExpression"&&c.parent.callee.type==="Identifier"&&c.parent.callee.name==="useCallback"){let $=c.parent;if($.parent.type==="VariableDeclarator"&&Wr($.parent.id.name))return}let O=`React Hook "${t(I)}" 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:I,message:O})}}},CallExpression(l){if(Tt(l.callee)){let c=Ur(s),f=Ur(o),d=c.get(f);d||(d=[],c.set(f,d)),d.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||$r(l.callee))&&l.arguments.length>0&&(n=l)},Identifier(l){n==null&&i.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${t(l)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(l){l===n&&(n=null)},FunctionDeclaration(l){En(l)&&p(r(l))},ArrowFunctionExpression(l){En(l)&&p(r(l))}}}};function Br(e){return e.type==="FunctionDeclaration"||e.type==="FunctionExpression"&&e.id?e.id:e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"?e.parent.type==="VariableDeclarator"&&e.parent.init===e?e.parent.id:e.parent.type==="AssignmentExpression"&&e.parent.right===e&&e.parent.operator==="="?e.parent.left:e.parent.type==="Property"&&e.parent.value===e&&!e.parent.computed?e.parent.key:e.parent.type==="AssignmentPattern"&&e.parent.right===e&&!e.parent.computed?e.parent.left:void 0:void 0}function Ur(e){return e[e.length-1]}var ie=require("@typescript-eslint/utils"),fe=he(require("zod/v4"));var ea=/^\s+$/,xn=/\r?\n/,ta=/^(\s*)/,na=/^(\s*)\S/,ra=/\r?\n/,ia=fe.object({indent:fe.union([fe.string().regex(ea),fe.number().int().min(1)]).optional(),tags:fe.array(fe.string()).optional(),functions:fe.array(fe.string()).optional(),comments:fe.array(fe.string()).optional()}),Cn=M({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[L(ia)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:s=["outdent","dedent","gql","sql","html","styled"],indent:o}=e.options[0],i=r.map(y=>y.toLowerCase());function p(y){let E=y.split(xn),x=E.filter(b=>b.trim()!=="");if(x.length===0)return y;let g=Number.POSITIVE_INFINITY;for(let b of x){let S=b.match(ta);S&&(g=Math.min(g,S[1]?.length??0))}return!isFinite(g)||g===0?y:E.map(b=>b.slice(g)).join(`
|
|
36
|
-
`)}function l(
|
|
37
|
-
`)}function c(
|
|
35
|
+
${d}`)),f.push(y.replaceText(s,a)),f}}]})}var St=require("@typescript-eslint/utils"),Vo=St.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mr="require-description",Xo=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Ho=/^eslint-disable-(next-)?line$/u,Bo=Vo({name:Mr,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let s of r.getAllComments()){let o=Yo(s);o!=null&&(n.has(o.kind)||o.description||e.report({loc:Go(s.loc),messageId:"missingDescription"}))}}}}}),_r={name:Mr,rule:Bo};function Yo(e){let{text:t,description:r}=Zo(e.value);if(!t)return null;let n=Xo.exec(t);if(!n)return null;let s=n[1];if(!s)return null;let o=Ho.test(s);if(e.type===St.TSESTree.AST_TOKEN_TYPES.Line&&!o||o&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+s.length);return{kind:s,value:i.trim(),description:r}}var qo=/\s-{2,}\s/u;function Zo(e){let t=e.split(qo);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Go(e){return{start:{line:e.start.line,column:-1},end:e.end}}var J=require("@typescript-eslint/utils"),Ie=require("zod/v4");var Ko=Ie.z.object({varsToCheck:Ie.z.array(Ie.z.object({selector:Ie.z.string().optional(),fromFnCall:Ie.z.string().optional(),prop:Ie.z.string().or(Ie.z.array(Ie.z.string())),errorMsg:Ie.z.string().optional()}))}),hn=M({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:[L(Ko)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,p,l,c){let y=new Set;for(let a of i.properties)a.type===J.AST_NODE_TYPES.Property&&a.key.type===J.AST_NODE_TYPES.Identifier&&y.add(a.key.name);let d=p.filter(a=>!y.has(a));if(d.length>0)if(d.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:d[0],fnName:c,customMsg:l||""}});else{let a=d.map(u=>`"${u}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:a,fnName:c,customMsg:l||""}})}}function s(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 o={};for(let i of t.varsToCheck)i.selector&&(o[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:s(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];n(p.id,l,i.errorMsg,s(p))}});for(let i of t.varsToCheck)if(i.fromFnCall){let p=i.fromFnCall;if(p.startsWith("*.")){let c=`VariableDeclarator > CallExpression > MemberExpression[property.name="${p.slice(2)}"]`;o[c]=y=>{if(y.type!==J.AST_NODE_TYPES.MemberExpression||y.parent.type!==J.AST_NODE_TYPES.CallExpression)return;let d=y.parent;if(d.parent.type!==J.AST_NODE_TYPES.VariableDeclarator)return;let a=d.parent;if(a.id.type===J.AST_NODE_TYPES.Identifier)r.set(a.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:a.id,fnName:i.fromFnCall||"unknown function"});else if(a.id.type===J.AST_NODE_TYPES.ObjectPattern){let u=Array.isArray(i.prop)?i.prop:[i.prop];n(a.id,u,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(p.includes(".")){let[l,c]=p.split("."),y=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${c}"]`;o[y]=d=>{if(d.type!==J.AST_NODE_TYPES.MemberExpression||d.parent.type!==J.AST_NODE_TYPES.CallExpression)return;let a=d.parent;if(a.parent.type!==J.AST_NODE_TYPES.VariableDeclarator)return;let u=a.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 f=Array.isArray(i.prop)?i.prop:[i.prop];n(u.id,f,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${p}"]`;o[l]=c=>{if(c.type!==J.AST_NODE_TYPES.Identifier||c.parent.type!==J.AST_NODE_TYPES.CallExpression)return;let y=c.parent;if(y.parent.type!==J.AST_NODE_TYPES.VariableDeclarator)return;let d=y.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 a=Array.isArray(i.prop)?i.prop:[i.prop];n(d.id,a,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...o,"Program:exit"(){for(let[i,{props:p,errorMsg:l,node:c,fnName:y}]of r){let a=e.sourceCode.getScope(c).set.get(i);if(a){let u=new Set(p);for(let f of a.references){let S=f.identifier,h=S.parent;if(!(h.type===J.AST_NODE_TYPES.VariableDeclarator&&h.id===S)){if(h.type===J.AST_NODE_TYPES.MemberExpression&&h.object===S&&h.property.type===J.AST_NODE_TYPES.Identifier&&u.has(h.property.name)){if(u.delete(h.property.name),u.size===0)break;continue}if(h.type===J.AST_NODE_TYPES.VariableDeclarator&&h.init===S&&h.id.type===J.AST_NODE_TYPES.ObjectPattern){for(let m of h.id.properties)m.type===J.AST_NODE_TYPES.Property&&m.key.type===J.AST_NODE_TYPES.Identifier&&u.has(m.key.name)&&u.delete(m.key.name);if(u.size===0)break;continue}if(!(h.type===J.AST_NODE_TYPES.MemberExpression&&h.object===S&&h.property.type===J.AST_NODE_TYPES.Identifier&&!p.includes(h.property.name))){u.clear();break}}}if(u.size>0){let f=Array.from(u);if(f.length===1)e.report({node:c,messageId:"propNotRead",data:{prop:f[0],fnName:y,customMsg:l||""}});else{let S=f.map(h=>`"${h}"`).join(", ");e.report({node:c,messageId:"propsNotRead",data:{props:S,fnName:y,customMsg:l||""}})}}}}}}}});function zr(e){return/^use[A-Z0-9]/.test(e)}function Tt(e){return e.type==="Identifier"?zr(e.name):e.type==="MemberExpression"&&!e.computed&&Tt(e.property)?e.object.type==="Identifier":!1}function Wr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Jr(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Vr(e){return!!(e.parent&&e.parent.callee&&Jr(e.parent.callee,"forwardRef"))}function Xr(e){return!!(e.parent&&e.parent.callee&&Jr(e.parent.callee,"memo"))}function En(e){for(;e;){let t=Br(e);if(t&&(Wr(t)||Tt(t))||Vr(e)||Xr(e))return!0;e=e.parent}return!1}function $r(e){return!1}function bn(e){return!1}var Qo=/eslint +react-compiler\/react-compiler: +\["error/,Hr={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(Qo.test(l.value))return{CallExpression(c){let y=null;c.callee.name==="useMemo"?y="useMemo":c.callee.name==="useCallback"&&(y="useCallback"),y&&e.report({node:c,message:`"${y}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?l=>t(l):l=>e.sourceCode.getText(l),r=typeof e.getScope=="function"?()=>r():l=>e.sourceCode.getScope(l),n=null,s=[],o=[],i=new WeakSet;function p(l){for(let c of l.references){let y=c.identifier.parent;if(y.type==="VariableDeclarator"&&y.init&&y.init.type==="CallExpression"&&y.init.callee&&$r(y.init.callee))for(let d of c.resolved.references)d!==c&&i.add(d.identifier)}}return{onCodePathSegmentStart:l=>o.push(l),onCodePathSegmentEnd:()=>o.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(l,c){let y=s.pop();if(y.size===0)return;let d=new Set;function a(g,b){let{cache:T}=a,C=T.get(g.id),w=new Set(b);if(w.has(g.id)){let I=[...w],O=I.slice(I.indexOf(g.id)+1);for(let $ of O)d.add($);return BigInt("0")}if(w.add(g.id),C!==void 0)return C;if(l.thrownSegments.includes(g))C=BigInt("0");else if(g.prevSegments.length===0)C=BigInt("1");else{C=BigInt("0");for(let I of g.prevSegments)C+=a(I,w)}return g.reachable&&C===BigInt("0")?T.delete(g.id):T.set(g.id,C),C}function u(g,b){let{cache:T}=u,C=T.get(g.id),w=new Set(b);if(w.has(g.id)){let I=Array.from(w),O=I.slice(I.indexOf(g.id)+1);for(let $ of O)d.add($);return BigInt("0")}if(w.add(g.id),C!==void 0)return C;if(l.thrownSegments.includes(g))C=BigInt("0");else if(g.nextSegments.length===0)C=BigInt("1");else{C=BigInt("0");for(let I of g.nextSegments)C+=u(I,w)}return T.set(g.id,C),C}function f(g){let{cache:b}=f,T=b.get(g.id);if(T===null)return 1/0;if(T!==void 0)return T;if(b.set(g.id,null),g.prevSegments.length===0)T=1;else{T=1/0;for(let C of g.prevSegments){let w=f(C);w<T&&(T=w)}T+=1}return b.set(g.id,T),T}a.cache=new Map,u.cache=new Map,f.cache=new Map;let S=u(l.initialSegment),h=Br(c),m=En(c),E=h?Wr(h)||Tt(h):Vr(c)||Xr(c),x=1/0;for(let g of l.finalSegments){if(!g.reachable)continue;let b=f(g);b<x&&(x=b)}for(let[g,b]of y){if(!g.reachable)continue;let T=g.nextSegments.length===0?x<=f(g):x<f(g),C=a(g)*u(g),w=d.has(g.id);for(let I of b)if(w&&!bn(I)&&e.report({node:I,message:`React Hook "${t(I)}" 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(c.async&&e.report({node:I,message:`React Hook "${t(I)}" cannot be called in an async function.`}),!w&&C!==S&&!bn(I)){let $=`React Hook "${t(I)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(T?" Did you accidentally call a React Hook after an early return?":"");e.report({node:I,message:$})}}else if(c.parent&&(c.parent.type==="MethodDefinition"||c.parent.type==="ClassProperty")&&c.parent.value===c){let O=`React Hook "${t(I)}" 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:I,message:O})}else if(h){let O=`React Hook "${t(I)}" is called in function "${t(h)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:I,message:O})}else if(c.type==="Program"){let O=`React Hook "${t(I)}" 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:I,message:O})}else if(m&&!bn(I)){if(c.parent.type==="CallExpression"&&c.parent.callee.type==="Identifier"&&c.parent.callee.name==="useCallback"){let $=c.parent;if($.parent.type==="VariableDeclarator"&&zr($.parent.id.name))return}let O=`React Hook "${t(I)}" 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:I,message:O})}}},CallExpression(l){if(Tt(l.callee)){let c=Ur(s),y=Ur(o),d=c.get(y);d||(d=[],c.set(y,d)),d.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||$r(l.callee))&&l.arguments.length>0&&(n=l)},Identifier(l){n==null&&i.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${t(l)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(l){l===n&&(n=null)},FunctionDeclaration(l){En(l)&&p(r(l))},ArrowFunctionExpression(l){En(l)&&p(r(l))}}}};function Br(e){return e.type==="FunctionDeclaration"||e.type==="FunctionExpression"&&e.id?e.id:e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"?e.parent.type==="VariableDeclarator"&&e.parent.init===e?e.parent.id:e.parent.type==="AssignmentExpression"&&e.parent.right===e&&e.parent.operator==="="?e.parent.left:e.parent.type==="Property"&&e.parent.value===e&&!e.parent.computed?e.parent.key:e.parent.type==="AssignmentPattern"&&e.parent.right===e&&!e.parent.computed?e.parent.left:void 0:void 0}function Ur(e){return e[e.length-1]}var ie=require("@typescript-eslint/utils"),fe=he(require("zod/v4"));var ea=/^\s+$/,xn=/\r?\n/,ta=/^(\s*)/,na=/^(\s*)\S/,ra=/\r?\n/,ia=fe.object({indent:fe.union([fe.string().regex(ea),fe.number().int().min(1)]).optional(),tags:fe.array(fe.string()).optional(),functions:fe.array(fe.string()).optional(),comments:fe.array(fe.string()).optional()}),Cn=M({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[L(ia)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:s=["outdent","dedent","gql","sql","html","styled"],indent:o}=e.options[0],i=r.map(m=>m.toLowerCase());function p(m){let E=m.split(xn),x=E.filter(b=>b.trim()!=="");if(x.length===0)return m;let g=Number.POSITIVE_INFINITY;for(let b of x){let T=b.match(ta);T&&(g=Math.min(g,T[1]?.length??0))}return!isFinite(g)||g===0?m:E.map(b=>b.slice(g)).join(`
|
|
36
|
+
`)}function l(m,E,x){return m.split(xn).map(b=>b.trim()===""?b:x.repeat(E)+b).join(`
|
|
37
|
+
`)}function c(m){if(m.type===ie.AST_NODE_TYPES.Identifier)return m.name;if(m.type===ie.AST_NODE_TYPES.MemberExpression){let E=m.object.type===ie.AST_NODE_TYPES.Identifier?m.object.name:null,x=m.property.type===ie.AST_NODE_TYPES.Identifier?m.property.name:null;return E&&x?`${E}.${x}`:x}return null}function y(m,E){if(!m)return!1;for(let x of E)if(x.includes(".")){let g=x.split(".");if(m.type===ie.AST_NODE_TYPES.MemberExpression&&m.object.type===ie.AST_NODE_TYPES.Identifier&&m.property.type===ie.AST_NODE_TYPES.Identifier&&m.object.name===g[0]&&m.property.name===g[1])return!0}else if(m.type===ie.AST_NODE_TYPES.Identifier&&m.name===x)return!0;return!1}function d(m,E){let x=m.parent;if(x.type!==ie.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let g=c(x.tag);return g?E.includes(g):!1}function a(m,E){if(!m||m.type!==ie.AST_NODE_TYPES.CallExpression)return!1;let{method:x,argumentsLength:g,optionalCall:b=!0,optionalMember:T=!0}=E;return g!==void 0&&m.arguments.length!==g||!b&&m.optional||m.callee.type!==ie.AST_NODE_TYPES.MemberExpression||!T&&m.callee.optional||m.callee.property.type!==ie.AST_NODE_TYPES.Identifier?!1:m.callee.property.name===x}function u(m,E){if(!m||m.type!==ie.AST_NODE_TYPES.CallExpression)return!1;let{name:x,argumentsLength:g,optionalCall:b=!0}=E;return g!==void 0&&m.arguments.length!==g||!b&&m.optional||m.callee.type!==ie.AST_NODE_TYPES.Identifier?!1:m.callee.name===x}function f(m){return a(m.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&m.parent.type===ie.AST_NODE_TYPES.CallExpression&&m.parent.arguments[0]===m&&u(m.parent.callee.type===ie.AST_NODE_TYPES.MemberExpression?m.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function S(m){if(i.length>0){let E=t.getTokenBefore(m,{includeComments:!0});if(E?.type===ie.AST_TOKEN_TYPES.Block&&i.includes(E.value.trim().toLowerCase()))return!0}return!!(f(m)||s.length>0&&d(m,s)||n.length>0&&m.parent.type===ie.AST_NODE_TYPES.CallExpression&&m.parent.arguments.includes(m)&&y(m.parent.callee,n))}function h(m){let E=`__PLACEHOLDER__${Math.random()}`,x=m.quasis.map(Z=>t.getText(Z).slice(1,Z.tail?-1:-2)).join(E),g=x.match(ra);if(!g)return;let b=g[0],T=t.lines[t.getLocFromIndex(m.range[0]).line-1];if(!T)return;let w=T.match(na)?.[1]??"",I;typeof o=="string"?I=o:typeof o=="number"?I=" ".repeat(o):I=w.startsWith(" ")?" ":" ";let $=p(x).replace(new RegExp(`^${b}|${b}[ ]*$`,"g"),""),ne=b+l($,1,w+I)+b+w,Q=x.includes(`\r
|
|
38
38
|
`)?`\r
|
|
39
39
|
`:`
|
|
40
|
-
`,
|
|
40
|
+
`,oe=x.split(xn),ae=oe.map((Z,be)=>be!==oe.length-1&&Z===I+w?"":Z).join(Q);if(ne!==ae)return{node:m,messageId:"improperlyIndented",fix:Z=>ne.split(E).map((be,Je)=>{let ce=m.quasis[Je];return ce?Z.replaceTextRange([ce.range[0]+1,ce.range[1]-(ce.tail?1:2)],be):[]}).flat()}}return{TemplateLiteral(m){if(!S(m))return;let E=h(m);if(E)return e.report(E)}}}});var An=require("@typescript-eslint/utils");function sa(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function oa(e){let t=e.parent;return t?.type===An.AST_NODE_TYPES.NewExpression&&t.callee.type===An.AST_NODE_TYPES.Identifier&&t.callee.name==="RegExp"}var In=M({name:"use-top-level-regex",meta:{type:"suggestion",docs:{description:"Require regex literals to be declared at the top level to avoid performance issues"},messages:{regexShouldBeTopLevel:"Move this regex literal to the top level to avoid creating new RegExp objects on each function call."},schema:[],hasSuggestions:!1},defaultOptions:[],create(e){function t(r){sa(r)||oa(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var pe=require("@typescript-eslint/utils"),Ye=require("zod/v4");var aa=Ye.z.object({checkOnly:Ye.z.array(Ye.z.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:Ye.z.array(Ye.z.string()).optional()}),Rn=M({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:[L(aa)],messages:{moveTypeAboveUsage:"Type definition should be placed directly above its first usage."}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=new Map,s=[];function o(u){for(let f of s)if(u.range[0]>=f.range[0]&&u.range[1]<=f.range[1])return f;return null}function i(u){let f=u.parent;for(;f;){if(f.type===pe.AST_NODE_TYPES.FunctionDeclaration||f.type===pe.AST_NODE_TYPES.FunctionExpression||f.type===pe.AST_NODE_TYPES.ArrowFunctionExpression){let S=f.params;for(let h of S)if(u.range[0]>=h.range[0]&&u.range[1]<=h.range[1])return!0;break}f=f.parent}return!1}function p(u){let f=u.parent;for(;f;){if(f.type===pe.AST_NODE_TYPES.TSTypeParameterInstantiation){let S=f.parent;if(S.type===pe.AST_NODE_TYPES.TSTypeReference&&S.typeName.type===pe.AST_NODE_TYPES.Identifier&&(S.typeName.name==="FC"||S.typeName.name==="React.FC")||S.type===pe.AST_NODE_TYPES.TSTypeReference&&S.typeName.type===pe.AST_NODE_TYPES.TSQualifiedName&&S.typeName.right.name==="FC")return!0}f=f.parent}return!1}function l(u){let f=u.parent;for(;f;){if(f.type===pe.AST_NODE_TYPES.TSTypeParameterInstantiation){let S=f.parent;if(S.type===pe.AST_NODE_TYPES.CallExpression||S.type===pe.AST_NODE_TYPES.NewExpression)return!0}f=f.parent}return!1}function c(u){let f=u.parent;for(;f;){if(f.type===pe.AST_NODE_TYPES.TSTypeAliasDeclaration||f.type===pe.AST_NODE_TYPES.TSInterfaceDeclaration)return!0;f=f.parent}return!1}let y=[];function d(u){let f=[],S=new Map;for(let{typeName:m,firstUsage:E}of u){let x=S.get(E)||[];x.push(m),S.set(E,x)}for(let{typeName:m,firstUsage:E,firstUsagePosition:x,firstUsageInFunctionArgs:g}of u){let b=n.get(m);if(!b||b.statement===E)continue;let T=s.indexOf(b.statement),C=s.indexOf(E);if(T===-1||C===-1)continue;let w=!!(t.checkOnly&&t.checkOnly.includes("function-args")&&g),O=(S.get(E)||[]).length>1;(w||O?T>C:T>C||T!==C-1)&&f.push({typeName:m,typeDef:b,targetStatement:E,firstUsagePosition:x})}if(f.length===0)return;f.sort((m,E)=>{let x=m.firstUsagePosition-E.firstUsagePosition;if(x!==0)return x;let g=s.indexOf(m.typeDef.statement),b=s.indexOf(E.typeDef.statement);return g-b});let h=f[0];h&&e.report({node:h.typeDef.node,messageId:"moveTypeAboveUsage",fix:a(f)})}function a(u){return function*(f){let S=new Map;for(let h of u){let m=S.get(h.targetStatement)||[];m.push(h),S.set(h.targetStatement,m)}for(let[,h]of S)h.sort((m,E)=>{let x=m.firstUsagePosition-E.firstUsagePosition;if(x!==0)return x;let g=s.indexOf(m.typeDef.statement),b=s.indexOf(E.typeDef.statement);return g-b});for(let h of u){let{typeDef:m}=h,E=m.statement,x=r.getCommentsBefore(E),g=E.range[0],b=E.range[1];x.length>0&&x[0]&&(g=x[0].range[0]),yield f.removeRange([g,b])}for(let[h,m]of S){let E=r.getCommentsBefore(h),x=E.length>0&&E[0]?E[0].range[0]:h.range[0],g=[];for(let b of m){let T=b.typeDef.statement,C=r.getText(T),w=r.getCommentsBefore(T),I=C;w.length>0&&(I=`${w.map($=>r.getText($)).join(`
|
|
41
41
|
`)}
|
|
42
|
-
${C}`),g.push(I)}yield
|
|
42
|
+
${C}`),g.push(I)}yield f.insertTextBeforeRange([x,x],`${g.join(`
|
|
43
43
|
|
|
44
44
|
`)}
|
|
45
45
|
|
|
46
|
-
`)}}}return{Program(u){s.push(...u.body)},TSTypeAliasDeclaration(u){if(s.some(T=>T.type===pe.AST_NODE_TYPES.ExportNamedDeclaration&&T.declaration===u?!0:T===u)){let T=o(u);T&&n.set(u.id.name,{node:u,name:u.id.name,statement:T})}},TSInterfaceDeclaration(u){if(s.some(T=>T.type===pe.AST_NODE_TYPES.ExportNamedDeclaration&&T.declaration===u?!0:T===u)){let T=o(u);T&&n.set(u.id.name,{node:u,name:u.id.name,statement:T})}},TSTypeReference(u){if(u.typeName.type===pe.AST_NODE_TYPES.Identifier){let m=i(u),T=p(u),h=l(u);f.push({typeName:u.typeName.name,node:u,inFunctionArgs:m,inFCProps:T,inGenericArgAtFunctionCall:h,usagePosition:u.range[0]})}},"Program:exit"(){let u=new Map;function m(h){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let y of t.checkOnly)if(y==="function-args"&&h.inFunctionArgs||y==="FC"&&h.inFCProps||y==="generic-args-at-fn-calls"&&h.inGenericArgAtFunctionCall)return!0;return!1}for(let h of f){let{typeName:y,node:E}=h;if(!n.has(y)||!m(h))continue;let x=o(E),g=n.get(y);if(!x||!g||x===g.statement)continue;u.has(y)||u.set(y,[]);let b=u.get(y);if(!b)return;b.includes(x)||b.push(x)}let T=[];for(let[h,y]of u)if(y.length>0){if(y.length===0)continue;let E=y[0];if(!E)continue;let x=Number.MAX_SAFE_INTEGER,g=!1;for(let S of y)S.range[0]<E.range[0]&&(E=S);for(let S of f)m(S)&&S.typeName===h&&o(S.node)===E&&S.usagePosition<x&&(x=S.usagePosition,g=S.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let S=Number.MAX_SAFE_INTEGER;for(let w of f){if(w.typeName!==h)continue;let I=o(w.node);if(!I)continue;let O=s.indexOf(I);O!==-1&&O<S&&(S=O)}let C=s.indexOf(E);if(S!==Number.MAX_SAFE_INTEGER&&C!==-1&&S<C)continue}else{let S=Number.MAX_SAFE_INTEGER;for(let w of f){if(w.typeName!==h||c(w.node))continue;let I=o(w.node);if(!I)continue;let O=s.indexOf(I);O!==-1&&O<S&&(S=O)}let C=s.indexOf(E);if(S!==Number.MAX_SAFE_INTEGER&&C!==-1&&S<C)continue}T.push({typeName:h,firstUsage:E,firstUsagePosition:x,firstUsageInFunctionArgs:g})}T.length>0&&d(T)}}}});var X=require("@typescript-eslint/utils"),qe=he(require("zod/v4"));var la=["tsx"],pa=/^[A-Z][A-Za-z0-9]*$/,ca=qe.object({extensions:qe.array(qe.string()).optional()}),wn=M({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:[L(ca)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??la,s=!1;for(let g of n)if(r.endsWith(g)){s=!0;break}if(!s)return{};let o=e.sourceCode,i=new Set,p=new Map;function l(g){return pa.test(g)}function c(g){if(g.type!==X.AST_NODE_TYPES.CallExpression)return!1;let b=g.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 f(g){if(g.type===X.AST_NODE_TYPES.JSXElement||g.type===X.AST_NODE_TYPES.JSXFragment)return!0;if(g.type===X.AST_NODE_TYPES.ArrayExpression){for(let b of g.elements)if(b&&(b.type===X.AST_NODE_TYPES.JSXElement||b.type===X.AST_NODE_TYPES.JSXFragment))return!0}return!1}function d(g){if(g.type!==X.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let b=g.body;if(b.type===X.AST_NODE_TYPES.ArrowFunctionExpression){let S=b.body;if(f(S))return!0}return!1}function a(g){if(g.id.type!==X.AST_NODE_TYPES.Identifier)return;let b=g.id.name,S=g.init;if(S){if(l(b)&&(S.type===X.AST_NODE_TYPES.ArrowFunctionExpression||S.type===X.AST_NODE_TYPES.FunctionExpression||c(S))){i.add(b);return}S.type===X.AST_NODE_TYPES.Identifier&&p.set(b,S.name),l(b)||d(S)&&i.add(b)}}function u(g){if(g.type===X.AST_NODE_TYPES.VariableDeclaration){for(let b of g.declarations)a(b);return}if(g.type===X.AST_NODE_TYPES.FunctionDeclaration&&g.id){l(g.id.name)&&i.add(g.id.name);return}if(g.type===X.AST_NODE_TYPES.ExportNamedDeclaration&&g.declaration){let b=g.declaration;if(b.type===X.AST_NODE_TYPES.VariableDeclaration){for(let S of b.declarations)a(S);return}if(b.type===X.AST_NODE_TYPES.FunctionDeclaration&&b.id){l(b.id.name)&&i.add(b.id.name);return}}}for(let g of o.ast.body)u(g);function m(g,b=new Set){if(i.has(g))return!0;if(b.has(g))return!1;b.add(g);let S=p.get(g);return S?m(S,b):!1}let T=[];function h(g,b,S){T.push({node:g,isType:b,isComponent:S})}for(let g of o.ast.body){if(g.type===X.AST_NODE_TYPES.ExportNamedDeclaration){let b=g.exportKind==="type";if(g.declaration){let S=g.declaration;if(S.type===X.AST_NODE_TYPES.TSTypeAliasDeclaration||S.type===X.AST_NODE_TYPES.TSInterfaceDeclaration){h(S,!0,!1);continue}if(S.type===X.AST_NODE_TYPES.VariableDeclaration){for(let C of S.declarations){if(C.id.type!==X.AST_NODE_TYPES.Identifier)continue;let w=C.id.name,I=m(w);h(C,b,I)}continue}if(S.type===X.AST_NODE_TYPES.FunctionDeclaration){let C=S.id?.name,w=C?m(C)||l(C):!1;h(S,b,w);continue}h(S,b,!1);continue}if(g.specifiers.length>0)for(let S of g.specifiers){if(S.local.type!==X.AST_NODE_TYPES.Identifier)continue;let C=S.local.name,w=m(C);h(S,b,w)}continue}if(g.type===X.AST_NODE_TYPES.ExportDefaultDeclaration){let b=g.declaration;if(b.type===X.AST_NODE_TYPES.Identifier){let S=m(b.name)||l(b.name);h(g,!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){h(g,!1,!0);continue}h(g,!1,!1);continue}}let y=!1;for(let g of T)if(!g.isType&&g.isComponent){y=!0;break}if(!y)return{};let E=[];for(let g of T)g.isType||E.push(g);let x=-1;for(let[g,b]of E.entries())if(b.isComponent){x=g;break}if(x===-1)return{};for(let[g,b]of E.entries())if(g!==x){e.report({node:b.node,messageId:"multipleExports"});break}return{}}});var Pe=require("@typescript-eslint/utils"),ht=require("zod/v4");function Et(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ua(e){return e.callee.type===Pe.AST_NODE_TYPES.Identifier?e.callee.name==="useState":e.callee.type===Pe.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===Pe.AST_NODE_TYPES.Identifier&&e.callee.property.type===Pe.AST_NODE_TYPES.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var fa=ht.z.object({ignorePrefixes:ht.z.array(ht.z.string()).optional()});function Yr(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function ma(e){return`set${Et(e)}`}var kn=M({name:"use-state-setter-naming",meta:{type:"problem",docs:{description:"Enforce consistent naming convention for useState destructuring where setter should be set{Value}"},messages:{incorrectSetterName:'useState setter should follow the pattern "set{{expectedName}}" with a "set" prefix but got "{{actualName}}"',useSuggestedName:'Use "{{expectedSetterName}}" instead'},hasSuggestions:!0,schema:[L(fa)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==Pe.AST_NODE_TYPES.CallExpression||!ua(r.init)||r.id.type!==Pe.AST_NODE_TYPES.ArrayPattern||r.id.elements.length!==2)return;let[n,s]=r.id.elements;if(!n||!s||n.type!==Pe.AST_NODE_TYPES.Identifier||s.type!==Pe.AST_NODE_TYPES.Identifier)return;let o=n.name,i=s.name,p=t.ignorePrefixes||[],l=Yr(o,p),c=Yr(i,p);if(l===""){if(!c.startsWith("set")){let d=`set${Et(o)}`;e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:Et(o),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:d},fix:a=>a.replaceText(s,d)}]})}return}let f=ma(l);c!==f&&e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:Et(l),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:f},fix:d=>d.replaceText(s,f)}]})}}}});var oe=require("@typescript-eslint/utils"),ze=require("zod/v4");var ya=ze.z.object({name:ze.z.string(),defaults:ze.z.array(ze.z.unknown())}),da=ze.z.object({functions:ze.z.array(ya)});function bt(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0)return e===t;if(typeof e!=typeof t||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,o)=>bt(s,t[o]));let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let s of r){if(!n.includes(s))return!1;let o=Object.getOwnPropertyDescriptor(e,s),i=Object.getOwnPropertyDescriptor(t,s);if(!o||!i)return!1;let p=o.value,l=i.value;if(!bt(p,l))return!1}return!0}function ga(e,t){let r=new Set;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return r;for(let n in e){if(!(n in t))continue;let s=Object.getOwnPropertyDescriptor(e,n),o=Object.getOwnPropertyDescriptor(t,n);s&&o&&bt(s.value,o.value)&&r.add(n)}return r}function qr(e){if(e.type===oe.AST_NODE_TYPES.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case oe.AST_NODE_TYPES.Literal:return e.value;case oe.AST_NODE_TYPES.ObjectExpression:{let t={};for(let r of e.properties)r.type===oe.AST_NODE_TYPES.Property&&r.key.type===oe.AST_NODE_TYPES.Identifier&&!r.computed&&(r.value.type===oe.AST_NODE_TYPES.Literal?t[r.key.name]=r.value.value:r.value.type===oe.AST_NODE_TYPES.ObjectExpression?t[r.key.name]=qr(r.value):t[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case oe.AST_NODE_TYPES.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===oe.AST_NODE_TYPES.SpreadElement))return t.type===oe.AST_NODE_TYPES.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function Sa(e){return e.type===oe.AST_NODE_TYPES.Identifier?e.name:e.type===oe.AST_NODE_TYPES.MemberExpression&&e.property.type===oe.AST_NODE_TYPES.Identifier&&!e.computed?e.property.name:null}var vn=M({name:"no-redundant-function-params",meta:{type:"suggestion",docs:{description:"Disallow calling functions with redundant default parameters"},messages:{redundantParam:"Function call has redundant default parameter(s) that can be omitted"},fixable:"code",schema:[L(da)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map;for(let n of t.functions)r.set(n.name,n.defaults);return{CallExpression(n){let s=Sa(n.callee);if(!s)return;let o=r.get(s);if(!o)return;let i=n.arguments;if(i.length===0)return;let p=-1,l=!1,c=new Map;for(let f=0;f<i.length;f++){if(f>=o.length){p=f;continue}let d=o[f],a=i[f];if(!a||a.type===oe.AST_NODE_TYPES.SpreadElement){p=f;continue}let u=qr(a);if(d===void 0){p=f;continue}if(bt(u,d))continue;let m=ga(u,d);m.size>0&&(l=!0,c.set(f,m)),p=f}(p<i.length-1||l)&&e.report({node:n,messageId:"redundantParam",fix(f){let d=[];if(l)for(let[a,u]of c){let m=i[a];if(m&&m.type===oe.AST_NODE_TYPES.ObjectExpression){let T=[];for(let h of m.properties)h.type===oe.AST_NODE_TYPES.Property&&h.key.type===oe.AST_NODE_TYPES.Identifier&&!h.computed&&u.has(h.key.name)||T.push(h);if(T.length===0)d.push(f.replaceText(m,"{}"));else{let h=T.map(y=>e.sourceCode.getText(y));d.push(f.replaceText(m,`{ ${h.join(", ")} }`))}}}if(p<i.length-1)if(p===-1){let a=e.sourceCode.getTokenAfter(n.callee),u=e.sourceCode.getLastToken(n);a&&u&&d.push(f.replaceTextRange([a.range[1],u.range[0]],""))}else{let a=i[p],u=e.sourceCode.getLastToken(n);u&&a&&d.push(f.replaceTextRange([a.range[1],u.range[0]],""))}return d.length>0?d:null}})}}}});var Zr={[nn.name]:nn.rule,[Lt.name]:Lt.rule,[jt.name]:jt.rule,"rules-of-hooks":Hr,"exhaustive-deps":Wn,"require-description":_r.rule,[Mt.name]:Mt.rule,[$t.name]:$t.rule,[sn.name]:sn.rule,[At.name]:At.rule,[Dt.name]:Dt.rule,[Wt.name]:Wt.rule,[Ke.name]:Ke.rule,[ln.name]:ln.rule,[Ut.name]:Ut.rule,[_t.name]:_t.rule,[Jt.name]:Jt.rule,[Rt.name]:Rt.rule,[yn.name]:yn.rule,[mn.name]:mn.rule,[Tn.name]:Tn.rule,[Nt.name]:Nt.rule,[Bt.name]:Bt.rule,[Yt.name]:Yt.rule,[qt.name]:qt.rule,[Qt.name]:Qt.rule,[en.name]:en.rule,[Zt.name]:Zt.rule,[Kt.name]:Kt.rule,[an.name]:an.rule,[Xt.name]:Xt.rule,[Vt.name]:Vt.rule,[In.name]:In.rule,[rn.name]:rn.rule,[hn.name]:hn.rule,[Cn.name]:Cn.rule,[Rn.name]:Rn.rule,[wn.name]:wn.rule,[kn.name]:kn.rule,[vn.name]:vn.rule,[Ke.name]:Ke.rule};var Ta={rules:Zr};0&&(module.exports={extendedLintPlugin});
|
|
46
|
+
`)}}}return{Program(u){s.push(...u.body)},TSTypeAliasDeclaration(u){if(s.some(S=>S.type===pe.AST_NODE_TYPES.ExportNamedDeclaration&&S.declaration===u?!0:S===u)){let S=o(u);S&&n.set(u.id.name,{node:u,name:u.id.name,statement:S})}},TSInterfaceDeclaration(u){if(s.some(S=>S.type===pe.AST_NODE_TYPES.ExportNamedDeclaration&&S.declaration===u?!0:S===u)){let S=o(u);S&&n.set(u.id.name,{node:u,name:u.id.name,statement:S})}},TSTypeReference(u){if(u.typeName.type===pe.AST_NODE_TYPES.Identifier){let f=i(u),S=p(u),h=l(u);y.push({typeName:u.typeName.name,node:u,inFunctionArgs:f,inFCProps:S,inGenericArgAtFunctionCall:h,usagePosition:u.range[0]})}},"Program:exit"(){let u=new Map;function f(h){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let m of t.checkOnly)if(m==="function-args"&&h.inFunctionArgs||m==="FC"&&h.inFCProps||m==="generic-args-at-fn-calls"&&h.inGenericArgAtFunctionCall)return!0;return!1}for(let h of y){let{typeName:m,node:E}=h;if(!n.has(m)||!f(h))continue;let x=o(E),g=n.get(m);if(!x||!g||x===g.statement)continue;u.has(m)||u.set(m,[]);let b=u.get(m);if(!b)return;b.includes(x)||b.push(x)}let S=[];for(let[h,m]of u)if(m.length>0){if(m.length===0)continue;let E=m[0];if(!E)continue;let x=Number.MAX_SAFE_INTEGER,g=!1;for(let T of m)T.range[0]<E.range[0]&&(E=T);for(let T of y)f(T)&&T.typeName===h&&o(T.node)===E&&T.usagePosition<x&&(x=T.usagePosition,g=T.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let T=Number.MAX_SAFE_INTEGER;for(let w of y){if(w.typeName!==h)continue;let I=o(w.node);if(!I)continue;let O=s.indexOf(I);O!==-1&&O<T&&(T=O)}let C=s.indexOf(E);if(T!==Number.MAX_SAFE_INTEGER&&C!==-1&&T<C)continue}else{let T=Number.MAX_SAFE_INTEGER;for(let w of y){if(w.typeName!==h||c(w.node))continue;let I=o(w.node);if(!I)continue;let O=s.indexOf(I);O!==-1&&O<T&&(T=O)}let C=s.indexOf(E);if(T!==Number.MAX_SAFE_INTEGER&&C!==-1&&T<C)continue}S.push({typeName:h,firstUsage:E,firstUsagePosition:x,firstUsageInFunctionArgs:g})}S.length>0&&d(S)}}}});var X=require("@typescript-eslint/utils"),qe=he(require("zod/v4"));var la=["tsx"],pa=/^[A-Z][A-Za-z0-9]*$/,ca=qe.object({extensions:qe.array(qe.string()).optional()}),wn=M({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:[L(ca)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??la,s=!1;for(let g of n)if(r.endsWith(g)){s=!0;break}if(!s)return{};let o=e.sourceCode,i=new Set,p=new Map;function l(g){return pa.test(g)}function c(g){if(g.type!==X.AST_NODE_TYPES.CallExpression)return!1;let b=g.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 y(g){if(g.type===X.AST_NODE_TYPES.JSXElement||g.type===X.AST_NODE_TYPES.JSXFragment)return!0;if(g.type===X.AST_NODE_TYPES.ArrayExpression){for(let b of g.elements)if(b&&(b.type===X.AST_NODE_TYPES.JSXElement||b.type===X.AST_NODE_TYPES.JSXFragment))return!0}return!1}function d(g){if(g.type!==X.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let b=g.body;if(b.type===X.AST_NODE_TYPES.ArrowFunctionExpression){let T=b.body;if(y(T))return!0}return!1}function a(g){if(g.id.type!==X.AST_NODE_TYPES.Identifier)return;let b=g.id.name,T=g.init;if(T){if(l(b)&&(T.type===X.AST_NODE_TYPES.ArrowFunctionExpression||T.type===X.AST_NODE_TYPES.FunctionExpression||c(T))){i.add(b);return}T.type===X.AST_NODE_TYPES.Identifier&&p.set(b,T.name),l(b)||d(T)&&i.add(b)}}function u(g){if(g.type===X.AST_NODE_TYPES.VariableDeclaration){for(let b of g.declarations)a(b);return}if(g.type===X.AST_NODE_TYPES.FunctionDeclaration&&g.id){l(g.id.name)&&i.add(g.id.name);return}if(g.type===X.AST_NODE_TYPES.ExportNamedDeclaration&&g.declaration){let b=g.declaration;if(b.type===X.AST_NODE_TYPES.VariableDeclaration){for(let T of b.declarations)a(T);return}if(b.type===X.AST_NODE_TYPES.FunctionDeclaration&&b.id){l(b.id.name)&&i.add(b.id.name);return}}}for(let g of o.ast.body)u(g);function f(g,b=new Set){if(i.has(g))return!0;if(b.has(g))return!1;b.add(g);let T=p.get(g);return T?f(T,b):!1}let S=[];function h(g,b,T){S.push({node:g,isType:b,isComponent:T})}for(let g of o.ast.body){if(g.type===X.AST_NODE_TYPES.ExportNamedDeclaration){let b=g.exportKind==="type";if(g.declaration){let T=g.declaration;if(T.type===X.AST_NODE_TYPES.TSTypeAliasDeclaration||T.type===X.AST_NODE_TYPES.TSInterfaceDeclaration){h(T,!0,!1);continue}if(T.type===X.AST_NODE_TYPES.VariableDeclaration){for(let C of T.declarations){if(C.id.type!==X.AST_NODE_TYPES.Identifier)continue;let w=C.id.name,I=f(w);h(C,b,I)}continue}if(T.type===X.AST_NODE_TYPES.FunctionDeclaration){let C=T.id?.name,w=C?f(C)||l(C):!1;h(T,b,w);continue}h(T,b,!1);continue}if(g.specifiers.length>0)for(let T of g.specifiers){if(T.local.type!==X.AST_NODE_TYPES.Identifier)continue;let C=T.local.name,w=f(C);h(T,b,w)}continue}if(g.type===X.AST_NODE_TYPES.ExportDefaultDeclaration){let b=g.declaration;if(b.type===X.AST_NODE_TYPES.Identifier){let T=f(b.name)||l(b.name);h(g,!1,T);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){h(g,!1,!0);continue}h(g,!1,!1);continue}}let m=!1;for(let g of S)if(!g.isType&&g.isComponent){m=!0;break}if(!m)return{};let E=[];for(let g of S)g.isType||E.push(g);let x=-1;for(let[g,b]of E.entries())if(b.isComponent){x=g;break}if(x===-1)return{};for(let[g,b]of E.entries())if(g!==x){e.report({node:b.node,messageId:"multipleExports"});break}return{}}});var Pe=require("@typescript-eslint/utils"),ht=require("zod/v4");function Et(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ua(e){return e.callee.type===Pe.AST_NODE_TYPES.Identifier?e.callee.name==="useState":e.callee.type===Pe.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===Pe.AST_NODE_TYPES.Identifier&&e.callee.property.type===Pe.AST_NODE_TYPES.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var fa=ht.z.object({ignorePrefixes:ht.z.array(ht.z.string()).optional()});function Yr(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function ma(e){return`set${Et(e)}`}var kn=M({name:"use-state-setter-naming",meta:{type:"problem",docs:{description:"Enforce consistent naming convention for useState destructuring where setter should be set{Value}"},messages:{incorrectSetterName:'useState setter should follow the pattern "set{{expectedName}}" with a "set" prefix but got "{{actualName}}"',useSuggestedName:'Use "{{expectedSetterName}}" instead'},hasSuggestions:!0,schema:[L(fa)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==Pe.AST_NODE_TYPES.CallExpression||!ua(r.init)||r.id.type!==Pe.AST_NODE_TYPES.ArrayPattern||r.id.elements.length!==2)return;let[n,s]=r.id.elements;if(!n||!s||n.type!==Pe.AST_NODE_TYPES.Identifier||s.type!==Pe.AST_NODE_TYPES.Identifier)return;let o=n.name,i=s.name,p=t.ignorePrefixes||[],l=Yr(o,p),c=Yr(i,p);if(l===""){if(!c.startsWith("set")){let d=`set${Et(o)}`;e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:Et(o),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:d},fix:a=>a.replaceText(s,d)}]})}return}let y=ma(l);c!==y&&e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:Et(l),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:y},fix:d=>d.replaceText(s,y)}]})}}}});var se=require("@typescript-eslint/utils"),We=require("zod/v4");var ya=We.z.object({name:We.z.string(),defaults:We.z.array(We.z.unknown())}),da=We.z.object({functions:We.z.array(ya)});function bt(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0)return e===t;if(typeof e!=typeof t||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,o)=>bt(s,t[o]));let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let s of r){if(!n.includes(s))return!1;let o=Object.getOwnPropertyDescriptor(e,s),i=Object.getOwnPropertyDescriptor(t,s);if(!o||!i)return!1;let p=o.value,l=i.value;if(!bt(p,l))return!1}return!0}function ga(e,t){let r=new Set;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return r;for(let n in e){if(!(n in t))continue;let s=Object.getOwnPropertyDescriptor(e,n),o=Object.getOwnPropertyDescriptor(t,n);s&&o&&bt(s.value,o.value)&&r.add(n)}return r}function qr(e){if(e.type===se.AST_NODE_TYPES.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case se.AST_NODE_TYPES.Literal:return e.value;case se.AST_NODE_TYPES.ObjectExpression:{let t={};for(let r of e.properties)r.type===se.AST_NODE_TYPES.Property&&r.key.type===se.AST_NODE_TYPES.Identifier&&!r.computed&&(r.value.type===se.AST_NODE_TYPES.Literal?t[r.key.name]=r.value.value:r.value.type===se.AST_NODE_TYPES.ObjectExpression?t[r.key.name]=qr(r.value):t[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case se.AST_NODE_TYPES.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===se.AST_NODE_TYPES.SpreadElement))return t.type===se.AST_NODE_TYPES.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function Sa(e){return e.type===se.AST_NODE_TYPES.Identifier?e.name:e.type===se.AST_NODE_TYPES.MemberExpression&&e.property.type===se.AST_NODE_TYPES.Identifier&&!e.computed?e.property.name:null}var vn=M({name:"no-redundant-function-params",meta:{type:"suggestion",docs:{description:"Disallow calling functions with redundant default parameters"},messages:{redundantParam:"Function call has redundant default parameter(s) that can be omitted"},fixable:"code",schema:[L(da)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map;for(let n of t.functions)r.set(n.name,n.defaults);return{CallExpression(n){let s=Sa(n.callee);if(!s)return;let o=r.get(s);if(!o)return;let i=n.arguments;if(i.length===0)return;let p=-1,l=!1,c=new Map,y=new Set;for(let d=0;d<i.length;d++){if(d>=o.length){p=d;continue}let a=o[d],u=i[d];if(!u||u.type===se.AST_NODE_TYPES.SpreadElement){p=d;continue}let f=qr(u);if(a===void 0){p=d;continue}if(bt(f,a))continue;if(u.type===se.AST_NODE_TYPES.ObjectExpression&&u.properties.length===0&&typeof a=="object"&&a!==null&&Object.keys(a).length>0){y.add(d);continue}let S=ga(f,a);if(S.size>0)if(u.type===se.AST_NODE_TYPES.ObjectExpression&&u.properties.length===S.size){y.add(d);continue}else l=!0,c.set(d,S),p=d;else p=d}(p<i.length-1||l||y.size>0)&&e.report({node:n,messageId:"redundantParam",fix(d){let a=[];if(l)for(let[f,S]of c){let h=i[f];if(h&&h.type===se.AST_NODE_TYPES.ObjectExpression){let m=[];for(let x of h.properties)x.type===se.AST_NODE_TYPES.Property&&x.key.type===se.AST_NODE_TYPES.Identifier&&!x.computed&&S.has(x.key.name)||m.push(x);let E=m.map(x=>e.sourceCode.getText(x));a.push(d.replaceText(h,`{ ${E.join(", ")} }`))}}let u=-1;for(let f=i.length-1;f>=0;f--)if(!y.has(f)&&f<=p){u=f;break}if(u<i.length-1)if(u===-1){let f=e.sourceCode.getTokenAfter(n.callee),S=e.sourceCode.getLastToken(n);f&&S&&a.push(d.replaceTextRange([f.range[1],S.range[0]],""))}else{let f=i[u],S=e.sourceCode.getLastToken(n);S&&f&&a.push(d.replaceTextRange([f.range[1],S.range[0]],""))}return a.length>0?a:null}})}}}});var Zr={[nn.name]:nn.rule,[Lt.name]:Lt.rule,[jt.name]:jt.rule,"rules-of-hooks":Hr,"exhaustive-deps":zn,"require-description":_r.rule,[Mt.name]:Mt.rule,[$t.name]:$t.rule,[sn.name]:sn.rule,[At.name]:At.rule,[Dt.name]:Dt.rule,[zt.name]:zt.rule,[Ke.name]:Ke.rule,[ln.name]:ln.rule,[Ut.name]:Ut.rule,[_t.name]:_t.rule,[Jt.name]:Jt.rule,[Rt.name]:Rt.rule,[yn.name]:yn.rule,[mn.name]:mn.rule,[Tn.name]:Tn.rule,[Nt.name]:Nt.rule,[Bt.name]:Bt.rule,[Yt.name]:Yt.rule,[qt.name]:qt.rule,[Qt.name]:Qt.rule,[en.name]:en.rule,[Zt.name]:Zt.rule,[Kt.name]:Kt.rule,[an.name]:an.rule,[Xt.name]:Xt.rule,[Vt.name]:Vt.rule,[In.name]:In.rule,[rn.name]:rn.rule,[hn.name]:hn.rule,[Cn.name]:Cn.rule,[Rn.name]:Rn.rule,[wn.name]:wn.rule,[kn.name]:kn.rule,[vn.name]:vn.rule,[Ke.name]:Ke.rule};var Ta={rules:Zr};0&&(module.exports={extendedLintPlugin});
|