@ls-stack/extended-lint 0.88.0 → 0.88.1
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 +10 -10
- package/dist/extended-lint.mjs +10 -10
- package/package.json +1 -1
package/dist/extended-lint.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _i=Object.create;var xt=Object.defineProperty;var $i=Object.getOwnPropertyDescriptor;var Ui=Object.getOwnPropertyNames;var zi=Object.getPrototypeOf,Vi=Object.prototype.hasOwnProperty;var Wi=(e,t)=>{for(var r in t)xt(e,r,{get:t[r],enumerable:!0})},or=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ui(t))!Vi.call(e,o)&&o!==r&&xt(e,o,{get:()=>t[o],enumerable:!(n=$i(t,o))||n.enumerable});return e};var Ne=(e,t,r)=>(r=e!=null?_i(zi(e)):{},or(t||!e||!e.__esModule?xt(r,"default",{value:e,enumerable:!0}):r,e)),Ji=e=>or(xt({},"__esModule",{value:!0}),e);var Il={};Wi(Il,{default:()=>Cl,extendedLintPlugin:()=>Ni});module.exports=Ji(Il);var be=require("@typescript-eslint/utils"),_=require("zod/v4");var sr=require("@typescript-eslint/utils"),ar=Ne(require("zod/v4"));function U(e){let r=sr.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function z(e){return ar.toJSONSchema(e)}var Xi=_.z.object({disallow:_.z.array(_.z.object({selector:_.z.string(),message:_.z.string(),replace:_.z.optional(_.z.union([_.z.string(),_.z.object({regex:_.z.string(),with:_.z.string()})])),replaceType:_.z.optional(_.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:_.z.optional(_.z.array(_.z.object({fn:_.z.string(),withArgs:_.z.optional(_.z.array(_.z.object({atIndex:_.z.number(),value:_.z.union([_.z.string(),_.z.number(),_.z.boolean()])}))),message:_.z.string(),replaceWith:_.z.optional(_.z.string()),ignoreRegex:_.z.optional(_.z.string())}))),__dev_simulateFileName:_.z.optional(_.z.string()),mustMatchSyntax:_.z.optional(_.z.array(_.z.object({includeRegex:_.z.string(),excludeRegex:_.z.optional(_.z.string()),mustCallFn:_.z.optional(_.z.array(_.z.object({anyCall:_.z.array(_.z.object({fn:_.z.string(),withArgs:_.z.array(_.z.object({atIndex:_.z.number(),literal:_.z.union([_.z.string(),_.z.number(),_.z.boolean()])}))})),message:_.z.optional(_.z.string())}))),mustMatchSelector:_.z.optional(_.z.array(_.z.object({selector:_.z.string(),message:_.z.string()}))),mustHaveExport:_.z.optional(_.z.array(_.z.object({name:_.z.string(),type:_.z.enum(["function","variable","any"]).default("any"),message:_.z.string()})))})))}),zt=U({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[z(Xi)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:s,disallowFnCalls:i}=t,a=o??e.filename,l=[],p=new Map,u=new Set,f=new Map,y=new Set,x=new Map;function m(b){for(let w of b.specifiers)w.type===be.AST_NODE_TYPES.ImportSpecifier&&w.imported.type===be.AST_NODE_TYPES.Identifier&&w.imported.name!==w.local.name&&x.set(w.local.name,w.imported.name)}function h(b){if(b.declaration){if(b.declaration.type===be.AST_NODE_TYPES.FunctionDeclaration&&b.declaration.id){let w=b.declaration.id.name;for(let k of Array.from(y)){let[N,c]=k.split(":");N===w&&(c==="function"||c==="any")&&y.delete(k)}}else if(b.declaration.type===be.AST_NODE_TYPES.VariableDeclaration){for(let w of b.declaration.declarations)if(w.id.type===be.AST_NODE_TYPES.Identifier){let k=w.id.name;for(let N of Array.from(y)){let[c,v]=N.split(":");c===k&&(v==="variable"||v==="any")&&y.delete(N)}}}}for(let w of b.specifiers)if(w.exported.type===be.AST_NODE_TYPES.Identifier){let k=w.exported.name;for(let N of Array.from(y)){let[c,v]=N.split(":");c===k&&v==="any"&&y.delete(N)}}}function C(b){b.id.type===be.AST_NODE_TYPES.Identifier&&b.init?.type===be.AST_NODE_TYPES.Identifier&&x.set(b.id.name,b.init.name)}function S(b){return x.get(b)??b}function I(b,w){return S(b)===w||b===w}for(let{includeRegex:b,excludeRegex:w,mustCallFn:k,mustMatchSelector:N,mustHaveExport:c}of n??[]){let d=function(T){let F=T;for(let{name:P,value:j}of v??[])F=F.replaceAll(P,j);return F};var E=d;let v=Bi(a,new RegExp(b));if(v&&!(w&&new RegExp(w).test(a))){for(let{anyCall:T,message:F}of k??[]){let P=`Expected file to call the function: ${T.map(({fn:j})=>j).join(" or ")}`;u.add(P),l.push(j=>{let{callee:X}=j;if(X.type===be.AST_NODE_TYPES.Identifier){for(let{fn:G,withArgs:q}of T)if(X.name===G){u.delete(P);for(let D of q){let Z=j.arguments[D.atIndex],B=typeof D.literal=="string"?d(D.literal):D.literal;if(!Z){e.report({node:j,messageId:"default",data:{message:`Missing argument with value "${B}" at index ${D.atIndex}${F?`: ${d(F)}`:""}`}});continue}if(Z.type!==be.AST_NODE_TYPES.Literal){e.report({node:Z,messageId:"default",data:{message:`Argument at position ${D.atIndex} should the literal "${B}"${F?`: ${d(F)}`:""}`}});continue}Z.value!==B&&e.report({node:Z,messageId:"default",data:{message:`Argument should have the value "${B}"${F?`: ${d(F)}`:""}`},fix:ue=>ue.replaceText(Z,typeof B=="string"?`'${B}'`:String(B))})}break}}})}for(let{selector:T,message:F}of N??[])f.set(T,d(F)),p.set(d(T),()=>{f.delete(T)});for(let{name:T,type:F,message:P}of c??[]){let j=d(T),X=d(P);y.add(`${j}:${F}:${X}`)}}}for(let{fn:b,withArgs:w,message:k,replaceWith:N,ignoreRegex:c}of i??[])c&&new RegExp(c).test(a)||l.push(v=>{let{callee:d}=v;if(d.type!==be.AST_NODE_TYPES.Identifier||!I(d.name,b))return;if(w)for(let F of w){let P=v.arguments[F.atIndex];if(!P){e.report({node:v,messageId:"default",data:{message:`Missing argument with value "${F.value}" at index ${F.atIndex}: ${k}`}});return}if(P.type!==be.AST_NODE_TYPES.Literal||P.value!==F.value)return}let T=F=>N?F.replaceText(v,N):null;e.report({node:v,messageId:"default",data:{message:k},suggest:N?[{messageId:"default",data:{message:`Replace with "${N}"`},fix:T}]:void 0})});function A(b,w){let k=r[b];k?r[b]=N=>{k(N),w(N)}:r[b]=w}for(let{selector:b,message:w,replace:k,replaceType:N="suggestion"}of s??[]){if(b==="CallExpression"){l.push(c=>{g(k,c,w,N)});continue}r[b]=c=>{g(k,c,w,N)}}if(p.size>0)for(let[b,w]of p)A(b,w);return l.length>0&&(r.CallExpression=b=>{if(b.type===be.AST_NODE_TYPES.CallExpression)for(let w of l)w(b)}),r.ImportDeclaration=b=>{b.type===be.AST_NODE_TYPES.ImportDeclaration&&m(b)},r.ExportNamedDeclaration=b=>{b.type===be.AST_NODE_TYPES.ExportNamedDeclaration&&h(b)},r.VariableDeclarator=b=>{b.type===be.AST_NODE_TYPES.VariableDeclarator&&C(b)},r["Program:exit"]=b=>{for(let w of u)e.report({node:b,messageId:"default",data:{message:w}});for(let[,w]of f)e.report({node:b,messageId:"default",data:{message:w}});for(let w of y){let[k,N,c]=w.split(":");e.report({node:b,messageId:"default",data:{message:`Missing required export "${k}" of type ${N}: ${c}`}})}},r;function g(b,w,k,N){let c=v=>{if(!b)return null;if(typeof b=="string")return v.replaceText(w,b);{let d=new RegExp(b.regex),T=e.sourceCode.getText(w);return v.replaceText(w,T.replace(d,b.with))}};e.report({node:w,messageId:"default",data:{message:k},fix:b&&N==="autofix"?c:void 0,suggest:b&&N==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof b=="string"?b:b.with}"`},fix:c}]:void 0})}}});function Bi(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...s]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:lr(o)}),r.push({name:"$0_uncapitalize",value:pr(o)}),r.push({name:"$0",value:o});for(let i=0;i<s.length;i++){let a=`$${i+1}`,l=s[i];l!==void 0&&(r.push({name:`${a}_lowercase`,value:l.toLowerCase()}),r.push({name:`${a}_capitalize`,value:lr(l)}),r.push({name:`${a}_uncapitalize`,value:pr(l)}),r.push({name:a,value:l}))}return r}function lr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function pr(e){return e.charAt(0).toLowerCase()+e.slice(1)}var re=require("@typescript-eslint/utils"),Ye=require("zod/v4");var Hi=re.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ur="collapse-simple-objs-in-one-line",Yi=Ye.z.object({maxLineLength:Ye.z.number().optional(),maxProperties:Ye.z.number().optional(),nestedObjMaxLineLength:Ye.z.number().optional(),nestedObjMaxProperties:Ye.z.number().optional(),ignoreTypesWithSuffix:Ye.z.array(Ye.z.string()).optional()}),qi=Hi({name:ur,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:[z(Yi)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,s=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function a(p){if(p.type===re.AST_NODE_TYPES.ObjectExpression){let u=p.parent.type===re.AST_NODE_TYPES.Property,f=u?i:o,y=p.properties.length;if(y>f)return!1;if(y===1){let m=p.properties[0];return!m||m.type===re.AST_NODE_TYPES.Property&&m.value.type===re.AST_NODE_TYPES.ObjectExpression||m.type===re.AST_NODE_TYPES.Property&&m.value.type===re.AST_NODE_TYPES.ArrayExpression&&!m.value.elements.every(C=>C&&Vt(C))?!1:{text:r.getText(m),isNested:u,propsSize:y}}let x=[];for(let m of p.properties){if(m.type===re.AST_NODE_TYPES.Property&&!Vt(m.value))return!1;x.push(r.getText(m))}return{text:x.join(", "),isNested:u,propsSize:y}}else{let u=p.parent.parent?.type===re.AST_NODE_TYPES.TSPropertySignature,f=u?i:o,y=p.members.length;if(y>f)return!1;if(n.length>0&&p.parent.type===re.AST_NODE_TYPES.TSTypeAliasDeclaration){let m=p.parent.id.name;if(n.some(h=>m.endsWith(h)))return!1}if(y===1){let m=p.members[0];return!m||m.type===re.AST_NODE_TYPES.TSPropertySignature&&m.typeAnnotation?.typeAnnotation.type===re.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(m),isNested:u,propsSize:1}}if(p.parent.type===re.AST_NODE_TYPES.TSIntersectionType||p.parent.type===re.AST_NODE_TYPES.TSUnionType&&p.parent.types[0]!==p)return!1;let x=[];for(let m of p.members){if(m.type!==re.AST_NODE_TYPES.TSPropertySignature)return!1;let h=m.typeAnnotation?.typeAnnotation;if(!h||h.type===re.AST_NODE_TYPES.TSTypeLiteral||!cr(h))return!1;if(h.type===re.AST_NODE_TYPES.TSTypeReference&&h.typeArguments){if(h.typeArguments.params.length>1)return!1;let S=h.typeArguments.params[0];if(!S||!cr(S))return!1}let C=r.getText(m).trim();(C.endsWith(";")||C.endsWith(","))&&(C=C.slice(0,-1)),x.push(C)}return{text:x.join("; "),isNested:u,propsSize:y}}}function l(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==re.AST_NODE_TYPES.JSXExpressionContainer){let h=0,C=!1,S=r.getTokenAfter(p,{filter:A=>A.type!==re.AST_TOKEN_TYPES.Punctuator||C?!0:A.value===","?(h++,!1):A.value===";"?(h++,C=!0,!1):A.value===")"||A.value==="}"?(h++,!1):!0});if(h>4)return;let I=S?.type===re.AST_TOKEN_TYPES.Template&&S.value.startsWith(`}
|
|
1
|
+
"use strict";var _i=Object.create;var xt=Object.defineProperty;var $i=Object.getOwnPropertyDescriptor;var Ui=Object.getOwnPropertyNames;var zi=Object.getPrototypeOf,Vi=Object.prototype.hasOwnProperty;var Wi=(e,t)=>{for(var r in t)xt(e,r,{get:t[r],enumerable:!0})},or=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ui(t))!Vi.call(e,o)&&o!==r&&xt(e,o,{get:()=>t[o],enumerable:!(n=$i(t,o))||n.enumerable});return e};var Ne=(e,t,r)=>(r=e!=null?_i(zi(e)):{},or(t||!e||!e.__esModule?xt(r,"default",{value:e,enumerable:!0}):r,e)),Ji=e=>or(xt({},"__esModule",{value:!0}),e);var Al={};Wi(Al,{default:()=>Il,extendedLintPlugin:()=>Ni});module.exports=Ji(Al);var be=require("@typescript-eslint/utils"),_=require("zod/v4");var sr=require("@typescript-eslint/utils"),ar=Ne(require("zod/v4"));function U(e){let r=sr.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function z(e){return ar.toJSONSchema(e)}var Xi=_.z.object({disallow:_.z.array(_.z.object({selector:_.z.string(),message:_.z.string(),replace:_.z.optional(_.z.union([_.z.string(),_.z.object({regex:_.z.string(),with:_.z.string()})])),replaceType:_.z.optional(_.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:_.z.optional(_.z.array(_.z.object({fn:_.z.string(),withArgs:_.z.optional(_.z.array(_.z.object({atIndex:_.z.number(),value:_.z.union([_.z.string(),_.z.number(),_.z.boolean()])}))),message:_.z.string(),replaceWith:_.z.optional(_.z.string()),ignoreRegex:_.z.optional(_.z.string())}))),__dev_simulateFileName:_.z.optional(_.z.string()),mustMatchSyntax:_.z.optional(_.z.array(_.z.object({includeRegex:_.z.string(),excludeRegex:_.z.optional(_.z.string()),mustCallFn:_.z.optional(_.z.array(_.z.object({anyCall:_.z.array(_.z.object({fn:_.z.string(),withArgs:_.z.array(_.z.object({atIndex:_.z.number(),literal:_.z.union([_.z.string(),_.z.number(),_.z.boolean()])}))})),message:_.z.optional(_.z.string())}))),mustMatchSelector:_.z.optional(_.z.array(_.z.object({selector:_.z.string(),message:_.z.string()}))),mustHaveExport:_.z.optional(_.z.array(_.z.object({name:_.z.string(),type:_.z.enum(["function","variable","any"]).default("any"),message:_.z.string()})))})))}),zt=U({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[z(Xi)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:s,disallowFnCalls:i}=t,a=o??e.filename,l=[],p=new Map,u=new Set,f=new Map,y=new Set,x=new Map;function m(b){for(let w of b.specifiers)w.type===be.AST_NODE_TYPES.ImportSpecifier&&w.imported.type===be.AST_NODE_TYPES.Identifier&&w.imported.name!==w.local.name&&x.set(w.local.name,w.imported.name)}function h(b){if(b.declaration){if(b.declaration.type===be.AST_NODE_TYPES.FunctionDeclaration&&b.declaration.id){let w=b.declaration.id.name;for(let k of Array.from(y)){let[N,c]=k.split(":");N===w&&(c==="function"||c==="any")&&y.delete(k)}}else if(b.declaration.type===be.AST_NODE_TYPES.VariableDeclaration){for(let w of b.declaration.declarations)if(w.id.type===be.AST_NODE_TYPES.Identifier){let k=w.id.name;for(let N of Array.from(y)){let[c,v]=N.split(":");c===k&&(v==="variable"||v==="any")&&y.delete(N)}}}}for(let w of b.specifiers)if(w.exported.type===be.AST_NODE_TYPES.Identifier){let k=w.exported.name;for(let N of Array.from(y)){let[c,v]=N.split(":");c===k&&v==="any"&&y.delete(N)}}}function C(b){b.id.type===be.AST_NODE_TYPES.Identifier&&b.init?.type===be.AST_NODE_TYPES.Identifier&&x.set(b.id.name,b.init.name)}function S(b){return x.get(b)??b}function I(b,w){return S(b)===w||b===w}for(let{includeRegex:b,excludeRegex:w,mustCallFn:k,mustMatchSelector:N,mustHaveExport:c}of n??[]){let d=function(T){let F=T;for(let{name:P,value:j}of v??[])F=F.replaceAll(P,j);return F};var E=d;let v=Bi(a,new RegExp(b));if(v&&!(w&&new RegExp(w).test(a))){for(let{anyCall:T,message:F}of k??[]){let P=`Expected file to call the function: ${T.map(({fn:j})=>j).join(" or ")}`;u.add(P),l.push(j=>{let{callee:X}=j;if(X.type===be.AST_NODE_TYPES.Identifier){for(let{fn:G,withArgs:q}of T)if(X.name===G){u.delete(P);for(let D of q){let Z=j.arguments[D.atIndex],B=typeof D.literal=="string"?d(D.literal):D.literal;if(!Z){e.report({node:j,messageId:"default",data:{message:`Missing argument with value "${B}" at index ${D.atIndex}${F?`: ${d(F)}`:""}`}});continue}if(Z.type!==be.AST_NODE_TYPES.Literal){e.report({node:Z,messageId:"default",data:{message:`Argument at position ${D.atIndex} should the literal "${B}"${F?`: ${d(F)}`:""}`}});continue}Z.value!==B&&e.report({node:Z,messageId:"default",data:{message:`Argument should have the value "${B}"${F?`: ${d(F)}`:""}`},fix:ue=>ue.replaceText(Z,typeof B=="string"?`'${B}'`:String(B))})}break}}})}for(let{selector:T,message:F}of N??[])f.set(T,d(F)),p.set(d(T),()=>{f.delete(T)});for(let{name:T,type:F,message:P}of c??[]){let j=d(T),X=d(P);y.add(`${j}:${F}:${X}`)}}}for(let{fn:b,withArgs:w,message:k,replaceWith:N,ignoreRegex:c}of i??[])c&&new RegExp(c).test(a)||l.push(v=>{let{callee:d}=v;if(d.type!==be.AST_NODE_TYPES.Identifier||!I(d.name,b))return;if(w)for(let F of w){let P=v.arguments[F.atIndex];if(!P){e.report({node:v,messageId:"default",data:{message:`Missing argument with value "${F.value}" at index ${F.atIndex}: ${k}`}});return}if(P.type!==be.AST_NODE_TYPES.Literal||P.value!==F.value)return}let T=F=>N?F.replaceText(v,N):null;e.report({node:v,messageId:"default",data:{message:k},suggest:N?[{messageId:"default",data:{message:`Replace with "${N}"`},fix:T}]:void 0})});function A(b,w){let k=r[b];k?r[b]=N=>{k(N),w(N)}:r[b]=w}for(let{selector:b,message:w,replace:k,replaceType:N="suggestion"}of s??[]){if(b==="CallExpression"){l.push(c=>{g(k,c,w,N)});continue}r[b]=c=>{g(k,c,w,N)}}if(p.size>0)for(let[b,w]of p)A(b,w);return l.length>0&&(r.CallExpression=b=>{if(b.type===be.AST_NODE_TYPES.CallExpression)for(let w of l)w(b)}),r.ImportDeclaration=b=>{b.type===be.AST_NODE_TYPES.ImportDeclaration&&m(b)},r.ExportNamedDeclaration=b=>{b.type===be.AST_NODE_TYPES.ExportNamedDeclaration&&h(b)},r.VariableDeclarator=b=>{b.type===be.AST_NODE_TYPES.VariableDeclarator&&C(b)},r["Program:exit"]=b=>{for(let w of u)e.report({node:b,messageId:"default",data:{message:w}});for(let[,w]of f)e.report({node:b,messageId:"default",data:{message:w}});for(let w of y){let[k,N,c]=w.split(":");e.report({node:b,messageId:"default",data:{message:`Missing required export "${k}" of type ${N}: ${c}`}})}},r;function g(b,w,k,N){let c=v=>{if(!b)return null;if(typeof b=="string")return v.replaceText(w,b);{let d=new RegExp(b.regex),T=e.sourceCode.getText(w);return v.replaceText(w,T.replace(d,b.with))}};e.report({node:w,messageId:"default",data:{message:k},fix:b&&N==="autofix"?c:void 0,suggest:b&&N==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof b=="string"?b:b.with}"`},fix:c}]:void 0})}}});function Bi(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...s]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:lr(o)}),r.push({name:"$0_uncapitalize",value:pr(o)}),r.push({name:"$0",value:o});for(let i=0;i<s.length;i++){let a=`$${i+1}`,l=s[i];l!==void 0&&(r.push({name:`${a}_lowercase`,value:l.toLowerCase()}),r.push({name:`${a}_capitalize`,value:lr(l)}),r.push({name:`${a}_uncapitalize`,value:pr(l)}),r.push({name:a,value:l}))}return r}function lr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function pr(e){return e.charAt(0).toLowerCase()+e.slice(1)}var re=require("@typescript-eslint/utils"),Ye=require("zod/v4");var Hi=re.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ur="collapse-simple-objs-in-one-line",Yi=Ye.z.object({maxLineLength:Ye.z.number().optional(),maxProperties:Ye.z.number().optional(),nestedObjMaxLineLength:Ye.z.number().optional(),nestedObjMaxProperties:Ye.z.number().optional(),ignoreTypesWithSuffix:Ye.z.array(Ye.z.string()).optional()}),qi=Hi({name:ur,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:[z(Yi)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,s=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function a(p){if(p.type===re.AST_NODE_TYPES.ObjectExpression){let u=p.parent.type===re.AST_NODE_TYPES.Property,f=u?i:o,y=p.properties.length;if(y>f)return!1;if(y===1){let m=p.properties[0];return!m||m.type===re.AST_NODE_TYPES.Property&&m.value.type===re.AST_NODE_TYPES.ObjectExpression||m.type===re.AST_NODE_TYPES.Property&&m.value.type===re.AST_NODE_TYPES.ArrayExpression&&!m.value.elements.every(C=>C&&Vt(C))?!1:{text:r.getText(m),isNested:u,propsSize:y}}let x=[];for(let m of p.properties){if(m.type===re.AST_NODE_TYPES.Property&&!Vt(m.value))return!1;x.push(r.getText(m))}return{text:x.join(", "),isNested:u,propsSize:y}}else{let u=p.parent.parent?.type===re.AST_NODE_TYPES.TSPropertySignature,f=u?i:o,y=p.members.length;if(y>f)return!1;if(n.length>0&&p.parent.type===re.AST_NODE_TYPES.TSTypeAliasDeclaration){let m=p.parent.id.name;if(n.some(h=>m.endsWith(h)))return!1}if(y===1){let m=p.members[0];return!m||m.type===re.AST_NODE_TYPES.TSPropertySignature&&m.typeAnnotation?.typeAnnotation.type===re.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(m),isNested:u,propsSize:1}}if(p.parent.type===re.AST_NODE_TYPES.TSIntersectionType||p.parent.type===re.AST_NODE_TYPES.TSUnionType&&p.parent.types[0]!==p)return!1;let x=[];for(let m of p.members){if(m.type!==re.AST_NODE_TYPES.TSPropertySignature)return!1;let h=m.typeAnnotation?.typeAnnotation;if(!h||h.type===re.AST_NODE_TYPES.TSTypeLiteral||!cr(h))return!1;if(h.type===re.AST_NODE_TYPES.TSTypeReference&&h.typeArguments){if(h.typeArguments.params.length>1)return!1;let S=h.typeArguments.params[0];if(!S||!cr(S))return!1}let C=r.getText(m).trim();(C.endsWith(";")||C.endsWith(","))&&(C=C.slice(0,-1)),x.push(C)}return{text:x.join("; "),isNested:u,propsSize:y}}}function l(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==re.AST_NODE_TYPES.JSXExpressionContainer){let h=0,C=!1,S=r.getTokenAfter(p,{filter:A=>A.type!==re.AST_TOKEN_TYPES.Punctuator||C?!0:A.value===","?(h++,!1):A.value===";"?(h++,C=!0,!1):A.value===")"||A.value==="}"?(h++,!1):!0});if(h>4)return;let I=S?.type===re.AST_TOKEN_TYPES.Template&&S.value.startsWith(`}
|
|
2
2
|
`);if(S?.loc.start.line===p.loc.end.line&&!I)return}let u=a(p);if(!u)return;let f=u.text;if(f.includes(`
|
|
3
3
|
`)||r.getCommentsInside(p).length>0)return;f.endsWith(";")&&(f=f.slice(0,-1));let y=`{ ${f} }`,x=Gi(r,p),m=u.isNested&&u.propsSize>2?s:t.maxLineLength;m&&y.length+x.length+Zi(p,r)>m||e.report({node:p,messageId:"singleLineProp",fix:h=>h.replaceText(p,y)})}return{TSTypeLiteral:l,ObjectExpression:l}}});function cr(e){return e.type===re.AST_NODE_TYPES.TSLiteralType||e.type===re.AST_NODE_TYPES.TSTypeReference||e.type===re.AST_NODE_TYPES.TSNumberKeyword||e.type===re.AST_NODE_TYPES.TSStringKeyword||e.type===re.AST_NODE_TYPES.TSBooleanKeyword||e.type===re.AST_NODE_TYPES.TSNullKeyword||e.type===re.AST_NODE_TYPES.TSUndefinedKeyword}function Vt(e,t){return!!(e.type===re.AST_NODE_TYPES.Literal||e.type===re.AST_NODE_TYPES.Identifier||e.type===re.AST_NODE_TYPES.TemplateLiteral||e.type===re.AST_NODE_TYPES.TaggedTemplateExpression||!t&&e.type===re.AST_NODE_TYPES.ArrayExpression&&e.elements.every(r=>r&&Vt(r,!0)))}function Zi(e,t){let r=t.getLastToken(e);if(!r)return 0;let n=t.text.indexOf(`
|
|
4
4
|
`,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function Gi(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var Wt={name:ur,rule:qi};var Ki=/eslint +react-compiler\/react-compiler: +\["error/;function fr(e){let t=null;if((e.type==="FunctionDeclaration"||e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"&&e.body.type==="BlockStatement")&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r.type==="ExpressionStatement"&&r.expression.type==="Literal"&&r.expression.value==="use no memo"}function mr(e){let t=e.parent;for(;t;){if(t.type==="FunctionDeclaration"||t.type==="FunctionExpression"||t.type==="ArrowFunctionExpression")return t;t=t.parent}return null}var dr={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"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let t=!1,r=typeof e.getSource=="function"?I=>r(I):I=>e.sourceCode.getText(I),n=typeof e.getScope=="function"?()=>n():I=>e.sourceCode.getScope(I),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,s=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:s};function a(I){s&&Array.isArray(I.suggest)&&I.suggest.length>0&&(I.fix=I.suggest[0].fix),e.report(I)}let l=e.getSourceCode().scopeManager,p=new WeakMap,u=new WeakSet,f=new WeakMap,y=new WeakMap,x=new WeakSet;function m(I,A){return function(g){if(A.has(g))return A.get(g);let E=I(g);return A.set(g,E),E}}function h(I,A,g,E,b){b&&I.async&&a({node:I,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
|
|
@@ -12,14 +12,14 @@ 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 w=l.acquire(I),k=new Set,N=null;{let R=w.upper;for(;R&&(k.add(R),R.type!=="function");)R=R.upper;if(!R)return;N=R}let c=Array.isArray;function v(R){if(!c(R.defs))return!1;let O=R.defs[0];if(O==null||O.node.type!=="VariableDeclarator")return!1;let W=O.node.init;if(W==null)return!1;for(;W.type==="TSAsExpression";)W=W.expression;let J=O.node.parent;if(J==null&&(Bt(N.block,O.node.id),J=O.node.parent,J==null))return!1;if(J.kind==="const"&&W.type==="Literal"&&(typeof W.value=="string"||typeof W.value=="number"||W.value===null))return!0;if(W.type!=="CallExpression")return!1;let Y=W.callee;if(Y.type==="MemberExpression"&&Y.object.name==="React"&&Y.property!=null&&!Y.computed&&(Y=Y.property),Y.type!=="Identifier")return!1;let V=O.node.id,{name:K}=Y;if(K==="useRef"&&V.type==="Identifier")return!0;if(ro(Y)&&V.type==="Identifier"){for(let ee of R.references)ee!==V&&x.add(ee.identifier);return!0}else if(K==="useState"||K==="useReducer"){if(V.type==="ArrayPattern"&&V.elements.length===2&&c(R.identifiers)){if(V.elements[1]===R.identifiers[0]){if(K==="useState"){let ee=R.references,Fe=0;for(let Ve=0;Ve<ee.length;Ve++){if(ee[Ve].isWrite()&&Fe++,Fe>1)return!1;p.set(ee[Ve].identifier,V.elements[0])}}return!0}else if(V.elements[0]===R.identifiers[0]){if(K==="useState"){let ee=R.references;for(let Fe=0;Fe<ee.length;Fe++)u.add(ee[Fe].identifier)}return!1}}}else if(K==="useTransition"&&V.type==="ArrayPattern"&&V.elements.length===2&&Array.isArray(R.identifiers)&&V.elements[1]===R.identifiers[0])return!0;return!1}function d(R){if(!c(R.defs))return!1;let O=R.defs[0];if(O==null||O.node==null||O.node.id==null)return!1;let W=O.node,J=N.childScopes,Y=null,V;for(V=0;V<J.length;V++){let K=J[V],ee=K.block;if(W.type==="FunctionDeclaration"&&ee===W||W.type==="VariableDeclarator"&&ee.parent===W){Y=K;break}}if(Y==null)return!1;for(V=0;V<Y.through.length;V++){let K=Y.through[V];if(K.resolved!=null&&k.has(K.resolved.scope)&&!T(K.resolved))return!1}return!0}let T=m(v,f),F=m(d,y),P=new Map;function j(R){let O=R.from,W=!1;for(;O.block!==I;)O.type==="function"&&(W=O.block.parent!=null&&O.block.parent.type==="ReturnStatement"),O=O.upper;return W}let X=new Map,G=new Map;q(w);function q(R){for(let O of R.references){if(!O.resolved||!k.has(O.resolved.scope))continue;let W=Bt(I,O.identifier),J=gr(W),Y=We(J,G);if(b&&J.type==="Identifier"&&(J.parent.type==="MemberExpression"||J.parent.type==="OptionalMemberExpression")&&!J.parent.computed&&J.parent.property.type==="Identifier"&&J.parent.property.name==="current"&&j(O)&&P.set(Y,{reference:O,dependencyNode:J}),J.parent.type==="TSTypeQuery"||J.parent.type==="TSTypeReference")continue;let V=O.resolved.defs[0];if(V!=null&&!(V.node!=null&&V.node.init===I.parent)&&V.type!=="TypeParameter")if(X.has(Y))X.get(Y).references.push(O);else{let K=O.resolved,ee=T(K)||F(K);X.set(Y,{isStable:ee,references:[O]})}}for(let O of R.childScopes)q(O)}P.forEach(({reference:R,dependencyNode:O},W)=>{let J=R.resolved.references,Y=!1;for(let V=0;V<J.length;V++){let{identifier:K}=J[V],{parent:ee}=K;if(ee!=null&&ee.type==="MemberExpression"&&!ee.computed&&ee.property.type==="Identifier"&&ee.property.name==="current"&&ee.parent.type==="AssignmentExpression"&&ee.parent.left===ee){Y=!0;break}}Y||a({node:O.parent.property,message:`The ref value '${W}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${W}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let D=new Set;function Z(R,O){D.has(O)||(D.add(O),a({node:R,message:`Assignments to the '${O}' variable from inside React Hook ${r(g)} 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(g)}.`}))}let B=new Set;if(X.forEach(({isStable:R,references:O},W)=>{R&&B.add(W),O.forEach(J=>{J.writeExpr&&Z(J.writeExpr,W)})}),D.size>0)return;if(!A){let R=null;if(X.forEach(({isStable:O,references:W},J)=>{R||W.forEach(Y=>{if(R)return;let V=Y.identifier;if(!p.has(V))return;let ee=Y.from;for(;ee.type!=="function";)ee=ee.upper;ee.block===I&&(R=J)})}),R){let{suggestedDependencies:O}=Jt({dependencies:X,declaredDependencies:[],stableDependencies:B,externalDependencies:new Set,isEffect:!0});a({node:g,message:`React Hook ${E} contains a call to '${R}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+O.join(", ")+`] as a second argument to the ${E} Hook.`,suggest:[{desc:`Add dependencies array: [${O.join(", ")}]`,fix(W){return W.insertTextAfter(I,`, [${O.join(", ")}]`)}}]})}return}let ue=[],ye=new Set;A.type!=="ArrayExpression"?a({node:A,message:`React Hook ${r(g)} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.`}):A.elements.forEach(R=>{if(R===null)return;if(R.type==="SpreadElement"){a({node:R,message:`React Hook ${r(g)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}x.has(R)&&a({node:R,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(R)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(R)}\``,fix(Y){return Y.removeRange(R.range)}}]});let O;try{O=We(R,G)}catch(Y){if(/Unsupported node type/.test(Y.message)){R.type==="Literal"?X.has(R.value)?a({node:R,message:`The ${R.raw} literal is not a valid dependency because it never changes. Did you mean to include ${R.value} in the array instead?`}):a({node:R,message:`The ${R.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):a({node:R,message:`React Hook ${r(g)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw Y}let W=R;for(;W.type==="MemberExpression"||W.type==="OptionalMemberExpression"||W.type==="ChainExpression";)W=W.object||W.expression.object;let J=!N.through.some(Y=>Y.identifier===W);ue.push({key:O,node:R}),J||ye.add(O)});let{suggestedDependencies:Pe,unnecessaryDependencies:He,missingDependencies:Ee,duplicateDependencies:mt}=Jt({dependencies:X,declaredDependencies:ue,stableDependencies:B,externalDependencies:ye,isEffect:b}),rt=Pe;if(mt.size+Ee.size+He.size===0){let R=mr(g),O=R&&fr(R);if(t&&!O)return;Qi({declaredDependencies:ue,declaredDependenciesNode:A,componentScope:N,scope:w}).forEach(({construction:J,isUsedOutsideOfHook:Y,depType:V})=>{let K=V==="function"?"useCallback":"useMemo",ee=V==="function"?"definition":"initialization",Fe=`wrap the ${ee} of '${J.name.name}' in its own ${K}() Hook.`,Ve=Y?`To fix this, ${Fe}`:`Move it inside the ${E} callback. Alternatively, ${Fe}`,Di=V==="conditional"||V==="logical expression"?"could make":"makes",Li=`The '${J.name.name}' ${V} ${Di} the dependencies of ${E} Hook (at line ${A.loc.start.line}) change on every render. ${Ve}`,rr;Y&&J.type==="Variable"&&V==="function"&&(rr=[{desc:`Wrap the ${ee} of '${J.name.name}' in its own ${K}() Hook.`,fix(ir){let[ji,Mi]=K==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[ir.insertTextBefore(J.node.init,ji),ir.insertTextAfter(J.node.init,Mi)]}}]),a({node:J.node,message:Li,suggest:rr})});return}!b&&Ee.size>0&&(rt=Jt({dependencies:X,declaredDependencies:[],stableDependencies:B,externalDependencies:ye,isEffect:b}).suggestedDependencies);function xe(){if(ue.length===0)return!0;let R=ue.map(W=>W.key),O=R.slice().sort();return R.join(",")===O.join(",")}xe()&&rt.sort();function Ae(R){let O=R.split("."),W="";for(let J=0;J<O.length;J++){if(J!==0){let Y=O.slice(0,J+1).join("."),V=G.get(Y)===!0;W+=V?"?.":"."}W+=O[J]}return W}function Ut(R,O,W,J){return R.size===0?null:(R.size>1?"":O+" ")+W+" "+(R.size>1?"dependencies":"dependency")+": "+to(Array.from(R).sort().map(Y=>"'"+Ae(Y)+"'"))+`. Either ${J} ${R.size>1?"them":"it"} or remove the dependency array.`}let je="";if(He.size>0){let R=null;if(Array.from(He.keys()).forEach(O=>{R===null&&O.endsWith(".current")&&(R=O)}),R!==null)je=` Mutable values like '${R}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(ye.size>0){let O=Array.from(ye)[0];w.set.has(O)||(je=` Outer scope values like '${O}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!je&&Ee.has("props")){let R=X.get("props");if(R==null)return;let O=R.references;if(!Array.isArray(O))return;let W=!0;for(let J=0;J<O.length;J++){let Y=O[J],V=Bt(N.block,Y.identifier);if(!V){W=!1;break}let K=V.parent;if(K==null){W=!1;break}if(K.type!=="MemberExpression"&&K.type!=="OptionalMemberExpression"){W=!1;break}}W&&(je=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${E} call and refer to those specific props inside ${r(g)}.`)}if(!je&&Ee.size>0){let R=null;Ee.forEach(O=>{if(R)return;let W=N.set.get(O),J=X.get(O);if(J.references[0].resolved!==W)return;let Y=W.defs[0];if(Y==null||Y.name==null||Y.type!=="Parameter")return;let V=!1,K;for(let ee=0;ee<J.references.length;ee++)if(K=J.references[ee].identifier,K!=null&&K.parent!=null&&(K.parent.type==="CallExpression"||K.parent.type==="OptionalCallExpression")&&K.parent.callee===K){V=!0;break}V&&(R=O)}),R!==null&&(je=` If '${R}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!je&&Ee.size>0){let R=null;if(Ee.forEach(O=>{if(R!==null)return;let J=X.get(O).references,Y,V;for(let K=0;K<J.length;K++){for(Y=J[K].identifier,V=Y.parent;V!=null&&V!==N.block;){if(V.type==="CallExpression"){let ee=p.get(V.callee);if(ee!=null){if(ee.name===O)R={missingDep:O,setter:V.callee.name,form:"updater"};else if(u.has(Y))R={missingDep:O,setter:V.callee.name,form:"reducer"};else{let Fe=J[K].resolved;if(Fe!=null){let Ve=Fe.defs[0];Ve!=null&&Ve.type==="Parameter"&&(R={missingDep:O,setter:V.callee.name,form:"inlineReducer"})}}break}}V=V.parent}if(R!==null)break}}),R!==null)switch(R.form){case"reducer":je=` You can also replace multiple useState variables with useReducer if '${R.setter}' needs the current value of '${R.missingDep}'.`;break;case"inlineReducer":je=` If '${R.setter}' needs the current value of '${R.missingDep}', you can also switch to useReducer instead of useState and read '${R.missingDep}' in the reducer.`;break;case"updater":je=` You can also do a functional update '${R.setter}(${R.missingDep.slice(0,1)} => ...)' if you only need '${R.missingDep}' in the '${R.setter}' call.`;break;default:throw new Error("Unknown case.")}}a({node:A,message:`React Hook ${r(g)} has `+(Ut(Ee,"a","missing","include")||Ut(He,"an","unnecessary","exclude")||Ut(mt,"a","duplicate","omit"))+je,suggest:[{desc:`Update the dependencies array to be: [${rt.map(Ae).join(", ")}]`,fix(R){return R.replaceText(A,`[${rt.map(Ae).join(", ")}]`)}}]})}function C(I){let A=eo(I.callee,i);if(A===-1)return;let g=I.arguments[A],E=I.callee,b=Sr(E).name,w=I.arguments[A+1],k=/Effect($|[^a-z])/g.test(b);if(!g){a({node:E,message:`React Hook ${b} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(t&&!k){let N=mr(E);if(!(N&&fr(N)))return}if(!w&&!k){(b==="useMemo"||b==="useCallback")&&a({node:E,message:`React Hook ${b} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(g.type){case"FunctionExpression":case"ArrowFunctionExpression":h(g,w,E,b,k);return;case"Identifier":if(!w||w.elements&&w.elements.some(v=>v&&v.type==="Identifier"&&v.name===g.name))return;let N=n(I).set.get(g.name);if(N==null||N.defs==null)return;let c=N.defs[0];if(!c||!c.node||c.type!=="Variable"&&c.type!=="FunctionName")break;switch(c.node.type){case"FunctionDeclaration":h(c.node,w,E,b,k);return;case"VariableDeclarator":let v=c.node.init;if(!v)break;switch(v.type){case"ArrowFunctionExpression":case"FunctionExpression":h(v,w,E,b,k);return}break}break;default:a({node:E,message:`React Hook ${b} received a function whose dependencies are unknown. Pass an inline function instead.`});return}a({node:E,message:`React Hook ${b} has a missing dependency: '${g.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${g.name}]`,fix(N){return N.replaceText(w,`[${g.name}]`)}}]})}if(!!e.options[0]?.reactCompilerIsEnabled)return t=!0,{CallExpression:I=>C(I)};if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let I of e.sourceCode.getAllComments())if(Ki.test(I.value))return t=!0,{CallExpression:A=>C(A)}}return{CallExpression:I=>C(I)}}};function Jt({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:o}){let s=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((h,C)=>{let S=a(s,C);S.isUsed=!0,l(s,C,I=>{I.isSubtreeUsed=!0})}),t.forEach(({key:h})=>{let C=a(s,h);C.isSatisfiedRecursively=!0}),r.forEach(h=>{let C=a(s,h);C.isSatisfiedRecursively=!0});function a(h,C){let S=C.split("."),I=h;for(let A of S){let g=I.children.get(A);g||(g=i(),I.children.set(A,g)),I=g}return I}function l(h,C,S){let I=C.split("."),A=h;for(let g of I){let E=A.children.get(g);if(!E)return;S(E),A=E}}let p=new Set,u=new Set;f(s,p,u,h=>h);function f(h,C,S,I){h.children.forEach((A,g)=>{let E=I(g);if(A.isSatisfiedRecursively){A.isSubtreeUsed&&S.add(E);return}if(A.isUsed){C.add(E);return}f(A,C,S,b=>E+"."+b)})}let y=[],x=new Set,m=new Set;return t.forEach(({key:h})=>{u.has(h)?y.indexOf(h)===-1?y.push(h):m.add(h):x.add(h)}),p.forEach(h=>{y.push(h)}),{suggestedDependencies:y,unnecessaryDependencies:x,duplicateDependencies:m,missingDependencies:p}}function qe(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 qe(e.consequent)!=null||qe(e.alternate)!=null?"conditional":null;case"LogicalExpression":return qe(e.left)!=null||qe(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return qe(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return qe(e.expression);case"TSAsExpression":return qe(e.expression)}return null}function Qi({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let o=e.map(({key:i})=>{let a=r.variables.find(p=>p.name===i);if(a==null)return null;let l=a.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let p=qe(l.node.init);if(p!=null)return[a,p]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[a,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[a,"class"]:null}).filter(Boolean);function s(i){let a=!1;for(let l=0;l<i.references.length;l++){let p=i.references[l];if(p.writeExpr){if(a)return!0;a=!0;continue}let u=p.from;for(;u!==n&&u!=null;)u=u.upper;if(u!==n&&!Tr(t,p.identifier))return!0}return!1}return o.map(([i,a])=>({construction:i.defs[0],depType:a,isUsedOutsideOfHook:s(i)}))}function gr(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)?gr(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function Xt(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),o=`${r}.${n}`;return Xt(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=We(e.object,t),n=We(e.property,null),o=`${r}.${n}`;return Xt(e,t,o),o}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let n=We(r.object,t),o=We(r.property,null),s=`${n}.${o}`;return Xt(r,t,s),s}else throw new Error(`Unsupported node type: ${e.type}`)}function Sr(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function eo(e,t){let r=Sr(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(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return t.additionalHooks.test(n)?0:-1}else return-1}}function Bt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),no(n,t))return n;if(Tr(n,t))for(let[o,s]of Object.entries(n))o!=="parent"&&(yr(s)?(s.parent=n,r.push(s)):Array.isArray(s)&&s.forEach(i=>{yr(i)&&(i.parent=n,r.push(i))}))}return null}function to(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 yr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function no(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 Tr(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function ro(e){return!1}var le=require("@typescript-eslint/utils"),H=Ne(require("typescript")),Zt=require("zod/v4");var Ht=require("@typescript-eslint/utils");function it(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:it(e.parent,t,r===1/0?r:r-1)}function*Yt(e){yield e,e.parent&&(yield*Yt(e.parent))}function qt(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function hr(e,t,r){let o=r.getDeclaredVariables(e).find(s=>s.name===t||s.identifiers[0]?.parent.type===Ht.AST_NODE_TYPES.Property&&s.identifiers[0].parent.key.type===Ht.AST_NODE_TYPES.Identifier&&s.identifiers[0].parent.key.name===t);return o?o.references.filter(s=>!s.init):[]}function Er(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function io(e,t){return e[t]}function Me(e,t,r){let n=r.visitorKeys,o=new Set;function s(i){if(o.has(i))return!1;if(o.add(i),t(i)===!0)return!0;let l=n[i.type];if(l)for(let p of l){let u=io(i,p);if(u){if(Array.isArray(u)){for(let f of u)if(Er(f)&&s(f))return!0}else if(Er(u)&&s(u))return!0}}return!1}s(e)}var oo=le.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),br="improved-no-unnecessary-condition",so=Zt.z.object({alternativeForInCondition:Zt.z.string().optional().describe("Alternative to appear in the error for `in` condition")}),xr={object:"Array",property:"isArray"},ao=["string","number","bigint","boolean","symbol","undefined","object","function","never"],lo=new Set(ao),Gt={name:br,rule:oo({name:br,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".',unnecessaryStartsWithCondition:"This startsWith check is unnecessary as it always evaluates to true.",alwaysFalseStartsWithCondition:"This startsWith check will always be false.",unnecessaryEndsWithCondition:"This endsWith check is unnecessary as it always evaluates to true.",alwaysFalseEndsWithCondition:"This endsWith check will always be false.",unnecessaryIncludesCondition:"This includes check is unnecessary as it always evaluates to true.",alwaysFalseIncludesCondition:"This includes check will always be false.",unnecessaryArrayIsArrayCondition:"This Array.isArray check is unnecessary as it always evaluates to true.",alwaysFalseArrayIsArrayCondition:"This Array.isArray check will always be false.",unnecessaryLengthCondition:"This length comparison is unnecessary as it always evaluates to true.",alwaysFalseLengthCondition:"This length comparison will always be false.",unnecessaryInCondition:'This in check is unnecessary. Property "{{property}}" always exists on type "{{type}}".{{alternative}}',alwaysFalseInCondition:'This in check will always be false. Property "{{property}}" does not exist on type "{{type}}".{{alternative}}'},schema:[z(so)]},defaultOptions:[{}],create(e,[t]){let r=le.ESLintUtils.getParserServices(e,!0),n=r.program?.getTypeChecker();if(!n||!r.program)throw new Error("TypeScript services or program not available");function o(c){return c.type===le.AST_NODE_TYPES.UnaryExpression&&c.operator==="typeof"}function s(c){return c.flags&H.default.TypeFlags.Any||c.flags&H.default.TypeFlags.Unknown?null:c.flags&H.default.TypeFlags.StringLike?["string"]:c.flags&H.default.TypeFlags.NumberLike?["number"]:c.flags&H.default.TypeFlags.BigIntLike?["bigint"]:c.flags&H.default.TypeFlags.BooleanLike?["boolean"]:c.flags&H.default.TypeFlags.ESSymbolLike?["symbol"]:c.flags&H.default.TypeFlags.Undefined||c.flags&H.default.TypeFlags.Void?["undefined"]:c.flags&H.default.TypeFlags.Null?["object"]:c.getCallSignatures().length>0?["function"]:c.flags&H.default.TypeFlags.Object?c.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:c.flags&H.default.TypeFlags.NonPrimitive?["object"]:c.flags&H.default.TypeFlags.Never?["never"]:null}function i(c){if(!n)return null;let v=r.esTreeNodeToTSNodeMap.get(c),d=n.getTypeAtLocation(v.expression);if(d.flags&H.default.TypeFlags.Any||d.flags&H.default.TypeFlags.Unknown)return null;let T=[];if(d.isUnion()){for(let P of d.types){let j=s(P);if(j)T.push(...j);else return null}return T}let F=s(d);return F?(T.push(...F),T):null}function a(c){if(!(c.operator==="==="||c.operator==="!=="))return;let d=null,T=null;if(o(c.left)?(d=c.left,T=c.right.type===le.AST_NODE_TYPES.Literal&&typeof c.right.value=="string"?c.right.value:null):o(c.right)&&(d=c.right,T=c.left.type===le.AST_NODE_TYPES.Literal&&typeof c.left.value=="string"?c.left.value:null),!d||!T||!po(T,lo))return;let F=i(d);if(!F)return;let P=c.operator==="!==",j=F.includes(T);F.length===1?j&&!P?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:ot(d,e),type:T}}):!j&&P?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:ot(d,e),type:Array.from(F)[0]}}):!j&&!P?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:ot(d,e),actualType:Ct(F),conditionType:T}}):j&&P&&e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:ot(d,e),actualType:Ct(F),conditionType:T}}):!j&&!P?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:ot(d,e),actualType:Ct(F),conditionType:T}}):!j&&P&&e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:ot(d,e),type:Ct(F)}})}function l(c){if(c.flags&H.default.TypeFlags.Any||c.flags&H.default.TypeFlags.Unknown)return null;if(c.isUnion()){let v=[];for(let d of c.types)if(d.flags&H.default.TypeFlags.StringLiteral){let T=d.value;v.push(T)}else return null;return v}return c.flags&H.default.TypeFlags.StringLiteral?[c.value]:null}function p(c){if(!n)return null;let v=r.esTreeNodeToTSNodeMap.get(c),d=n.getTypeAtLocation(v),T=l(d);if(T)return T;let F=n.getSymbolAtLocation(v);if(F){let P=n.getTypeOfSymbolAtLocation(F,v),j=l(P);if(j)return j}return null}function u(c){let v=e.sourceCode.ast,d=null;return Me(v,T=>{if(T.type===le.AST_NODE_TYPES.VariableDeclarator&&T.id.type===le.AST_NODE_TYPES.Identifier&&T.id.name===c.name&&T.id.typeAnnotation){let F=T.id.typeAnnotation.typeAnnotation;if(F.type===le.AST_NODE_TYPES.TSUnionType){let P=[];for(let j of F.types)if(j.type===le.AST_NODE_TYPES.TSLiteralType&&j.literal.type===le.AST_NODE_TYPES.Literal&&typeof j.literal.value=="string")P.push(j.literal.value);else return!0;return d=P,!0}if(F.type===le.AST_NODE_TYPES.TSLiteralType&&F.literal.type===le.AST_NODE_TYPES.Literal&&typeof F.literal.value=="string")return d=[F.literal.value],!0}return!1},e.sourceCode),d}function f(c){return c==="Array"||c==="ReadonlyArray"?!0:c.endsWith(".Array")||c.endsWith(".ReadonlyArray")}function y(c){if(!n)return!1;if(n.isArrayType(c)||n.isTupleType(c))return!0;let v=n.getApparentType(c);if(v!==c&&(n.isArrayType(v)||n.isTupleType(v)))return!0;if(c.aliasSymbol){let T=n.getFullyQualifiedName(c.aliasSymbol);if(f(T))return!0}let d=c.getSymbol();if(d){let T=n.getFullyQualifiedName(d);if(f(T))return!0}return!1}function x(c){if(!n)return!1;if(c.flags&H.default.TypeFlags.StringLike||c.flags&H.default.TypeFlags.NumberLike||c.flags&H.default.TypeFlags.BigIntLike||c.flags&H.default.TypeFlags.BooleanLike||c.flags&H.default.TypeFlags.ESSymbolLike||c.flags&H.default.TypeFlags.EnumLike||c.flags&H.default.TypeFlags.Null||c.flags&H.default.TypeFlags.Undefined||c.flags&H.default.TypeFlags.Void||c.flags&H.default.TypeFlags.Never)return!0;let v=c.getSymbol();if(v){let d=n.getFullyQualifiedName(v);if(d==="__function"||d==="__object"&&!y(c))return!0}return!1}function m(c){if(c.flags&H.default.TypeFlags.Any||c.flags&H.default.TypeFlags.Unknown)return"unknown";if(c.isUnion()){let v=!0,d=!0;for(let T of c.types){let F=m(T);if(F==="unknown")return"unknown";F!=="alwaysTrue"&&(v=!1),F!=="alwaysFalse"&&(d=!1)}return v?"alwaysTrue":d?"alwaysFalse":"unknown"}return y(c)?"alwaysTrue":x(c)?"alwaysFalse":"unknown"}function h(c){return!c.computed&&c.object.type===le.AST_NODE_TYPES.Identifier&&c.object.name===xr.object&&c.property.type===le.AST_NODE_TYPES.Identifier&&c.property.name===xr.property}function C(c){if(!n||c.callee.type!==le.AST_NODE_TYPES.MemberExpression||!h(c.callee)||c.arguments.length===0)return;let[v]=c.arguments;if(!v||v.type===le.AST_NODE_TYPES.SpreadElement)return;let d=r.esTreeNodeToTSNodeMap.get(v),T=n.getTypeAtLocation(d),F=m(T);F==="alwaysTrue"?e.report({node:c,messageId:"unnecessaryArrayIsArrayCondition"}):F==="alwaysFalse"&&e.report({node:c,messageId:"alwaysFalseArrayIsArrayCondition"})}function S(c){if(c.callee.type!==le.AST_NODE_TYPES.MemberExpression||c.callee.property.type!==le.AST_NODE_TYPES.Identifier||c.callee.computed)return;let v=c.callee.property.name;if(v!=="startsWith"&&v!=="endsWith"&&v!=="includes"||c.arguments.length!==1)return;let[d]=c.arguments;if(!d||d.type!==le.AST_NODE_TYPES.Literal||typeof d.value!="string")return;let T=c.callee.object,F=p(T);if(!F&&T.type===le.AST_NODE_TYPES.Identifier&&(F=u(T)),!F||F.length===0)return;let P=d.value;if(v==="includes"&&F.length>1)return;let j=0,X=0;for(let G of F)if((v==="startsWith"?G.startsWith(P):v==="endsWith"?G.endsWith(P):G.includes(P))?j++:X++,j>0&&X>0)return;if(j>0&&X===0){let G=v==="startsWith"?"unnecessaryStartsWithCondition":v==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:c,messageId:G})}else if(X>0&&j===0){let G=v==="startsWith"?"alwaysFalseStartsWithCondition":v==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:c,messageId:G})}}function I(c){if(!new Set(["===","!==",">",">=","<","<="]).has(c.operator))return;function d(q){if(q.type!==le.AST_NODE_TYPES.MemberExpression||q.computed||q.property.type!==le.AST_NODE_TYPES.Identifier||q.property.name!=="length")return null;let D=q.object,Z=p(D);if(!Z||Z.length===0)return null;let B=[];for(let ue of Z)B.push(ue.length);return{values:B}}let T=d(c.left),F=d(c.right),P=null,j=null;if(T?c.right.type===le.AST_NODE_TYPES.Literal&&typeof c.right.value=="number"&&(P=T.values,j=c.right.value):F&&c.left.type===le.AST_NODE_TYPES.Literal&&typeof c.left.value=="number"&&(P=F.values,j=c.left.value),!P||j===null)return;let X=0,G=0;for(let q of P){let D=!1;if(c.operator==="==="?D=q===j:c.operator==="!=="?D=q!==j:c.operator===">"?D=q>j:c.operator===">="?D=q>=j:c.operator==="<"?D=q<j:c.operator==="<="&&(D=q<=j),D?X++:G++,X>0&&G>0)return}X>0&&G===0?e.report({node:c,messageId:"unnecessaryLengthCondition"}):G>0&&X===0&&e.report({node:c,messageId:"alwaysFalseLengthCondition"})}function A(c){if(c.type===le.AST_NODE_TYPES.Literal&&typeof c.value=="string")return c.value;let v=p(c);if(!v||v.length!==1)return null;let[d]=v;return d??null}function g(c){return(c.flags&H.default.TypeFlags.Intersection)!==0}function E(c){return(c.flags&H.default.TypeFlags.Object)!==0}function b(c){return!n||n.getIndexTypeOfType(c,H.default.IndexKind.String)?!0:!!n.getIndexTypeOfType(c,H.default.IndexKind.Number)}function w(c,v){if(!n||b(c)||c.getProperties().length===0)return"unknown";let d=n.getPropertyOfType(c,v);return d?d.flags&H.default.SymbolFlags.Optional?"optional":"required":"absent"}function k(c,v){if(c.flags&H.default.TypeFlags.Any||c.flags&H.default.TypeFlags.Unknown||c.flags&H.default.TypeFlags.Never||c.flags&H.default.TypeFlags.TypeParameter||c.flags&H.default.TypeFlags.IndexedAccess||c.flags&H.default.TypeFlags.StringLike||c.flags&H.default.TypeFlags.NumberLike||c.flags&H.default.TypeFlags.BigIntLike||c.flags&H.default.TypeFlags.BooleanLike||c.flags&H.default.TypeFlags.EnumLike||c.flags&H.default.TypeFlags.ESSymbolLike||c.flags&H.default.TypeFlags.NonPrimitive||c.flags&H.default.TypeFlags.Null||c.flags&H.default.TypeFlags.Undefined||c.flags&H.default.TypeFlags.Void)return"unknown";if(c.isUnion()){let d=!0,T=!0;for(let F of c.types){let P=k(F,v);if(P==="unknown"||(P!=="required"&&(d=!1),P!=="absent"&&(T=!1),P==="optional"))return"unknown"}return d?"required":T?"absent":"unknown"}if(g(c)){let d=c,T=!1,F=!1;for(let P of d.types){let j=k(P,v);if(j==="unknown")return"unknown";j==="required"?T=!0:j==="optional"&&(F=!0)}return T?"required":F?"optional":"absent"}return E(c)?w(c,v):"unknown"}function N(c){if(c.operator!=="in"||c.left.type===le.AST_NODE_TYPES.PrivateIdentifier)return;let v=A(c.left);if(!v)return;let d=c.right,T=r.esTreeNodeToTSNodeMap.get(d);if(!n)return;let F=n.getTypeAtLocation(T),P=k(F,v);P==="required"?e.report({node:c,messageId:"unnecessaryInCondition",data:{property:v,type:n.typeToString(F),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}}):P==="absent"&&e.report({node:c,messageId:"alwaysFalseInCondition",data:{property:v,type:n.typeToString(F),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}})}return{BinaryExpression(c){a(c),I(c),N(c)},CallExpression(c){S(c),C(c)}}}})};function Ct(e){return Array.from(new Set(e)).join(" | ")||"never"}function ot(e,t){let r=e.argument;return r.type===le.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function po(e,t){return t.has(e)}var yt=require("@typescript-eslint/utils"),Qe=require("zod/v4");var co=Qe.z.object({functions:Qe.z.array(Qe.z.string().or(Qe.z.object({name:Qe.z.string(),message:Qe.z.string()})))});function uo(e){if(e.type===yt.AST_NODE_TYPES.Identifier)return e.name;if(e.type===yt.AST_NODE_TYPES.MemberExpression&&e.property.type===yt.AST_NODE_TYPES.Identifier&&e.object.type===yt.AST_NODE_TYPES.Identifier)return`${e.object.name}.${e.property.name}`}var Kt=U({name:"no-call-with-explicit-generics",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)",noExplicitGenericsCustom:"{{ message }}"},schema:[z(co)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map,n=new Map;for(let s of t.functions){let i=typeof s=="string"?s:s.name,a=typeof s=="string"?void 0:s.message;i.startsWith("*.")?n.set(i.slice(2),a):r.set(i,a)}function o(s){if(r.has(s))return{message:r.get(s)};let i=s.indexOf(".");if(i!==-1){let a=s.slice(i+1);if(n.has(a))return{message:n.get(a)}}}return{CallExpression(s){let i=uo(s.callee);if(!i||!s.typeArguments)return;let a=o(i);a&&(a.message?e.report({node:s,messageId:"noExplicitGenericsCustom",data:{message:a.message}}):e.report({node:s,messageId:"noExplicitGenerics",data:{functionName:i}}))}}}});var Oe=require("@typescript-eslint/utils"),fo=Oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cr="no-call-with-inferred-generics",mo=fo({name:Cr,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",typeOfUsedInGenerics:"Function '{{ functionName }}' should not be called with 'typeof' in generics",unknownUsedInGenerics:"Function '{{ functionName }}' should not be called with 'unknown' 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"}},disallowTypeOf:{type:"boolean"},disallowUnknown:{type:"boolean"}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(s=>[s.name,s])),n=t.functions.some(s=>s.disallowTypeOf),o=new Set;return{...n&&{TSTypeAliasDeclaration(s){s.typeAnnotation.type===Oe.AST_NODE_TYPES.TSTypeQuery&&o.add(s.id.name)}},CallExpression(s){let{callee:i}=s;if(i.type!==Oe.AST_NODE_TYPES.Identifier)return;let a=r.get(i.name);if(!a)return;let{minGenerics:l=1,allowAny:p,disallowTypes:u=t.disallowTypes,disallowTypeOf:f,disallowUnknown:y}=a;(s.typeArguments?.params.length||0)<(l||0)&&e.report({node:s,messageId:"missingGenericDeclaration",data:{functionName:i.name,minGenerics:l||0}}),!(p&&!u)&&(s.typeArguments?.params.some(m=>!p&&m.type===Oe.AST_NODE_TYPES.TSAnyKeyword||u&&m.type===Oe.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===Oe.AST_NODE_TYPES.Identifier&&u.includes(m.typeName.name))&&e.report({node:s,messageId:"anyUsedInGenerics",data:{functionName:i.name}}),y&&s.typeArguments?.params.some(m=>m.type===Oe.AST_NODE_TYPES.TSUnknownKeyword)&&e.report({node:s,messageId:"unknownUsedInGenerics",data:{functionName:i.name}}),f&&s.typeArguments?.params.some(m=>m.type===Oe.AST_NODE_TYPES.TSTypeQuery||m.type===Oe.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===Oe.AST_NODE_TYPES.Identifier&&o.has(m.typeName.name))&&e.report({node:s,messageId:"typeOfUsedInGenerics",data:{functionName:i.name}}))}}}}),Qt={name:Cr,rule:mo};var wr=require("@typescript-eslint/utils"),yo=wr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Fr="no-commented-out-code",go=["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:"],So=/^\s*return\s+/,To=/\w=("|'|`)/,Eo=/\w+:\s*('|"|`)/,ho=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,bo=/\w+-\w+:/,xo=/\w+_\w+:/,Co=/\?\s+\w/,Io=/:\s+\w/,Ao=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,wo=/^\s*\d+[,}]/,Fo=/^\s*\[[^\]]*\][,}]/,vo=/^\s*\{[^}]*\}[,}]/,Ro=/\.\w+\(/,ko=/\[\w+\]/,Po=/^\s*(['"`]).+?\1\s*:/,No=/^<[A-Z]\w*(\s|>|\/)/,Oo=/^<[a-z]+(\s|>|\/)/,Do=/<[A-Z]\w*(\s.*)?>/,Lo=/<\/[A-Z]\w*>/,jo=/<[a-z]+(\s.*)?>/,Mo=/<\/[a-z]+>/,_o=/^\s*[*\s]*$/,$o=/^[a-zA-Z]/,Uo=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,zo=/```[\s\S]*?```/g,Vo=/`[^`]*`/g,Ir=/[a-zA-Z0-9]/,Wo=/\.[A-Za-z_][A-Za-z0-9_]*\(/,Jo=/[{}[\]()`=<>]/,Xo=/:\s*(['"`[{(]|\w+\s*=>)/,Bo=/\bif\s*\(|\belse\b|=>/,de={returnStatement:So,stringAssignment:To,objectPropertyWithQuotes:Eo,computedPropertyAssignment:ho,kebabCaseProperty:bo,snakeCaseProperty:xo,ternaryOperator:Co,colonWithWord:Io,quotedString:Ao,numberWithComma:wo,arrayWithComma:Fo,objectWithComma:vo,methodCall:Ro,arrayAccess:ko,quotedPropertyKey:Po,jsxSelfClosing:No,jsxElement:Oo,jsxOpeningTag:Do,jsxClosingTag:Lo,htmlOpeningTag:jo,htmlClosingTag:Mo,jsdocComment:_o};function Ho(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&$o.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||Wo.test(t)||Jo.test(t)||Xo.test(t)||Bo.test(t)?!1:!!(t.includes(":")&&Uo.test(t))}var Yo=[") {","return;",de.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",de.stringAssignment,");",de.objectPropertyWithQuotes,de.computedPropertyAssignment,de.kebabCaseProperty,de.snakeCaseProperty,"&&","||","()",de.ternaryOperator,de.colonWithWord,de.quotedString,de.numberWithComma,de.arrayWithComma,de.objectWithComma,de.methodCall,de.arrayAccess,"?.(","??","=>",de.quotedPropertyKey],qo=["/>","</",de.jsxSelfClosing,de.jsxElement,de.jsxOpeningTag,de.jsxClosingTag,de.htmlOpeningTag,de.htmlClosingTag],Ar=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint","cspell:","spell-checker:"],Zo=yo({name:Fr,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(n,o){if(n.startsWith("/"))return!1;let s=n.trimStart();if(n.startsWith("*")||s.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||de.jsdocComment.test(n))return!1;for(let i of Ar)if(s.startsWith(i))return!1;if(n.includes("https://")||Ho(s))return!1;if(o==="Block"){for(let i of qo)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 go)if(s.startsWith(i))return{wrongPattern:i};for(let i of Yo)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,o){let s=n,i=s.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return s;if(o==="Block"&&s.includes("```")){let p=s.split(zo);p.some(f=>Ir.test(f))&&(s=p.join(""))}if(!s.includes("`"))return s;let a=s.split(Vo);return a.some(p=>Ir.test(p))?a.join(""):s}return{Program(){let o=e.sourceCode.getAllComments();for(let s of o){let i=r(s.value,s.type),a=t(i,s.type);a&&e.report({node:s,messageId:"commentedOutCode",data:{wrongPattern:a.wrongPattern,allowedPrefixes:Ar.join(", ")}})}}}}}),en={name:Fr,rule:Zo};var It=require("@typescript-eslint/utils"),Go=It.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),vr="no-default-export",Ko=Go({name:vr,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===It.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),tn={name:vr,rule:Ko};var Rr=require("@typescript-eslint/utils"),Qo=Rr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),kr="no-leaked-text-in-jsx",es=[",",";","[","]","(",")"],ts=Qo({name:kr,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="";es.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),nn={name:kr,rule:ts};var Ze=require("@typescript-eslint/utils"),ns=Ze.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nr="no-non-camel-case-functions",rs=/^(\$?[a-z][a-zA-Z0-9]*)$/;function Pr(e){if(e.typeName.type!==Ze.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Ze.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var is=ns({name:Nr,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!rs.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Ze.AST_NODE_TYPES.TSTypeReference?Pr(r):r.type===Ze.AST_NODE_TYPES.TSUnionType&&r.types.some(o=>o.type===Ze.AST_NODE_TYPES.TSTypeReference&&Pr(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),rn={name:Nr,rule:is};var ae=require("@typescript-eslint/utils");var os=ae.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Or="no-optional-root-props",ss=os({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 s=e.sourceCode.getDeclaredVariables(n)[0];if(!s||s.references.length!==1)return!1;let i=s.references[0];if(!i)return!1;for(let a of Yt(i.identifier)){if("returnType"in a||a.type===ae.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=a.parent;if(!l)return!1;if(l.type===ae.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===ae.TSESTree.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===ae.TSESTree.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let u=it(l.parent.parent,ae.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let f=At(u,e.sourceCode);return f?!(f.parent.type===ae.TSESTree.AST_NODE_TYPES.CallExpression&&f.parent.callee.type===ae.TSESTree.AST_NODE_TYPES.Identifier&&f.parent.callee.name==="memo"):!1}if(a.type===ae.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===ae.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let p=it(l,ae.TSESTree.AST_NODE_TYPES.VariableDeclaration);return p?!!At(p,e.sourceCode):!1}if(l.type===ae.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!At(l,e.sourceCode)}return!1}function r(n){n.key.type!==ae.TSESTree.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:o=>{let s=it(n,ae.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!s)return null;let i=e.sourceCode.getText(s);return o.replaceText(s,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===ae.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(wt(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===ae.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(wt(n)||!t(n)))for(let o of n.body.body)o.type===ae.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(n){if(n.typeName.type!==ae.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==ae.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let s=it(n.parent,ae.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!s)return;let i=At(s,e.sourceCode);if(!(!i||i.parent.type===ae.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===ae.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of o.members)l.type===ae.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function wt(e){return e?e.parent?.type===ae.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===ae.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function At(e,t){if(wt(e))return;let r;if(e.type===ae.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===ae.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===ae.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let o=n.variables.find(i=>i.identifiers.includes(r));if(!o)return;let s=o.references.filter(i=>i.identifier!==r);if(!(s.length!==1||!s[0])&&!wt(s[0].identifier.parent.parent))return s[0].identifier}var on={name:Or,rule:ss};var dt=require("@typescript-eslint/utils");var gt=U({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===dt.AST_NODE_TYPES.Identifier?t.has(n.name):n.type===dt.AST_NODE_TYPES.MemberExpression?r(n.object):!1:!1}return{ImportDeclaration(n){for(let o of n.specifiers)t.add(o.local.name)},ExportNamedDeclaration(n){if(n.source){e.report({node:n,messageId:"noReexport"});return}if(n.declaration?.type===dt.AST_NODE_TYPES.VariableDeclaration)for(let o of n.declaration.declarations)r(o.init)&&e.report({node:n,messageId:"noReexport"});n.specifiers.length>0&&e.report({node:n,messageId:"noReexport"})},ExportDefaultDeclaration(n){n.declaration.type===dt.AST_NODE_TYPES.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});var Dr=require("@typescript-eslint/utils"),Ft=Ne(require("path")),Je=require("zod/v4");var as=Dr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Lr="no-relative-imports",ls=Je.z.object({find:Je.z.string(),replacement:Je.z.string()}),ps=Je.z.object({aliases:Je.z.array(ls),rootDir:Je.z.string().optional(),allowNotFoundAliases:Je.z.boolean().optional(),_dev_simulateFileName:Je.z.string().optional()}),cs=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:[z(ps)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function o(i,a){let l=Ft.default.dirname(a);return Ft.default.resolve(l,i)}function s(i){let a=t.rootDir??process.cwd(),l=Ft.default.relative(a,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:u}of t.aliases)if(l.startsWith(u)){let f=l.replace(u,p);return{alias:p,newPath:f}}return null}return{ImportDeclaration(i){let a=i.source.value;if(!n(a))return;let l=o(a,r),p=s(l);!p&&t.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?u=>u.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),sn={name:Lr,rule:cs};var ge=require("@typescript-eslint/utils"),an=require("zod/v4");var us=an.z.object({customMessage:an.z.string().optional()}),ln=U({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[z(us)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case ge.AST_NODE_TYPES.Literal:return!0;case ge.AST_NODE_TYPES.ObjectExpression:return n.properties.every(o=>o.type===ge.AST_NODE_TYPES.Property?o.computed||o.value.type===ge.AST_NODE_TYPES.Identifier&&o.key.type===ge.AST_NODE_TYPES.Identifier&&o.key.name===o.value.name?!1:r(o.value):!1);case ge.AST_NODE_TYPES.ArrayExpression:return n.elements.every(o=>o?o.type===ge.AST_NODE_TYPES.SpreadElement?!1:r(o):!0);case ge.AST_NODE_TYPES.TemplateLiteral:return n.expressions.length===0;case ge.AST_NODE_TYPES.ConditionalExpression:case ge.AST_NODE_TYPES.LogicalExpression:case ge.AST_NODE_TYPES.BinaryExpression:case ge.AST_NODE_TYPES.UnaryExpression:case ge.AST_NODE_TYPES.CallExpression:case ge.AST_NODE_TYPES.MemberExpression:case ge.AST_NODE_TYPES.Identifier:case ge.AST_NODE_TYPES.ArrowFunctionExpression:case ge.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===ge.AST_NODE_TYPES.JSXIdentifier&&n.name.name==="style"&&n.value){let o=null;n.value.type===ge.AST_NODE_TYPES.JSXExpressionContainer?n.value.expression.type!==ge.AST_NODE_TYPES.JSXEmptyExpression&&(o=n.value.expression):n.value.type===ge.AST_NODE_TYPES.Literal&&(o=n.value),o&&r(o)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var St=require("@typescript-eslint/utils"),et=Ne(require("zod/v4"));var fs=et.object({alternativeMsgs:et.object({inArrayFind:et.string().optional(),inArrayFilter:et.string().optional()}).optional(),__dev_simulateFileName:et.string().optional()});function ms(e){return e.typeAnnotation.type!==St.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var ys=/(typeGuards|type-guards)\.(ts|tsx)$/;function ds(e){return ys.test(e)}function gs(e){let t=e.parent;for(;t;){if(t.type===St.AST_NODE_TYPES.CallExpression&&t.callee.type===St.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===St.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var pn=U({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:[z(fs)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(ds(r))return{};function n(o){if(!ms(o))return;let s=gs(o);if(t.alternativeMsgs&&s){let i=s.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let a=s.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:a,data:{message:i}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});var tt=require("@typescript-eslint/utils");var Ss="no-unnecessary-async-on-jsx-props";function Ts(e){if(e.body.type!==tt.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!==tt.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===tt.AST_NODE_TYPES.AwaitExpression}var cn=U({name:Ss,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){Ts(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,s=[],i=o.getFirstToken(r,l=>l.value==="async");if(i){let l=o.getTokenAfter(i);l?s.push(n.replaceTextRange([i.range[0],l.range[0]],"")):s.push(n.remove(i))}function a(l){if(l.type===tt.AST_NODE_TYPES.AwaitExpression){let p=o.getFirstToken(l);if(p&&p.value==="await"){let u=o.getTokenAfter(p);u?s.push(n.replaceTextRange([p.range[0],u.range[0]],"")):s.push(n.remove(p))}}if(l.type===tt.AST_NODE_TYPES.BlockStatement)for(let p of l.body)a(p);else l.type===tt.AST_NODE_TYPES.ExpressionStatement&&a(l.expression)}return a(r.body),s}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var Xe=require("@typescript-eslint/utils"),un=Ne(require("typescript")),st=Ne(require("zod/v4"));var Es=Xe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),jr="no-unnecessary-casting",hs=st.default.object({additionalCastFunctions:st.default.array(st.default.object({name:st.default.string(),expectedType:st.default.enum(["string","number"])})).optional()}),fn={name:jr,rule:Es({name:jr,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:[z(hs)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=Xe.ESLintUtils.getParserServices(e,!0),s=o.program?.getTypeChecker();if(!s||!o.program)throw new Error("TypeScript services or program not available");function i(u,f){switch(u.type){case Xe.AST_NODE_TYPES.Literal:return f==="number"?typeof u.value=="number":typeof u.value=="string";case Xe.AST_NODE_TYPES.TemplateLiteral:return f==="string";case Xe.AST_NODE_TYPES.UnaryExpression:return f==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function a(u,f){return f==="number"?!!(u.flags&un.TypeFlags.NumberLike):!!(u.flags&un.TypeFlags.StringLike)}function l(u,f){return y=>y.replaceText(u,e.sourceCode.getText(f))}function p(u){if(!s||u.arguments.length!==1)return;let f=u.arguments[0];if(!f||f.type===Xe.AST_NODE_TYPES.SpreadElement)return;let{callee:y}=u;if(y.type!==Xe.AST_NODE_TYPES.Identifier)return;let x=y.name,m=n.find(C=>C.name===x);if(!m)return;if(i(f,m.expectedType)||a(s.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(f)),m.expectedType)){let C,S;x==="Number"?C="unnecessaryNumberCasting":x==="String"?C="unnecessaryStringCasting":(C="unnecessaryCustomCasting",S={name:m.name,type:m.expectedType}),e.report({node:u,messageId:C,...S?{data:S}:{},fix:l(u,f)})}}return{CallExpression:p}}})};var ve=require("@typescript-eslint/utils"),vt=Ne(require("zod/v4"));var bs=vt.object({ignoreWithDescription:vt.string().optional()}),mn=U({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:[z(bs)]},defaultOptions:[{}],create(e,[t]){let r=e.getSourceCode(),n=r.ast;function o(l){let p=l.arguments[0];return p&&p.type===ve.AST_NODE_TYPES.Literal&&typeof p.value=="string"?p.value:null}function s(l){return!l||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(l)}function i(l){return l.length!==1?!1:n.body.filter(u=>{if(u.type===ve.AST_NODE_TYPES.ExpressionStatement){let f=u.expression;if(f.type===ve.AST_NODE_TYPES.CallExpression&&f.callee.type===ve.AST_NODE_TYPES.Identifier){let y=f.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(y)}}return!1}).length===0}function a(l){let p=l.arguments[1];if(p&&(p.type===ve.AST_NODE_TYPES.FunctionExpression||p.type===ve.AST_NODE_TYPES.ArrowFunctionExpression)&&p.body.type===ve.AST_NODE_TYPES.BlockStatement){let u=p.body.body;return u.length===0?"":u.map(y=>r.text.slice(y.range[0],y.range[1])).join(`
|
|
15
|
+
Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let w=l.acquire(I),k=new Set,N=null;{let R=w.upper;for(;R&&(k.add(R),R.type!=="function");)R=R.upper;if(!R)return;N=R}let c=Array.isArray;function v(R){if(!c(R.defs))return!1;let O=R.defs[0];if(O==null||O.node.type!=="VariableDeclarator")return!1;let W=O.node.init;if(W==null)return!1;for(;W.type==="TSAsExpression";)W=W.expression;let J=O.node.parent;if(J==null&&(Bt(N.block,O.node.id),J=O.node.parent,J==null))return!1;if(J.kind==="const"&&W.type==="Literal"&&(typeof W.value=="string"||typeof W.value=="number"||W.value===null))return!0;if(W.type!=="CallExpression")return!1;let Y=W.callee;if(Y.type==="MemberExpression"&&Y.object.name==="React"&&Y.property!=null&&!Y.computed&&(Y=Y.property),Y.type!=="Identifier")return!1;let V=O.node.id,{name:K}=Y;if(K==="useRef"&&V.type==="Identifier")return!0;if(ro(Y)&&V.type==="Identifier"){for(let ee of R.references)ee!==V&&x.add(ee.identifier);return!0}else if(K==="useState"||K==="useReducer"){if(V.type==="ArrayPattern"&&V.elements.length===2&&c(R.identifiers)){if(V.elements[1]===R.identifiers[0]){if(K==="useState"){let ee=R.references,Fe=0;for(let Ve=0;Ve<ee.length;Ve++){if(ee[Ve].isWrite()&&Fe++,Fe>1)return!1;p.set(ee[Ve].identifier,V.elements[0])}}return!0}else if(V.elements[0]===R.identifiers[0]){if(K==="useState"){let ee=R.references;for(let Fe=0;Fe<ee.length;Fe++)u.add(ee[Fe].identifier)}return!1}}}else if(K==="useTransition"&&V.type==="ArrayPattern"&&V.elements.length===2&&Array.isArray(R.identifiers)&&V.elements[1]===R.identifiers[0])return!0;return!1}function d(R){if(!c(R.defs))return!1;let O=R.defs[0];if(O==null||O.node==null||O.node.id==null)return!1;let W=O.node,J=N.childScopes,Y=null,V;for(V=0;V<J.length;V++){let K=J[V],ee=K.block;if(W.type==="FunctionDeclaration"&&ee===W||W.type==="VariableDeclarator"&&ee.parent===W){Y=K;break}}if(Y==null)return!1;for(V=0;V<Y.through.length;V++){let K=Y.through[V];if(K.resolved!=null&&k.has(K.resolved.scope)&&!T(K.resolved))return!1}return!0}let T=m(v,f),F=m(d,y),P=new Map;function j(R){let O=R.from,W=!1;for(;O.block!==I;)O.type==="function"&&(W=O.block.parent!=null&&O.block.parent.type==="ReturnStatement"),O=O.upper;return W}let X=new Map,G=new Map;q(w);function q(R){for(let O of R.references){if(!O.resolved||!k.has(O.resolved.scope))continue;let W=Bt(I,O.identifier),J=gr(W),Y=We(J,G);if(b&&J.type==="Identifier"&&(J.parent.type==="MemberExpression"||J.parent.type==="OptionalMemberExpression")&&!J.parent.computed&&J.parent.property.type==="Identifier"&&J.parent.property.name==="current"&&j(O)&&P.set(Y,{reference:O,dependencyNode:J}),J.parent.type==="TSTypeQuery"||J.parent.type==="TSTypeReference")continue;let V=O.resolved.defs[0];if(V!=null&&!(V.node!=null&&V.node.init===I.parent)&&V.type!=="TypeParameter")if(X.has(Y))X.get(Y).references.push(O);else{let K=O.resolved,ee=T(K)||F(K);X.set(Y,{isStable:ee,references:[O]})}}for(let O of R.childScopes)q(O)}P.forEach(({reference:R,dependencyNode:O},W)=>{let J=R.resolved.references,Y=!1;for(let V=0;V<J.length;V++){let{identifier:K}=J[V],{parent:ee}=K;if(ee!=null&&ee.type==="MemberExpression"&&!ee.computed&&ee.property.type==="Identifier"&&ee.property.name==="current"&&ee.parent.type==="AssignmentExpression"&&ee.parent.left===ee){Y=!0;break}}Y||a({node:O.parent.property,message:`The ref value '${W}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${W}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let D=new Set;function Z(R,O){D.has(O)||(D.add(O),a({node:R,message:`Assignments to the '${O}' variable from inside React Hook ${r(g)} 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(g)}.`}))}let B=new Set;if(X.forEach(({isStable:R,references:O},W)=>{R&&B.add(W),O.forEach(J=>{J.writeExpr&&Z(J.writeExpr,W)})}),D.size>0)return;if(!A){let R=null;if(X.forEach(({isStable:O,references:W},J)=>{R||W.forEach(Y=>{if(R)return;let V=Y.identifier;if(!p.has(V))return;let ee=Y.from;for(;ee.type!=="function";)ee=ee.upper;ee.block===I&&(R=J)})}),R){let{suggestedDependencies:O}=Jt({dependencies:X,declaredDependencies:[],stableDependencies:B,externalDependencies:new Set,isEffect:!0});a({node:g,message:`React Hook ${E} contains a call to '${R}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+O.join(", ")+`] as a second argument to the ${E} Hook.`,suggest:[{desc:`Add dependencies array: [${O.join(", ")}]`,fix(W){return W.insertTextAfter(I,`, [${O.join(", ")}]`)}}]})}return}let ue=[],ye=new Set;A.type!=="ArrayExpression"?a({node:A,message:`React Hook ${r(g)} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.`}):A.elements.forEach(R=>{if(R===null)return;if(R.type==="SpreadElement"){a({node:R,message:`React Hook ${r(g)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}x.has(R)&&a({node:R,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(R)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(R)}\``,fix(Y){return Y.removeRange(R.range)}}]});let O;try{O=We(R,G)}catch(Y){if(/Unsupported node type/.test(Y.message)){R.type==="Literal"?X.has(R.value)?a({node:R,message:`The ${R.raw} literal is not a valid dependency because it never changes. Did you mean to include ${R.value} in the array instead?`}):a({node:R,message:`The ${R.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):a({node:R,message:`React Hook ${r(g)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw Y}let W=R;for(;W.type==="MemberExpression"||W.type==="OptionalMemberExpression"||W.type==="ChainExpression";)W=W.object||W.expression.object;let J=!N.through.some(Y=>Y.identifier===W);ue.push({key:O,node:R}),J||ye.add(O)});let{suggestedDependencies:Pe,unnecessaryDependencies:He,missingDependencies:Ee,duplicateDependencies:mt}=Jt({dependencies:X,declaredDependencies:ue,stableDependencies:B,externalDependencies:ye,isEffect:b}),rt=Pe;if(mt.size+Ee.size+He.size===0){let R=mr(g),O=R&&fr(R);if(t&&!O)return;Qi({declaredDependencies:ue,declaredDependenciesNode:A,componentScope:N,scope:w}).forEach(({construction:J,isUsedOutsideOfHook:Y,depType:V})=>{let K=V==="function"?"useCallback":"useMemo",ee=V==="function"?"definition":"initialization",Fe=`wrap the ${ee} of '${J.name.name}' in its own ${K}() Hook.`,Ve=Y?`To fix this, ${Fe}`:`Move it inside the ${E} callback. Alternatively, ${Fe}`,Di=V==="conditional"||V==="logical expression"?"could make":"makes",Li=`The '${J.name.name}' ${V} ${Di} the dependencies of ${E} Hook (at line ${A.loc.start.line}) change on every render. ${Ve}`,rr;Y&&J.type==="Variable"&&V==="function"&&(rr=[{desc:`Wrap the ${ee} of '${J.name.name}' in its own ${K}() Hook.`,fix(ir){let[ji,Mi]=K==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[ir.insertTextBefore(J.node.init,ji),ir.insertTextAfter(J.node.init,Mi)]}}]),a({node:J.node,message:Li,suggest:rr})});return}!b&&Ee.size>0&&(rt=Jt({dependencies:X,declaredDependencies:[],stableDependencies:B,externalDependencies:ye,isEffect:b}).suggestedDependencies);function xe(){if(ue.length===0)return!0;let R=ue.map(W=>W.key),O=R.slice().sort();return R.join(",")===O.join(",")}xe()&&rt.sort();function Ae(R){let O=R.split("."),W="";for(let J=0;J<O.length;J++){if(J!==0){let Y=O.slice(0,J+1).join("."),V=G.get(Y)===!0;W+=V?"?.":"."}W+=O[J]}return W}function Ut(R,O,W,J){return R.size===0?null:(R.size>1?"":O+" ")+W+" "+(R.size>1?"dependencies":"dependency")+": "+to(Array.from(R).sort().map(Y=>"'"+Ae(Y)+"'"))+`. Either ${J} ${R.size>1?"them":"it"} or remove the dependency array.`}let je="";if(He.size>0){let R=null;if(Array.from(He.keys()).forEach(O=>{R===null&&O.endsWith(".current")&&(R=O)}),R!==null)je=` Mutable values like '${R}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(ye.size>0){let O=Array.from(ye)[0];w.set.has(O)||(je=` Outer scope values like '${O}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!je&&Ee.has("props")){let R=X.get("props");if(R==null)return;let O=R.references;if(!Array.isArray(O))return;let W=!0;for(let J=0;J<O.length;J++){let Y=O[J],V=Bt(N.block,Y.identifier);if(!V){W=!1;break}let K=V.parent;if(K==null){W=!1;break}if(K.type!=="MemberExpression"&&K.type!=="OptionalMemberExpression"){W=!1;break}}W&&(je=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${E} call and refer to those specific props inside ${r(g)}.`)}if(!je&&Ee.size>0){let R=null;Ee.forEach(O=>{if(R)return;let W=N.set.get(O),J=X.get(O);if(J.references[0].resolved!==W)return;let Y=W.defs[0];if(Y==null||Y.name==null||Y.type!=="Parameter")return;let V=!1,K;for(let ee=0;ee<J.references.length;ee++)if(K=J.references[ee].identifier,K!=null&&K.parent!=null&&(K.parent.type==="CallExpression"||K.parent.type==="OptionalCallExpression")&&K.parent.callee===K){V=!0;break}V&&(R=O)}),R!==null&&(je=` If '${R}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!je&&Ee.size>0){let R=null;if(Ee.forEach(O=>{if(R!==null)return;let J=X.get(O).references,Y,V;for(let K=0;K<J.length;K++){for(Y=J[K].identifier,V=Y.parent;V!=null&&V!==N.block;){if(V.type==="CallExpression"){let ee=p.get(V.callee);if(ee!=null){if(ee.name===O)R={missingDep:O,setter:V.callee.name,form:"updater"};else if(u.has(Y))R={missingDep:O,setter:V.callee.name,form:"reducer"};else{let Fe=J[K].resolved;if(Fe!=null){let Ve=Fe.defs[0];Ve!=null&&Ve.type==="Parameter"&&(R={missingDep:O,setter:V.callee.name,form:"inlineReducer"})}}break}}V=V.parent}if(R!==null)break}}),R!==null)switch(R.form){case"reducer":je=` You can also replace multiple useState variables with useReducer if '${R.setter}' needs the current value of '${R.missingDep}'.`;break;case"inlineReducer":je=` If '${R.setter}' needs the current value of '${R.missingDep}', you can also switch to useReducer instead of useState and read '${R.missingDep}' in the reducer.`;break;case"updater":je=` You can also do a functional update '${R.setter}(${R.missingDep.slice(0,1)} => ...)' if you only need '${R.missingDep}' in the '${R.setter}' call.`;break;default:throw new Error("Unknown case.")}}a({node:A,message:`React Hook ${r(g)} has `+(Ut(Ee,"a","missing","include")||Ut(He,"an","unnecessary","exclude")||Ut(mt,"a","duplicate","omit"))+je,suggest:[{desc:`Update the dependencies array to be: [${rt.map(Ae).join(", ")}]`,fix(R){return R.replaceText(A,`[${rt.map(Ae).join(", ")}]`)}}]})}function C(I){let A=eo(I.callee,i);if(A===-1)return;let g=I.arguments[A],E=I.callee,b=Sr(E).name,w=I.arguments[A+1],k=/Effect($|[^a-z])/g.test(b);if(!g){a({node:E,message:`React Hook ${b} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(t&&!k){let N=mr(E);if(!(N&&fr(N)))return}if(!w&&!k){(b==="useMemo"||b==="useCallback")&&a({node:E,message:`React Hook ${b} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(g.type){case"FunctionExpression":case"ArrowFunctionExpression":h(g,w,E,b,k);return;case"Identifier":if(!w||w.elements&&w.elements.some(v=>v&&v.type==="Identifier"&&v.name===g.name))return;let N=n(I).set.get(g.name);if(N==null||N.defs==null)return;let c=N.defs[0];if(!c||!c.node||c.type!=="Variable"&&c.type!=="FunctionName")break;switch(c.node.type){case"FunctionDeclaration":h(c.node,w,E,b,k);return;case"VariableDeclarator":let v=c.node.init;if(!v)break;switch(v.type){case"ArrowFunctionExpression":case"FunctionExpression":h(v,w,E,b,k);return}break}break;default:a({node:E,message:`React Hook ${b} received a function whose dependencies are unknown. Pass an inline function instead.`});return}a({node:E,message:`React Hook ${b} has a missing dependency: '${g.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${g.name}]`,fix(N){return N.replaceText(w,`[${g.name}]`)}}]})}if(!!e.options[0]?.reactCompilerIsEnabled)return t=!0,{CallExpression:I=>C(I)};if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let I of e.sourceCode.getAllComments())if(Ki.test(I.value))return t=!0,{CallExpression:A=>C(A)}}return{CallExpression:I=>C(I)}}};function Jt({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:o}){let s=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((h,C)=>{let S=a(s,C);S.isUsed=!0,l(s,C,I=>{I.isSubtreeUsed=!0})}),t.forEach(({key:h})=>{let C=a(s,h);C.isSatisfiedRecursively=!0}),r.forEach(h=>{let C=a(s,h);C.isSatisfiedRecursively=!0});function a(h,C){let S=C.split("."),I=h;for(let A of S){let g=I.children.get(A);g||(g=i(),I.children.set(A,g)),I=g}return I}function l(h,C,S){let I=C.split("."),A=h;for(let g of I){let E=A.children.get(g);if(!E)return;S(E),A=E}}let p=new Set,u=new Set;f(s,p,u,h=>h);function f(h,C,S,I){h.children.forEach((A,g)=>{let E=I(g);if(A.isSatisfiedRecursively){A.isSubtreeUsed&&S.add(E);return}if(A.isUsed){C.add(E);return}f(A,C,S,b=>E+"."+b)})}let y=[],x=new Set,m=new Set;return t.forEach(({key:h})=>{u.has(h)?y.indexOf(h)===-1?y.push(h):m.add(h):x.add(h)}),p.forEach(h=>{y.push(h)}),{suggestedDependencies:y,unnecessaryDependencies:x,duplicateDependencies:m,missingDependencies:p}}function qe(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 qe(e.consequent)!=null||qe(e.alternate)!=null?"conditional":null;case"LogicalExpression":return qe(e.left)!=null||qe(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return qe(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return qe(e.expression);case"TSAsExpression":return qe(e.expression)}return null}function Qi({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let o=e.map(({key:i})=>{let a=r.variables.find(p=>p.name===i);if(a==null)return null;let l=a.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let p=qe(l.node.init);if(p!=null)return[a,p]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[a,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[a,"class"]:null}).filter(Boolean);function s(i){let a=!1;for(let l=0;l<i.references.length;l++){let p=i.references[l];if(p.writeExpr){if(a)return!0;a=!0;continue}let u=p.from;for(;u!==n&&u!=null;)u=u.upper;if(u!==n&&!Tr(t,p.identifier))return!0}return!1}return o.map(([i,a])=>({construction:i.defs[0],depType:a,isUsedOutsideOfHook:s(i)}))}function gr(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)?gr(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function Xt(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),o=`${r}.${n}`;return Xt(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=We(e.object,t),n=We(e.property,null),o=`${r}.${n}`;return Xt(e,t,o),o}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let n=We(r.object,t),o=We(r.property,null),s=`${n}.${o}`;return Xt(r,t,s),s}else throw new Error(`Unsupported node type: ${e.type}`)}function Sr(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function eo(e,t){let r=Sr(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(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return t.additionalHooks.test(n)?0:-1}else return-1}}function Bt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),no(n,t))return n;if(Tr(n,t))for(let[o,s]of Object.entries(n))o!=="parent"&&(yr(s)?(s.parent=n,r.push(s)):Array.isArray(s)&&s.forEach(i=>{yr(i)&&(i.parent=n,r.push(i))}))}return null}function to(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 yr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function no(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 Tr(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function ro(e){return!1}var le=require("@typescript-eslint/utils"),H=Ne(require("typescript")),Zt=require("zod/v4");var Ht=require("@typescript-eslint/utils");function it(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:it(e.parent,t,r===1/0?r:r-1)}function*Yt(e){yield e,e.parent&&(yield*Yt(e.parent))}function qt(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function hr(e,t,r){let o=r.getDeclaredVariables(e).find(s=>s.name===t||s.identifiers[0]?.parent.type===Ht.AST_NODE_TYPES.Property&&s.identifiers[0].parent.key.type===Ht.AST_NODE_TYPES.Identifier&&s.identifiers[0].parent.key.name===t);return o?o.references.filter(s=>!s.init):[]}function Er(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function io(e,t){return e[t]}function Me(e,t,r){let n=r.visitorKeys,o=new Set;function s(i){if(o.has(i))return!1;if(o.add(i),t(i)===!0)return!0;let l=n[i.type];if(l)for(let p of l){let u=io(i,p);if(u){if(Array.isArray(u)){for(let f of u)if(Er(f)&&s(f))return!0}else if(Er(u)&&s(u))return!0}}return!1}s(e)}var oo=le.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),br="improved-no-unnecessary-condition",so=Zt.z.object({alternativeForInCondition:Zt.z.string().optional().describe("Alternative to appear in the error for `in` condition")}),xr={object:"Array",property:"isArray"},ao=["string","number","bigint","boolean","symbol","undefined","object","function","never"],lo=new Set(ao),Gt={name:br,rule:oo({name:br,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".',unnecessaryStartsWithCondition:"This startsWith check is unnecessary as it always evaluates to true.",alwaysFalseStartsWithCondition:"This startsWith check will always be false.",unnecessaryEndsWithCondition:"This endsWith check is unnecessary as it always evaluates to true.",alwaysFalseEndsWithCondition:"This endsWith check will always be false.",unnecessaryIncludesCondition:"This includes check is unnecessary as it always evaluates to true.",alwaysFalseIncludesCondition:"This includes check will always be false.",unnecessaryArrayIsArrayCondition:"This Array.isArray check is unnecessary as it always evaluates to true.",alwaysFalseArrayIsArrayCondition:"This Array.isArray check will always be false.",unnecessaryLengthCondition:"This length comparison is unnecessary as it always evaluates to true.",alwaysFalseLengthCondition:"This length comparison will always be false.",unnecessaryInCondition:'This in check is unnecessary. Property "{{property}}" always exists on type "{{type}}".{{alternative}}',alwaysFalseInCondition:'This in check will always be false. Property "{{property}}" does not exist on type "{{type}}".{{alternative}}'},schema:[z(so)]},defaultOptions:[{}],create(e,[t]){let r=le.ESLintUtils.getParserServices(e,!0),n=r.program?.getTypeChecker();if(!n||!r.program)throw new Error("TypeScript services or program not available");function o(c){return c.type===le.AST_NODE_TYPES.UnaryExpression&&c.operator==="typeof"}function s(c){return c.flags&H.default.TypeFlags.Any||c.flags&H.default.TypeFlags.Unknown?null:c.flags&H.default.TypeFlags.StringLike?["string"]:c.flags&H.default.TypeFlags.NumberLike?["number"]:c.flags&H.default.TypeFlags.BigIntLike?["bigint"]:c.flags&H.default.TypeFlags.BooleanLike?["boolean"]:c.flags&H.default.TypeFlags.ESSymbolLike?["symbol"]:c.flags&H.default.TypeFlags.Undefined||c.flags&H.default.TypeFlags.Void?["undefined"]:c.flags&H.default.TypeFlags.Null?["object"]:c.getCallSignatures().length>0?["function"]:c.flags&H.default.TypeFlags.Object?c.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:c.flags&H.default.TypeFlags.NonPrimitive?["object"]:c.flags&H.default.TypeFlags.Never?["never"]:null}function i(c){if(!n)return null;let v=r.esTreeNodeToTSNodeMap.get(c),d=n.getTypeAtLocation(v.expression);if(d.flags&H.default.TypeFlags.Any||d.flags&H.default.TypeFlags.Unknown)return null;let T=[];if(d.isUnion()){for(let P of d.types){let j=s(P);if(j)T.push(...j);else return null}return T}let F=s(d);return F?(T.push(...F),T):null}function a(c){if(!(c.operator==="==="||c.operator==="!=="))return;let d=null,T=null;if(o(c.left)?(d=c.left,T=c.right.type===le.AST_NODE_TYPES.Literal&&typeof c.right.value=="string"?c.right.value:null):o(c.right)&&(d=c.right,T=c.left.type===le.AST_NODE_TYPES.Literal&&typeof c.left.value=="string"?c.left.value:null),!d||!T||!po(T,lo))return;let F=i(d);if(!F)return;let P=c.operator==="!==",j=F.includes(T);F.length===1?j&&!P?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:ot(d,e),type:T}}):!j&&P?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:ot(d,e),type:Array.from(F)[0]}}):!j&&!P?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:ot(d,e),actualType:Ct(F),conditionType:T}}):j&&P&&e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:ot(d,e),actualType:Ct(F),conditionType:T}}):!j&&!P?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:ot(d,e),actualType:Ct(F),conditionType:T}}):!j&&P&&e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:ot(d,e),type:Ct(F)}})}function l(c){if(c.flags&H.default.TypeFlags.Any||c.flags&H.default.TypeFlags.Unknown)return null;if(c.isUnion()){let v=[];for(let d of c.types)if(d.flags&H.default.TypeFlags.StringLiteral){let T=d.value;v.push(T)}else return null;return v}return c.flags&H.default.TypeFlags.StringLiteral?[c.value]:null}function p(c){if(!n)return null;let v=r.esTreeNodeToTSNodeMap.get(c),d=n.getTypeAtLocation(v),T=l(d);if(T)return T;let F=n.getSymbolAtLocation(v);if(F){let P=n.getTypeOfSymbolAtLocation(F,v),j=l(P);if(j)return j}return null}function u(c){let v=e.sourceCode.ast,d=null;return Me(v,T=>{if(T.type===le.AST_NODE_TYPES.VariableDeclarator&&T.id.type===le.AST_NODE_TYPES.Identifier&&T.id.name===c.name&&T.id.typeAnnotation){let F=T.id.typeAnnotation.typeAnnotation;if(F.type===le.AST_NODE_TYPES.TSUnionType){let P=[];for(let j of F.types)if(j.type===le.AST_NODE_TYPES.TSLiteralType&&j.literal.type===le.AST_NODE_TYPES.Literal&&typeof j.literal.value=="string")P.push(j.literal.value);else return!0;return d=P,!0}if(F.type===le.AST_NODE_TYPES.TSLiteralType&&F.literal.type===le.AST_NODE_TYPES.Literal&&typeof F.literal.value=="string")return d=[F.literal.value],!0}return!1},e.sourceCode),d}function f(c){return c==="Array"||c==="ReadonlyArray"?!0:c.endsWith(".Array")||c.endsWith(".ReadonlyArray")}function y(c){if(!n)return!1;if(n.isArrayType(c)||n.isTupleType(c))return!0;let v=n.getApparentType(c);if(v!==c&&(n.isArrayType(v)||n.isTupleType(v)))return!0;if(c.aliasSymbol){let T=n.getFullyQualifiedName(c.aliasSymbol);if(f(T))return!0}let d=c.getSymbol();if(d){let T=n.getFullyQualifiedName(d);if(f(T))return!0}return!1}function x(c){if(!n)return!1;if(c.flags&H.default.TypeFlags.StringLike||c.flags&H.default.TypeFlags.NumberLike||c.flags&H.default.TypeFlags.BigIntLike||c.flags&H.default.TypeFlags.BooleanLike||c.flags&H.default.TypeFlags.ESSymbolLike||c.flags&H.default.TypeFlags.EnumLike||c.flags&H.default.TypeFlags.Null||c.flags&H.default.TypeFlags.Undefined||c.flags&H.default.TypeFlags.Void||c.flags&H.default.TypeFlags.Never)return!0;let v=c.getSymbol();if(v){let d=n.getFullyQualifiedName(v);if(d==="__function"||d==="__object"&&!y(c))return!0}return!1}function m(c){if(c.flags&H.default.TypeFlags.Any||c.flags&H.default.TypeFlags.Unknown)return"unknown";if(c.isUnion()){let v=!0,d=!0;for(let T of c.types){let F=m(T);if(F==="unknown")return"unknown";F!=="alwaysTrue"&&(v=!1),F!=="alwaysFalse"&&(d=!1)}return v?"alwaysTrue":d?"alwaysFalse":"unknown"}return y(c)?"alwaysTrue":x(c)?"alwaysFalse":"unknown"}function h(c){return!c.computed&&c.object.type===le.AST_NODE_TYPES.Identifier&&c.object.name===xr.object&&c.property.type===le.AST_NODE_TYPES.Identifier&&c.property.name===xr.property}function C(c){if(!n||c.callee.type!==le.AST_NODE_TYPES.MemberExpression||!h(c.callee)||c.arguments.length===0)return;let[v]=c.arguments;if(!v||v.type===le.AST_NODE_TYPES.SpreadElement)return;let d=r.esTreeNodeToTSNodeMap.get(v),T=n.getTypeAtLocation(d),F=m(T);F==="alwaysTrue"?e.report({node:c,messageId:"unnecessaryArrayIsArrayCondition"}):F==="alwaysFalse"&&e.report({node:c,messageId:"alwaysFalseArrayIsArrayCondition"})}function S(c){if(c.callee.type!==le.AST_NODE_TYPES.MemberExpression||c.callee.property.type!==le.AST_NODE_TYPES.Identifier||c.callee.computed)return;let v=c.callee.property.name;if(v!=="startsWith"&&v!=="endsWith"&&v!=="includes"||c.arguments.length!==1)return;let[d]=c.arguments;if(!d||d.type!==le.AST_NODE_TYPES.Literal||typeof d.value!="string")return;let T=c.callee.object,F=p(T);if(!F&&T.type===le.AST_NODE_TYPES.Identifier&&(F=u(T)),!F||F.length===0)return;let P=d.value;if(v==="includes"&&F.length>1)return;let j=0,X=0;for(let G of F)if((v==="startsWith"?G.startsWith(P):v==="endsWith"?G.endsWith(P):G.includes(P))?j++:X++,j>0&&X>0)return;if(j>0&&X===0){let G=v==="startsWith"?"unnecessaryStartsWithCondition":v==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:c,messageId:G})}else if(X>0&&j===0){let G=v==="startsWith"?"alwaysFalseStartsWithCondition":v==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:c,messageId:G})}}function I(c){if(!new Set(["===","!==",">",">=","<","<="]).has(c.operator))return;function d(q){if(q.type!==le.AST_NODE_TYPES.MemberExpression||q.computed||q.property.type!==le.AST_NODE_TYPES.Identifier||q.property.name!=="length")return null;let D=q.object,Z=p(D);if(!Z||Z.length===0)return null;let B=[];for(let ue of Z)B.push(ue.length);return{values:B}}let T=d(c.left),F=d(c.right),P=null,j=null;if(T?c.right.type===le.AST_NODE_TYPES.Literal&&typeof c.right.value=="number"&&(P=T.values,j=c.right.value):F&&c.left.type===le.AST_NODE_TYPES.Literal&&typeof c.left.value=="number"&&(P=F.values,j=c.left.value),!P||j===null)return;let X=0,G=0;for(let q of P){let D=!1;if(c.operator==="==="?D=q===j:c.operator==="!=="?D=q!==j:c.operator===">"?D=q>j:c.operator===">="?D=q>=j:c.operator==="<"?D=q<j:c.operator==="<="&&(D=q<=j),D?X++:G++,X>0&&G>0)return}X>0&&G===0?e.report({node:c,messageId:"unnecessaryLengthCondition"}):G>0&&X===0&&e.report({node:c,messageId:"alwaysFalseLengthCondition"})}function A(c){if(c.type===le.AST_NODE_TYPES.Literal&&typeof c.value=="string")return c.value;let v=p(c);if(!v||v.length!==1)return null;let[d]=v;return d??null}function g(c){return(c.flags&H.default.TypeFlags.Intersection)!==0}function E(c){return(c.flags&H.default.TypeFlags.Object)!==0}function b(c){return!n||n.getIndexTypeOfType(c,H.default.IndexKind.String)?!0:!!n.getIndexTypeOfType(c,H.default.IndexKind.Number)}function w(c,v){if(!n||b(c)||c.getProperties().length===0)return"unknown";let d=n.getPropertyOfType(c,v);return d?d.flags&H.default.SymbolFlags.Optional?"optional":"required":"absent"}function k(c,v){if(c.flags&H.default.TypeFlags.Any||c.flags&H.default.TypeFlags.Unknown||c.flags&H.default.TypeFlags.Never||c.flags&H.default.TypeFlags.TypeParameter||c.flags&H.default.TypeFlags.IndexedAccess||c.flags&H.default.TypeFlags.StringLike||c.flags&H.default.TypeFlags.NumberLike||c.flags&H.default.TypeFlags.BigIntLike||c.flags&H.default.TypeFlags.BooleanLike||c.flags&H.default.TypeFlags.EnumLike||c.flags&H.default.TypeFlags.ESSymbolLike||c.flags&H.default.TypeFlags.NonPrimitive||c.flags&H.default.TypeFlags.Null||c.flags&H.default.TypeFlags.Undefined||c.flags&H.default.TypeFlags.Void)return"unknown";if(c.isUnion()){let d=!0,T=!0;for(let F of c.types){let P=k(F,v);if(P==="unknown"||(P!=="required"&&(d=!1),P!=="absent"&&(T=!1),P==="optional"))return"unknown"}return d?"required":T?"absent":"unknown"}if(g(c)){let d=c,T=!1,F=!1;for(let P of d.types){let j=k(P,v);if(j==="unknown")return"unknown";j==="required"?T=!0:j==="optional"&&(F=!0)}return T?"required":F?"optional":"absent"}return E(c)?w(c,v):"unknown"}function N(c){if(c.operator!=="in"||c.left.type===le.AST_NODE_TYPES.PrivateIdentifier)return;let v=A(c.left);if(!v)return;let d=c.right,T=r.esTreeNodeToTSNodeMap.get(d);if(!n)return;let F=n.getTypeAtLocation(T),P=k(F,v);P==="required"?e.report({node:c,messageId:"unnecessaryInCondition",data:{property:v,type:n.typeToString(F),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}}):P==="absent"&&e.report({node:c,messageId:"alwaysFalseInCondition",data:{property:v,type:n.typeToString(F),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}})}return{BinaryExpression(c){a(c),I(c),N(c)},CallExpression(c){S(c),C(c)}}}})};function Ct(e){return Array.from(new Set(e)).join(" | ")||"never"}function ot(e,t){let r=e.argument;return r.type===le.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function po(e,t){return t.has(e)}var yt=require("@typescript-eslint/utils"),Qe=require("zod/v4");var co=Qe.z.object({functions:Qe.z.array(Qe.z.string().or(Qe.z.object({name:Qe.z.string(),message:Qe.z.string()})))});function uo(e){if(e.type===yt.AST_NODE_TYPES.Identifier)return e.name;if(e.type===yt.AST_NODE_TYPES.MemberExpression&&e.property.type===yt.AST_NODE_TYPES.Identifier&&e.object.type===yt.AST_NODE_TYPES.Identifier)return`${e.object.name}.${e.property.name}`}var Kt=U({name:"no-call-with-explicit-generics",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)",noExplicitGenericsCustom:"{{ message }}"},schema:[z(co)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map,n=new Map;for(let s of t.functions){let i=typeof s=="string"?s:s.name,a=typeof s=="string"?void 0:s.message;i.startsWith("*.")?n.set(i.slice(2),a):r.set(i,a)}function o(s){if(r.has(s))return{message:r.get(s)};let i=s.indexOf(".");if(i!==-1){let a=s.slice(i+1);if(n.has(a))return{message:n.get(a)}}}return{CallExpression(s){let i=uo(s.callee);if(!i||!s.typeArguments)return;let a=o(i);a&&(a.message?e.report({node:s,messageId:"noExplicitGenericsCustom",data:{message:a.message}}):e.report({node:s,messageId:"noExplicitGenerics",data:{functionName:i}}))}}}});var Oe=require("@typescript-eslint/utils"),fo=Oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cr="no-call-with-inferred-generics",mo=fo({name:Cr,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",typeOfUsedInGenerics:"Function '{{ functionName }}' should not be called with 'typeof' in generics",unknownUsedInGenerics:"Function '{{ functionName }}' should not be called with 'unknown' 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"}},disallowTypeOf:{type:"boolean"},disallowUnknown:{type:"boolean"}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(s=>[s.name,s])),n=t.functions.some(s=>s.disallowTypeOf),o=new Set;return{...n&&{TSTypeAliasDeclaration(s){s.typeAnnotation.type===Oe.AST_NODE_TYPES.TSTypeQuery&&o.add(s.id.name)}},CallExpression(s){let{callee:i}=s;if(i.type!==Oe.AST_NODE_TYPES.Identifier)return;let a=r.get(i.name);if(!a)return;let{minGenerics:l=1,allowAny:p,disallowTypes:u=t.disallowTypes,disallowTypeOf:f,disallowUnknown:y}=a;(s.typeArguments?.params.length||0)<(l||0)&&e.report({node:s,messageId:"missingGenericDeclaration",data:{functionName:i.name,minGenerics:l||0}}),!(p&&!u)&&(s.typeArguments?.params.some(m=>!p&&m.type===Oe.AST_NODE_TYPES.TSAnyKeyword||u&&m.type===Oe.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===Oe.AST_NODE_TYPES.Identifier&&u.includes(m.typeName.name))&&e.report({node:s,messageId:"anyUsedInGenerics",data:{functionName:i.name}}),y&&s.typeArguments?.params.some(m=>m.type===Oe.AST_NODE_TYPES.TSUnknownKeyword)&&e.report({node:s,messageId:"unknownUsedInGenerics",data:{functionName:i.name}}),f&&s.typeArguments?.params.some(m=>m.type===Oe.AST_NODE_TYPES.TSTypeQuery||m.type===Oe.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===Oe.AST_NODE_TYPES.Identifier&&o.has(m.typeName.name))&&e.report({node:s,messageId:"typeOfUsedInGenerics",data:{functionName:i.name}}))}}}}),Qt={name:Cr,rule:mo};var wr=require("@typescript-eslint/utils"),yo=wr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Fr="no-commented-out-code",go=["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:"],So=/^\s*return\s+/,To=/\w=("|'|`)/,Eo=/\w+:\s*('|"|`)/,ho=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,bo=/\w+-\w+:/,xo=/\w+_\w+:/,Co=/\?\s+\w/,Io=/:\s+\w/,Ao=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,wo=/^\s*\d+[,}]/,Fo=/^\s*\[[^\]]*\][,}]/,vo=/^\s*\{[^}]*\}[,}]/,Ro=/\.\w+\(/,ko=/\[\w+\]/,Po=/^\s*(['"`]).+?\1\s*:/,No=/^<[A-Z]\w*(\s|>|\/)/,Oo=/^<[a-z]+(\s|>|\/)/,Do=/<[A-Z]\w*(\s.*)?>/,Lo=/<\/[A-Z]\w*>/,jo=/<[a-z]+(\s.*)?>/,Mo=/<\/[a-z]+>/,_o=/^\s*[*\s]*$/,$o=/^[a-zA-Z]/,Uo=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,zo=/```[\s\S]*?```/g,Vo=/`[^`]*`/g,Ir=/[a-zA-Z0-9]/,Wo=/\.[A-Za-z_][A-Za-z0-9_]*\(/,Jo=/[{}[\]()`=<>]/,Xo=/:\s*(['"`[{(]|\w+\s*=>)/,Bo=/\bif\s*\(|\belse\b|=>/,de={returnStatement:So,stringAssignment:To,objectPropertyWithQuotes:Eo,computedPropertyAssignment:ho,kebabCaseProperty:bo,snakeCaseProperty:xo,ternaryOperator:Co,colonWithWord:Io,quotedString:Ao,numberWithComma:wo,arrayWithComma:Fo,objectWithComma:vo,methodCall:Ro,arrayAccess:ko,quotedPropertyKey:Po,jsxSelfClosing:No,jsxElement:Oo,jsxOpeningTag:Do,jsxClosingTag:Lo,htmlOpeningTag:jo,htmlClosingTag:Mo,jsdocComment:_o};function Ho(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&$o.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||Wo.test(t)||Jo.test(t)||Xo.test(t)||Bo.test(t)?!1:!!(t.includes(":")&&Uo.test(t))}var Yo=[") {","return;",de.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",de.stringAssignment,");",de.objectPropertyWithQuotes,de.computedPropertyAssignment,de.kebabCaseProperty,de.snakeCaseProperty,"&&","||","()",de.ternaryOperator,de.colonWithWord,de.quotedString,de.numberWithComma,de.arrayWithComma,de.objectWithComma,de.methodCall,de.arrayAccess,"?.(","??","=>",de.quotedPropertyKey],qo=["/>","</",de.jsxSelfClosing,de.jsxElement,de.jsxOpeningTag,de.jsxClosingTag,de.htmlOpeningTag,de.htmlClosingTag],Ar=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint","cspell:","spell-checker:"],Zo=yo({name:Fr,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(n,o){if(n.startsWith("/"))return!1;let s=n.trimStart();if(n.startsWith("*")||s.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||de.jsdocComment.test(n))return!1;for(let i of Ar)if(s.startsWith(i))return!1;if(n.includes("https://")||Ho(s))return!1;if(o==="Block"){for(let i of qo)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 go)if(s.startsWith(i))return{wrongPattern:i};for(let i of Yo)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,o){let s=n,i=s.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return s;if(o==="Block"&&s.includes("```")){let p=s.split(zo);p.some(f=>Ir.test(f))&&(s=p.join(""))}if(!s.includes("`"))return s;let a=s.split(Vo);return a.some(p=>Ir.test(p))?a.join(""):s}return{Program(){let o=e.sourceCode.getAllComments();for(let s of o){let i=r(s.value,s.type),a=t(i,s.type);a&&e.report({node:s,messageId:"commentedOutCode",data:{wrongPattern:a.wrongPattern,allowedPrefixes:Ar.join(", ")}})}}}}}),en={name:Fr,rule:Zo};var It=require("@typescript-eslint/utils"),Go=It.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),vr="no-default-export",Ko=Go({name:vr,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===It.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),tn={name:vr,rule:Ko};var Rr=require("@typescript-eslint/utils"),Qo=Rr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),kr="no-leaked-text-in-jsx",es=[",",";","[","]","(",")"],ts=Qo({name:kr,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="";es.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),nn={name:kr,rule:ts};var Ze=require("@typescript-eslint/utils"),ns=Ze.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nr="no-non-camel-case-functions",rs=/^(\$?[a-z][a-zA-Z0-9]*)$/;function Pr(e){if(e.typeName.type!==Ze.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Ze.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var is=ns({name:Nr,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!rs.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Ze.AST_NODE_TYPES.TSTypeReference?Pr(r):r.type===Ze.AST_NODE_TYPES.TSUnionType&&r.types.some(o=>o.type===Ze.AST_NODE_TYPES.TSTypeReference&&Pr(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),rn={name:Nr,rule:is};var se=require("@typescript-eslint/utils");var os=se.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Or="no-optional-root-props",ss=os({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 s=e.sourceCode.getDeclaredVariables(n)[0];if(!s||s.references.length!==1)return!1;let i=s.references[0];if(!i)return!1;for(let a of Yt(i.identifier)){if("returnType"in a||a.type===se.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=a.parent;if(!l)return!1;if(l.type===se.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===se.TSESTree.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===se.TSESTree.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let u=it(l.parent.parent,se.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let f=At(u,e.sourceCode);return f?!(f.parent.type===se.TSESTree.AST_NODE_TYPES.CallExpression&&f.parent.callee.type===se.TSESTree.AST_NODE_TYPES.Identifier&&f.parent.callee.name==="memo"):!1}if(a.type===se.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===se.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let p=it(l,se.TSESTree.AST_NODE_TYPES.VariableDeclaration);return p?!!At(p,e.sourceCode):!1}if(l.type===se.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!At(l,e.sourceCode)}return!1}function r(n){n.key.type!==se.TSESTree.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:o=>{let s=it(n,se.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!s)return null;let i=e.sourceCode.getText(s);return o.replaceText(s,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===se.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(wt(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===se.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(wt(n)||!t(n)))for(let o of n.body.body)o.type===se.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(n){if(n.typeName.type!==se.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==se.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let s=it(n.parent,se.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!s)return;let i=At(s,e.sourceCode);if(!(!i||i.parent.type===se.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===se.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of o.members)l.type===se.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function wt(e){return e?e.parent?.type===se.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===se.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function At(e,t){if(wt(e))return;let r;if(e.type===se.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===se.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===se.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let o=n.variables.find(i=>i.identifiers.includes(r));if(!o)return;let s=o.references.filter(i=>i.identifier!==r);if(!(s.length!==1||!s[0])&&!wt(s[0].identifier.parent.parent))return s[0].identifier}var on={name:Or,rule:ss};var dt=require("@typescript-eslint/utils");var gt=U({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===dt.AST_NODE_TYPES.Identifier?t.has(n.name):n.type===dt.AST_NODE_TYPES.MemberExpression?r(n.object):!1:!1}return{ImportDeclaration(n){for(let o of n.specifiers)t.add(o.local.name)},ExportNamedDeclaration(n){if(n.source){e.report({node:n,messageId:"noReexport"});return}if(n.declaration?.type===dt.AST_NODE_TYPES.VariableDeclaration)for(let o of n.declaration.declarations)r(o.init)&&e.report({node:n,messageId:"noReexport"});n.specifiers.length>0&&e.report({node:n,messageId:"noReexport"})},ExportDefaultDeclaration(n){n.declaration.type===dt.AST_NODE_TYPES.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});var Dr=require("@typescript-eslint/utils"),Ft=Ne(require("path")),Je=require("zod/v4");var as=Dr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Lr="no-relative-imports",ls=Je.z.object({find:Je.z.string(),replacement:Je.z.string()}),ps=Je.z.object({aliases:Je.z.array(ls),rootDir:Je.z.string().optional(),allowNotFoundAliases:Je.z.boolean().optional(),_dev_simulateFileName:Je.z.string().optional()}),cs=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:[z(ps)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function o(i,a){let l=Ft.default.dirname(a);return Ft.default.resolve(l,i)}function s(i){let a=t.rootDir??process.cwd(),l=Ft.default.relative(a,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:u}of t.aliases)if(l.startsWith(u)){let f=l.replace(u,p);return{alias:p,newPath:f}}return null}return{ImportDeclaration(i){let a=i.source.value;if(!n(a))return;let l=o(a,r),p=s(l);!p&&t.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?u=>u.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),sn={name:Lr,rule:cs};var ge=require("@typescript-eslint/utils"),an=require("zod/v4");var us=an.z.object({customMessage:an.z.string().optional()}),ln=U({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[z(us)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case ge.AST_NODE_TYPES.Literal:return!0;case ge.AST_NODE_TYPES.ObjectExpression:return n.properties.every(o=>o.type===ge.AST_NODE_TYPES.Property?o.computed||o.value.type===ge.AST_NODE_TYPES.Identifier&&o.key.type===ge.AST_NODE_TYPES.Identifier&&o.key.name===o.value.name?!1:r(o.value):!1);case ge.AST_NODE_TYPES.ArrayExpression:return n.elements.every(o=>o?o.type===ge.AST_NODE_TYPES.SpreadElement?!1:r(o):!0);case ge.AST_NODE_TYPES.TemplateLiteral:return n.expressions.length===0;case ge.AST_NODE_TYPES.ConditionalExpression:case ge.AST_NODE_TYPES.LogicalExpression:case ge.AST_NODE_TYPES.BinaryExpression:case ge.AST_NODE_TYPES.UnaryExpression:case ge.AST_NODE_TYPES.CallExpression:case ge.AST_NODE_TYPES.MemberExpression:case ge.AST_NODE_TYPES.Identifier:case ge.AST_NODE_TYPES.ArrowFunctionExpression:case ge.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===ge.AST_NODE_TYPES.JSXIdentifier&&n.name.name==="style"&&n.value){let o=null;n.value.type===ge.AST_NODE_TYPES.JSXExpressionContainer?n.value.expression.type!==ge.AST_NODE_TYPES.JSXEmptyExpression&&(o=n.value.expression):n.value.type===ge.AST_NODE_TYPES.Literal&&(o=n.value),o&&r(o)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var St=require("@typescript-eslint/utils"),et=Ne(require("zod/v4"));var fs=et.object({alternativeMsgs:et.object({inArrayFind:et.string().optional(),inArrayFilter:et.string().optional()}).optional(),__dev_simulateFileName:et.string().optional()});function ms(e){return e.typeAnnotation.type!==St.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var ys=/(typeGuards|type-guards)\.(ts|tsx)$/;function ds(e){return ys.test(e)}function gs(e){let t=e.parent;for(;t;){if(t.type===St.AST_NODE_TYPES.CallExpression&&t.callee.type===St.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===St.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var pn=U({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:[z(fs)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(ds(r))return{};function n(o){if(!ms(o))return;let s=gs(o);if(t.alternativeMsgs&&s){let i=s.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let a=s.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:a,data:{message:i}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});var tt=require("@typescript-eslint/utils");var Ss="no-unnecessary-async-on-jsx-props";function Ts(e){if(e.body.type!==tt.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!==tt.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===tt.AST_NODE_TYPES.AwaitExpression}var cn=U({name:Ss,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){Ts(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,s=[],i=o.getFirstToken(r,l=>l.value==="async");if(i){let l=o.getTokenAfter(i);l?s.push(n.replaceTextRange([i.range[0],l.range[0]],"")):s.push(n.remove(i))}function a(l){if(l.type===tt.AST_NODE_TYPES.AwaitExpression){let p=o.getFirstToken(l);if(p&&p.value==="await"){let u=o.getTokenAfter(p);u?s.push(n.replaceTextRange([p.range[0],u.range[0]],"")):s.push(n.remove(p))}}if(l.type===tt.AST_NODE_TYPES.BlockStatement)for(let p of l.body)a(p);else l.type===tt.AST_NODE_TYPES.ExpressionStatement&&a(l.expression)}return a(r.body),s}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var Xe=require("@typescript-eslint/utils"),un=Ne(require("typescript")),st=Ne(require("zod/v4"));var Es=Xe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),jr="no-unnecessary-casting",hs=st.default.object({additionalCastFunctions:st.default.array(st.default.object({name:st.default.string(),expectedType:st.default.enum(["string","number"])})).optional()}),fn={name:jr,rule:Es({name:jr,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:[z(hs)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=Xe.ESLintUtils.getParserServices(e,!0),s=o.program?.getTypeChecker();if(!s||!o.program)throw new Error("TypeScript services or program not available");function i(u,f){switch(u.type){case Xe.AST_NODE_TYPES.Literal:return f==="number"?typeof u.value=="number":typeof u.value=="string";case Xe.AST_NODE_TYPES.TemplateLiteral:return f==="string";case Xe.AST_NODE_TYPES.UnaryExpression:return f==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function a(u,f){return f==="number"?!!(u.flags&un.TypeFlags.NumberLike):!!(u.flags&un.TypeFlags.StringLike)}function l(u,f){return y=>y.replaceText(u,e.sourceCode.getText(f))}function p(u){if(!s||u.arguments.length!==1)return;let f=u.arguments[0];if(!f||f.type===Xe.AST_NODE_TYPES.SpreadElement)return;let{callee:y}=u;if(y.type!==Xe.AST_NODE_TYPES.Identifier)return;let x=y.name,m=n.find(C=>C.name===x);if(!m)return;if(i(f,m.expectedType)||a(s.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(f)),m.expectedType)){let C,S;x==="Number"?C="unnecessaryNumberCasting":x==="String"?C="unnecessaryStringCasting":(C="unnecessaryCustomCasting",S={name:m.name,type:m.expectedType}),e.report({node:u,messageId:C,...S?{data:S}:{},fix:l(u,f)})}}return{CallExpression:p}}})};var ve=require("@typescript-eslint/utils"),vt=Ne(require("zod/v4"));var bs=vt.object({ignoreWithDescription:vt.string().optional()}),mn=U({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:[z(bs)]},defaultOptions:[{}],create(e,[t]){let r=e.getSourceCode(),n=r.ast;function o(l){let p=l.arguments[0];return p&&p.type===ve.AST_NODE_TYPES.Literal&&typeof p.value=="string"?p.value:null}function s(l){return!l||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(l)}function i(l){return l.length!==1?!1:n.body.filter(u=>{if(u.type===ve.AST_NODE_TYPES.ExpressionStatement){let f=u.expression;if(f.type===ve.AST_NODE_TYPES.CallExpression&&f.callee.type===ve.AST_NODE_TYPES.Identifier){let y=f.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(y)}}return!1}).length===0}function a(l){let p=l.arguments[1];if(p&&(p.type===ve.AST_NODE_TYPES.FunctionExpression||p.type===ve.AST_NODE_TYPES.ArrowFunctionExpression)&&p.body.type===ve.AST_NODE_TYPES.BlockStatement){let u=p.body.body;return u.length===0?"":u.map(y=>r.text.slice(y.range[0],y.range[1])).join(`
|
|
16
16
|
|
|
17
17
|
`)}return""}return{Program(){let l=[];for(let y of n.body)y.type===ve.AST_NODE_TYPES.ExpressionStatement&&y.expression.type===ve.AST_NODE_TYPES.CallExpression&&y.expression.callee.type===ve.AST_NODE_TYPES.Identifier&&y.expression.callee.name==="describe"&&y.expression.arguments.length===2&&l.push(y.expression);if(!i(l))return;let[p]=l;if(!p)return;let u=o(p);if(s(u))return;let f=n.body.find(y=>y.type===ve.AST_NODE_TYPES.ExpressionStatement&&y.expression===p);!f||f.type!==ve.AST_NODE_TYPES.ExpressionStatement||e.report({node:p,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(y){let x=a(p);return x?y.replaceText(f,x):null}}]})}}}});var Tt=require("@typescript-eslint/utils"),_e=Ne(require("zod/v4"));var xs=_e.object({methods:_e.union([_e.array(_e.string()),_e.literal("array")])}),yn=U({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:[z(xs)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(a){return Array.isArray(r)?r.includes(a):n.has(a)}function s(a){let{callee:l}=a;if(l.type===Tt.AST_NODE_TYPES.MemberExpression){let p=l.property;if(p.type===Tt.AST_NODE_TYPES.Identifier)return p.name}return null}function i(a,l){if(a.type!==Tt.AST_NODE_TYPES.Identifier||!a.typeAnnotation)return;let p=l.parent;if(p.type===Tt.AST_NODE_TYPES.CallExpression){let u=s(p);u&&o(u)&&p.arguments.indexOf(l)===0&&e.report({node:a.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(y){return a.typeAnnotation?y.remove(a.typeAnnotation):null}})}}return{ArrowFunctionExpression(a){for(let l of a.params)i(l,a)},FunctionExpression(a){for(let l of a.params)i(l,a)}}}});var we=require("@typescript-eslint/utils");var dn=U({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===we.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==we.AST_NODE_TYPES.ObjectExpression||t.id.type===we.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===we.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===we.AST_NODE_TYPES.Property&&i.key.type===we.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==we.AST_NODE_TYPES.Identifier)return;let n=Cs(t,e.sourceCode);if(n.length===0)return;let o=t.init.properties.some(i=>i.type!==we.AST_NODE_TYPES.Property?!1:i.value.type===we.AST_NODE_TYPES.FunctionExpression),s=new Set;for(let i of n){if(i.identifier.parent.type!==we.AST_NODE_TYPES.MemberExpression)return;let a=i.identifier.parent;if(a.object!==i.identifier)return;if(a.computed)if(a.property.type===we.AST_NODE_TYPES.Literal&&typeof a.property.value=="string")s.add(a.property.value);else return;else{if(a.property.type!==we.AST_NODE_TYPES.Identifier)return;s.add(a.property.name)}if(a.parent.type===we.AST_NODE_TYPES.CallExpression&&o)return}for(let[i,a]of r)s.has(i)||e.report({node:a,messageId:"unusedObjectProperty",data:{name:i}})}}}});function Cs(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}var te=require("@typescript-eslint/utils"),gn=require("zod/v4");var Is=gn.z.object({ignoreArgsMatching:gn.z.string().optional()}),Sn=U({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:[z(Is)]},defaultOptions:[{}],create(e,[t]){let r=[];function n(i){return t.ignoreArgsMatching?new RegExp(t.ignoreArgsMatching).test(i):!1}function o(i){return i.type===te.AST_NODE_TYPES.ExportNamedDeclaration||i.type===te.AST_NODE_TYPES.ExportDefaultDeclaration||i.parent?.type===te.AST_NODE_TYPES.ExportNamedDeclaration||i.parent?.type===te.AST_NODE_TYPES.ExportDefaultDeclaration}function s(i){let a=[];for(let l=0;l<i.length;l++){let p=i[l];if(!p||p.type!==te.AST_NODE_TYPES.Identifier)continue;let u=p.name;if(!n(u)){if(p.optional&&p.typeAnnotation&&p.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeLiteral){let f=p.typeAnnotation.typeAnnotation,y=[];for(let x of f.members)x.type===te.AST_NODE_TYPES.TSPropertySignature&&x.key.type===te.AST_NODE_TYPES.Identifier&&y.push({name:x.key.name,optional:x.optional===!0});y.some(x=>x.optional)?a.push({param:p,index:l,name:u,isObjectParam:!0,objectProps:y}):a.push({param:p,index:l,name:u,isObjectParam:!1})}else if(p.optional)a.push({param:p,index:l,name:u,isObjectParam:!1});else if(p.typeAnnotation&&p.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeLiteral){let f=p.typeAnnotation.typeAnnotation,y=[];for(let x of f.members)x.type===te.AST_NODE_TYPES.TSPropertySignature&&x.key.type===te.AST_NODE_TYPES.Identifier&&y.push({name:x.key.name,optional:x.optional===!0});y.some(x=>x.optional)&&a.push({param:p,index:l,name:u,isObjectParam:!0,objectProps:y})}}}return a}return{FunctionDeclaration(i){if(o(i))return;let a=s(i.params);a.length!==0&&r.push({node:i,declarationNode:i,optionalParams:a})},VariableDeclarator(i){if(i.id.type!==te.AST_NODE_TYPES.Identifier||!i.init||i.init.type!==te.AST_NODE_TYPES.ArrowFunctionExpression&&i.init.type!==te.AST_NODE_TYPES.FunctionExpression||o(i.parent.parent))return;let l=[...s(i.init.params)];if(i.id.typeAnnotation&&i.id.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeReference){let p=i.id.typeAnnotation.typeAnnotation;if(p.typeName.type===te.AST_NODE_TYPES.Identifier&&p.typeName.name==="FC"){let u=p.typeArguments;if(u&&u.params.length===1){let f=u.params[0];if(f&&f.type===te.AST_NODE_TYPES.TSTypeLiteral){let y=[];for(let x of f.members)x.type===te.AST_NODE_TYPES.TSPropertySignature&&x.key.type===te.AST_NODE_TYPES.Identifier&&y.push({name:x.key.name,optional:x.optional===!0});y.some(x=>x.optional)&&l.push({param:i.id,index:0,name:"props",isObjectParam:!0,objectProps:y})}}}}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 p=l.references.filter(y=>y.identifier!==l.identifiers[0]);if(p.length===0)continue;let u=!1;for(let y of p){let x=y.identifier.parent;if(x.type===te.AST_NODE_TYPES.CallExpression&&y.identifier.type===te.AST_NODE_TYPES.Identifier&&x.arguments.includes(y.identifier)){u=!0;break}if(x.type===te.AST_NODE_TYPES.ReturnStatement){u=!0;break}if(x.type===te.AST_NODE_TYPES.Property&&x.parent.type===te.AST_NODE_TYPES.ObjectExpression&&x.parent.parent.type===te.AST_NODE_TYPES.ReturnStatement){u=!0;break}if(x.type===te.AST_NODE_TYPES.JSXExpressionContainer){u=!0;break}}if(u)continue;let f=[];for(let y of p){let x=y.identifier.parent;if(x.type===te.AST_NODE_TYPES.CallExpression&&x.callee===y.identifier){let m=x.arguments.length,h=x.arguments.some(S=>S.type===te.AST_NODE_TYPES.SpreadElement);if(h){u=!0;break}let C={argCount:m,hasSpread:h};for(let S of i.optionalParams)if(S.isObjectParam&&S.index<m){let I=x.arguments[S.index];if(I?.type===te.AST_NODE_TYPES.ObjectExpression){let A={};for(let g of I.properties)g.type===te.AST_NODE_TYPES.Property&&g.key.type===te.AST_NODE_TYPES.Identifier&&(A[g.key.name]=!0);C.objectArgs||(C.objectArgs=[]),C.objectArgs[S.index]=A}else if(I){u=!0;break}}f.push(C)}else if(x.type===te.AST_NODE_TYPES.JSXOpeningElement&&x.name===y.identifier){let m=x.attributes.some(C=>C.type===te.AST_NODE_TYPES.JSXSpreadAttribute);if(m){u=!0;break}let h={argCount:1,hasSpread:m};for(let C of i.optionalParams)if(C.isObjectParam&&C.index===0){let S={};for(let I of x.attributes)I.type===te.AST_NODE_TYPES.JSXAttribute&&I.name.type===te.AST_NODE_TYPES.JSXIdentifier&&(S[I.name.name]=!0);h.objectArgs||(h.objectArgs=[]),h.objectArgs[0]=S}f.push(h)}}if(!(u||f.length===0))for(let y of i.optionalParams)if(y.isObjectParam&&y.objectProps)for(let x of y.objectProps){if(!x.optional)continue;let m=!1;for(let h of f)if(h.objectArgs&&h.objectArgs[y.index]){let C=h.objectArgs[y.index];if(C&&C[x.name]){m=!0;break}}m||e.report({node:y.param,messageId:"unusedOptionalProp",data:{name:x.name}})}else{let x=!1;for(let m of f)if(m.argCount>y.index){x=!0;break}x||e.report({node:y.param,messageId:"unusedOptionalArg",data:{name:y.name}})}}}}}});var pe=require("@typescript-eslint/utils"),Ge=require("zod/v4");var As=Ge.z.object({selectors:Ge.z.array(Ge.z.object({name:Ge.z.string(),selectorProp:Ge.z.string().optional(),selectorArgPos:Ge.z.number().optional(),returnProp:Ge.z.string().optional()}))}),ws=pe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mr="no-unused-selected-values",Tn={name:Mr,rule:ws({name:Mr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[z(As)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let s=null;if(o.init?.type===pe.AST_NODE_TYPES.CallExpression&&(s=o.init),!s)return;let i=vs(s);if(!i)return;let a=n.get(i);if(!a)return;let l=Fs(s,a.selectorArgPos??0,a.selectorProp);if(!l)return;let p=Rs(l);if(!p)return;let u=_r(p.properties,void 0);if(!u)return;if(o.id.type===pe.AST_NODE_TYPES.ObjectPattern){let x=_r(o.id.properties,a.returnProp);if(!x)return;for(let[m,h]of u)x.has(m)||e.report({node:h,messageId:"unusedSelectedValue",data:{name:m}});return}if(o.id.type!==pe.AST_NODE_TYPES.Identifier||a.returnProp)return;let f=ks(o,e.sourceCode);if(f.length===0)return;let y=new Set;for(let x of f){if(x.identifier.parent.type!==pe.AST_NODE_TYPES.MemberExpression)return;let m=x.identifier.parent.property;if(m.type!==pe.AST_NODE_TYPES.Identifier)return;y.add(m.name)}for(let[x,m]of u)y.has(x)||e.report({node:m,messageId:"unusedSelectedValue",data:{name:x}})}}}})};function Fs(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===pe.AST_NODE_TYPES.ArrowFunctionExpression||n.type===pe.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===pe.AST_NODE_TYPES.ObjectExpression){let o=n.properties.find(i=>i.type===pe.AST_NODE_TYPES.Property&&i.key.type===pe.AST_NODE_TYPES.Identifier&&i.key.name===r);if(o?.type!==pe.AST_NODE_TYPES.Property)return null;let s=o.value;if(s.type===pe.AST_NODE_TYPES.ArrowFunctionExpression||s.type===pe.AST_NODE_TYPES.FunctionExpression)return s}return null}function vs(e){return e.callee.type===pe.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===pe.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===pe.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Rs(e){if(e.body.type===pe.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===pe.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===pe.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==pe.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function _r(e,t){let r=e;if(t){let o=e.find(s=>s.type===pe.AST_NODE_TYPES.Property&&s.key.type===pe.AST_NODE_TYPES.Identifier&&s.key.name===t);if(o?.type!==pe.AST_NODE_TYPES.Property||o.value.type!==pe.AST_NODE_TYPES.ObjectPattern)return null;r=o.value.properties}let n=new Map;for(let o of r){if(o.type!==pe.AST_NODE_TYPES.Property||o.key.type!==pe.AST_NODE_TYPES.Identifier)return null;n.set(o.key.name,o)}return n.size>0?n:null}function ks(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}var ce=require("@typescript-eslint/utils");var En=U({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(s=>s.type===ce.AST_NODE_TYPES.ImportDeclaration&&s.source.value==="t-state-form"))return{};let n=null,o=!1;return{CallExpression(s){if(o)return;if(!n){let a=Ps(s);a&&(n=a);return}let i=Ns(s,e.sourceCode);if(i){o=!0;for(let a of i)n.delete(a);if(n.size!==0)for(let[a,l]of n)e.report({node:l,messageId:"unusedField",data:{name:a}})}}}}});function Ps(e){if(!(e.callee.type===ce.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==ce.AST_NODE_TYPES.ObjectExpression)return null;let n=qt(r.properties,s=>s.type!==ce.AST_NODE_TYPES.Property||s.key.type!==ce.AST_NODE_TYPES.Identifier||s.key.name!=="initialConfig"?null:s.value.type===ce.AST_NODE_TYPES.ObjectExpression?s.value:s.value.type===ce.AST_NODE_TYPES.ArrowFunctionExpression||s.value.type===ce.AST_NODE_TYPES.FunctionExpression?Os(s.value):null);if(!n)return null;let o=new Map;for(let s of n.properties)s.type===ce.AST_NODE_TYPES.Property&&s.key.type===ce.AST_NODE_TYPES.Identifier&&o.set(s.key.name,s);return o}function Ns(e,t){if(!(e.callee.type===ce.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==ce.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==ce.AST_NODE_TYPES.ObjectPattern||!qt(e.parent.id.properties,i=>i.type===ce.AST_NODE_TYPES.Property&&i.key.type===ce.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let o=hr(e.parent,"formFields",t),s=new Set;for(let{identifier:i}of o){if(i.type!==ce.AST_NODE_TYPES.Identifier||i.parent.type===ce.AST_NODE_TYPES.Property&&i.parent.parent.type===ce.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===ce.AST_NODE_TYPES.ReturnStatement||i.parent.type===ce.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===ce.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==ce.AST_NODE_TYPES.Identifier||i.parent.property.type!==ce.AST_NODE_TYPES.Identifier)return null;s.add(i.parent.property.name)}}return s}function Os(e){if(e.body.type===ce.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===ce.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===ce.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==ce.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var oe=require("@typescript-eslint/utils"),Et=require("zod/v4");var Ds=oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function $r(e){let t=[];for(let r of e.members)r.type===oe.AST_NODE_TYPES.TSPropertySignature&&r.key.type===oe.AST_NODE_TYPES.Identifier&&t.push([r.key.name,r]);return t}function Ur(e,...t){for(let r of t)e.set(...r);return e}var Ls=Et.z.object({forceCheckOnFCPropTypesWithName:Et.z.array(Et.z.string()).optional(),alwaysCheckFunctionOptionTypes:Et.z.boolean().optional()}),zr="no-unused-type-props-in-args",hn=null,js=Ds({name:zr,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:[z(Ls)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!hn&&(hn=r.map(l=>new RegExp(l)));function o(l,p,u,f,y=!0,x=!1){let m=u.name,h=e.sourceCode.getScope(p).references.find(g=>g.identifier.name===m)?.resolved,C=l&&hn?.some(g=>g.test(m)),S=x&&n;if(!h||!C&&h.references.filter(g=>g.isTypeReference).length>1||!h.defs[0])return;let I=h.defs[0].node,A=I.parent?.type===oe.AST_NODE_TYPES.ExportNamedDeclaration;if(!(y&&A&&!S)){if(I.type===oe.AST_NODE_TYPES.TSTypeAliasDeclaration){s(l,p,f,I.typeAnnotation,!0,x);return}if(I.type===oe.AST_NODE_TYPES.TSInterfaceDeclaration){s(l,p,f,I.body,!0,x);return}}}function s(l,p,u,f,y,x=!1){if(f.type===oe.AST_NODE_TYPES.TSInterfaceBody){for(let m of f.body)m.type===oe.AST_NODE_TYPES.TSPropertySignature&&m.key.type===oe.AST_NODE_TYPES.Identifier&&u.set(m.key.name,m);return}if(f.type===oe.AST_NODE_TYPES.TSTypeLiteral){Ur(u,...$r(f));return}if(f.type===oe.AST_NODE_TYPES.TSIntersectionType){for(let m of f.types)s(l,p,u,m,!0,x);return}y||f.type===oe.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===oe.AST_NODE_TYPES.Identifier&&o(l,p,f.typeName,u,!0,x)}function i(l,p,u,f=!1){for(let y of u)if(y.type===oe.AST_NODE_TYPES.ObjectPattern&&y.typeAnnotation){let x=new Map;if(s(l,p,x,y.typeAnnotation.typeAnnotation,!1,f),x.size===0)continue;a(y,x)}else y.type===oe.AST_NODE_TYPES.AssignmentPattern&&y.left.type===oe.AST_NODE_TYPES.ObjectPattern&&i(l,p,[y.left],f)}function a(l,p){let u=[];if(l.properties.at(-1)?.type===oe.AST_NODE_TYPES.RestElement)return;for(let m of l.properties)m.type===oe.AST_NODE_TYPES.Property&&m.key.type===oe.AST_NODE_TYPES.Identifier&&u.push(m.key.name);let y=[],x=[];for(let[m,h]of p)u.includes(m)||(x.push(m),y.push({node:h,messageId:"unusedObjectTypeProperty",data:{propertyName:m}}));for(let[m,h]of y.entries())e.report({...h,fix:m===y.length-1?C=>{let S=l.properties.at(-1),I=x.join(", ");return S?S.type===oe.AST_NODE_TYPES.RestElement?null:C.insertTextAfter(S,`, ${I}`):C.insertTextBeforeRange([l.range[0]+1,l.range[1]],I)}:void 0})}return{VariableDeclaration(l){let p=l.declarations[0],u=new Map,f=p.id.type===oe.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===oe.AST_NODE_TYPES.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===oe.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(f){if(f.type===oe.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===oe.AST_NODE_TYPES.Identifier)o(!0,l,f.typeName,u,!1);else if(f.type===oe.AST_NODE_TYPES.TSTypeLiteral)Ur(u,...$r(f));else if(f.type===oe.AST_NODE_TYPES.TSIntersectionType)for(let y of f.types)y.type===oe.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===oe.AST_NODE_TYPES.Identifier?o(!0,l,y.typeName,u,!1):s(!0,l,u,y,!0);if(u.size!==0&&p.init?.type===oe.AST_NODE_TYPES.ArrowFunctionExpression){let y=p.init.params[0];if(!y){e.report({node:p.init,messageId:"missingComponentParam"});return}y.type===oe.AST_NODE_TYPES.ObjectPattern&&a(y,u)}}},FunctionDeclaration(l){i(!1,l,l.params,n)},ArrowFunctionExpression(l){i(!1,l,l.params,n)}}}}),bn={name:zr,rule:js};var De=require("@typescript-eslint/utils");var xn=U({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===De.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===De.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===De.AST_NODE_TYPES.Identifier&&n.callee.property.type===De.AST_NODE_TYPES.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let o of n.specifiers)o.type===De.AST_NODE_TYPES.ImportSpecifier&&o.imported.type===De.AST_NODE_TYPES.Identifier&&o.imported.name==="useRef"&&t.add(o.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===De.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===De.AST_NODE_TYPES.Identifier){let s=e.sourceCode.getScope(n).set.get(n.id.name);if(s){let i=!1;for(let a of s.references){let p=a.identifier.parent;if(p!==n&&!(p.type===De.AST_NODE_TYPES.JSXExpressionContainer&&p.parent.type===De.AST_NODE_TYPES.JSXAttribute&&p.parent.name.type===De.AST_NODE_TYPES.JSXIdentifier&&p.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var at=require("@typescript-eslint/utils"),Ms=at.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Wr="prefer-named-functions",Vr=new Map,_s=Ms({name:Wr,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=Vr.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),Vr.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===at.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===at.AST_NODE_TYPES.Identifier){let o=n.id.name;if(n.id.typeAnnotation||r&&r.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==at.AST_NODE_TYPES.BlockStatement)return;let s=n.parent,i=n.init.params,a=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(s,`${l.async?"async ":""}function ${o}(${i.map(u=>e.sourceCode.getText(u)).join(", ")||""}) ${e.sourceCode.getText(a)}`)}]})}}}}}),Cn={name:Wr,rule:_s};var Q=require("@typescript-eslint/utils"),$e=require("zod/v4");var $s=$e.z.object({disallowedFunctions:$e.z.array($e.z.object({name:$e.z.string(),allowUsingWithArgs:$e.z.boolean().optional(),hookAlternative:$e.z.string().optional(),message:$e.z.string().optional(),allowUseInside:$e.z.array($e.z.string()).optional()}))}),Us=/^use[A-Z]/,zs=/^[A-Z]/;function Rt(e){return Us.test(e)}function Jr(e){return zs.test(e)}function Vs(e){return e.type===Q.AST_NODE_TYPES.Identifier?Rt(e.name):e.type===Q.AST_NODE_TYPES.MemberExpression&&e.property.type===Q.AST_NODE_TYPES.Identifier?Rt(e.property.name):!1}function Xr(e,t){return e.type===Q.AST_NODE_TYPES.Identifier?e.name===t:e.type===Q.AST_NODE_TYPES.MemberExpression&&e.object.type===Q.AST_NODE_TYPES.Identifier&&e.property.type===Q.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function Br(e){return!!(e.parent&&e.parent.type===Q.AST_NODE_TYPES.CallExpression&&Xr(e.parent.callee,"forwardRef"))}function Hr(e){return!!(e.parent&&e.parent.type===Q.AST_NODE_TYPES.CallExpression&&Xr(e.parent.callee,"memo"))}function In(e){if(e.type===Q.AST_NODE_TYPES.FunctionDeclaration||e.type===Q.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===Q.AST_NODE_TYPES.FunctionExpression||e.type===Q.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===Q.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===Q.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===Q.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===Q.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Ws(e){let t=e.parent,r=!1;for(;t;){if(t.type===Q.AST_NODE_TYPES.FunctionDeclaration||t.type===Q.AST_NODE_TYPES.FunctionExpression||t.type===Q.AST_NODE_TYPES.ArrowFunctionExpression){let n=In(t);if(n&&n.type===Q.AST_NODE_TYPES.Identifier){if(Jr(n.name)||Rt(n.name))return!r;r=!0}else{if(Br(t)||Hr(t))return!r;if(t.parent.type===Q.AST_NODE_TYPES.CallExpression){let o=t.parent;Vs(o.callee)||(r=!0)}else t.parent.type===Q.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Yr(e){return e.callee.type===Q.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===Q.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===Q.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Js(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===Q.AST_NODE_TYPES.FunctionDeclaration||r.type===Q.AST_NODE_TYPES.FunctionExpression||r.type===Q.AST_NODE_TYPES.ArrowFunctionExpression){let n=In(r);if(n&&n.type===Q.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===Q.AST_NODE_TYPES.CallExpression){let n=Yr(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function Xs(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===Q.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function Bs(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===Q.AST_NODE_TYPES.FunctionDeclaration||n.type===Q.AST_NODE_TYPES.FunctionExpression||n.type===Q.AST_NODE_TYPES.ArrowFunctionExpression){let o=In(n);if(o&&o.type===Q.AST_NODE_TYPES.Identifier){if(Jr(o.name)||Rt(o.name)){r=!0;break}}else if(Br(n)||Hr(n)){r=!0;break}}n=n.parent}return r?t.length===0?Ws(e):!Js(e,t):!1}var An=U({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:[z($s)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let s=Yr(o);if(!s)return;let i=n.get(s);if(!i||i.allowUsingWithArgs&&Xs(o))return;let a=i.allowUseInside||[];Bs(o,a)&&e.report({node:o,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:l=>{let p=i.hookAlternative;return p?o.callee.type===Q.AST_NODE_TYPES.Identifier?l.replaceText(o.callee,p):o.callee.type===Q.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===Q.AST_NODE_TYPES.Identifier?l.replaceText(o.callee.property,p):null:null}}]:[]})}}}});var fe=require("@typescript-eslint/utils"),kt=Ne(require("zod/v4"));var Hs=fe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Zr="prefer-single-line-if",Ys=kt.default.object({maxLineLength:kt.default.number().optional(),maxNonSimpleConditionLength:kt.default.number().optional()}),qs=Hs({name:Zr,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:[z(Ys)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==fe.AST_NODE_TYPES.BlockStatement||n.loc.start.line===n.loc.end.line||r.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let s=n.consequent.body[0];if(!s)return;if(s.type===fe.AST_NODE_TYPES.ReturnStatement){if(!Kr(s))return}else if(!(s.type===fe.AST_NODE_TYPES.ContinueStatement||s.type===fe.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===fe.AST_NODE_TYPES.LogicalExpression||n.test.type===fe.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let f=qr(n.test);if(!f&&n.test.type===fe.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let y=n.test.argument;qr(y)&&(f=!0)}if(f&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let a=r.getText(s);if(i.includes(`
|
|
18
18
|
`))return;let l=r.getTokenAfter(n);if(l&&l.type===fe.AST_TOKEN_TYPES.Punctuator&&l.value==="}"){let f=r.getTokenAfter(l);if(f&&f.type===fe.AST_TOKEN_TYPES.Keyword&&(f.value==="else"||f.value==="catch"))return}let p=Zs(r,n),u=`if (${i}) ${a}`;t.maxLineLength&&u.length+p.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:f=>f.replaceText(n,u)})}}}});function qr(e){return e.type===fe.AST_NODE_TYPES.CallExpression||e.type===fe.AST_NODE_TYPES.BinaryExpression||e.type===fe.AST_NODE_TYPES.MemberExpression&&Gr(e)}function Gr(e){return e.object.type===fe.AST_NODE_TYPES.MemberExpression?Gr(e.object):e.object.type!==fe.AST_NODE_TYPES.Identifier}function Zs(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Kr(e){if(!e.argument)return!0;let t=e.argument;return t.type===fe.AST_NODE_TYPES.ArrayExpression&&t.elements.length===0||t.type===fe.AST_NODE_TYPES.ObjectExpression&&t.properties.length===0||t.type===fe.AST_NODE_TYPES.Literal||t.type===fe.AST_NODE_TYPES.Identifier||t.type===fe.AST_NODE_TYPES.TemplateLiteral||t.type===fe.AST_NODE_TYPES.TaggedTemplateExpression?!0:t.type===fe.AST_NODE_TYPES.CallExpression?t.arguments.length===0:t.type===fe.AST_NODE_TYPES.UnaryExpression?Kr(t):!1}var wn={name:Zr,rule:qs};var L=require("@typescript-eslint/utils"),vn=require("zod/v4");var Gs=L.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ri="react-compiler-extra",Ks=vn.z.object({runOnlyWithEnableCompilerDirective:vn.z.boolean().optional()}),Qs=/eslint +react-compiler\/react-compiler: +\["error/;function lt(e){let t=null;if((e.type===L.AST_NODE_TYPES.FunctionDeclaration||e.type===L.AST_NODE_TYPES.FunctionExpression||e.type===L.AST_NODE_TYPES.ArrowFunctionExpression&&e.body.type===L.AST_NODE_TYPES.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r?r.type===L.AST_NODE_TYPES.ExpressionStatement&&r.expression.type===L.AST_NODE_TYPES.Literal&&r.expression.value==="use no memo":!1}function Qr(e){let t=e.parent;for(;t;){if(t.type===L.AST_NODE_TYPES.FunctionDeclaration||t.type===L.AST_NODE_TYPES.FunctionExpression||t.type===L.AST_NODE_TYPES.ArrowFunctionExpression)return t;t=t.parent}return null}function ea(e){return e.type===L.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):!1}function ii(e){return e.type===L.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===L.AST_NODE_TYPES.MemberExpression&&e.property.type===L.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}function Ue(e){if(!e)return!1;switch(e.type){case L.AST_NODE_TYPES.JSXElement:case L.AST_NODE_TYPES.JSXFragment:return!0;case L.AST_NODE_TYPES.ConditionalExpression:return Ue(e.consequent)||Ue(e.alternate);case L.AST_NODE_TYPES.LogicalExpression:return e.operator==="&&"?Ue(e.right):e.operator==="||"?Ue(e.left)||Ue(e.right):!1;case L.AST_NODE_TYPES.CallExpression:if(e.callee.type===L.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===L.AST_NODE_TYPES.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===L.AST_NODE_TYPES.Identifier&&e.callee.property.name==="createElement")return!0;for(let t of e.arguments)if(t.type!==L.AST_NODE_TYPES.SpreadElement&&Ue(t))return!0;return!1;default:return!1}}function ta(e){let t=e.typeAnnotation;if(t.type===L.AST_NODE_TYPES.TSTypeReference){if(t.typeName.type===L.AST_NODE_TYPES.Identifier)return t.typeName.name==="FC";if(t.typeName.type===L.AST_NODE_TYPES.TSQualifiedName&&t.typeName.left.type===L.AST_NODE_TYPES.Identifier&&t.typeName.right.type===L.AST_NODE_TYPES.Identifier)return t.typeName.left.name==="React"&&t.typeName.right.name==="FC"}return!1}var na=/^[A-Z][a-zA-Z0-9]*$/;function bt(e){return na.test(e)}function Pt(e){return e.startsWith("use")&&e.length>3}function Rn(e,t,r,n){if(r&&ta(r))return t?bt(t.name):e.type===L.AST_NODE_TYPES.FunctionDeclaration&&e.id?bt(e.id.name):!0;if(t&&Pt(t.name)||e.type===L.AST_NODE_TYPES.FunctionDeclaration&&e.id&&Pt(e.id.name))return!0;if(n){let o=t?.name||e.type===L.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;if(o&&bt(o)&&oi(e.body,n).containsJSX)return!0}return!1}function ht(e){if(e.body.type===L.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===L.AST_NODE_TYPES.ExpressionStatement&&t.expression.type===L.AST_NODE_TYPES.Literal&&typeof t.expression.value=="string"&&t.expression.value==="use memo")return!0}return!1}function oi(e,t){let r={containsJSX:!1,containsHookCalls:!1};return Me(e,n=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(n.type){case L.AST_NODE_TYPES.JSXElement:case L.AST_NODE_TYPES.JSXFragment:r.containsJSX=!0;break;case L.AST_NODE_TYPES.CallExpression:ea(n.callee)&&(r.containsHookCalls=!0),Ue(n)&&(r.containsJSX=!0);break;case L.AST_NODE_TYPES.ReturnStatement:n.argument&&Ue(n.argument)&&(r.containsJSX=!0);break;case L.AST_NODE_TYPES.VariableDeclarator:n.init&&Ue(n.init)&&(r.containsJSX=!0);break;case L.AST_NODE_TYPES.AssignmentExpression:Ue(n.right)&&(r.containsJSX=!0);break}},t),r}function ei(e,t){let r=e.body,n=oi(r,t);return n.containsJSX||n.containsHookCalls}var ra=/\bthis[.[]/;function ti(e){return ra.test(e)}function ia(e,t){let r={containsJSX:!1,containsHookCalls:!1};return Me(e,n=>{if(r.containsHookCalls||(n.type===L.AST_NODE_TYPES.FunctionDeclaration||n.type===L.AST_NODE_TYPES.FunctionExpression||n.type===L.AST_NODE_TYPES.ArrowFunctionExpression)&&n!==e)return!0;n.type===L.AST_NODE_TYPES.CallExpression&&ii(n.callee)&&(r.containsHookCalls=!0)},t),r}function ni(e){return bt(e)||Pt(e)}function Fn(e,t,r,n){if(!ia(e.body,t).containsHookCalls)return!1;let s=Rn(e,r,n,t);if(!s&&n){let i=r?.name||e.type===L.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;i&&bt(i)&&(s=!0)}return!s}var oa=Gs({name:ri,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:[z(Ks)]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let i of e.sourceCode.getAllComments())if(Qs.test(i.value)){r=!0;break}if(!r)return{}}function n(i){for(let a of i.properties)if(a.type===L.AST_NODE_TYPES.Property&&a.method&&a.value.type===L.AST_NODE_TYPES.FunctionExpression){let l=e.sourceCode,p=l.getText(a.key),u=a.value,f=l.getText(u.body);if(ti(f))e.report({node:a,messageId:"thisKeywordInMethod"});else{let y=u.params.map(m=>l.getText(m)).join(", "),x="";u.generator?x=`${p}: function* (${y}) ${f}`:u.async?x=`${p}: async (${y}) => ${f}`:x=`${p}: (${y}) => ${f}`,e.report({node:a,messageId:"objectMethodIsNotSupported",fix:m=>m.replaceText(a,x)})}}}function o(i){for(let a of i.properties)if(a.type===L.AST_NODE_TYPES.Property&&a.value.type===L.AST_NODE_TYPES.ObjectExpression){for(let l of a.value.properties)if(l.type===L.AST_NODE_TYPES.Property&&l.method&&l.value.type===L.AST_NODE_TYPES.FunctionExpression){let u=e.sourceCode.getText(l.value.body);ti(u)&&e.report({node:l,messageId:"thisKeywordInMethod"})}}}function s(i){let a=Qr(i);return a!==null&<(a)}return{CallExpression(i){if(ii(i.callee))for(let a of i.arguments){if(a.type===L.AST_NODE_TYPES.ObjectExpression){if(s(i))return;n(a),o(a)}if(a.type===L.AST_NODE_TYPES.ArrowFunctionExpression){if(a.body.type===L.AST_NODE_TYPES.ObjectExpression){if(s(i))return;n(a.body),o(a.body)}if(a.body.type===L.AST_NODE_TYPES.BlockStatement){for(let l of a.body.body)if(l.type===L.AST_NODE_TYPES.ReturnStatement&&l.argument?.type===L.AST_NODE_TYPES.ObjectExpression){if(s(i))return;n(l.argument),o(l.argument)}}}if(a.type===L.AST_NODE_TYPES.FunctionExpression){for(let l of a.body.body)if(l.type===L.AST_NODE_TYPES.ReturnStatement&&l.argument?.type===L.AST_NODE_TYPES.ObjectExpression){if(s(i))return;n(l.argument),o(l.argument)}}}},VariableDeclarator(i){if(i.id.type===L.AST_NODE_TYPES.Identifier&&i.init&&(i.init.type===L.AST_NODE_TYPES.ArrowFunctionExpression||i.init.type===L.AST_NODE_TYPES.FunctionExpression)){let a=i.init,l=i.id,p=i.id.typeAnnotation;if(ht(a)&&!ni(l.name)){e.report({node:a,messageId:"useMemoDirectiveNaming"});return}if(Fn(a,e.sourceCode,l,p)){if(lt(a))return;e.report({node:a,messageId:"functionCallingHooksMustBeComponent"});return}if(Rn(a,l,p,e.sourceCode)){let u=ei(a,e.sourceCode),f=ht(a);if(!u&&!f){if(lt(a))return;e.report({node:a,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(y){if(a.body.type===L.AST_NODE_TYPES.BlockStatement){let x=a.body.range[0]+1;return y.insertTextAfterRange([x,x],`
|
|
19
19
|
"use memo"
|
|
20
20
|
`)}return null}}]})}}}},FunctionDeclaration(i){if(i.id&&ht(i)&&!ni(i.id.name)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(Fn(i,e.sourceCode)){if(lt(i))return;e.report({node:i,messageId:"functionCallingHooksMustBeComponent"});return}if(Rn(i,void 0,void 0,e.sourceCode)){let a=ei(i,e.sourceCode),l=ht(i);if(!a&&!l){if(lt(i))return;e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(p){let u=i.body.range[0]+1;return p.insertTextAfterRange([u,u],`
|
|
21
21
|
"use memo"
|
|
22
|
-
`)}}]})}}},FunctionExpression(i){if(ht(i)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(Fn(i,e.sourceCode)){if(lt(i))return;e.report({node:i,messageId:"functionCallingHooksMustBeComponent"})}},ReturnStatement(i){if(i.argument?.type!==L.AST_NODE_TYPES.ObjectExpression)return;let a=Qr(i);if(!a)return;let l;a.type===L.AST_NODE_TYPES.FunctionDeclaration&&a.id?l=a.id.name:(a.type===L.AST_NODE_TYPES.ArrowFunctionExpression||a.type===L.AST_NODE_TYPES.FunctionExpression)&&a.parent.type===L.AST_NODE_TYPES.VariableDeclarator&&a.parent.id.type===L.AST_NODE_TYPES.Identifier&&(l=a.parent.id.name),l&&Pt(l)&&(s(i)||(n(i.argument),o(i.argument)))}}}}),kn={name:ri,rule:oa};var me=require("@typescript-eslint/utils"),Le=require("zod/v4");var sa=me.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),si="react-compiler-migration",aa=Le.z.object({disallowHooks:Le.z.array(Le.z.object({name:Le.z.string(),replacement:Le.z.string()})).optional(),disallowMethods:Le.z.array(Le.z.object({name:Le.z.string(),replacement:Le.z.string().optional(),requireTrueProp:Le.z.string().optional()})).optional(),runOnlyWithEnableCompilerDirective:Le.z.boolean().optional()}),la=/eslint +react-compiler\/react-compiler: +\["error/;function pa(e){let t=null;if((e.type===me.AST_NODE_TYPES.FunctionDeclaration||e.type===me.AST_NODE_TYPES.FunctionExpression||e.type===me.AST_NODE_TYPES.ArrowFunctionExpression&&e.body.type===me.AST_NODE_TYPES.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r?r.type===me.AST_NODE_TYPES.ExpressionStatement&&r.expression.type===me.AST_NODE_TYPES.Literal&&r.expression.value==="use no memo":!1}function ca(e){let t=e.parent;for(;t;){if(t.type===me.AST_NODE_TYPES.FunctionDeclaration||t.type===me.AST_NODE_TYPES.FunctionExpression||t.type===me.AST_NODE_TYPES.ArrowFunctionExpression)return t;t=t.parent}return null}function ua(e){return e.type===me.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===me.AST_NODE_TYPES.MemberExpression&&e.property.type===me.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var fa=sa({name:si,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:[z(aa)]},defaultOptions:[{disallowHooks:[],disallowMethods:[],runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let r=!0;if(t.runOnlyWithEnableCompilerDirective){r=!1;for(let o of e.sourceCode.getAllComments())if(la.test(o.value)){r=!0;break}}if(!r)return{};function n(o){let s=ca(o);return s!==null&&pa(s)}return{CallExpression(o){if(t.disallowHooks?.length){let s=null,i=null;if(o.callee.type===me.AST_NODE_TYPES.Identifier?(s=o.callee.name,i=o.callee):o.callee.type===me.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===me.AST_NODE_TYPES.Identifier&&(s=o.callee.property.name,i=o.callee.property),s){let a=t.disallowHooks.find(l=>l.name===s);if(a&&i){if(n(o))return;e.report({node:o,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:a.name,replacement:a.replacement},suggest:[{messageId:"replace",data:{replacement:a.replacement},fix:l=>l.replaceText(i,a.replacement)}]})}}}if(t.disallowMethods?.length&&ua(o.callee)){for(let s of o.arguments)if(s.type===me.AST_NODE_TYPES.ObjectExpression){for(let i of s.properties)if(i.type===me.AST_NODE_TYPES.Property&&i.key.type===me.AST_NODE_TYPES.Identifier){let a=i.key.name,l=t.disallowMethods.find(p=>p.name===a);if(l){if(n(o))return;if(l.requireTrueProp){let p=l.requireTrueProp,u=!1;for(let f of s.properties)if(f.type===me.AST_NODE_TYPES.Property&&f.key.type===me.AST_NODE_TYPES.Identifier&&f.key.name===p&&f.value.type===me.AST_NODE_TYPES.Literal&&f.value.value===!0){u=!0;break}if(!u){e.report({node:i,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:l.name,requireTrueProp:p}});continue}}l.replacement&&e.report({node:i,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:l.name,replacement:l.replacement},suggest:[{messageId:"replace",data:{replacement:l.replacement},fix:p=>l.replacement?p.replaceText(i.key,l.replacement):null}]})}}}}}}}}),Pn={name:si,rule:fa};var se=require("@typescript-eslint/utils");var ma=/\.(tsx|jsx)$/,ya=/^[A-Z][A-Za-z0-9]*$/,ai=80,On=U({name:"react-no-module-level-single-use-values",meta:{type:"problem",docs:{description:"Disallow module-level non-primitive values and long strings that are only used in one React component"},schema:[],messages:{moveValueInsideComponent:'Module-level "{{valueName}}" is only used in React component "{{componentName}}". Move it inside the component to improve memory usage.'}},defaultOptions:[],create(e){if(!ma.test(e.filename))return{};let t=e.sourceCode,r=da(t.ast.body);return r.length===0?{}:{VariableDeclarator(n){if(n.id.type!==se.AST_NODE_TYPES.Identifier||!ga(n)||!Ea(n.init))return;let o=n.id.name,i=t.getDeclaredVariables(n).find(f=>f.name===o);if(!i)return;let a=new Set,l=!1,p=!1;for(let f of i.references){if(f.init)continue;p=!0;let y=Sa(f.identifier,r);if(!y){l=!0;break}if(a.add(y),a.size>1)break}if(!p||l||a.size!==1)return;let[u]=Array.from(a);u&&e.report({node:n.id,messageId:"moveValueInsideComponent",data:{valueName:o,componentName:u}})}}}});function da(e){let t=[],r=new Set;function n(s,i){ya.test(s)&&(r.has(s)||(r.add(s),t.push({name:s,range:i.range})))}function o(s){for(let i of s.declarations){if(i.id.type!==se.AST_NODE_TYPES.Identifier)continue;let a=li(i.init);a&&n(i.id.name,a)}}for(let s of e){if(s.type===se.AST_NODE_TYPES.VariableDeclaration){o(s);continue}if(s.type===se.AST_NODE_TYPES.FunctionDeclaration){n(s.id.name,s);continue}s.type===se.AST_NODE_TYPES.ExportNamedDeclaration&&s.declaration&&(s.declaration.type===se.AST_NODE_TYPES.VariableDeclaration?o(s.declaration):s.declaration.type===se.AST_NODE_TYPES.FunctionDeclaration&&s.declaration.id&&n(s.declaration.id.name,s.declaration))}return t}function ga(e){return e.parent.parent.type===se.AST_NODE_TYPES.Program}function Sa(e,t){let r=null;for(let n of t){if(!(e.range[0]>=n.range[0]&&e.range[1]<=n.range[1]))continue;if(!r){r=n;continue}let s=r.range[1]-r.range[0];n.range[1]-n.range[0]<s&&(r=n)}return r?.name??null}function li(e){if(!e)return null;let t=Nn(e);if(t.type===se.AST_NODE_TYPES.ArrowFunctionExpression||t.type===se.AST_NODE_TYPES.FunctionExpression)return t;if(t.type!==se.AST_NODE_TYPES.CallExpression||!Ta(t.callee))return null;let r=t.arguments[0];if(!r||r.type===se.AST_NODE_TYPES.SpreadElement)return null;if(r.type===se.AST_NODE_TYPES.CallExpression)return li(r);let n=Nn(r);return n.type===se.AST_NODE_TYPES.ArrowFunctionExpression||n.type===se.AST_NODE_TYPES.FunctionExpression?n:null}function Ta(e){return e.type===se.AST_NODE_TYPES.Identifier?e.name==="memo"||e.name==="forwardRef":e.type===se.AST_NODE_TYPES.MemberExpression?e.property.type===se.AST_NODE_TYPES.Identifier&&(e.property.name==="memo"||e.property.name==="forwardRef"):!1}function Nn(e){let t=e;for(;;){if(t.type===se.AST_NODE_TYPES.TSAsExpression){t=t.expression;continue}if(t.type===se.AST_NODE_TYPES.TSSatisfiesExpression){t=t.expression;continue}if(t.type===se.AST_NODE_TYPES.TSNonNullExpression){t=t.expression;continue}return t}}function Ea(e){if(!e)return!1;let t=Nn(e);return ha(t)?!0:ba(t)}function ha(e){if(e.type===se.AST_NODE_TYPES.Literal)return typeof e.value=="string"&&e.value.length>=ai;if(e.type===se.AST_NODE_TYPES.TemplateLiteral){if(e.expressions.length>0)return!1;let t=e.quasis[0];return t?t.value.cooked.length>=ai:!1}return!1}function ba(e){return e.type===se.AST_NODE_TYPES.Literal?e.value instanceof RegExp:e.type===se.AST_NODE_TYPES.ArrayExpression||e.type===se.AST_NODE_TYPES.ObjectExpression||e.type===se.AST_NODE_TYPES.ArrowFunctionExpression||e.type===se.AST_NODE_TYPES.FunctionExpression||e.type===se.AST_NODE_TYPES.ClassExpression||e.type===se.AST_NODE_TYPES.NewExpression}var $=require("@typescript-eslint/utils"),Ln=require("zod");var xa=Ln.z.object({runOnlyWithEnableCompilerDirective:Ln.z.boolean().optional()}),Ca=/eslint +react-compiler\/react-compiler: +\["error/,Ia=/^\d+$/,Aa=/[\s_-]+/,wa=/[a-z][A-Z]/,Fa=/^(.+?)([A-Z][a-z]+s?)$/,va=/^[a-z][a-zA-Z]*$/;function pi(e,t){let r=[];if(e.type===$.AST_NODE_TYPES.JSXElement){for(let n of e.openingElement.attributes)if(n.type===$.AST_NODE_TYPES.JSXAttribute&&n.name.type===$.AST_NODE_TYPES.JSXIdentifier&&n.value?.type===$.AST_NODE_TYPES.JSXExpressionContainer&&n.value.expression.type!==$.AST_NODE_TYPES.JSXEmptyExpression){let o=n.name.name,s=n.value.expression,i=!1;Me(s,a=>{switch(a.type){case $.AST_NODE_TYPES.ObjectExpression:case $.AST_NODE_TYPES.ArrowFunctionExpression:case $.AST_NODE_TYPES.FunctionExpression:case $.AST_NODE_TYPES.ArrayExpression:return i=!0,!0}return!1},t),i&&r.push(o)}}return{hasUnstable:r.length>0,problematicProps:r}}function Ra(e){if(e.body.type===$.AST_NODE_TYPES.JSXElement||e.body.type===$.AST_NODE_TYPES.JSXFragment)return!0;if(e.body.type===$.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===$.AST_NODE_TYPES.ReturnStatement&&t.argument&&(t.argument.type===$.AST_NODE_TYPES.JSXElement||t.argument.type===$.AST_NODE_TYPES.JSXFragment))return!0}return!1}function ka(e,t){let r=e.callee;if(r.type===$.AST_NODE_TYPES.MemberExpression){let n=r.object;if(n.type===$.AST_NODE_TYPES.Identifier){let o=n.name,s=Pa(o);if(s!==o)return jn(s)}}if(t.length>0){let n=t[0];if(n&&n.type===$.AST_NODE_TYPES.Identifier)return jn(n.name)}return"ListItem"}function Pa(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(wa)){let n=e.match(Fa);if(n){let o=n[1],s=n[2];if(!o||!s)return Dn(e);let i=Dn(s);if(i!==s)return o+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 jn(e){return e.match(va)?e.charAt(0).toUpperCase()+e.slice(1):e.split(Aa).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function ci(e,t,r){let n=[],o=new Set,s=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Me(e,i=>{if(i.type===$.AST_NODE_TYPES.Identifier&&!t.includes(i.name)&&!s.has(i.name)&&!Ia.test(i.name)){let a=i.parent;if(a.type===$.AST_NODE_TYPES.Property&&a.key===i||a.type===$.AST_NODE_TYPES.MemberExpression&&a.property===i&&!a.computed||a.type===$.AST_NODE_TYPES.JSXOpeningElement||a.type===$.AST_NODE_TYPES.JSXClosingElement||a.type===$.AST_NODE_TYPES.JSXAttribute&&a.name.type===$.AST_NODE_TYPES.JSXIdentifier&&a.name.name===i.name)return!1;o.add(i.name)}return!1},r);for(let i of o)t.includes(i)||n.push({name:i,type:"unknown"});return n}function ui(e,t,r,n,o){let i=[...r.map(f=>f.type===$.AST_NODE_TYPES.Identifier?f.name:"item").map((f,y)=>({name:f,type:y===0?`${e}Type`:y===1?"number":"unknown"})),...n],a=i.map(f=>{let y=f.type;return f.name.includes("on")&&y==="any"&&(y="unknown"),` ${f.name}: ${y};`}).join(`
|
|
22
|
+
`)}}]})}}},FunctionExpression(i){if(ht(i)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(Fn(i,e.sourceCode)){if(lt(i))return;e.report({node:i,messageId:"functionCallingHooksMustBeComponent"})}},ReturnStatement(i){if(i.argument?.type!==L.AST_NODE_TYPES.ObjectExpression)return;let a=Qr(i);if(!a)return;let l;a.type===L.AST_NODE_TYPES.FunctionDeclaration&&a.id?l=a.id.name:(a.type===L.AST_NODE_TYPES.ArrowFunctionExpression||a.type===L.AST_NODE_TYPES.FunctionExpression)&&a.parent.type===L.AST_NODE_TYPES.VariableDeclarator&&a.parent.id.type===L.AST_NODE_TYPES.Identifier&&(l=a.parent.id.name),l&&Pt(l)&&(s(i)||(n(i.argument),o(i.argument)))}}}}),kn={name:ri,rule:oa};var me=require("@typescript-eslint/utils"),Le=require("zod/v4");var sa=me.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),si="react-compiler-migration",aa=Le.z.object({disallowHooks:Le.z.array(Le.z.object({name:Le.z.string(),replacement:Le.z.string()})).optional(),disallowMethods:Le.z.array(Le.z.object({name:Le.z.string(),replacement:Le.z.string().optional(),requireTrueProp:Le.z.string().optional()})).optional(),runOnlyWithEnableCompilerDirective:Le.z.boolean().optional()}),la=/eslint +react-compiler\/react-compiler: +\["error/;function pa(e){let t=null;if((e.type===me.AST_NODE_TYPES.FunctionDeclaration||e.type===me.AST_NODE_TYPES.FunctionExpression||e.type===me.AST_NODE_TYPES.ArrowFunctionExpression&&e.body.type===me.AST_NODE_TYPES.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r?r.type===me.AST_NODE_TYPES.ExpressionStatement&&r.expression.type===me.AST_NODE_TYPES.Literal&&r.expression.value==="use no memo":!1}function ca(e){let t=e.parent;for(;t;){if(t.type===me.AST_NODE_TYPES.FunctionDeclaration||t.type===me.AST_NODE_TYPES.FunctionExpression||t.type===me.AST_NODE_TYPES.ArrowFunctionExpression)return t;t=t.parent}return null}function ua(e){return e.type===me.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===me.AST_NODE_TYPES.MemberExpression&&e.property.type===me.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var fa=sa({name:si,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:[z(aa)]},defaultOptions:[{disallowHooks:[],disallowMethods:[],runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let r=!0;if(t.runOnlyWithEnableCompilerDirective){r=!1;for(let o of e.sourceCode.getAllComments())if(la.test(o.value)){r=!0;break}}if(!r)return{};function n(o){let s=ca(o);return s!==null&&pa(s)}return{CallExpression(o){if(t.disallowHooks?.length){let s=null,i=null;if(o.callee.type===me.AST_NODE_TYPES.Identifier?(s=o.callee.name,i=o.callee):o.callee.type===me.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===me.AST_NODE_TYPES.Identifier&&(s=o.callee.property.name,i=o.callee.property),s){let a=t.disallowHooks.find(l=>l.name===s);if(a&&i){if(n(o))return;e.report({node:o,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:a.name,replacement:a.replacement},suggest:[{messageId:"replace",data:{replacement:a.replacement},fix:l=>l.replaceText(i,a.replacement)}]})}}}if(t.disallowMethods?.length&&ua(o.callee)){for(let s of o.arguments)if(s.type===me.AST_NODE_TYPES.ObjectExpression){for(let i of s.properties)if(i.type===me.AST_NODE_TYPES.Property&&i.key.type===me.AST_NODE_TYPES.Identifier){let a=i.key.name,l=t.disallowMethods.find(p=>p.name===a);if(l){if(n(o))return;if(l.requireTrueProp){let p=l.requireTrueProp,u=!1;for(let f of s.properties)if(f.type===me.AST_NODE_TYPES.Property&&f.key.type===me.AST_NODE_TYPES.Identifier&&f.key.name===p&&f.value.type===me.AST_NODE_TYPES.Literal&&f.value.value===!0){u=!0;break}if(!u){e.report({node:i,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:l.name,requireTrueProp:p}});continue}}l.replacement&&e.report({node:i,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:l.name,replacement:l.replacement},suggest:[{messageId:"replace",data:{replacement:l.replacement},fix:p=>l.replacement?p.replaceText(i.key,l.replacement):null}]})}}}}}}}}),Pn={name:si,rule:fa};var ae=require("@typescript-eslint/utils");var ma=/\.(tsx|jsx)$/,ya=/^[A-Z][A-Za-z0-9]*$/,ai=80,On=U({name:"react-no-module-level-single-use-values",meta:{type:"problem",docs:{description:"Disallow module-level allocated data values and long strings that are only used in one React component, excluding functions, inferable aliases, and regex values"},schema:[],messages:{moveValueInsideComponent:'Module-level "{{valueName}}" is only used in React component "{{componentName}}". Move it inside the component to improve memory usage.'}},defaultOptions:[],create(e){if(!ma.test(e.filename))return{};let t=e.sourceCode,r=da(t.ast.body);return r.length===0?{}:{VariableDeclarator(n){if(n.id.type!==ae.AST_NODE_TYPES.Identifier||!ga(n)||!Ea(n.init))return;let o=n.id.name,i=t.getDeclaredVariables(n).find(f=>f.name===o);if(!i)return;let a=new Set,l=!1,p=!1;for(let f of i.references){if(f.init)continue;p=!0;let y=Sa(f.identifier,r);if(!y){l=!0;break}if(a.add(y),a.size>1)break}if(!p||l||a.size!==1)return;let[u]=Array.from(a);u&&e.report({node:n.id,messageId:"moveValueInsideComponent",data:{valueName:o,componentName:u}})}}}});function da(e){let t=[],r=new Set;function n(s,i){ya.test(s)&&(r.has(s)||(r.add(s),t.push({name:s,range:i.range})))}function o(s){for(let i of s.declarations){if(i.id.type!==ae.AST_NODE_TYPES.Identifier)continue;let a=li(i.init);a&&n(i.id.name,a)}}for(let s of e){if(s.type===ae.AST_NODE_TYPES.VariableDeclaration){o(s);continue}if(s.type===ae.AST_NODE_TYPES.FunctionDeclaration){n(s.id.name,s);continue}s.type===ae.AST_NODE_TYPES.ExportNamedDeclaration&&s.declaration&&(s.declaration.type===ae.AST_NODE_TYPES.VariableDeclaration?o(s.declaration):s.declaration.type===ae.AST_NODE_TYPES.FunctionDeclaration&&s.declaration.id&&n(s.declaration.id.name,s.declaration))}return t}function ga(e){return e.parent.parent.type===ae.AST_NODE_TYPES.Program}function Sa(e,t){let r=null;for(let n of t){if(!(e.range[0]>=n.range[0]&&e.range[1]<=n.range[1]))continue;if(!r){r=n;continue}let s=r.range[1]-r.range[0];n.range[1]-n.range[0]<s&&(r=n)}return r?.name??null}function li(e){if(!e)return null;let t=Nn(e);if(t.type===ae.AST_NODE_TYPES.ArrowFunctionExpression||t.type===ae.AST_NODE_TYPES.FunctionExpression)return t;if(t.type!==ae.AST_NODE_TYPES.CallExpression||!Ta(t.callee))return null;let r=t.arguments[0];if(!r||r.type===ae.AST_NODE_TYPES.SpreadElement)return null;if(r.type===ae.AST_NODE_TYPES.CallExpression)return li(r);let n=Nn(r);return n.type===ae.AST_NODE_TYPES.ArrowFunctionExpression||n.type===ae.AST_NODE_TYPES.FunctionExpression?n:null}function Ta(e){return e.type===ae.AST_NODE_TYPES.Identifier?e.name==="memo"||e.name==="forwardRef":e.type===ae.AST_NODE_TYPES.MemberExpression?e.property.type===ae.AST_NODE_TYPES.Identifier&&(e.property.name==="memo"||e.property.name==="forwardRef"):!1}function Nn(e){let t=e;for(;;){if(t.type===ae.AST_NODE_TYPES.TSAsExpression){t=t.expression;continue}if(t.type===ae.AST_NODE_TYPES.TSSatisfiesExpression){t=t.expression;continue}if(t.type===ae.AST_NODE_TYPES.TSNonNullExpression){t=t.expression;continue}return t}}function Ea(e){if(!e)return!1;let t=Nn(e);return ha(t)?!1:ba(t)?!0:xa(t)}function ha(e){return e.type===ae.AST_NODE_TYPES.Identifier||e.type===ae.AST_NODE_TYPES.MemberExpression}function ba(e){if(e.type===ae.AST_NODE_TYPES.Literal)return typeof e.value=="string"&&e.value.length>=ai;if(e.type===ae.AST_NODE_TYPES.TemplateLiteral){if(e.expressions.length>0)return!1;let t=e.quasis[0];return t?t.value.cooked.length>=ai:!1}return!1}function xa(e){return e.type===ae.AST_NODE_TYPES.ArrayExpression||e.type===ae.AST_NODE_TYPES.ObjectExpression||e.type===ae.AST_NODE_TYPES.ClassExpression||e.type===ae.AST_NODE_TYPES.NewExpression}var $=require("@typescript-eslint/utils"),Ln=require("zod");var Ca=Ln.z.object({runOnlyWithEnableCompilerDirective:Ln.z.boolean().optional()}),Ia=/eslint +react-compiler\/react-compiler: +\["error/,Aa=/^\d+$/,wa=/[\s_-]+/,Fa=/[a-z][A-Z]/,va=/^(.+?)([A-Z][a-z]+s?)$/,Ra=/^[a-z][a-zA-Z]*$/;function pi(e,t){let r=[];if(e.type===$.AST_NODE_TYPES.JSXElement){for(let n of e.openingElement.attributes)if(n.type===$.AST_NODE_TYPES.JSXAttribute&&n.name.type===$.AST_NODE_TYPES.JSXIdentifier&&n.value?.type===$.AST_NODE_TYPES.JSXExpressionContainer&&n.value.expression.type!==$.AST_NODE_TYPES.JSXEmptyExpression){let o=n.name.name,s=n.value.expression,i=!1;Me(s,a=>{switch(a.type){case $.AST_NODE_TYPES.ObjectExpression:case $.AST_NODE_TYPES.ArrowFunctionExpression:case $.AST_NODE_TYPES.FunctionExpression:case $.AST_NODE_TYPES.ArrayExpression:return i=!0,!0}return!1},t),i&&r.push(o)}}return{hasUnstable:r.length>0,problematicProps:r}}function ka(e){if(e.body.type===$.AST_NODE_TYPES.JSXElement||e.body.type===$.AST_NODE_TYPES.JSXFragment)return!0;if(e.body.type===$.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===$.AST_NODE_TYPES.ReturnStatement&&t.argument&&(t.argument.type===$.AST_NODE_TYPES.JSXElement||t.argument.type===$.AST_NODE_TYPES.JSXFragment))return!0}return!1}function Pa(e,t){let r=e.callee;if(r.type===$.AST_NODE_TYPES.MemberExpression){let n=r.object;if(n.type===$.AST_NODE_TYPES.Identifier){let o=n.name,s=Na(o);if(s!==o)return jn(s)}}if(t.length>0){let n=t[0];if(n&&n.type===$.AST_NODE_TYPES.Identifier)return jn(n.name)}return"ListItem"}function Na(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(Fa)){let n=e.match(va);if(n){let o=n[1],s=n[2];if(!o||!s)return Dn(e);let i=Dn(s);if(i!==s)return o+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 jn(e){return e.match(Ra)?e.charAt(0).toUpperCase()+e.slice(1):e.split(wa).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function ci(e,t,r){let n=[],o=new Set,s=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Me(e,i=>{if(i.type===$.AST_NODE_TYPES.Identifier&&!t.includes(i.name)&&!s.has(i.name)&&!Aa.test(i.name)){let a=i.parent;if(a.type===$.AST_NODE_TYPES.Property&&a.key===i||a.type===$.AST_NODE_TYPES.MemberExpression&&a.property===i&&!a.computed||a.type===$.AST_NODE_TYPES.JSXOpeningElement||a.type===$.AST_NODE_TYPES.JSXClosingElement||a.type===$.AST_NODE_TYPES.JSXAttribute&&a.name.type===$.AST_NODE_TYPES.JSXIdentifier&&a.name.name===i.name)return!1;o.add(i.name)}return!1},r);for(let i of o)t.includes(i)||n.push({name:i,type:"unknown"});return n}function ui(e,t,r,n,o){let i=[...r.map(f=>f.type===$.AST_NODE_TYPES.Identifier?f.name:"item").map((f,y)=>({name:f,type:y===0?`${e}Type`:y===1?"number":"unknown"})),...n],a=i.map(f=>{let y=f.type;return f.name.includes("on")&&y==="any"&&(y="unknown"),` ${f.name}: ${y};`}).join(`
|
|
23
23
|
`),l=i.map(f=>f.name).join(", "),p=o.getText(t),u=`${e}Props`;return`type ${u} = {
|
|
24
24
|
${a}
|
|
25
25
|
};
|
|
@@ -28,22 +28,22 @@ const ${e}: FC<${u}> = ({ ${l} }) => {
|
|
|
28
28
|
return (
|
|
29
29
|
${p}
|
|
30
30
|
);
|
|
31
|
-
};`}function
|
|
31
|
+
};`}function Oa(e,t,r,n){let o=t.map(i=>i.type===$.AST_NODE_TYPES.Identifier?i.name:"item"),s=[n?`key={${n}}`:`key={${o[0]}.id}`,...o.map(i=>`${i}={${i}}`),...r.map(i=>`${i.name}={${i.name}}`)].filter(Boolean);return`<${e} ${s.join(" ")} />`}function Da(e){if(e.type===$.AST_NODE_TYPES.JSXElement&&e.openingElement.name.type===$.AST_NODE_TYPES.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return jn(t)}return"ListItem"}function La(e,t,r){let n=[r?`key={${r}}`:"",...t.map(o=>`${o.name}={${o.name}}`)].filter(Boolean);return`<${e}${n.length>0?` ${n.join(" ")}`:""} />`}function fi(e,t){for(let r of e.openingElement.attributes)if(r.type===$.AST_NODE_TYPES.JSXAttribute&&r.name.type===$.AST_NODE_TYPES.JSXIdentifier&&r.name.name==="key"&&r.value&&r.value.type===$.AST_NODE_TYPES.JSXExpressionContainer&&r.value.expression.type!==$.AST_NODE_TYPES.JSXEmptyExpression)return t.getText(r.value.expression);return null}var Mn=U({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:[z(Ca)],hasSuggestions:!0},defaultOptions:[{runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let{sourceCode:r}=e;if(t.runOnlyWithEnableCompilerDirective){let n=!1;for(let o of r.getAllComments())if(Ia.test(o.value)){n=!0;break}if(!n)return{}}return{CallExpression(n){n.callee.type===$.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===$.AST_NODE_TYPES.Identifier&&(n.callee.property.name==="map"||n.callee.property.name==="push")&&(n.callee.property.name==="map"?ja(n,r,e):Ma(n,r,e))}}}});function ja(e,t,r){let n=e.arguments[0];if(!n||n.type!==$.AST_NODE_TYPES.ArrowFunctionExpression&&n.type!==$.AST_NODE_TYPES.FunctionExpression||!ka(n))return;let o=null;if(n.body.type===$.AST_NODE_TYPES.JSXElement||n.body.type===$.AST_NODE_TYPES.JSXFragment?o=n.body:n.body.type===$.AST_NODE_TYPES.BlockStatement&&n.body.body[0]?.type===$.AST_NODE_TYPES.ReturnStatement&&n.body.body[0].argument&&(n.body.body[0].argument.type===$.AST_NODE_TYPES.JSXElement||n.body.body[0].argument.type===$.AST_NODE_TYPES.JSXFragment)&&(o=n.body.body[0].argument),!o)return;let s=pi(o,t);if(!s.hasUnstable)return;let i=Pa(e,n.params),a=n.params.map(f=>f.type===$.AST_NODE_TYPES.Identifier?f.name:"item"),l=ci(o,a,t),p=o.type===$.AST_NODE_TYPES.JSXElement?fi(o,t):null,u=s.problematicProps.length===1?`prop "${s.problematicProps[0]}"`:`props "${s.problematicProps.join('", "')}"`;r.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:u},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:f=>{let y=ui(i,o,n.params,l,t),x=Oa(i,n.params,l,p),m=e;for(;m.parent.type!==$.AST_NODE_TYPES.Program&&!(m.type===$.AST_NODE_TYPES.FunctionDeclaration||m.type===$.AST_NODE_TYPES.VariableDeclarator&&m.init&&(m.init.type===$.AST_NODE_TYPES.ArrowFunctionExpression||m.init.type===$.AST_NODE_TYPES.FunctionExpression));)m=m.parent;let h=[];return h.push(f.insertTextAfter(m,`
|
|
32
32
|
|
|
33
|
-
${y}`)),h.push(f.replaceText(o,x)),h}}]})}function
|
|
33
|
+
${y}`)),h.push(f.replaceText(o,x)),h}}]})}function Ma(e,t,r){let n=e.arguments[0];if(!n||n.type!==$.AST_NODE_TYPES.JSXElement&&n.type!==$.AST_NODE_TYPES.JSXFragment)return;let o=n,s=pi(o,t);if(!s.hasUnstable)return;let i=Da(o),a=ci(o,[],t),l=o.type===$.AST_NODE_TYPES.JSXElement?fi(o,t):null,p=s.problematicProps.length===1?`prop "${s.problematicProps[0]}"`:`props "${s.problematicProps.join('", "')}"`;r.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:p},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:u=>{let f=ui(i,o,[],a,t),y=La(i,a,l),x=e;for(;x.parent.type!==$.AST_NODE_TYPES.Program&&!(x.type===$.AST_NODE_TYPES.FunctionDeclaration||x.type===$.AST_NODE_TYPES.VariableDeclarator&&x.init&&(x.init.type===$.AST_NODE_TYPES.ArrowFunctionExpression||x.init.type===$.AST_NODE_TYPES.FunctionExpression));)x=x.parent;let m=[];return m.push(u.insertTextAfter(x,`
|
|
34
34
|
|
|
35
|
-
${f}`)),m.push(u.replaceText(o,y)),m}}]})}var Nt=require("@typescript-eslint/utils"),Ma=Nt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mi="require-description",_a=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,$a=/^eslint-disable-(next-)?line$/u,Ua=Ma({name:mi,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of r.getAllComments()){let s=za(o);s!=null&&(n.has(s.kind)||s.description||e.report({loc:Ja(o.loc),messageId:"missingDescription"}))}}}}}),yi={name:mi,rule:Ua};function za(e){let{text:t,description:r}=Wa(e.value);if(!t)return null;let n=_a.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let s=$a.test(o);if(e.type===Nt.TSESTree.AST_TOKEN_TYPES.Line&&!s||s&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+o.length);return{kind:o,value:i.trim(),description:r}}var Va=/\s-{2,}\s/u;function Wa(e){let t=e.split(Va);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Ja(e){return{start:{line:e.start.line,column:-1},end:e.end}}var ne=require("@typescript-eslint/utils"),ze=require("zod/v4");var Xa=ze.z.object({varsToCheck:ze.z.array(ze.z.object({selector:ze.z.string().optional(),fromFnCall:ze.z.string().optional(),prop:ze.z.string().or(ze.z.array(ze.z.string())),errorMsg:ze.z.string().optional()}))}),_n=U({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:[z(Xa)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,a,l,p){let u=new Set;for(let y of i.properties)y.type===ne.AST_NODE_TYPES.Property&&y.key.type===ne.AST_NODE_TYPES.Identifier&&u.add(y.key.name);let f=a.filter(y=>!u.has(y));if(f.length>0)if(f.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:f[0],fnName:p,customMsg:l||""}});else{let y=f.map(x=>`"${x}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:p,customMsg:l||""}})}}function o(i){if(i.init?.type===ne.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===ne.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===ne.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===ne.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===ne.AST_NODE_TYPES.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"}let s={};for(let i of t.varsToCheck)i.selector&&(s[i.selector]=a=>{if(a.type===ne.AST_NODE_TYPES.VariableDeclarator&&a.id.type===ne.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:o(a)}),a.type===ne.AST_NODE_TYPES.VariableDeclarator&&a.id.type===ne.AST_NODE_TYPES.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(a.id,l,i.errorMsg,o(a))}});for(let i of t.varsToCheck)if(i.fromFnCall){let a=i.fromFnCall;if(a.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${a.slice(2)}"]`;s[p]=u=>{if(u.type!==ne.AST_NODE_TYPES.MemberExpression||u.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let f=u.parent;if(f.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let y=f.parent;if(y.id.type===ne.AST_NODE_TYPES.Identifier)r.set(y.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:y.id,fnName:i.fromFnCall||"unknown function"});else if(y.id.type===ne.AST_NODE_TYPES.ObjectPattern){let x=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,x,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(a.includes(".")){let[l,p]=a.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;s[u]=f=>{if(f.type!==ne.AST_NODE_TYPES.MemberExpression||f.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let y=f.parent;if(y.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let x=y.parent;if(x.id.type===ne.AST_NODE_TYPES.Identifier)r.set(x.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:x.id,fnName:i.fromFnCall||"unknown function"});else if(x.id.type===ne.AST_NODE_TYPES.ObjectPattern){let m=Array.isArray(i.prop)?i.prop:[i.prop];n(x.id,m,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${a}"]`;s[l]=p=>{if(p.type!==ne.AST_NODE_TYPES.Identifier||p.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let u=p.parent;if(u.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let f=u.parent;if(f.id.type===ne.AST_NODE_TYPES.Identifier)r.set(f.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:f.id,fnName:i.fromFnCall||"unknown function"});else if(f.id.type===ne.AST_NODE_TYPES.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];n(f.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...s,"Program:exit"(){for(let[i,{props:a,errorMsg:l,node:p,fnName:u}]of r){let y=e.sourceCode.getScope(p).set.get(i);if(y){let x=new Set(a);for(let m of y.references){let h=m.identifier,C=h.parent;if(!(C.type===ne.AST_NODE_TYPES.VariableDeclarator&&C.id===h)){if(C.type===ne.AST_NODE_TYPES.MemberExpression&&C.object===h&&C.property.type===ne.AST_NODE_TYPES.Identifier&&x.has(C.property.name)){if(x.delete(C.property.name),x.size===0)break;continue}if(C.type===ne.AST_NODE_TYPES.VariableDeclarator&&C.init===h&&C.id.type===ne.AST_NODE_TYPES.ObjectPattern){for(let S of C.id.properties)S.type===ne.AST_NODE_TYPES.Property&&S.key.type===ne.AST_NODE_TYPES.Identifier&&x.has(S.key.name)&&x.delete(S.key.name);if(x.size===0)break;continue}if(!(C.type===ne.AST_NODE_TYPES.MemberExpression&&C.object===h&&C.property.type===ne.AST_NODE_TYPES.Identifier&&!a.includes(C.property.name))){x.clear();break}}}if(x.size>0){let m=Array.from(x);if(m.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:m[0],fnName:u,customMsg:l||""}});else{let h=m.map(C=>`"${C}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:h,fnName:u,customMsg:l||""}})}}}}}}}});function Ei(e){return/^use[A-Z0-9]/.test(e)}function Ot(e){return e.type==="Identifier"?Ei(e.name):e.type==="MemberExpression"&&!e.computed&&Ot(e.property)?e.object.type==="Identifier":!1}function hi(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function bi(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function xi(e){return!!(e.parent&&e.parent.callee&&bi(e.parent.callee,"forwardRef"))}function Ci(e){return!!(e.parent&&e.parent.callee&&bi(e.parent.callee,"memo"))}function $n(e){for(;e;){let t=Ai(e);if(t&&(hi(t)||Ot(t))||xi(e)||Ci(e))return!0;e=e.parent}return!1}function di(e){return!1}function Un(e){return!1}var Ba=/eslint +react-compiler\/react-compiler: +\["error/;function gi(e){let t=null;if((e.type==="FunctionDeclaration"||e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"&&e.body.type==="BlockStatement")&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r.type==="ExpressionStatement"&&r.expression.type==="Literal"&&r.expression.value==="use no memo"}function Si(e){let t=e.parent;for(;t;){if(t.type==="FunctionDeclaration"||t.type==="FunctionExpression"||t.type==="ArrowFunctionExpression")return t;t=t.parent}return null}var Ii={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"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let t=!!e.options[0]?.reactCompilerIsEnabled;if(t)return{CallExpression(p){let u=null;if(p.callee.name==="useMemo"?u="useMemo":p.callee.name==="useCallback"&&(u="useCallback"),u){let f=Si(p);if(f&&gi(f))return;e.report({node:p,message:`"${u}" is not necessary when using React Compiler.`})}}};if(e.options[0]?.ignoreIfReactCompilerIsEnabled||t){for(let p of e.sourceCode.getAllComments())if(Ba.test(p.value))return{CallExpression(u){let f=null;if(u.callee.name==="useMemo"?f="useMemo":u.callee.name==="useCallback"&&(f="useCallback"),f){let y=Si(u);if(y&&gi(y))return;e.report({node:u,message:`"${f}" is not necessary when using React Compiler.`})}}}}let r=typeof e.getSource=="function"?p=>r(p):p=>e.sourceCode.getText(p),n=typeof e.getScope=="function"?()=>n():p=>e.sourceCode.getScope(p),o=null,s=[],i=[],a=new WeakSet;function l(p){for(let u of p.references){let f=u.identifier.parent;if(f.type==="VariableDeclarator"&&f.init&&f.init.type==="CallExpression"&&f.init.callee&&di(f.init.callee))for(let y of u.resolved.references)y!==u&&a.add(y.identifier)}}return{onCodePathSegmentStart:p=>i.push(p),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(p,u){let f=s.pop();if(f.size===0)return;let y=new Set;function x(E,b){let{cache:w}=x,k=w.get(E.id),N=new Set(b);if(N.has(E.id)){let c=[...N],v=c.slice(c.indexOf(E.id)+1);for(let d of v)y.add(d);return BigInt("0")}if(N.add(E.id),k!==void 0)return k;if(p.thrownSegments.includes(E))k=BigInt("0");else if(E.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let c of E.prevSegments)k+=x(c,N)}return E.reachable&&k===BigInt("0")?w.delete(E.id):w.set(E.id,k),k}function m(E,b){let{cache:w}=m,k=w.get(E.id),N=new Set(b);if(N.has(E.id)){let c=Array.from(N),v=c.slice(c.indexOf(E.id)+1);for(let d of v)y.add(d);return BigInt("0")}if(N.add(E.id),k!==void 0)return k;if(p.thrownSegments.includes(E))k=BigInt("0");else if(E.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let c of E.nextSegments)k+=m(c,N)}return w.set(E.id,k),k}function h(E){let{cache:b}=h,w=b.get(E.id);if(w===null)return 1/0;if(w!==void 0)return w;if(b.set(E.id,null),E.prevSegments.length===0)w=1;else{w=1/0;for(let k of E.prevSegments){let N=h(k);N<w&&(w=N)}w+=1}return b.set(E.id,w),w}x.cache=new Map,m.cache=new Map,h.cache=new Map;let C=m(p.initialSegment),S=Ai(u),I=$n(u),A=S?hi(S)||Ot(S):xi(u)||Ci(u),g=1/0;for(let E of p.finalSegments){if(!E.reachable)continue;let b=h(E);b<g&&(g=b)}for(let[E,b]of f){if(!E.reachable)continue;let w=E.nextSegments.length===0?g<=h(E):g<h(E),k=x(E)*m(E),N=y.has(E.id);for(let c of b)if(N&&!Un(c)&&e.report({node:c,message:`React Hook "${r(c)}" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.`}),A){if(u.async&&e.report({node:c,message:`React Hook "${r(c)}" cannot be called in an async function.`}),!N&&k!==C&&!Un(c)){let d=`React Hook "${r(c)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(w?" Did you accidentally call a React Hook after an early return?":"");e.report({node:c,message:d})}}else if(u.parent&&(u.parent.type==="MethodDefinition"||u.parent.type==="ClassProperty")&&u.parent.value===u){let v=`React Hook "${r(c)}" 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:c,message:v})}else if(S){let v=`React Hook "${r(c)}" is called in function "${r(S)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:c,message:v})}else if(u.type==="Program"){let v=`React Hook "${r(c)}" 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:c,message:v})}else if(I&&!Un(c)){if(u.parent.type==="CallExpression"&&u.parent.callee.type==="Identifier"&&u.parent.callee.name==="useCallback"){let d=u.parent;if(d.parent.type==="VariableDeclarator"&&Ei(d.parent.id.name))return}let v=`React Hook "${r(c)}" 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:c,message:v})}}},CallExpression(p){if(Ot(p.callee)){let u=Ti(s),f=Ti(i),y=u.get(f);y||(y=[],u.set(f,y)),y.push(p.callee)}p.callee.type==="Identifier"&&(p.callee.name==="useEffect"||di(p.callee))&&p.arguments.length>0&&(o=p)},Identifier(p){o==null&&a.has(p)&&p.parent.type!=="CallExpression"&&e.report({node:p,message:`\`${r(p)}\` 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"(p){p===o&&(o=null)},FunctionDeclaration(p){$n(p)&&l(n(p))},ArrowFunctionExpression(p){$n(p)&&l(n(p))}}}};function Ai(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 Ti(e){return e[e.length-1]}var Te=require("@typescript-eslint/utils"),Ce=Ne(require("zod/v4"));var Ha=/^\s+$/,zn=/\r?\n/,Ya=/^(\s*)/,qa=/^(\s*)\S/,Za=/\r?\n/,Ga=Ce.object({indent:Ce.union([Ce.string().regex(Ha),Ce.number().int().min(1)]).optional(),tags:Ce.array(Ce.string()).optional(),functions:Ce.array(Ce.string()).optional(),comments:Ce.array(Ce.string()).optional()}),Vn=U({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[z(Ga)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:s}=e.options[0],i=r.map(S=>S.toLowerCase());function a(S){let I=S.split(zn),A=I.filter(E=>E.trim()!=="");if(A.length===0)return S;let g=Number.POSITIVE_INFINITY;for(let E of A){let b=E.match(Ya);b&&(g=Math.min(g,b[1]?.length??0))}return!isFinite(g)||g===0?S:I.map(E=>E.slice(g)).join(`
|
|
35
|
+
${f}`)),m.push(u.replaceText(o,y)),m}}]})}var Nt=require("@typescript-eslint/utils"),_a=Nt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mi="require-description",$a=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Ua=/^eslint-disable-(next-)?line$/u,za=_a({name:mi,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of r.getAllComments()){let s=Va(o);s!=null&&(n.has(s.kind)||s.description||e.report({loc:Xa(o.loc),messageId:"missingDescription"}))}}}}}),yi={name:mi,rule:za};function Va(e){let{text:t,description:r}=Ja(e.value);if(!t)return null;let n=$a.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let s=Ua.test(o);if(e.type===Nt.TSESTree.AST_TOKEN_TYPES.Line&&!s||s&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+o.length);return{kind:o,value:i.trim(),description:r}}var Wa=/\s-{2,}\s/u;function Ja(e){let t=e.split(Wa);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Xa(e){return{start:{line:e.start.line,column:-1},end:e.end}}var ne=require("@typescript-eslint/utils"),ze=require("zod/v4");var Ba=ze.z.object({varsToCheck:ze.z.array(ze.z.object({selector:ze.z.string().optional(),fromFnCall:ze.z.string().optional(),prop:ze.z.string().or(ze.z.array(ze.z.string())),errorMsg:ze.z.string().optional()}))}),_n=U({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:[z(Ba)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,a,l,p){let u=new Set;for(let y of i.properties)y.type===ne.AST_NODE_TYPES.Property&&y.key.type===ne.AST_NODE_TYPES.Identifier&&u.add(y.key.name);let f=a.filter(y=>!u.has(y));if(f.length>0)if(f.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:f[0],fnName:p,customMsg:l||""}});else{let y=f.map(x=>`"${x}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:p,customMsg:l||""}})}}function o(i){if(i.init?.type===ne.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===ne.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===ne.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===ne.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===ne.AST_NODE_TYPES.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"}let s={};for(let i of t.varsToCheck)i.selector&&(s[i.selector]=a=>{if(a.type===ne.AST_NODE_TYPES.VariableDeclarator&&a.id.type===ne.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:o(a)}),a.type===ne.AST_NODE_TYPES.VariableDeclarator&&a.id.type===ne.AST_NODE_TYPES.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(a.id,l,i.errorMsg,o(a))}});for(let i of t.varsToCheck)if(i.fromFnCall){let a=i.fromFnCall;if(a.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${a.slice(2)}"]`;s[p]=u=>{if(u.type!==ne.AST_NODE_TYPES.MemberExpression||u.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let f=u.parent;if(f.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let y=f.parent;if(y.id.type===ne.AST_NODE_TYPES.Identifier)r.set(y.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:y.id,fnName:i.fromFnCall||"unknown function"});else if(y.id.type===ne.AST_NODE_TYPES.ObjectPattern){let x=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,x,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(a.includes(".")){let[l,p]=a.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;s[u]=f=>{if(f.type!==ne.AST_NODE_TYPES.MemberExpression||f.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let y=f.parent;if(y.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let x=y.parent;if(x.id.type===ne.AST_NODE_TYPES.Identifier)r.set(x.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:x.id,fnName:i.fromFnCall||"unknown function"});else if(x.id.type===ne.AST_NODE_TYPES.ObjectPattern){let m=Array.isArray(i.prop)?i.prop:[i.prop];n(x.id,m,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${a}"]`;s[l]=p=>{if(p.type!==ne.AST_NODE_TYPES.Identifier||p.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let u=p.parent;if(u.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let f=u.parent;if(f.id.type===ne.AST_NODE_TYPES.Identifier)r.set(f.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:f.id,fnName:i.fromFnCall||"unknown function"});else if(f.id.type===ne.AST_NODE_TYPES.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];n(f.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...s,"Program:exit"(){for(let[i,{props:a,errorMsg:l,node:p,fnName:u}]of r){let y=e.sourceCode.getScope(p).set.get(i);if(y){let x=new Set(a);for(let m of y.references){let h=m.identifier,C=h.parent;if(!(C.type===ne.AST_NODE_TYPES.VariableDeclarator&&C.id===h)){if(C.type===ne.AST_NODE_TYPES.MemberExpression&&C.object===h&&C.property.type===ne.AST_NODE_TYPES.Identifier&&x.has(C.property.name)){if(x.delete(C.property.name),x.size===0)break;continue}if(C.type===ne.AST_NODE_TYPES.VariableDeclarator&&C.init===h&&C.id.type===ne.AST_NODE_TYPES.ObjectPattern){for(let S of C.id.properties)S.type===ne.AST_NODE_TYPES.Property&&S.key.type===ne.AST_NODE_TYPES.Identifier&&x.has(S.key.name)&&x.delete(S.key.name);if(x.size===0)break;continue}if(!(C.type===ne.AST_NODE_TYPES.MemberExpression&&C.object===h&&C.property.type===ne.AST_NODE_TYPES.Identifier&&!a.includes(C.property.name))){x.clear();break}}}if(x.size>0){let m=Array.from(x);if(m.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:m[0],fnName:u,customMsg:l||""}});else{let h=m.map(C=>`"${C}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:h,fnName:u,customMsg:l||""}})}}}}}}}});function Ei(e){return/^use[A-Z0-9]/.test(e)}function Ot(e){return e.type==="Identifier"?Ei(e.name):e.type==="MemberExpression"&&!e.computed&&Ot(e.property)?e.object.type==="Identifier":!1}function hi(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function bi(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function xi(e){return!!(e.parent&&e.parent.callee&&bi(e.parent.callee,"forwardRef"))}function Ci(e){return!!(e.parent&&e.parent.callee&&bi(e.parent.callee,"memo"))}function $n(e){for(;e;){let t=Ai(e);if(t&&(hi(t)||Ot(t))||xi(e)||Ci(e))return!0;e=e.parent}return!1}function di(e){return!1}function Un(e){return!1}var Ha=/eslint +react-compiler\/react-compiler: +\["error/;function gi(e){let t=null;if((e.type==="FunctionDeclaration"||e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"&&e.body.type==="BlockStatement")&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r.type==="ExpressionStatement"&&r.expression.type==="Literal"&&r.expression.value==="use no memo"}function Si(e){let t=e.parent;for(;t;){if(t.type==="FunctionDeclaration"||t.type==="FunctionExpression"||t.type==="ArrowFunctionExpression")return t;t=t.parent}return null}var Ii={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"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let t=!!e.options[0]?.reactCompilerIsEnabled;if(t)return{CallExpression(p){let u=null;if(p.callee.name==="useMemo"?u="useMemo":p.callee.name==="useCallback"&&(u="useCallback"),u){let f=Si(p);if(f&&gi(f))return;e.report({node:p,message:`"${u}" is not necessary when using React Compiler.`})}}};if(e.options[0]?.ignoreIfReactCompilerIsEnabled||t){for(let p of e.sourceCode.getAllComments())if(Ha.test(p.value))return{CallExpression(u){let f=null;if(u.callee.name==="useMemo"?f="useMemo":u.callee.name==="useCallback"&&(f="useCallback"),f){let y=Si(u);if(y&&gi(y))return;e.report({node:u,message:`"${f}" is not necessary when using React Compiler.`})}}}}let r=typeof e.getSource=="function"?p=>r(p):p=>e.sourceCode.getText(p),n=typeof e.getScope=="function"?()=>n():p=>e.sourceCode.getScope(p),o=null,s=[],i=[],a=new WeakSet;function l(p){for(let u of p.references){let f=u.identifier.parent;if(f.type==="VariableDeclarator"&&f.init&&f.init.type==="CallExpression"&&f.init.callee&&di(f.init.callee))for(let y of u.resolved.references)y!==u&&a.add(y.identifier)}}return{onCodePathSegmentStart:p=>i.push(p),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(p,u){let f=s.pop();if(f.size===0)return;let y=new Set;function x(E,b){let{cache:w}=x,k=w.get(E.id),N=new Set(b);if(N.has(E.id)){let c=[...N],v=c.slice(c.indexOf(E.id)+1);for(let d of v)y.add(d);return BigInt("0")}if(N.add(E.id),k!==void 0)return k;if(p.thrownSegments.includes(E))k=BigInt("0");else if(E.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let c of E.prevSegments)k+=x(c,N)}return E.reachable&&k===BigInt("0")?w.delete(E.id):w.set(E.id,k),k}function m(E,b){let{cache:w}=m,k=w.get(E.id),N=new Set(b);if(N.has(E.id)){let c=Array.from(N),v=c.slice(c.indexOf(E.id)+1);for(let d of v)y.add(d);return BigInt("0")}if(N.add(E.id),k!==void 0)return k;if(p.thrownSegments.includes(E))k=BigInt("0");else if(E.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let c of E.nextSegments)k+=m(c,N)}return w.set(E.id,k),k}function h(E){let{cache:b}=h,w=b.get(E.id);if(w===null)return 1/0;if(w!==void 0)return w;if(b.set(E.id,null),E.prevSegments.length===0)w=1;else{w=1/0;for(let k of E.prevSegments){let N=h(k);N<w&&(w=N)}w+=1}return b.set(E.id,w),w}x.cache=new Map,m.cache=new Map,h.cache=new Map;let C=m(p.initialSegment),S=Ai(u),I=$n(u),A=S?hi(S)||Ot(S):xi(u)||Ci(u),g=1/0;for(let E of p.finalSegments){if(!E.reachable)continue;let b=h(E);b<g&&(g=b)}for(let[E,b]of f){if(!E.reachable)continue;let w=E.nextSegments.length===0?g<=h(E):g<h(E),k=x(E)*m(E),N=y.has(E.id);for(let c of b)if(N&&!Un(c)&&e.report({node:c,message:`React Hook "${r(c)}" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.`}),A){if(u.async&&e.report({node:c,message:`React Hook "${r(c)}" cannot be called in an async function.`}),!N&&k!==C&&!Un(c)){let d=`React Hook "${r(c)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(w?" Did you accidentally call a React Hook after an early return?":"");e.report({node:c,message:d})}}else if(u.parent&&(u.parent.type==="MethodDefinition"||u.parent.type==="ClassProperty")&&u.parent.value===u){let v=`React Hook "${r(c)}" 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:c,message:v})}else if(S){let v=`React Hook "${r(c)}" is called in function "${r(S)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:c,message:v})}else if(u.type==="Program"){let v=`React Hook "${r(c)}" 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:c,message:v})}else if(I&&!Un(c)){if(u.parent.type==="CallExpression"&&u.parent.callee.type==="Identifier"&&u.parent.callee.name==="useCallback"){let d=u.parent;if(d.parent.type==="VariableDeclarator"&&Ei(d.parent.id.name))return}let v=`React Hook "${r(c)}" 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:c,message:v})}}},CallExpression(p){if(Ot(p.callee)){let u=Ti(s),f=Ti(i),y=u.get(f);y||(y=[],u.set(f,y)),y.push(p.callee)}p.callee.type==="Identifier"&&(p.callee.name==="useEffect"||di(p.callee))&&p.arguments.length>0&&(o=p)},Identifier(p){o==null&&a.has(p)&&p.parent.type!=="CallExpression"&&e.report({node:p,message:`\`${r(p)}\` 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"(p){p===o&&(o=null)},FunctionDeclaration(p){$n(p)&&l(n(p))},ArrowFunctionExpression(p){$n(p)&&l(n(p))}}}};function Ai(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 Ti(e){return e[e.length-1]}var Te=require("@typescript-eslint/utils"),Ce=Ne(require("zod/v4"));var Ya=/^\s+$/,zn=/\r?\n/,qa=/^(\s*)/,Za=/^(\s*)\S/,Ga=/\r?\n/,Ka=Ce.object({indent:Ce.union([Ce.string().regex(Ya),Ce.number().int().min(1)]).optional(),tags:Ce.array(Ce.string()).optional(),functions:Ce.array(Ce.string()).optional(),comments:Ce.array(Ce.string()).optional()}),Vn=U({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[z(Ka)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:s}=e.options[0],i=r.map(S=>S.toLowerCase());function a(S){let I=S.split(zn),A=I.filter(E=>E.trim()!=="");if(A.length===0)return S;let g=Number.POSITIVE_INFINITY;for(let E of A){let b=E.match(qa);b&&(g=Math.min(g,b[1]?.length??0))}return!isFinite(g)||g===0?S:I.map(E=>E.slice(g)).join(`
|
|
36
36
|
`)}function l(S,I,A){return S.split(zn).map(E=>E.trim()===""?E:A.repeat(I)+E).join(`
|
|
37
|
-
`)}function p(S){if(S.type===Te.AST_NODE_TYPES.Identifier)return S.name;if(S.type===Te.AST_NODE_TYPES.MemberExpression){let I=S.object.type===Te.AST_NODE_TYPES.Identifier?S.object.name:null,A=S.property.type===Te.AST_NODE_TYPES.Identifier?S.property.name:null;return I&&A?`${I}.${A}`:A}return null}function u(S,I){if(!S)return!1;for(let A of I)if(A.includes(".")){let g=A.split(".");if(S.type===Te.AST_NODE_TYPES.MemberExpression&&S.object.type===Te.AST_NODE_TYPES.Identifier&&S.property.type===Te.AST_NODE_TYPES.Identifier&&S.object.name===g[0]&&S.property.name===g[1])return!0}else if(S.type===Te.AST_NODE_TYPES.Identifier&&S.name===A)return!0;return!1}function f(S,I){let A=S.parent;if(A.type!==Te.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let g=p(A.tag);return g?I.includes(g):!1}function y(S,I){if(!S||S.type!==Te.AST_NODE_TYPES.CallExpression)return!1;let{method:A,argumentsLength:g,optionalCall:E=!0,optionalMember:b=!0}=I;return g!==void 0&&S.arguments.length!==g||!E&&S.optional||S.callee.type!==Te.AST_NODE_TYPES.MemberExpression||!b&&S.callee.optional||S.callee.property.type!==Te.AST_NODE_TYPES.Identifier?!1:S.callee.property.name===A}function x(S,I){if(!S||S.type!==Te.AST_NODE_TYPES.CallExpression)return!1;let{name:A,argumentsLength:g,optionalCall:E=!0}=I;return g!==void 0&&S.arguments.length!==g||!E&&S.optional||S.callee.type!==Te.AST_NODE_TYPES.Identifier?!1:S.callee.name===A}function m(S){return y(S.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&S.parent.type===Te.AST_NODE_TYPES.CallExpression&&S.parent.arguments[0]===S&&x(S.parent.callee.type===Te.AST_NODE_TYPES.MemberExpression?S.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function h(S){if(i.length>0){let I=t.getTokenBefore(S,{includeComments:!0});if(I?.type===Te.AST_TOKEN_TYPES.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(m(S)||o.length>0&&f(S,o)||n.length>0&&S.parent.type===Te.AST_NODE_TYPES.CallExpression&&S.parent.arguments.includes(S)&&u(S.parent.callee,n))}function C(S){let I=`__PLACEHOLDER__${Math.random()}`,A=S.quasis.map(j=>t.getText(j).slice(1,j.tail?-1:-2)).join(I),g=A.match(
|
|
37
|
+
`)}function p(S){if(S.type===Te.AST_NODE_TYPES.Identifier)return S.name;if(S.type===Te.AST_NODE_TYPES.MemberExpression){let I=S.object.type===Te.AST_NODE_TYPES.Identifier?S.object.name:null,A=S.property.type===Te.AST_NODE_TYPES.Identifier?S.property.name:null;return I&&A?`${I}.${A}`:A}return null}function u(S,I){if(!S)return!1;for(let A of I)if(A.includes(".")){let g=A.split(".");if(S.type===Te.AST_NODE_TYPES.MemberExpression&&S.object.type===Te.AST_NODE_TYPES.Identifier&&S.property.type===Te.AST_NODE_TYPES.Identifier&&S.object.name===g[0]&&S.property.name===g[1])return!0}else if(S.type===Te.AST_NODE_TYPES.Identifier&&S.name===A)return!0;return!1}function f(S,I){let A=S.parent;if(A.type!==Te.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let g=p(A.tag);return g?I.includes(g):!1}function y(S,I){if(!S||S.type!==Te.AST_NODE_TYPES.CallExpression)return!1;let{method:A,argumentsLength:g,optionalCall:E=!0,optionalMember:b=!0}=I;return g!==void 0&&S.arguments.length!==g||!E&&S.optional||S.callee.type!==Te.AST_NODE_TYPES.MemberExpression||!b&&S.callee.optional||S.callee.property.type!==Te.AST_NODE_TYPES.Identifier?!1:S.callee.property.name===A}function x(S,I){if(!S||S.type!==Te.AST_NODE_TYPES.CallExpression)return!1;let{name:A,argumentsLength:g,optionalCall:E=!0}=I;return g!==void 0&&S.arguments.length!==g||!E&&S.optional||S.callee.type!==Te.AST_NODE_TYPES.Identifier?!1:S.callee.name===A}function m(S){return y(S.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&S.parent.type===Te.AST_NODE_TYPES.CallExpression&&S.parent.arguments[0]===S&&x(S.parent.callee.type===Te.AST_NODE_TYPES.MemberExpression?S.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function h(S){if(i.length>0){let I=t.getTokenBefore(S,{includeComments:!0});if(I?.type===Te.AST_TOKEN_TYPES.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(m(S)||o.length>0&&f(S,o)||n.length>0&&S.parent.type===Te.AST_NODE_TYPES.CallExpression&&S.parent.arguments.includes(S)&&u(S.parent.callee,n))}function C(S){let I=`__PLACEHOLDER__${Math.random()}`,A=S.quasis.map(j=>t.getText(j).slice(1,j.tail?-1:-2)).join(I),g=A.match(Ga);if(!g)return;let E=g[0],b=t.lines[t.getLocFromIndex(S.range[0]).line-1];if(!b)return;let k=b.match(Za)?.[1]??"",N;typeof s=="string"?N=s:typeof s=="number"?N=" ".repeat(s):N=k.startsWith(" ")?" ":" ";let v=a(A).replace(new RegExp(`^${E}|${E}[ ]*$`,"g"),""),d=E+l(v,1,k+N)+E+k,T=A.includes(`\r
|
|
38
38
|
`)?`\r
|
|
39
39
|
`:`
|
|
40
|
-
`,F=A.split(zn),P=F.map((j,X)=>X!==F.length-1&&j===N+k?"":j).join(T);if(d!==P)return{node:S,messageId:"improperlyIndented",fix:j=>d.split(I).map((X,G)=>{let q=S.quasis[G];return q?j.replaceTextRange([q.range[0]+1,q.range[1]-(q.tail?1:2)],X):[]}).flat()}}return{TemplateLiteral(S){if(!h(S))return;let I=C(S);if(I)return e.report(I)}}}});var Wn=require("@typescript-eslint/utils");function
|
|
40
|
+
`,F=A.split(zn),P=F.map((j,X)=>X!==F.length-1&&j===N+k?"":j).join(T);if(d!==P)return{node:S,messageId:"improperlyIndented",fix:j=>d.split(I).map((X,G)=>{let q=S.quasis[G];return q?j.replaceTextRange([q.range[0]+1,q.range[1]-(q.tail?1:2)],X):[]}).flat()}}return{TemplateLiteral(S){if(!h(S))return;let I=C(S);if(I)return e.report(I)}}}});var Wn=require("@typescript-eslint/utils");function Qa(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function el(e){let t=e.parent;return t?.type===Wn.AST_NODE_TYPES.NewExpression&&t.callee.type===Wn.AST_NODE_TYPES.Identifier&&t.callee.name==="RegExp"}var Jn=U({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){Qa(r)||el(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var he=require("@typescript-eslint/utils"),pt=require("zod/v4");var tl=pt.z.object({checkOnly:pt.z.array(pt.z.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:pt.z.array(pt.z.string()).optional()}),Xn=U({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:[z(tl)],messages:{moveTypeAboveUsage:"Type definition should be placed directly above its first usage."}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=new Map,o=[];function s(m){for(let h of o)if(m.range[0]>=h.range[0]&&m.range[1]<=h.range[1])return h;return null}function i(m){let h=m.parent;for(;h;){if(h.type===he.AST_NODE_TYPES.FunctionDeclaration||h.type===he.AST_NODE_TYPES.FunctionExpression||h.type===he.AST_NODE_TYPES.ArrowFunctionExpression){let C=h.params;for(let S of C)if(m.range[0]>=S.range[0]&&m.range[1]<=S.range[1])return!0;break}h=h.parent}return!1}function a(m){let h=m.parent;for(;h;){if(h.type===he.AST_NODE_TYPES.TSTypeParameterInstantiation){let C=h.parent;if(C.type===he.AST_NODE_TYPES.TSTypeReference&&C.typeName.type===he.AST_NODE_TYPES.Identifier&&(C.typeName.name==="FC"||C.typeName.name==="React.FC")||C.type===he.AST_NODE_TYPES.TSTypeReference&&C.typeName.type===he.AST_NODE_TYPES.TSQualifiedName&&C.typeName.right.name==="FC")return!0}h=h.parent}return!1}function l(m){let h=m.parent;for(;h;){if(h.type===he.AST_NODE_TYPES.TSTypeParameterInstantiation){let C=h.parent;if(C.type===he.AST_NODE_TYPES.CallExpression||C.type===he.AST_NODE_TYPES.NewExpression)return!0}h=h.parent}return!1}function p(m){let h=m.parent;for(;h;){if(h.type===he.AST_NODE_TYPES.TSTypeAliasDeclaration||h.type===he.AST_NODE_TYPES.TSInterfaceDeclaration)return!0;h=h.parent}return!1}function u(m){return m.parent.type===he.AST_NODE_TYPES.TSIndexedAccessType&&m.parent.objectType===m}let f=[];function y(m){let h=[],C=new Map;for(let{typeName:I,firstUsage:A}of m){let g=C.get(A)||[];g.push(I),C.set(A,g)}for(let{typeName:I,firstUsage:A,firstUsagePosition:g,firstUsageInFunctionArgs:E}of m){let b=n.get(I);if(!b||b.statement===A)continue;let w=o.indexOf(b.statement),k=o.indexOf(A);if(w===-1||k===-1)continue;let N=!!(t.checkOnly&&t.checkOnly.includes("function-args")&&E),v=(C.get(A)||[]).length>1;(N||v?w>k:w>k||w!==k-1)&&h.push({typeName:I,typeDef:b,targetStatement:A,firstUsagePosition:g})}if(h.length===0)return;h.sort((I,A)=>{let g=I.firstUsagePosition-A.firstUsagePosition;if(g!==0)return g;let E=o.indexOf(I.typeDef.statement),b=o.indexOf(A.typeDef.statement);return E-b});let S=h[0];S&&e.report({node:S.typeDef.node,messageId:"moveTypeAboveUsage",fix:x(h)})}function x(m){return function*(h){let C=new Map;for(let S of m){let I=C.get(S.targetStatement)||[];I.push(S),C.set(S.targetStatement,I)}for(let[,S]of C)S.sort((I,A)=>{let g=I.firstUsagePosition-A.firstUsagePosition;if(g!==0)return g;let E=o.indexOf(I.typeDef.statement),b=o.indexOf(A.typeDef.statement);return E-b});for(let S of m){let{typeDef:I}=S,A=I.statement,g=r.getCommentsBefore(A),E=A.range[0],b=A.range[1];g.length>0&&g[0]&&(E=g[0].range[0]),yield h.removeRange([E,b])}for(let[S,I]of C){let A=r.getCommentsBefore(S),g=A.length>0&&A[0]?A[0].range[0]:S.range[0],E=[];for(let b of I){let w=b.typeDef.statement,k=r.getText(w),N=r.getCommentsBefore(w),c=k;N.length>0&&(c=`${N.map(d=>r.getText(d)).join(`
|
|
41
41
|
`)}
|
|
42
42
|
${k}`),E.push(c)}yield h.insertTextBeforeRange([g,g],`${E.join(`
|
|
43
43
|
|
|
44
44
|
`)}
|
|
45
45
|
|
|
46
|
-
`)}}}return{Program(m){o.push(...m.body)},TSTypeAliasDeclaration(m){if(o.some(C=>C.type===he.AST_NODE_TYPES.ExportNamedDeclaration&&C.declaration===m?!0:C===m)){let C=s(m);C&&n.set(m.id.name,{node:m,name:m.id.name,statement:C})}},TSInterfaceDeclaration(m){if(o.some(C=>C.type===he.AST_NODE_TYPES.ExportNamedDeclaration&&C.declaration===m?!0:C===m)){let C=s(m);C&&n.set(m.id.name,{node:m,name:m.id.name,statement:C})}},TSTypeReference(m){if(m.typeName.type===he.AST_NODE_TYPES.Identifier){if(u(m))return;let h=i(m),C=a(m),S=l(m);f.push({typeName:m.typeName.name,node:m,inFunctionArgs:h,inFCProps:C,inGenericArgAtFunctionCall:S,usagePosition:m.range[0]})}},"Program:exit"(){let m=new Map;function h(S){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let I of t.checkOnly)if(I==="function-args"&&S.inFunctionArgs||I==="FC"&&S.inFCProps||I==="generic-args-at-fn-calls"&&S.inGenericArgAtFunctionCall)return!0;return!1}for(let S of f){let{typeName:I,node:A}=S;if(!n.has(I)||!h(S))continue;let g=s(A),E=n.get(I);if(!g||!E||g===E.statement)continue;m.has(I)||m.set(I,[]);let b=m.get(I);if(!b)return;b.includes(g)||b.push(g)}let C=[];for(let[S,I]of m)if(I.length>0){if(I.length===0)continue;let A=I[0];if(!A)continue;let g=Number.MAX_SAFE_INTEGER,E=!1;for(let w of I)w.range[0]<A.range[0]&&(A=w);for(let w of f)h(w)&&w.typeName===S&&s(w.node)===A&&w.usagePosition<g&&(g=w.usagePosition,E=w.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let w=Number.MAX_SAFE_INTEGER;for(let N of f){if(N.typeName!==S)continue;let c=s(N.node);if(!c)continue;let v=o.indexOf(c);v!==-1&&v<w&&(w=v)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}else{let w=Number.MAX_SAFE_INTEGER;for(let N of f){if(N.typeName!==S||p(N.node))continue;let c=s(N.node);if(!c)continue;let v=o.indexOf(c);v!==-1&&v<w&&(w=v)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}C.push({typeName:S,firstUsage:A,firstUsagePosition:g,firstUsageInFunctionArgs:E})}C.length>0&&y(C)}}}});var ie=require("@typescript-eslint/utils"),ct=Ne(require("zod/v4"));var tl=["tsx"],nl=/^[A-Z][A-Za-z0-9]*$/,rl=ct.object({extensions:ct.array(ct.string()).optional()}),Bn=U({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:[z(rl)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??tl,o=!1;for(let g of n)if(r.endsWith(g)){o=!0;break}if(!o)return{};let s=e.sourceCode,i=new Set,a=new Map;function l(g){return nl.test(g)}function p(g){if(g.type!==ie.AST_NODE_TYPES.CallExpression)return!1;let E=g.callee;return E.type===ie.AST_NODE_TYPES.Identifier?E.name==="memo"||E.name==="forwardRef":E.type===ie.AST_NODE_TYPES.MemberExpression&&E.property.type===ie.AST_NODE_TYPES.Identifier?E.property.name==="memo"||E.property.name==="forwardRef":!1}function u(g){if(g.type===ie.AST_NODE_TYPES.JSXElement||g.type===ie.AST_NODE_TYPES.JSXFragment)return!0;if(g.type===ie.AST_NODE_TYPES.ArrayExpression){for(let E of g.elements)if(E&&(E.type===ie.AST_NODE_TYPES.JSXElement||E.type===ie.AST_NODE_TYPES.JSXFragment))return!0}return!1}function f(g){if(g.type!==ie.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let E=g.body;if(E.type===ie.AST_NODE_TYPES.ArrowFunctionExpression){let b=E.body;if(u(b))return!0}return!1}function y(g){if(g.id.type!==ie.AST_NODE_TYPES.Identifier)return;let E=g.id.name,b=g.init;if(b){if(l(E)&&(b.type===ie.AST_NODE_TYPES.ArrowFunctionExpression||b.type===ie.AST_NODE_TYPES.FunctionExpression||p(b))){i.add(E);return}b.type===ie.AST_NODE_TYPES.Identifier&&a.set(E,b.name),l(E)||f(b)&&i.add(E)}}function x(g){if(g.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let E of g.declarations)y(E);return}if(g.type===ie.AST_NODE_TYPES.FunctionDeclaration&&g.id){l(g.id.name)&&i.add(g.id.name);return}if(g.type===ie.AST_NODE_TYPES.ExportNamedDeclaration&&g.declaration){let E=g.declaration;if(E.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let b of E.declarations)y(b);return}if(E.type===ie.AST_NODE_TYPES.FunctionDeclaration&&E.id){l(E.id.name)&&i.add(E.id.name);return}}}for(let g of s.ast.body)x(g);function m(g,E=new Set){if(i.has(g))return!0;if(E.has(g))return!1;E.add(g);let b=a.get(g);return b?m(b,E):!1}let h=[];function C(g,E,b){h.push({node:g,isType:E,isComponent:b})}for(let g of s.ast.body){if(g.type===ie.AST_NODE_TYPES.ExportNamedDeclaration){let E=g.exportKind==="type";if(g.declaration){let b=g.declaration;if(b.type===ie.AST_NODE_TYPES.TSTypeAliasDeclaration||b.type===ie.AST_NODE_TYPES.TSInterfaceDeclaration){C(b,!0,!1);continue}if(b.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let w of b.declarations){if(w.id.type!==ie.AST_NODE_TYPES.Identifier)continue;let k=w.id.name,N=m(k);C(w,E,N)}continue}if(b.type===ie.AST_NODE_TYPES.FunctionDeclaration){let w=b.id?.name,k=w?m(w)||l(w):!1;C(b,E,k);continue}C(b,E,!1);continue}if(g.specifiers.length>0)for(let b of g.specifiers){if(b.local.type!==ie.AST_NODE_TYPES.Identifier)continue;let w=b.local.name,k=m(w);C(b,E,k)}continue}if(g.type===ie.AST_NODE_TYPES.ExportDefaultDeclaration){let E=g.declaration;if(E.type===ie.AST_NODE_TYPES.Identifier){let b=m(E.name)||l(E.name);C(g,!1,b);continue}if(E.type===ie.AST_NODE_TYPES.FunctionDeclaration||E.type===ie.AST_NODE_TYPES.ArrowFunctionExpression||E.type===ie.AST_NODE_TYPES.FunctionExpression||E.type===ie.AST_NODE_TYPES.CallExpression){C(g,!1,!0);continue}C(g,!1,!1);continue}}let S=!1;for(let g of h)if(!g.isType&&g.isComponent){S=!0;break}if(!S)return{};let I=[];for(let g of h)g.isType||I.push(g);let A=-1;for(let[g,E]of I.entries())if(E.isComponent){A=g;break}if(A===-1)return{};for(let[g,E]of I.entries())if(g!==A){e.report({node:E.node,messageId:"multipleExports"});break}return{}}});var Be=require("@typescript-eslint/utils"),Dt=require("zod/v4");function Lt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function il(e){return e.callee.type===Be.AST_NODE_TYPES.Identifier?e.callee.name==="useState":e.callee.type===Be.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===Be.AST_NODE_TYPES.Identifier&&e.callee.property.type===Be.AST_NODE_TYPES.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var ol=Dt.z.object({ignorePrefixes:Dt.z.array(Dt.z.string()).optional()});function wi(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function sl(e){return`set${Lt(e)}`}var Hn=U({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:[z(ol)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==Be.AST_NODE_TYPES.CallExpression||!il(r.init)||r.id.type!==Be.AST_NODE_TYPES.ArrayPattern||r.id.elements.length!==2)return;let[n,o]=r.id.elements;if(!n||!o||n.type!==Be.AST_NODE_TYPES.Identifier||o.type!==Be.AST_NODE_TYPES.Identifier)return;let s=n.name,i=o.name,a=t.ignorePrefixes||[],l=wi(s,a),p=wi(i,a);if(l===""){if(!p.startsWith("set")){let f=`set${Lt(s)}`;e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:Lt(s),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:f},fix:y=>y.replaceText(o,f)}]})}return}let u=sl(l);p!==u&&e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:Lt(l),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:u},fix:f=>f.replaceText(o,u)}]})}}}});var Se=require("@typescript-eslint/utils"),nt=require("zod/v4");var al=nt.z.object({name:nt.z.string(),defaults:nt.z.array(nt.z.unknown())}),ll=nt.z.object({functions:nt.z.array(al)});function jt(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((o,s)=>jt(o,t[s]));let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r){if(!n.includes(o))return!1;let s=Object.getOwnPropertyDescriptor(e,o),i=Object.getOwnPropertyDescriptor(t,o);if(!s||!i)return!1;let a=s.value,l=i.value;if(!jt(a,l))return!1}return!0}function pl(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 o=Object.getOwnPropertyDescriptor(e,n),s=Object.getOwnPropertyDescriptor(t,n);o&&s&&jt(o.value,s.value)&&r.add(n)}return r}function Fi(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]=Fi(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 cl(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 Yn=U({name:"no-redundant-function-params",meta:{type:"suggestion",docs:{description:"Disallow calling functions with redundant default parameters"},messages:{redundantParams:"Function call has redundant parameters matching its default values and can be removed: {{details}}"},fixable:"code",schema:[z(ll)]},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 o=cl(n.callee);if(!o)return;let s=r.get(o);if(!s)return;let i=n.arguments;if(i.length===0)return;let a=-1,l=!1,p=new Map,u=new Set,f=new Map,y=[];for(let m=0;m<i.length;m++){if(m>=s.length){a=m;continue}let h=s[m],C=i[m];if(!C||C.type===Se.AST_NODE_TYPES.SpreadElement){a=m;continue}let S=Fi(C);if(h===void 0){a=m;continue}if(jt(S,h)){C.type===Se.AST_NODE_TYPES.ObjectExpression?(u.add(m),y.push({type:"object",position:m+1})):(f.set(m,S),y.push({type:"simple",position:m+1,value:S}));continue}if(C.type===Se.AST_NODE_TYPES.ObjectExpression&&C.properties.length===0&&typeof h=="object"&&h!==null&&Object.keys(h).length>0){u.add(m),y.push({type:"object",position:m+1});continue}let I=pl(S,h);if(I.size>0){let A=typeof h=="object"&&h!==null?Object.keys(h).length:0;if(C.type===Se.AST_NODE_TYPES.ObjectExpression&&C.properties.length===I.size&&C.properties.length===A){u.add(m),y.push({type:"object",position:m+1});continue}else l=!0,p.set(m,I),y.push({type:"partialObject",position:m+1,redundantProperties:Array.from(I)}),a=m}else a=m}if(a<i.length-1||l||u.size>0){let m=function(){let C=[];for(let S of y)if(S.type==="simple")C.push(`Param ${S.position} with value ${JSON.stringify(S.value)}`);else if(S.type==="object")C.push(`Param ${S.position} (object)`);else{let I=S.redundantProperties||[],A=s?s[S.position-1]:void 0;if(typeof A=="object"&&A!==null){let g=A;for(let E of I)if(E in g){let b=Object.getOwnPropertyDescriptor(g,E);b&&C.push(`Param ${S.position} property "${E}" with value ${JSON.stringify(b.value)}`)}}}return{messageId:"redundantParams",data:{details:C.join(", ")}}};var x=m;let h=m();e.report({node:n,messageId:h.messageId,data:h.data,fix(C){let S=[];if(l)for(let[A,g]of p){let E=i[A];if(E&&E.type===Se.AST_NODE_TYPES.ObjectExpression){let b=[];for(let k of E.properties)k.type===Se.AST_NODE_TYPES.Property&&k.key.type===Se.AST_NODE_TYPES.Identifier&&!k.computed&&g.has(k.key.name)||b.push(k);let w=b.map(k=>e.sourceCode.getText(k));S.push(C.replaceText(E,`{ ${w.join(", ")} }`))}}let I=-1;for(let A=i.length-1;A>=0;A--)if(!u.has(A)&&A<=a){I=A;break}if(I<i.length-1)if(I===-1){let A=e.sourceCode.getTokenAfter(n.callee),g=e.sourceCode.getLastToken(n);A&&g&&S.push(C.replaceTextRange([A.range[1],g.range[0]],""))}else{let A=i[I],g=e.sourceCode.getLastToken(n);g&&A&&S.push(C.replaceTextRange([A.range[1],g.range[0]],""))}return S.length>0?S:null}})}}}}});var Re=require("@typescript-eslint/utils");function ul(e){let t=e.parent;for(;t;){if(t.type===Re.AST_NODE_TYPES.AwaitExpression||t.type===Re.AST_NODE_TYPES.MemberExpression&&t.object===e&&t.property.type===Re.AST_NODE_TYPES.Identifier&&t.property.name==="then"||t.type===Re.AST_NODE_TYPES.ArrowFunctionExpression&&t.body===e)return!0;if(t.type===Re.AST_NODE_TYPES.ArrayExpression&&t.parent.type===Re.AST_NODE_TYPES.CallExpression){let r=t.parent;if(r.callee.type===Re.AST_NODE_TYPES.MemberExpression&&r.callee.object.type===Re.AST_NODE_TYPES.Identifier&&r.callee.object.name==="Promise"&&r.callee.property.type===Re.AST_NODE_TYPES.Identifier&&["all","allSettled","race"].includes(r.callee.property.name))return!0}if(t.parent)t=t.parent;else break}return!1}function fl(e){let{callee:t}=e;return t.type===Re.AST_NODE_TYPES.Identifier&&t.name==="require"||t.type===Re.AST_NODE_TYPES.MemberExpression&&t.object.type===Re.AST_NODE_TYPES.Identifier&&t.object.name==="require"}var qn=U({name:"no-sync-dynamic-import",meta:{type:"problem",docs:{description:"Disallow synchronous dynamic imports and require statements, only allow async dynamic imports with await"},messages:{syncDynamicImport:"Synchronous dynamic import() is not allowed. Use regular import statement or await import() for dynamic imports.",requireNotAllowed:"require() statements are not allowed. Use ES6 import statements instead."},schema:[]},defaultOptions:[],create(e){return{ImportExpression(t){ul(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){fl(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});var M=require("@typescript-eslint/utils"),Mt=require("zod/v4");var ml=Mt.z.object({mainComponentRegex:Mt.z.string().optional(),mainComponentSelector:Mt.z.string().optional()}),yl=/^[A-Z][A-Za-z0-9]*$/,Zn=U({name:"sort-react-components-and-styles",meta:{type:"suggestion",docs:{description:"Sort React components and styles with styles placed above their first usage"},fixable:"code",schema:[z(ml)],messages:{stylesShouldBeAboveUsage:"Style definitions should be placed above the first component that uses them",mainComponentShouldBeFirst:"Main component should be placed before other components"}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.mainComponentRegex?new RegExp(t.mainComponentRegex):void 0,o=t.mainComponentSelector;if(!e.filename.endsWith(".tsx"))return{};let i=new Set,a=new Map,l=[],p=[],u=new Set;function f(d){let T=d.node;if(T.type===M.AST_NODE_TYPES.VariableDeclaration){for(let F of T.declarations)if(F.id.type===M.AST_NODE_TYPES.Identifier&&F.id.name===d.name&&F.init)return F.init}if(T.type===M.AST_NODE_TYPES.ExportNamedDeclaration){let F=T.declaration;if(F&&F.type===M.AST_NODE_TYPES.VariableDeclaration){for(let P of F.declarations)if(P.id.type===M.AST_NODE_TYPES.Identifier&&P.id.name===d.name&&P.init)return P.init}}return null}function y(d){let T=new Set;return Me(d,F=>(F.type===M.AST_NODE_TYPES.Identifier&&F.name!=="styled"&&F.name!=="css"&&T.add(F.name),!1),r),T}function x(d){return yl.test(d)}function m(d){if(d.type!==M.AST_NODE_TYPES.CallExpression)return!1;let T=d.callee;return T.type===M.AST_NODE_TYPES.Identifier?T.name==="memo"||T.name==="forwardRef":T.type===M.AST_NODE_TYPES.MemberExpression&&T.property.type===M.AST_NODE_TYPES.Identifier?T.property.name==="memo"||T.property.name==="forwardRef":!1}function h(d){if(d.type===M.AST_NODE_TYPES.JSXElement||d.type===M.AST_NODE_TYPES.JSXFragment)return!0;if(d.type===M.AST_NODE_TYPES.BlockStatement){for(let T of d.body)if(T.type===M.AST_NODE_TYPES.ReturnStatement&&T.argument)return h(T.argument)}if(d.type===M.AST_NODE_TYPES.ArrayExpression){for(let T of d.elements)if(T&&(T.type===M.AST_NODE_TYPES.JSXElement||T.type===M.AST_NODE_TYPES.JSXFragment))return!0}return!1}function C(d){if(d.type!==M.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let T=d.body;if(T.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let F=T.body;if(h(F))return!0}return!1}function S(d){if(d.type===M.AST_NODE_TYPES.TaggedTemplateExpression){let T=d.tag;if(T.type===M.AST_NODE_TYPES.MemberExpression&&T.object.type===M.AST_NODE_TYPES.Identifier&&T.object.name==="styled")return!0;if(T.type===M.AST_NODE_TYPES.CallExpression){let F=T.callee;if(F.type===M.AST_NODE_TYPES.Identifier&&F.name==="styled")return!0}}return!1}function I(d){if(d.type===M.AST_NODE_TYPES.TaggedTemplateExpression){let T=d.tag;if(T.type===M.AST_NODE_TYPES.Identifier&&T.name==="css")return!0}return!1}function A(d,T){if(d.id.type!==M.AST_NODE_TYPES.Identifier)return;let F=d.id.name,P=d.init;if(P){if(S(P)||I(P)){p.push({node:T,name:F});return}if((x(F)||P.type===M.AST_NODE_TYPES.ArrowFunctionExpression)&&(P.type===M.AST_NODE_TYPES.ArrowFunctionExpression||P.type===M.AST_NODE_TYPES.FunctionExpression||m(P))){if(P.type===M.AST_NODE_TYPES.ArrowFunctionExpression||P.type===M.AST_NODE_TYPES.FunctionExpression){if(h(P.body)){i.add(F);return}}else if(m(P)){i.add(F);return}}P.type===M.AST_NODE_TYPES.Identifier&&a.set(F,P.name),x(F)||C(P)&&i.add(F)}}function g(d){return d.type===M.AST_NODE_TYPES.ExportDefaultDeclaration||d.type===M.AST_NODE_TYPES.ExportNamedDeclaration}function E(d){if(d.type===M.AST_NODE_TYPES.FunctionDeclaration)return d.id?d.id.name:null;if(d.type===M.AST_NODE_TYPES.VariableDeclaration){let T=d.declarations[0];if(T&&T.id.type===M.AST_NODE_TYPES.Identifier)return T.id.name}if(d.type===M.AST_NODE_TYPES.ExportDefaultDeclaration){let T=d.declaration;if(T.type===M.AST_NODE_TYPES.FunctionDeclaration)return T.id?T.id.name:"default";if(T.type===M.AST_NODE_TYPES.Identifier)return T.name}if(d.type===M.AST_NODE_TYPES.ExportNamedDeclaration){let T=d.declaration;if(T&&T.type===M.AST_NODE_TYPES.FunctionDeclaration)return T.id?T.id.name:null;if(T&&T.type===M.AST_NODE_TYPES.VariableDeclaration){let F=T.declarations[0];if(F&&F.id.type===M.AST_NODE_TYPES.Identifier)return F.id.name}}return null}function b(d,T){return o?u.has(d):n?n.test(T):g(d)}function w(d){let T=new Set;Me(d.node,F=>{if(F.type===M.AST_NODE_TYPES.Identifier)for(let P of p)P.name===F.name&&(T.add(P.name),(P.firstUsagePosition===void 0||F.range[0]<P.firstUsagePosition)&&(P.firstUsagePosition=F.range[0]));if(F.type===M.AST_NODE_TYPES.JSXElement){let P=F.openingElement;if(P.name.type===M.AST_NODE_TYPES.JSXIdentifier)for(let j of p)j.name===P.name.name&&(T.add(j.name),(j.firstUsagePosition===void 0||P.name.range[0]<j.firstUsagePosition)&&(j.firstUsagePosition=P.name.range[0]))}return!1},r),d.usedStyles=T}function k(d){if(d.type===M.AST_NODE_TYPES.VariableDeclaration){for(let T of d.declarations)A(T,d);return}if(d.type===M.AST_NODE_TYPES.FunctionDeclaration){x(d.id.name)&&h(d.body)&&i.add(d.id.name);return}if(d.type===M.AST_NODE_TYPES.ExportNamedDeclaration&&d.declaration){let T=d.declaration;if(T.type===M.AST_NODE_TYPES.VariableDeclaration){for(let F of T.declarations)A(F,d);return}if(T.type===M.AST_NODE_TYPES.FunctionDeclaration&&T.id){x(T.id.name)&&h(T.body)&&i.add(T.id.name);return}}if(d.type===M.AST_NODE_TYPES.ExportDefaultDeclaration){let T=d.declaration;T.type===M.AST_NODE_TYPES.Identifier&&i.add(T.name),(T.type===M.AST_NODE_TYPES.FunctionDeclaration||T.type===M.AST_NODE_TYPES.ArrowFunctionExpression||T.type===M.AST_NODE_TYPES.FunctionExpression)&&(T.type===M.AST_NODE_TYPES.FunctionDeclaration?T.id?i.add(T.id.name):i.add("default"):h(T.body)&&i.add("default"))}}function N(d,T=new Set){if(i.has(d))return!0;if(T.has(d))return!1;T.add(d);let F=a.get(d);return F?N(F,T):!1}let c={};return o&&(c[o]=d=>{let T=d;for(;T.parent&&T.parent.type!==M.AST_NODE_TYPES.Program;)T=T.parent;T.parent&&(T.type===M.AST_NODE_TYPES.VariableDeclaration||T.type===M.AST_NODE_TYPES.FunctionDeclaration||T.type===M.AST_NODE_TYPES.ExportNamedDeclaration||T.type===M.AST_NODE_TYPES.ExportDefaultDeclaration)&&u.add(T)}),c["Program:exit"]=d=>{let T=0;for(let D of d.body){if(D.type===M.AST_NODE_TYPES.ImportDeclaration){T+=1;continue}break}for(let D of d.body)k(D);for(let D of d.body){let Z=E(D);if(Z&&N(Z)){let B=b(D,Z);l.push({node:D,name:Z,isMainComponent:B,usedStyles:new Set,isExported:g(D)})}}if(!o&&n&&!l.some(D=>D.isMainComponent))for(let D of l)D.isExported&&(D.isMainComponent=!0);for(let D of l)w(D);let F=new Set;for(let D of p)F.add(D.name);let P=new Map;for(let D=0;D<d.body.length;D+=1){let Z=d.body[D];for(let B of p)B.node===Z&&P.set(B.name,D)}let j=new Map;for(let D of p){let Z=f(D),B=new Set;if(Z){let ue=y(Z);for(let ye of ue)F.has(ye)&&ye!==D.name&&B.add(ye)}j.set(D.name,B)}let X=new Map;for(let D of p){let Z=j.get(D.name);if(!Z)continue;let B=P.get(D.name);if(B!==void 0)for(let ue of Z){let ye=X.get(ue);(ye===void 0||B<ye)&&X.set(ue,B)}}let G=[];for(let D of p){if(D.firstUsagePosition===void 0)continue;let Z=d.body.indexOf(D.node),B=-1;for(let xe of l){if(!xe.usedStyles.has(D.name))continue;let Ae=d.body.indexOf(xe.node);(B===-1||Ae<B)&&(B=Ae)}let ue=X.get(D.name);if(ue!==void 0&&(B===-1||ue<B)&&(B=ue),B===-1)continue;let ye=-1;for(let xe of l){let Ae=d.body.indexOf(xe.node);Ae<B&&Ae>ye&&(ye=Ae)}let Pe=Z<B,He=Z>ye,Ee=-1,mt=j.get(D.name);if(mt)for(let xe of mt){let Ae=P.get(xe);Ae!==void 0&&Ae>Ee&&(Ee=Ae)}let rt=Z>Ee;if(!(Pe&&He&&rt)){let xe=ye+1;if(Ee+1>xe&&(xe=Ee+1),xe<T&&(xe=T),xe>B)continue;G.push({style:D,targetPosition:xe})}}let q=null;if(l.length>1){let D=l.map(B=>({c:B,idx:d.body.indexOf(B.node)})).sort((B,ue)=>B.idx-ue.idx)[0]?.c,Z=l.find(B=>B.isMainComponent)||null;D&&Z&&D.node!==Z.node&&(q={component:Z,targetBefore:D.node})}if(G.length>0||q){let D=G[0]?.style.node||q?.component.node||d,Z=G.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:D,messageId:Z,fix:v(G,q,d.body)})}},c;function v(d,T,F){return function*(P){d.sort((X,G)=>X.targetPosition-G.targetPosition);for(let{style:X}of d){let G=r.getCommentsBefore(X.node),q=X.node.range[0],D=X.node.range[1];G.length>0&&G[0]&&(q=G[0].range[0]),q===X.node.range[0]&&r.text.slice(0,q).trim().length===0&&(q=0),yield P.removeRange([q,D])}let j=new Map;for(let X of d){let G=j.get(X.targetPosition)||[];G.push(X),j.set(X.targetPosition,G)}for(let[X,G]of j){let q=F[X];if(!q)continue;let D=r.getCommentsBefore(q),Z=D.length>0&&D[0]?D[0].range[0]:q.range[0],B=[];for(let{style:ue}of G){let ye=r.getCommentsBefore(ue.node),Pe=r.getText(ue.node);ye.length>0&&(Pe=`${ye.map(Ee=>r.getText(Ee)).join(`
|
|
46
|
+
`)}}}return{Program(m){o.push(...m.body)},TSTypeAliasDeclaration(m){if(o.some(C=>C.type===he.AST_NODE_TYPES.ExportNamedDeclaration&&C.declaration===m?!0:C===m)){let C=s(m);C&&n.set(m.id.name,{node:m,name:m.id.name,statement:C})}},TSInterfaceDeclaration(m){if(o.some(C=>C.type===he.AST_NODE_TYPES.ExportNamedDeclaration&&C.declaration===m?!0:C===m)){let C=s(m);C&&n.set(m.id.name,{node:m,name:m.id.name,statement:C})}},TSTypeReference(m){if(m.typeName.type===he.AST_NODE_TYPES.Identifier){if(u(m))return;let h=i(m),C=a(m),S=l(m);f.push({typeName:m.typeName.name,node:m,inFunctionArgs:h,inFCProps:C,inGenericArgAtFunctionCall:S,usagePosition:m.range[0]})}},"Program:exit"(){let m=new Map;function h(S){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let I of t.checkOnly)if(I==="function-args"&&S.inFunctionArgs||I==="FC"&&S.inFCProps||I==="generic-args-at-fn-calls"&&S.inGenericArgAtFunctionCall)return!0;return!1}for(let S of f){let{typeName:I,node:A}=S;if(!n.has(I)||!h(S))continue;let g=s(A),E=n.get(I);if(!g||!E||g===E.statement)continue;m.has(I)||m.set(I,[]);let b=m.get(I);if(!b)return;b.includes(g)||b.push(g)}let C=[];for(let[S,I]of m)if(I.length>0){if(I.length===0)continue;let A=I[0];if(!A)continue;let g=Number.MAX_SAFE_INTEGER,E=!1;for(let w of I)w.range[0]<A.range[0]&&(A=w);for(let w of f)h(w)&&w.typeName===S&&s(w.node)===A&&w.usagePosition<g&&(g=w.usagePosition,E=w.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let w=Number.MAX_SAFE_INTEGER;for(let N of f){if(N.typeName!==S)continue;let c=s(N.node);if(!c)continue;let v=o.indexOf(c);v!==-1&&v<w&&(w=v)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}else{let w=Number.MAX_SAFE_INTEGER;for(let N of f){if(N.typeName!==S||p(N.node))continue;let c=s(N.node);if(!c)continue;let v=o.indexOf(c);v!==-1&&v<w&&(w=v)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}C.push({typeName:S,firstUsage:A,firstUsagePosition:g,firstUsageInFunctionArgs:E})}C.length>0&&y(C)}}}});var ie=require("@typescript-eslint/utils"),ct=Ne(require("zod/v4"));var nl=["tsx"],rl=/^[A-Z][A-Za-z0-9]*$/,il=ct.object({extensions:ct.array(ct.string()).optional()}),Bn=U({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:[z(il)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??nl,o=!1;for(let g of n)if(r.endsWith(g)){o=!0;break}if(!o)return{};let s=e.sourceCode,i=new Set,a=new Map;function l(g){return rl.test(g)}function p(g){if(g.type!==ie.AST_NODE_TYPES.CallExpression)return!1;let E=g.callee;return E.type===ie.AST_NODE_TYPES.Identifier?E.name==="memo"||E.name==="forwardRef":E.type===ie.AST_NODE_TYPES.MemberExpression&&E.property.type===ie.AST_NODE_TYPES.Identifier?E.property.name==="memo"||E.property.name==="forwardRef":!1}function u(g){if(g.type===ie.AST_NODE_TYPES.JSXElement||g.type===ie.AST_NODE_TYPES.JSXFragment)return!0;if(g.type===ie.AST_NODE_TYPES.ArrayExpression){for(let E of g.elements)if(E&&(E.type===ie.AST_NODE_TYPES.JSXElement||E.type===ie.AST_NODE_TYPES.JSXFragment))return!0}return!1}function f(g){if(g.type!==ie.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let E=g.body;if(E.type===ie.AST_NODE_TYPES.ArrowFunctionExpression){let b=E.body;if(u(b))return!0}return!1}function y(g){if(g.id.type!==ie.AST_NODE_TYPES.Identifier)return;let E=g.id.name,b=g.init;if(b){if(l(E)&&(b.type===ie.AST_NODE_TYPES.ArrowFunctionExpression||b.type===ie.AST_NODE_TYPES.FunctionExpression||p(b))){i.add(E);return}b.type===ie.AST_NODE_TYPES.Identifier&&a.set(E,b.name),l(E)||f(b)&&i.add(E)}}function x(g){if(g.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let E of g.declarations)y(E);return}if(g.type===ie.AST_NODE_TYPES.FunctionDeclaration&&g.id){l(g.id.name)&&i.add(g.id.name);return}if(g.type===ie.AST_NODE_TYPES.ExportNamedDeclaration&&g.declaration){let E=g.declaration;if(E.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let b of E.declarations)y(b);return}if(E.type===ie.AST_NODE_TYPES.FunctionDeclaration&&E.id){l(E.id.name)&&i.add(E.id.name);return}}}for(let g of s.ast.body)x(g);function m(g,E=new Set){if(i.has(g))return!0;if(E.has(g))return!1;E.add(g);let b=a.get(g);return b?m(b,E):!1}let h=[];function C(g,E,b){h.push({node:g,isType:E,isComponent:b})}for(let g of s.ast.body){if(g.type===ie.AST_NODE_TYPES.ExportNamedDeclaration){let E=g.exportKind==="type";if(g.declaration){let b=g.declaration;if(b.type===ie.AST_NODE_TYPES.TSTypeAliasDeclaration||b.type===ie.AST_NODE_TYPES.TSInterfaceDeclaration){C(b,!0,!1);continue}if(b.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let w of b.declarations){if(w.id.type!==ie.AST_NODE_TYPES.Identifier)continue;let k=w.id.name,N=m(k);C(w,E,N)}continue}if(b.type===ie.AST_NODE_TYPES.FunctionDeclaration){let w=b.id?.name,k=w?m(w)||l(w):!1;C(b,E,k);continue}C(b,E,!1);continue}if(g.specifiers.length>0)for(let b of g.specifiers){if(b.local.type!==ie.AST_NODE_TYPES.Identifier)continue;let w=b.local.name,k=m(w);C(b,E,k)}continue}if(g.type===ie.AST_NODE_TYPES.ExportDefaultDeclaration){let E=g.declaration;if(E.type===ie.AST_NODE_TYPES.Identifier){let b=m(E.name)||l(E.name);C(g,!1,b);continue}if(E.type===ie.AST_NODE_TYPES.FunctionDeclaration||E.type===ie.AST_NODE_TYPES.ArrowFunctionExpression||E.type===ie.AST_NODE_TYPES.FunctionExpression||E.type===ie.AST_NODE_TYPES.CallExpression){C(g,!1,!0);continue}C(g,!1,!1);continue}}let S=!1;for(let g of h)if(!g.isType&&g.isComponent){S=!0;break}if(!S)return{};let I=[];for(let g of h)g.isType||I.push(g);let A=-1;for(let[g,E]of I.entries())if(E.isComponent){A=g;break}if(A===-1)return{};for(let[g,E]of I.entries())if(g!==A){e.report({node:E.node,messageId:"multipleExports"});break}return{}}});var Be=require("@typescript-eslint/utils"),Dt=require("zod/v4");function Lt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ol(e){return e.callee.type===Be.AST_NODE_TYPES.Identifier?e.callee.name==="useState":e.callee.type===Be.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===Be.AST_NODE_TYPES.Identifier&&e.callee.property.type===Be.AST_NODE_TYPES.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var sl=Dt.z.object({ignorePrefixes:Dt.z.array(Dt.z.string()).optional()});function wi(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function al(e){return`set${Lt(e)}`}var Hn=U({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:[z(sl)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==Be.AST_NODE_TYPES.CallExpression||!ol(r.init)||r.id.type!==Be.AST_NODE_TYPES.ArrayPattern||r.id.elements.length!==2)return;let[n,o]=r.id.elements;if(!n||!o||n.type!==Be.AST_NODE_TYPES.Identifier||o.type!==Be.AST_NODE_TYPES.Identifier)return;let s=n.name,i=o.name,a=t.ignorePrefixes||[],l=wi(s,a),p=wi(i,a);if(l===""){if(!p.startsWith("set")){let f=`set${Lt(s)}`;e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:Lt(s),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:f},fix:y=>y.replaceText(o,f)}]})}return}let u=al(l);p!==u&&e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:Lt(l),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:u},fix:f=>f.replaceText(o,u)}]})}}}});var Se=require("@typescript-eslint/utils"),nt=require("zod/v4");var ll=nt.z.object({name:nt.z.string(),defaults:nt.z.array(nt.z.unknown())}),pl=nt.z.object({functions:nt.z.array(ll)});function jt(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((o,s)=>jt(o,t[s]));let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r){if(!n.includes(o))return!1;let s=Object.getOwnPropertyDescriptor(e,o),i=Object.getOwnPropertyDescriptor(t,o);if(!s||!i)return!1;let a=s.value,l=i.value;if(!jt(a,l))return!1}return!0}function cl(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 o=Object.getOwnPropertyDescriptor(e,n),s=Object.getOwnPropertyDescriptor(t,n);o&&s&&jt(o.value,s.value)&&r.add(n)}return r}function Fi(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]=Fi(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 ul(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 Yn=U({name:"no-redundant-function-params",meta:{type:"suggestion",docs:{description:"Disallow calling functions with redundant default parameters"},messages:{redundantParams:"Function call has redundant parameters matching its default values and can be removed: {{details}}"},fixable:"code",schema:[z(pl)]},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 o=ul(n.callee);if(!o)return;let s=r.get(o);if(!s)return;let i=n.arguments;if(i.length===0)return;let a=-1,l=!1,p=new Map,u=new Set,f=new Map,y=[];for(let m=0;m<i.length;m++){if(m>=s.length){a=m;continue}let h=s[m],C=i[m];if(!C||C.type===Se.AST_NODE_TYPES.SpreadElement){a=m;continue}let S=Fi(C);if(h===void 0){a=m;continue}if(jt(S,h)){C.type===Se.AST_NODE_TYPES.ObjectExpression?(u.add(m),y.push({type:"object",position:m+1})):(f.set(m,S),y.push({type:"simple",position:m+1,value:S}));continue}if(C.type===Se.AST_NODE_TYPES.ObjectExpression&&C.properties.length===0&&typeof h=="object"&&h!==null&&Object.keys(h).length>0){u.add(m),y.push({type:"object",position:m+1});continue}let I=cl(S,h);if(I.size>0){let A=typeof h=="object"&&h!==null?Object.keys(h).length:0;if(C.type===Se.AST_NODE_TYPES.ObjectExpression&&C.properties.length===I.size&&C.properties.length===A){u.add(m),y.push({type:"object",position:m+1});continue}else l=!0,p.set(m,I),y.push({type:"partialObject",position:m+1,redundantProperties:Array.from(I)}),a=m}else a=m}if(a<i.length-1||l||u.size>0){let m=function(){let C=[];for(let S of y)if(S.type==="simple")C.push(`Param ${S.position} with value ${JSON.stringify(S.value)}`);else if(S.type==="object")C.push(`Param ${S.position} (object)`);else{let I=S.redundantProperties||[],A=s?s[S.position-1]:void 0;if(typeof A=="object"&&A!==null){let g=A;for(let E of I)if(E in g){let b=Object.getOwnPropertyDescriptor(g,E);b&&C.push(`Param ${S.position} property "${E}" with value ${JSON.stringify(b.value)}`)}}}return{messageId:"redundantParams",data:{details:C.join(", ")}}};var x=m;let h=m();e.report({node:n,messageId:h.messageId,data:h.data,fix(C){let S=[];if(l)for(let[A,g]of p){let E=i[A];if(E&&E.type===Se.AST_NODE_TYPES.ObjectExpression){let b=[];for(let k of E.properties)k.type===Se.AST_NODE_TYPES.Property&&k.key.type===Se.AST_NODE_TYPES.Identifier&&!k.computed&&g.has(k.key.name)||b.push(k);let w=b.map(k=>e.sourceCode.getText(k));S.push(C.replaceText(E,`{ ${w.join(", ")} }`))}}let I=-1;for(let A=i.length-1;A>=0;A--)if(!u.has(A)&&A<=a){I=A;break}if(I<i.length-1)if(I===-1){let A=e.sourceCode.getTokenAfter(n.callee),g=e.sourceCode.getLastToken(n);A&&g&&S.push(C.replaceTextRange([A.range[1],g.range[0]],""))}else{let A=i[I],g=e.sourceCode.getLastToken(n);g&&A&&S.push(C.replaceTextRange([A.range[1],g.range[0]],""))}return S.length>0?S:null}})}}}}});var Re=require("@typescript-eslint/utils");function fl(e){let t=e.parent;for(;t;){if(t.type===Re.AST_NODE_TYPES.AwaitExpression||t.type===Re.AST_NODE_TYPES.MemberExpression&&t.object===e&&t.property.type===Re.AST_NODE_TYPES.Identifier&&t.property.name==="then"||t.type===Re.AST_NODE_TYPES.ArrowFunctionExpression&&t.body===e)return!0;if(t.type===Re.AST_NODE_TYPES.ArrayExpression&&t.parent.type===Re.AST_NODE_TYPES.CallExpression){let r=t.parent;if(r.callee.type===Re.AST_NODE_TYPES.MemberExpression&&r.callee.object.type===Re.AST_NODE_TYPES.Identifier&&r.callee.object.name==="Promise"&&r.callee.property.type===Re.AST_NODE_TYPES.Identifier&&["all","allSettled","race"].includes(r.callee.property.name))return!0}if(t.parent)t=t.parent;else break}return!1}function ml(e){let{callee:t}=e;return t.type===Re.AST_NODE_TYPES.Identifier&&t.name==="require"||t.type===Re.AST_NODE_TYPES.MemberExpression&&t.object.type===Re.AST_NODE_TYPES.Identifier&&t.object.name==="require"}var qn=U({name:"no-sync-dynamic-import",meta:{type:"problem",docs:{description:"Disallow synchronous dynamic imports and require statements, only allow async dynamic imports with await"},messages:{syncDynamicImport:"Synchronous dynamic import() is not allowed. Use regular import statement or await import() for dynamic imports.",requireNotAllowed:"require() statements are not allowed. Use ES6 import statements instead."},schema:[]},defaultOptions:[],create(e){return{ImportExpression(t){fl(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){ml(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});var M=require("@typescript-eslint/utils"),Mt=require("zod/v4");var yl=Mt.z.object({mainComponentRegex:Mt.z.string().optional(),mainComponentSelector:Mt.z.string().optional()}),dl=/^[A-Z][A-Za-z0-9]*$/,Zn=U({name:"sort-react-components-and-styles",meta:{type:"suggestion",docs:{description:"Sort React components and styles with styles placed above their first usage"},fixable:"code",schema:[z(yl)],messages:{stylesShouldBeAboveUsage:"Style definitions should be placed above the first component that uses them",mainComponentShouldBeFirst:"Main component should be placed before other components"}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.mainComponentRegex?new RegExp(t.mainComponentRegex):void 0,o=t.mainComponentSelector;if(!e.filename.endsWith(".tsx"))return{};let i=new Set,a=new Map,l=[],p=[],u=new Set;function f(d){let T=d.node;if(T.type===M.AST_NODE_TYPES.VariableDeclaration){for(let F of T.declarations)if(F.id.type===M.AST_NODE_TYPES.Identifier&&F.id.name===d.name&&F.init)return F.init}if(T.type===M.AST_NODE_TYPES.ExportNamedDeclaration){let F=T.declaration;if(F&&F.type===M.AST_NODE_TYPES.VariableDeclaration){for(let P of F.declarations)if(P.id.type===M.AST_NODE_TYPES.Identifier&&P.id.name===d.name&&P.init)return P.init}}return null}function y(d){let T=new Set;return Me(d,F=>(F.type===M.AST_NODE_TYPES.Identifier&&F.name!=="styled"&&F.name!=="css"&&T.add(F.name),!1),r),T}function x(d){return dl.test(d)}function m(d){if(d.type!==M.AST_NODE_TYPES.CallExpression)return!1;let T=d.callee;return T.type===M.AST_NODE_TYPES.Identifier?T.name==="memo"||T.name==="forwardRef":T.type===M.AST_NODE_TYPES.MemberExpression&&T.property.type===M.AST_NODE_TYPES.Identifier?T.property.name==="memo"||T.property.name==="forwardRef":!1}function h(d){if(d.type===M.AST_NODE_TYPES.JSXElement||d.type===M.AST_NODE_TYPES.JSXFragment)return!0;if(d.type===M.AST_NODE_TYPES.BlockStatement){for(let T of d.body)if(T.type===M.AST_NODE_TYPES.ReturnStatement&&T.argument)return h(T.argument)}if(d.type===M.AST_NODE_TYPES.ArrayExpression){for(let T of d.elements)if(T&&(T.type===M.AST_NODE_TYPES.JSXElement||T.type===M.AST_NODE_TYPES.JSXFragment))return!0}return!1}function C(d){if(d.type!==M.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let T=d.body;if(T.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let F=T.body;if(h(F))return!0}return!1}function S(d){if(d.type===M.AST_NODE_TYPES.TaggedTemplateExpression){let T=d.tag;if(T.type===M.AST_NODE_TYPES.MemberExpression&&T.object.type===M.AST_NODE_TYPES.Identifier&&T.object.name==="styled")return!0;if(T.type===M.AST_NODE_TYPES.CallExpression){let F=T.callee;if(F.type===M.AST_NODE_TYPES.Identifier&&F.name==="styled")return!0}}return!1}function I(d){if(d.type===M.AST_NODE_TYPES.TaggedTemplateExpression){let T=d.tag;if(T.type===M.AST_NODE_TYPES.Identifier&&T.name==="css")return!0}return!1}function A(d,T){if(d.id.type!==M.AST_NODE_TYPES.Identifier)return;let F=d.id.name,P=d.init;if(P){if(S(P)||I(P)){p.push({node:T,name:F});return}if((x(F)||P.type===M.AST_NODE_TYPES.ArrowFunctionExpression)&&(P.type===M.AST_NODE_TYPES.ArrowFunctionExpression||P.type===M.AST_NODE_TYPES.FunctionExpression||m(P))){if(P.type===M.AST_NODE_TYPES.ArrowFunctionExpression||P.type===M.AST_NODE_TYPES.FunctionExpression){if(h(P.body)){i.add(F);return}}else if(m(P)){i.add(F);return}}P.type===M.AST_NODE_TYPES.Identifier&&a.set(F,P.name),x(F)||C(P)&&i.add(F)}}function g(d){return d.type===M.AST_NODE_TYPES.ExportDefaultDeclaration||d.type===M.AST_NODE_TYPES.ExportNamedDeclaration}function E(d){if(d.type===M.AST_NODE_TYPES.FunctionDeclaration)return d.id?d.id.name:null;if(d.type===M.AST_NODE_TYPES.VariableDeclaration){let T=d.declarations[0];if(T&&T.id.type===M.AST_NODE_TYPES.Identifier)return T.id.name}if(d.type===M.AST_NODE_TYPES.ExportDefaultDeclaration){let T=d.declaration;if(T.type===M.AST_NODE_TYPES.FunctionDeclaration)return T.id?T.id.name:"default";if(T.type===M.AST_NODE_TYPES.Identifier)return T.name}if(d.type===M.AST_NODE_TYPES.ExportNamedDeclaration){let T=d.declaration;if(T&&T.type===M.AST_NODE_TYPES.FunctionDeclaration)return T.id?T.id.name:null;if(T&&T.type===M.AST_NODE_TYPES.VariableDeclaration){let F=T.declarations[0];if(F&&F.id.type===M.AST_NODE_TYPES.Identifier)return F.id.name}}return null}function b(d,T){return o?u.has(d):n?n.test(T):g(d)}function w(d){let T=new Set;Me(d.node,F=>{if(F.type===M.AST_NODE_TYPES.Identifier)for(let P of p)P.name===F.name&&(T.add(P.name),(P.firstUsagePosition===void 0||F.range[0]<P.firstUsagePosition)&&(P.firstUsagePosition=F.range[0]));if(F.type===M.AST_NODE_TYPES.JSXElement){let P=F.openingElement;if(P.name.type===M.AST_NODE_TYPES.JSXIdentifier)for(let j of p)j.name===P.name.name&&(T.add(j.name),(j.firstUsagePosition===void 0||P.name.range[0]<j.firstUsagePosition)&&(j.firstUsagePosition=P.name.range[0]))}return!1},r),d.usedStyles=T}function k(d){if(d.type===M.AST_NODE_TYPES.VariableDeclaration){for(let T of d.declarations)A(T,d);return}if(d.type===M.AST_NODE_TYPES.FunctionDeclaration){x(d.id.name)&&h(d.body)&&i.add(d.id.name);return}if(d.type===M.AST_NODE_TYPES.ExportNamedDeclaration&&d.declaration){let T=d.declaration;if(T.type===M.AST_NODE_TYPES.VariableDeclaration){for(let F of T.declarations)A(F,d);return}if(T.type===M.AST_NODE_TYPES.FunctionDeclaration&&T.id){x(T.id.name)&&h(T.body)&&i.add(T.id.name);return}}if(d.type===M.AST_NODE_TYPES.ExportDefaultDeclaration){let T=d.declaration;T.type===M.AST_NODE_TYPES.Identifier&&i.add(T.name),(T.type===M.AST_NODE_TYPES.FunctionDeclaration||T.type===M.AST_NODE_TYPES.ArrowFunctionExpression||T.type===M.AST_NODE_TYPES.FunctionExpression)&&(T.type===M.AST_NODE_TYPES.FunctionDeclaration?T.id?i.add(T.id.name):i.add("default"):h(T.body)&&i.add("default"))}}function N(d,T=new Set){if(i.has(d))return!0;if(T.has(d))return!1;T.add(d);let F=a.get(d);return F?N(F,T):!1}let c={};return o&&(c[o]=d=>{let T=d;for(;T.parent&&T.parent.type!==M.AST_NODE_TYPES.Program;)T=T.parent;T.parent&&(T.type===M.AST_NODE_TYPES.VariableDeclaration||T.type===M.AST_NODE_TYPES.FunctionDeclaration||T.type===M.AST_NODE_TYPES.ExportNamedDeclaration||T.type===M.AST_NODE_TYPES.ExportDefaultDeclaration)&&u.add(T)}),c["Program:exit"]=d=>{let T=0;for(let D of d.body){if(D.type===M.AST_NODE_TYPES.ImportDeclaration){T+=1;continue}break}for(let D of d.body)k(D);for(let D of d.body){let Z=E(D);if(Z&&N(Z)){let B=b(D,Z);l.push({node:D,name:Z,isMainComponent:B,usedStyles:new Set,isExported:g(D)})}}if(!o&&n&&!l.some(D=>D.isMainComponent))for(let D of l)D.isExported&&(D.isMainComponent=!0);for(let D of l)w(D);let F=new Set;for(let D of p)F.add(D.name);let P=new Map;for(let D=0;D<d.body.length;D+=1){let Z=d.body[D];for(let B of p)B.node===Z&&P.set(B.name,D)}let j=new Map;for(let D of p){let Z=f(D),B=new Set;if(Z){let ue=y(Z);for(let ye of ue)F.has(ye)&&ye!==D.name&&B.add(ye)}j.set(D.name,B)}let X=new Map;for(let D of p){let Z=j.get(D.name);if(!Z)continue;let B=P.get(D.name);if(B!==void 0)for(let ue of Z){let ye=X.get(ue);(ye===void 0||B<ye)&&X.set(ue,B)}}let G=[];for(let D of p){if(D.firstUsagePosition===void 0)continue;let Z=d.body.indexOf(D.node),B=-1;for(let xe of l){if(!xe.usedStyles.has(D.name))continue;let Ae=d.body.indexOf(xe.node);(B===-1||Ae<B)&&(B=Ae)}let ue=X.get(D.name);if(ue!==void 0&&(B===-1||ue<B)&&(B=ue),B===-1)continue;let ye=-1;for(let xe of l){let Ae=d.body.indexOf(xe.node);Ae<B&&Ae>ye&&(ye=Ae)}let Pe=Z<B,He=Z>ye,Ee=-1,mt=j.get(D.name);if(mt)for(let xe of mt){let Ae=P.get(xe);Ae!==void 0&&Ae>Ee&&(Ee=Ae)}let rt=Z>Ee;if(!(Pe&&He&&rt)){let xe=ye+1;if(Ee+1>xe&&(xe=Ee+1),xe<T&&(xe=T),xe>B)continue;G.push({style:D,targetPosition:xe})}}let q=null;if(l.length>1){let D=l.map(B=>({c:B,idx:d.body.indexOf(B.node)})).sort((B,ue)=>B.idx-ue.idx)[0]?.c,Z=l.find(B=>B.isMainComponent)||null;D&&Z&&D.node!==Z.node&&(q={component:Z,targetBefore:D.node})}if(G.length>0||q){let D=G[0]?.style.node||q?.component.node||d,Z=G.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:D,messageId:Z,fix:v(G,q,d.body)})}},c;function v(d,T,F){return function*(P){d.sort((X,G)=>X.targetPosition-G.targetPosition);for(let{style:X}of d){let G=r.getCommentsBefore(X.node),q=X.node.range[0],D=X.node.range[1];G.length>0&&G[0]&&(q=G[0].range[0]),q===X.node.range[0]&&r.text.slice(0,q).trim().length===0&&(q=0),yield P.removeRange([q,D])}let j=new Map;for(let X of d){let G=j.get(X.targetPosition)||[];G.push(X),j.set(X.targetPosition,G)}for(let[X,G]of j){let q=F[X];if(!q)continue;let D=r.getCommentsBefore(q),Z=D.length>0&&D[0]?D[0].range[0]:q.range[0],B=[];for(let{style:ue}of G){let ye=r.getCommentsBefore(ue.node),Pe=r.getText(ue.node);ye.length>0&&(Pe=`${ye.map(Ee=>r.getText(Ee)).join(`
|
|
47
47
|
`)}
|
|
48
48
|
${Pe}`),B.push(Pe)}yield P.insertTextBeforeRange([Z,Z],`${B.join(`
|
|
49
49
|
|
|
@@ -52,4 +52,4 @@ ${Pe}`),B.push(Pe)}yield P.insertTextBeforeRange([Z,Z],`${B.join(`
|
|
|
52
52
|
`)}if(T){let{component:X,targetBefore:G}=T,q=r.getCommentsBefore(X.node),D=X.node.range[0],Z=X.node.range[1];q.length>0&&q[0]&&(D=q[0].range[0]),D===X.node.range[0]&&r.text.slice(0,D).trim().length===0&&(D=0);let B=r.getCommentsBefore(G),ue=B.length>0&&B[0]?B[0].range[0]:G.range[0],ye=(()=>{let Pe=r.getText(X.node);return q.length>0&&(Pe=`${q.map(Ee=>r.getText(Ee)).join(`
|
|
53
53
|
`)}
|
|
54
54
|
${Pe}`),Pe})();yield P.removeRange([D,Z]),yield P.insertTextBeforeRange([ue,ue],`${ye}
|
|
55
|
-
`)}}}}});var _t=require("@typescript-eslint/utils"),Gn=Ne(require("typescript")),vi=require("zod/v4");var
|
|
55
|
+
`)}}}}});var _t=require("@typescript-eslint/utils"),Gn=Ne(require("typescript")),vi=require("zod/v4");var gl=vi.z.object({}),Kn=U({name:"no-unnecessary-void-on-promise",meta:{type:"suggestion",docs:{description:"Disallow void operator on non-Promise function calls to avoid unnecessary void keywords added by no-floating-promises"},messages:{unnecessaryVoid:"Unnecessary void operator on non-Promise function call",removeVoid:"Remove void operator"},hasSuggestions:!0,schema:[z(gl)]},defaultOptions:[{}],create(e){let t=_t.ESLintUtils.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(o,s){if(o.flags&Gn.default.TypeFlags.Any||o.flags&Gn.default.TypeFlags.Unknown)return!1;let i=o.getProperty("then");return i?s.getTypeOfSymbol(i).getCallSignatures().length>0:!1}return{UnaryExpression(o){if(o.operator!=="void"||o.argument.type!==_t.AST_NODE_TYPES.CallExpression)return;let s=t.esTreeNodeToTSNodeMap.get(o.argument),i=r.getTypeAtLocation(s);if(!n(i,r)){let l=e.sourceCode.getText(o.argument);e.report({node:o,messageId:"unnecessaryVoid",suggest:[{messageId:"removeVoid",fix(p){return p.replaceText(o,l)}}]})}}}}});var Ie=require("@typescript-eslint/utils"),ut=require("zod/v4");var Sl=ut.z.object({functions:ut.z.array(ut.z.string()).optional(),selectors:ut.z.array(ut.z.string()).optional()});function Ri(e){let t=e.parent;for(;t;){if(t.type===Ie.AST_NODE_TYPES.FunctionDeclaration||t.type===Ie.AST_NODE_TYPES.FunctionExpression||t.type===Ie.AST_NODE_TYPES.ArrowFunctionExpression)return!0;t=t.parent}return!1}function ki(e){if(e.type===Ie.AST_NODE_TYPES.TaggedTemplateExpression){let{tag:r}=e;return r.type===Ie.AST_NODE_TYPES.Identifier?r.name:r.type===Ie.AST_NODE_TYPES.MemberExpression&&r.property.type===Ie.AST_NODE_TYPES.Identifier?r.property.name:null}let{callee:t}=e;return t.type===Ie.AST_NODE_TYPES.Identifier?t.name:t.type===Ie.AST_NODE_TYPES.MemberExpression&&t.property.type===Ie.AST_NODE_TYPES.Identifier?t.property.name:null}var Qn=U({name:"require-lazy-execution",meta:{type:"problem",docs:{description:"Require certain function calls to be executed lazily (inside functions, not at module level)"},messages:{moduleLevel:'Function "{{ functionName }}" must only be called inside functions or getters, not at module level'},schema:[z(Sl)]},defaultOptions:[{functions:[],selectors:[]}],create(e){let[t]=e.options,r=new Set(t.functions??[]),n=t.selectors??[];function o(i){if(Ri(i))return;let a=ki(i);a&&r.has(a)&&e.report({node:i,messageId:"moduleLevel",data:{functionName:a}})}let s={CallExpression(i){i.type===Ie.AST_NODE_TYPES.CallExpression&&o(i)},TaggedTemplateExpression(i){i.type===Ie.AST_NODE_TYPES.TaggedTemplateExpression&&o(i)}};for(let i of n)s[i]=a=>{if(a.type!==Ie.AST_NODE_TYPES.CallExpression&&a.type!==Ie.AST_NODE_TYPES.TaggedTemplateExpression||Ri(a))return;let l=ki(a);l&&e.report({node:a,messageId:"moduleLevel",data:{functionName:l}})};return s}});var ke=require("@typescript-eslint/utils");function Tl(e,t){let{body:r}=e;if(r.type!==ke.AST_NODE_TYPES.BlockStatement)return t.getText(r);let n=r.body[0];return!n||n.type!==ke.AST_NODE_TYPES.ReturnStatement?"":n.argument?t.getText(n.argument):"undefined"}function El(e){let t=e.parent;if(t.type!==ke.AST_NODE_TYPES.ReturnStatement)return null;let r=t.parent;if(r.type!==ke.AST_NODE_TYPES.BlockStatement||r.body.length!==1)return null;let n=r.parent;return n.type!==ke.AST_NODE_TYPES.FunctionDeclaration&&n.type!==ke.AST_NODE_TYPES.ArrowFunctionExpression&&n.type!==ke.AST_NODE_TYPES.FunctionExpression?null:{parentFunction:n,returnStatement:t}}var er=U({name:"no-unnecessary-iife",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary immediately invoked function expressions"},messages:{unnecessaryIife:"Unnecessary IIFE. Can be simplified to the returned expression."},schema:[]},defaultOptions:[],create(e){let t=e.sourceCode;return{CallExpression(r){let{callee:n,arguments:o}=r;if(o.length>0||n.type!==ke.AST_NODE_TYPES.FunctionExpression&&n.type!==ke.AST_NODE_TYPES.ArrowFunctionExpression||n.async||n.params.length>0)return;let{body:s}=n;if(s.type===ke.AST_NODE_TYPES.BlockStatement){if(s.body.length!==1){let p=El(r);if(p){if(t.getCommentsInside(n).length>0)return;let f=t.getText(s);e.report({node:r,messageId:"unnecessaryIife",fix:y=>{let{parentFunction:x}=p;return x.body.type!==ke.AST_NODE_TYPES.BlockStatement?null:y.replaceText(x.body,f)}})}return}let l=s.body[0];if(!l||l.type!==ke.AST_NODE_TYPES.ReturnStatement)return}if(t.getCommentsInside(n).length>0)return;let a=Tl(n,t);e.report({node:r,messageId:"unnecessaryIife",fix:l=>l.replaceText(r,a)})}}}});var Ke=require("zod/v4");var hl="no-restricted-comments",bl=Ke.z.object({regex:Ke.z.string().optional(),includes:Ke.z.string().optional(),message:Ke.z.string().optional(),autoFix:Ke.z.boolean().optional()}),xl=Ke.z.object({patterns:Ke.z.array(bl)}),tr=U({name:hl,meta:{type:"problem",docs:{description:"Disallow comments matching specific patterns"},fixable:"code",hasSuggestions:!0,schema:[z(xl)],messages:{restrictedComment:"Comment matches restricted pattern '{{pattern}}'",restrictedCommentWithMessage:"{{message}}",removeComment:"Remove this comment"}},defaultOptions:[{patterns:[]}],create(e,[t]){let r=e.sourceCode,n=new Map;function o(i){let a=n.get(i);return a||(a=new RegExp(i),n.set(i,a)),a}function s(i,a){return a.regex?o(a.regex).test(i):a.includes?i.includes(a.includes):!1}return{Program(){let i=r.getAllComments();for(let l of i)for(let p of t.patterns)if(s(l.value,p)){let f=function(y){return y.remove(l)};var a=f;let u=p.regex??p.includes??"";p.message?e.report({loc:l.loc,messageId:"restrictedCommentWithMessage",data:{message:p.message},fix:p.autoFix?f:void 0,suggest:p.autoFix?void 0:[{messageId:"removeComment",fix:f}]}):e.report({loc:l.loc,messageId:"restrictedComment",data:{pattern:u},fix:p.autoFix?f:void 0,suggest:p.autoFix?void 0:[{messageId:"removeComment",fix:f}]});break}}}}});var $t=require("@typescript-eslint/utils"),ft=require("zod/v4");var Cl=ft.z.object({allow:ft.z.record(ft.z.string(),ft.z.array(ft.z.string())).optional()}),nr=U({name:"no-data-attributes-on-components",meta:{type:"problem",docs:{description:"Disallow data-* attributes on custom React components. Use regular props instead."},schema:[z(Cl)],messages:{noDataAttributesOnComponents:"Avoid using data-* attributes on custom components. Use regular props instead or apply data attributes to the underlying DOM element."}},defaultOptions:[{}],create(e,[t]){let r=t.allow??{};function n(i){let a=i.charAt(0);return a===a.toUpperCase()&&a!==a.toLowerCase()}function o(i){return i.type===$t.AST_NODE_TYPES.JSXIdentifier?{name:i.name,isCustom:n(i.name)}:i.type===$t.AST_NODE_TYPES.JSXMemberExpression?{name:"",isCustom:!0}:{name:`${i.namespace.name}:${i.name.name}`,isCustom:!1}}function s(i,a){let l=r[i];return l?l.includes(a):!1}return{JSXAttribute(i){if(i.name.type!==$t.AST_NODE_TYPES.JSXIdentifier)return;let a=i.name.name;if(!a.startsWith("data-"))return;let l=o(i.parent.name);!l||!l.isCustom||l.name&&s(l.name,a)||e.report({node:i,messageId:"noDataAttributesOnComponents"})}}}});var Pi={[bn.name]:bn.rule,[en.name]:en.rule,[Qt.name]:Qt.rule,"rules-of-hooks":Ii,"exhaustive-deps":dr,"require-description":yi.rule,[tn.name]:tn.rule,[rn.name]:rn.rule,[Cn.name]:Cn.rule,[zt.name]:zt.rule,[Kt.name]:Kt.rule,[sn.name]:sn.rule,[gt.name]:gt.rule,[wn.name]:wn.rule,[on.name]:on.rule,[nn.name]:nn.rule,[ln.name]:ln.rule,[Wt.name]:Wt.rule,[Pn.name]:Pn.rule,[kn.name]:kn.rule,[On.name]:On.rule,[Mn.name]:Mn.rule,[Gt.name]:Gt.rule,[fn.name]:fn.rule,[mn.name]:mn.rule,[yn.name]:yn.rule,[Tn.name]:Tn.rule,[En.name]:En.rule,[dn.name]:dn.rule,[Sn.name]:Sn.rule,[An.name]:An.rule,[cn.name]:cn.rule,[pn.name]:pn.rule,[Jn.name]:Jn.rule,[xn.name]:xn.rule,[_n.name]:_n.rule,[Vn.name]:Vn.rule,[Xn.name]:Xn.rule,[Bn.name]:Bn.rule,[Hn.name]:Hn.rule,[Yn.name]:Yn.rule,[qn.name]:qn.rule,[Zn.name]:Zn.rule,[Kn.name]:Kn.rule,[Qn.name]:Qn.rule,[gt.name]:gt.rule,[er.name]:er.rule,[tr.name]:tr.rule,[nr.name]:nr.rule};var Ni={rules:Pi},Il=Ni;0&&(module.exports={extendedLintPlugin});
|