@ls-stack/extended-lint 0.57.0 → 0.57.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- "use strict";var ir=Object.create;var ze=Object.defineProperty;var sr=Object.getOwnPropertyDescriptor;var or=Object.getOwnPropertyNames;var ar=Object.getPrototypeOf,lr=Object.prototype.hasOwnProperty;var pr=(e,t)=>{for(var r in t)ze(e,r,{get:t[r],enumerable:!0})},Jt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of or(t))!lr.call(e,o)&&o!==r&&ze(e,o,{get:()=>t[o],enumerable:!(n=sr(t,o))||n.enumerable});return e};var ve=(e,t,r)=>(r=e!=null?ir(ar(e)):{},Jt(t||!e||!e.__esModule?ze(r,"default",{value:e,enumerable:!0}):r,e)),cr=e=>Jt(ze({},"__esModule",{value:!0}),e);var is={};pr(is,{extendedLintPlugin:()=>rs});module.exports=cr(is);var Z=require("@typescript-eslint/utils");var tt=Symbol.for("optional");function $(e){return{...e,[tt]:!0}}function Bt(e,t){return{enum:e,...t}}function Ne(e){return{...e,type:"boolean"}}function H(e){return{...e,type:"string"}}function ge(e){return{...e,type:"number"}}function te(e,t){return{...t,type:"array",items:e}}function Y(e,t){let r={...t,type:"object",properties:e};if(e&&(r.additionalProperties||=!1,!r.required)){let n,o=[];for(n in e)e[n][tt]?e[n][tt]=void 0:o.push(n);o.length>0&&(r.required=o)}return r}var ur=Z.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Gt="react-compiler-extra",fr=Y({runOnlyWithEnableCompilerDirective:$(Ne())}),mr=/eslint +react-compiler\/react-compiler: +\["error/;function dr(e){return e.type===Z.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===Z.AST_NODE_TYPES.MemberExpression&&e.property.type===Z.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var yr=/\bthis[.[]/;function Xt(e){return yr.test(e)}var gr=ur({name:Gt,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."},hasSuggestions:!0,schema:[fr]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let a of e.sourceCode.getAllComments())if(mr.test(a.value)){r=!0;break}if(!r)return{}}function n(a){for(let i of a.properties)if(i.type===Z.AST_NODE_TYPES.Property&&i.method&&i.value.type===Z.AST_NODE_TYPES.FunctionExpression){let s=e.sourceCode,l=s.getText(i.key),p=i.value,c=s.getText(p.body);if(Xt(c))e.report({node:i,messageId:"thisKeywordInMethod"});else{let f=p.params.map(T=>s.getText(T)).join(", "),y="";p.generator?y=`${l}: function* (${f}) ${c}`:y=`${l}: (${f}) => ${c}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:T=>T.replaceText(i,y)})}}}function o(a){for(let i of a.properties)if(i.type===Z.AST_NODE_TYPES.Property&&i.value.type===Z.AST_NODE_TYPES.ObjectExpression){for(let s of i.value.properties)if(s.type===Z.AST_NODE_TYPES.Property&&s.method&&s.value.type===Z.AST_NODE_TYPES.FunctionExpression){let p=e.sourceCode.getText(s.value.body);Xt(p)&&e.report({node:s,messageId:"thisKeywordInMethod"})}}}return{CallExpression(a){if(dr(a.callee))for(let i of a.arguments){if(i.type===Z.AST_NODE_TYPES.ObjectExpression&&(n(i),o(i)),i.type===Z.AST_NODE_TYPES.ArrowFunctionExpression&&(i.body.type===Z.AST_NODE_TYPES.ObjectExpression&&(n(i.body),o(i.body)),i.body.type===Z.AST_NODE_TYPES.BlockStatement))for(let s of i.body.body)s.type===Z.AST_NODE_TYPES.ReturnStatement&&s.argument?.type===Z.AST_NODE_TYPES.ObjectExpression&&(n(s.argument),o(s.argument));if(i.type===Z.AST_NODE_TYPES.FunctionExpression)for(let s of i.body.body)s.type===Z.AST_NODE_TYPES.ReturnStatement&&s.argument?.type===Z.AST_NODE_TYPES.ObjectExpression&&(n(s.argument),o(s.argument))}}}}}),nt={name:Gt,rule:gr};var re=require("@typescript-eslint/utils"),w=require("zod/v4");var Kt=require("@typescript-eslint/utils"),Zt=ve(require("zod/v4"));function X(e){let r=Kt.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function Ce(e){return Zt.toJSONSchema(e)}var Sr=w.z.object({disallow:w.z.array(w.z.object({selector:w.z.string(),message:w.z.string(),replace:w.z.optional(w.z.union([w.z.string(),w.z.object({regex:w.z.string(),with:w.z.string()})])),replaceType:w.z.optional(w.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:w.z.optional(w.z.array(w.z.object({fn:w.z.string(),withArgs:w.z.optional(w.z.array(w.z.object({atIndex:w.z.number(),value:w.z.union([w.z.string(),w.z.number(),w.z.boolean()])}))),message:w.z.string(),replaceWith:w.z.optional(w.z.string()),ignoreRegex:w.z.optional(w.z.string())}))),__dev_simulateFileName:w.z.optional(w.z.string()),mustMatchSyntax:w.z.optional(w.z.array(w.z.object({includeRegex:w.z.string(),mustCallFn:w.z.optional(w.z.array(w.z.object({anyCall:w.z.array(w.z.object({fn:w.z.string(),withArgs:w.z.array(w.z.object({atIndex:w.z.number(),literal:w.z.union([w.z.string(),w.z.number(),w.z.boolean()])}))})),message:w.z.optional(w.z.string())}))),mustMatchSelector:w.z.optional(w.z.array(w.z.object({selector:w.z.string(),message:w.z.string()}))),mustHaveExport:w.z.optional(w.z.array(w.z.object({name:w.z.string(),type:w.z.enum(["function","variable","any"]).default("any"),message:w.z.string()})))})))}),rt=X({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[Ce(Sr)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:a,disallowFnCalls:i}=t,s=o??e.filename,l=[],p=new Map,c=new Set,f=new Map,y=new Set,T=new Map;function I(m){for(let S of m.specifiers)S.type===re.AST_NODE_TYPES.ImportSpecifier&&S.imported.type===re.AST_NODE_TYPES.Identifier&&S.imported.name!==S.local.name&&T.set(S.local.name,S.imported.name)}function x(m){if(m.declaration){if(m.declaration.type===re.AST_NODE_TYPES.FunctionDeclaration&&m.declaration.id){let S=m.declaration.id.name;for(let k of Array.from(y)){let[A,C]=k.split(":");A===S&&(C==="function"||C==="any")&&y.delete(k)}}else if(m.declaration.type===re.AST_NODE_TYPES.VariableDeclaration){for(let S of m.declaration.declarations)if(S.id.type===re.AST_NODE_TYPES.Identifier){let k=S.id.name;for(let A of Array.from(y)){let[C,N]=A.split(":");C===k&&(N==="variable"||N==="any")&&y.delete(A)}}}}for(let S of m.specifiers)if(S.exported.type===re.AST_NODE_TYPES.Identifier){let k=S.exported.name;for(let A of Array.from(y)){let[C,N]=A.split(":");C===k&&N==="any"&&y.delete(A)}}}function E(m){m.id.type===re.AST_NODE_TYPES.Identifier&&m.init?.type===re.AST_NODE_TYPES.Identifier&&T.set(m.id.name,m.init.name)}function u(m){return T.get(m)??m}function R(m,S){return u(m)===S||m===S}for(let{includeRegex:m,mustCallFn:S,mustMatchSelector:k,mustHaveExport:A}of n??[]){let C=Tr(s,new RegExp(m));if(!C)continue;let N=z=>{let B=z;for(let{name:ne,value:ee}of C)B=B.replaceAll(ne,ee);return B};for(let{anyCall:z,message:B}of S??[]){let ne=`Expected file to call the function: ${z.map(({fn:ee})=>ee).join(" or ")}`;c.add(ne),l.push(ee=>{let{callee:xe}=ee;if(xe.type===re.AST_NODE_TYPES.Identifier){for(let{fn:G,withArgs:ye}of z)if(xe.name===G){c.delete(ne);for(let fe of ye){let se=ee.arguments[fe.atIndex],Te=typeof fe.literal=="string"?N(fe.literal):fe.literal;if(!se){e.report({node:ee,messageId:"default",data:{message:`Missing argument with value "${Te}" at index ${fe.atIndex}${B?`: ${N(B)}`:""}`}});continue}if(se.type!==re.AST_NODE_TYPES.Literal){e.report({node:se,messageId:"default",data:{message:`Argument at position ${fe.atIndex} should the literal "${Te}"${B?`: ${N(B)}`:""}`}});continue}se.value!==Te&&e.report({node:se,messageId:"default",data:{message:`Argument should have the value "${Te}"${B?`: ${N(B)}`:""}`},fix:Fe=>Fe.replaceText(se,typeof Te=="string"?`'${Te}'`:String(Te))})}break}}})}for(let{selector:z,message:B}of k??[])f.set(z,N(B)),p.set(N(z),()=>{f.delete(z)});for(let{name:z,type:B,message:ne}of A??[]){let ee=N(z),xe=N(ne);y.add(`${ee}:${B}:${xe}`)}}for(let{fn:m,withArgs:S,message:k,replaceWith:A,ignoreRegex:C}of i??[])C&&new RegExp(C).test(s)||l.push(N=>{let{callee:z}=N;if(z.type!==re.AST_NODE_TYPES.Identifier||!R(z.name,m))return;if(S)for(let ne of S){let ee=N.arguments[ne.atIndex];if(!ee){e.report({node:N,messageId:"default",data:{message:`Missing argument with value "${ne.value}" at index ${ne.atIndex}: ${k}`}});return}if(ee.type!==re.AST_NODE_TYPES.Literal||ee.value!==ne.value)return}let B=ne=>A?ne.replaceText(N,A):null;e.report({node:N,messageId:"default",data:{message:k},suggest:A?[{messageId:"default",data:{message:`Replace with "${A}"`},fix:B}]:void 0})});function b(m,S){let k=r[m];k?r[m]=A=>{k(A),S(A)}:r[m]=S}for(let{selector:m,message:S,replace:k,replaceType:A="suggestion"}of a??[]){if(m==="CallExpression"){l.push(C=>{g(k,C,S,A)});continue}r[m]=C=>{g(k,C,S,A)}}if(p.size>0)for(let[m,S]of p)b(m,S);return l.length>0&&(r.CallExpression=m=>{if(m.type===re.AST_NODE_TYPES.CallExpression)for(let S of l)S(m)}),r.ImportDeclaration=m=>{m.type===re.AST_NODE_TYPES.ImportDeclaration&&I(m)},r.ExportNamedDeclaration=m=>{m.type===re.AST_NODE_TYPES.ExportNamedDeclaration&&x(m)},r.VariableDeclarator=m=>{m.type===re.AST_NODE_TYPES.VariableDeclarator&&E(m)},r["Program:exit"]=m=>{for(let S of c)e.report({node:m,messageId:"default",data:{message:S}});for(let[,S]of f)e.report({node:m,messageId:"default",data:{message:S}});for(let S of y){let[k,A,C]=S.split(":");e.report({node:m,messageId:"default",data:{message:`Missing required export "${k}" of type ${A}: ${C}`}})}},r;function g(m,S,k,A){let C=N=>{if(!m)return null;if(typeof m=="string")return N.replaceText(S,m);{let z=new RegExp(m.regex),B=e.sourceCode.getText(S);return N.replaceText(S,B.replace(z,m.with))}};e.report({node:S,messageId:"default",data:{message:k},fix:m&&A==="autofix"?C:void 0,suggest:m&&A==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof m=="string"?m:m.with}"`},fix:C}]:void 0})}}});function Tr(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...a]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:Qt(o)}),r.push({name:"$0_uncapitalize",value:en(o)}),r.push({name:"$0",value:o});for(let i=0;i<a.length;i++){let s=`$${i+1}`,l=a[i];r.push({name:`${s}_lowercase`,value:l.toLowerCase()}),r.push({name:`${s}_capitalize`,value:Qt(l)}),r.push({name:`${s}_uncapitalize`,value:en(l)}),r.push({name:s,value:l})}return r}function Qt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function en(e){return e.charAt(0).toLowerCase()+e.slice(1)}var _=require("@typescript-eslint/utils");var hr=_.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nn="collapse-simple-objs-in-one-line",Er=Y({maxLineLength:$(ge()),maxProperties:$(ge()),nestedObjMaxLineLength:$(ge()),nestedObjMaxProperties:$(ge()),ignoreTypesWithSuffix:$(te(H()))}),br=hr({name:nn,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:[Er]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,a=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function s(p){if(p.type===_.AST_NODE_TYPES.ObjectExpression){let c=p.parent.type===_.AST_NODE_TYPES.Property,f=c?i:o,y=p.properties.length;if(y>f)return!1;if(y===1){let I=p.properties[0];return I.type===_.AST_NODE_TYPES.Property&&I.value.type===_.AST_NODE_TYPES.ObjectExpression||I.type===_.AST_NODE_TYPES.Property&&I.value.type===_.AST_NODE_TYPES.ArrayExpression&&!I.value.elements.every(E=>E&&it(E))?!1:{text:r.getText(I),isNested:c,propsSize:y}}let T=[];for(let I of p.properties){if(I.type===_.AST_NODE_TYPES.Property&&!it(I.value))return!1;T.push(r.getText(I))}return{text:T.join(", "),isNested:c,propsSize:y}}else{let c=p.parent.parent?.type===_.AST_NODE_TYPES.TSPropertySignature,f=c?i:o,y=p.members.length;if(y>f)return!1;if(n.length>0&&p.parent.type===_.AST_NODE_TYPES.TSTypeAliasDeclaration){let I=p.parent.id.name;if(n.some(x=>I.endsWith(x)))return!1}if(y===1){let I=p.members[0];return I.type===_.AST_NODE_TYPES.TSPropertySignature&&I.typeAnnotation?.typeAnnotation.type===_.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(I),isNested:c,propsSize:1}}if(p.parent.type===_.AST_NODE_TYPES.TSIntersectionType||p.parent.type===_.AST_NODE_TYPES.TSUnionType&&p.parent.types[0]!==p)return!1;let T=[];for(let I of p.members){if(I.type!==_.AST_NODE_TYPES.TSPropertySignature)return!1;let x=I.typeAnnotation?.typeAnnotation;if(!x||x.type===_.AST_NODE_TYPES.TSTypeLiteral||!tn(x))return!1;if(x.type===_.AST_NODE_TYPES.TSTypeReference&&x.typeArguments){if(x.typeArguments.params.length>1)return!1;let u=x.typeArguments.params[0];if(!tn(u))return!1}let E=r.getText(I).trim();(E.endsWith(";")||E.endsWith(","))&&(E=E.slice(0,-1)),T.push(E)}return{text:T.join("; "),isNested:c,propsSize:y}}}function l(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==_.AST_NODE_TYPES.JSXExpressionContainer){let x=0,E=!1,u=r.getTokenAfter(p,{filter:b=>b.type!==_.AST_TOKEN_TYPES.Punctuator||E?!0:b.value===","?(x++,!1):b.value===";"?(x++,E=!0,!1):b.value===")"||b.value==="}"?(x++,!1):!0});if(x>4)return;let R=u?.type===_.AST_TOKEN_TYPES.Template&&u.value.startsWith(`}
1
+ "use strict";var ir=Object.create;var He=Object.defineProperty;var sr=Object.getOwnPropertyDescriptor;var or=Object.getOwnPropertyNames;var ar=Object.getPrototypeOf,lr=Object.prototype.hasOwnProperty;var pr=(e,t)=>{for(var r in t)He(e,r,{get:t[r],enumerable:!0})},Jt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of or(t))!lr.call(e,o)&&o!==r&&He(e,o,{get:()=>t[o],enumerable:!(n=sr(t,o))||n.enumerable});return e};var ve=(e,t,r)=>(r=e!=null?ir(ar(e)):{},Jt(t||!e||!e.__esModule?He(r,"default",{value:e,enumerable:!0}):r,e)),cr=e=>Jt(He({},"__esModule",{value:!0}),e);var is={};pr(is,{extendedLintPlugin:()=>rs});module.exports=cr(is);var Z=require("@typescript-eslint/utils");var nt=Symbol.for("optional");function $(e){return{...e,[nt]:!0}}function Bt(e,t){return{enum:e,...t}}function Ne(e){return{...e,type:"boolean"}}function H(e){return{...e,type:"string"}}function ge(e){return{...e,type:"number"}}function te(e,t){return{...t,type:"array",items:e}}function Y(e,t){let r={...t,type:"object",properties:e};if(e&&(r.additionalProperties||=!1,!r.required)){let n,o=[];for(n in e)e[n][nt]?e[n][nt]=void 0:o.push(n);o.length>0&&(r.required=o)}return r}var ur=Z.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Gt="react-compiler-extra",fr=Y({runOnlyWithEnableCompilerDirective:$(Ne())}),mr=/eslint +react-compiler\/react-compiler: +\["error/;function dr(e){return e.type===Z.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===Z.AST_NODE_TYPES.MemberExpression&&e.property.type===Z.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var yr=/\bthis[.[]/;function Xt(e){return yr.test(e)}var gr=ur({name:Gt,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."},hasSuggestions:!0,schema:[fr]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let a of e.sourceCode.getAllComments())if(mr.test(a.value)){r=!0;break}if(!r)return{}}function n(a){for(let i of a.properties)if(i.type===Z.AST_NODE_TYPES.Property&&i.method&&i.value.type===Z.AST_NODE_TYPES.FunctionExpression){let s=e.sourceCode,l=s.getText(i.key),p=i.value,c=s.getText(p.body);if(Xt(c))e.report({node:i,messageId:"thisKeywordInMethod"});else{let f=p.params.map(T=>s.getText(T)).join(", "),y="";p.generator?y=`${l}: function* (${f}) ${c}`:y=`${l}: (${f}) => ${c}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:T=>T.replaceText(i,y)})}}}function o(a){for(let i of a.properties)if(i.type===Z.AST_NODE_TYPES.Property&&i.value.type===Z.AST_NODE_TYPES.ObjectExpression){for(let s of i.value.properties)if(s.type===Z.AST_NODE_TYPES.Property&&s.method&&s.value.type===Z.AST_NODE_TYPES.FunctionExpression){let p=e.sourceCode.getText(s.value.body);Xt(p)&&e.report({node:s,messageId:"thisKeywordInMethod"})}}}return{CallExpression(a){if(dr(a.callee))for(let i of a.arguments){if(i.type===Z.AST_NODE_TYPES.ObjectExpression&&(n(i),o(i)),i.type===Z.AST_NODE_TYPES.ArrowFunctionExpression&&(i.body.type===Z.AST_NODE_TYPES.ObjectExpression&&(n(i.body),o(i.body)),i.body.type===Z.AST_NODE_TYPES.BlockStatement))for(let s of i.body.body)s.type===Z.AST_NODE_TYPES.ReturnStatement&&s.argument?.type===Z.AST_NODE_TYPES.ObjectExpression&&(n(s.argument),o(s.argument));if(i.type===Z.AST_NODE_TYPES.FunctionExpression)for(let s of i.body.body)s.type===Z.AST_NODE_TYPES.ReturnStatement&&s.argument?.type===Z.AST_NODE_TYPES.ObjectExpression&&(n(s.argument),o(s.argument))}}}}}),rt={name:Gt,rule:gr};var re=require("@typescript-eslint/utils"),w=require("zod/v4");var Kt=require("@typescript-eslint/utils"),Zt=ve(require("zod/v4"));function X(e){let r=Kt.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function Ce(e){return Zt.toJSONSchema(e)}var Sr=w.z.object({disallow:w.z.array(w.z.object({selector:w.z.string(),message:w.z.string(),replace:w.z.optional(w.z.union([w.z.string(),w.z.object({regex:w.z.string(),with:w.z.string()})])),replaceType:w.z.optional(w.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:w.z.optional(w.z.array(w.z.object({fn:w.z.string(),withArgs:w.z.optional(w.z.array(w.z.object({atIndex:w.z.number(),value:w.z.union([w.z.string(),w.z.number(),w.z.boolean()])}))),message:w.z.string(),replaceWith:w.z.optional(w.z.string()),ignoreRegex:w.z.optional(w.z.string())}))),__dev_simulateFileName:w.z.optional(w.z.string()),mustMatchSyntax:w.z.optional(w.z.array(w.z.object({includeRegex:w.z.string(),mustCallFn:w.z.optional(w.z.array(w.z.object({anyCall:w.z.array(w.z.object({fn:w.z.string(),withArgs:w.z.array(w.z.object({atIndex:w.z.number(),literal:w.z.union([w.z.string(),w.z.number(),w.z.boolean()])}))})),message:w.z.optional(w.z.string())}))),mustMatchSelector:w.z.optional(w.z.array(w.z.object({selector:w.z.string(),message:w.z.string()}))),mustHaveExport:w.z.optional(w.z.array(w.z.object({name:w.z.string(),type:w.z.enum(["function","variable","any"]).default("any"),message:w.z.string()})))})))}),it=X({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[Ce(Sr)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:a,disallowFnCalls:i}=t,s=o??e.filename,l=[],p=new Map,c=new Set,f=new Map,y=new Set,T=new Map;function I(m){for(let S of m.specifiers)S.type===re.AST_NODE_TYPES.ImportSpecifier&&S.imported.type===re.AST_NODE_TYPES.Identifier&&S.imported.name!==S.local.name&&T.set(S.local.name,S.imported.name)}function x(m){if(m.declaration){if(m.declaration.type===re.AST_NODE_TYPES.FunctionDeclaration&&m.declaration.id){let S=m.declaration.id.name;for(let k of Array.from(y)){let[A,C]=k.split(":");A===S&&(C==="function"||C==="any")&&y.delete(k)}}else if(m.declaration.type===re.AST_NODE_TYPES.VariableDeclaration){for(let S of m.declaration.declarations)if(S.id.type===re.AST_NODE_TYPES.Identifier){let k=S.id.name;for(let A of Array.from(y)){let[C,N]=A.split(":");C===k&&(N==="variable"||N==="any")&&y.delete(A)}}}}for(let S of m.specifiers)if(S.exported.type===re.AST_NODE_TYPES.Identifier){let k=S.exported.name;for(let A of Array.from(y)){let[C,N]=A.split(":");C===k&&N==="any"&&y.delete(A)}}}function E(m){m.id.type===re.AST_NODE_TYPES.Identifier&&m.init?.type===re.AST_NODE_TYPES.Identifier&&T.set(m.id.name,m.init.name)}function u(m){return T.get(m)??m}function R(m,S){return u(m)===S||m===S}for(let{includeRegex:m,mustCallFn:S,mustMatchSelector:k,mustHaveExport:A}of n??[]){let C=Tr(s,new RegExp(m));if(!C)continue;let N=z=>{let B=z;for(let{name:ne,value:ee}of C)B=B.replaceAll(ne,ee);return B};for(let{anyCall:z,message:B}of S??[]){let ne=`Expected file to call the function: ${z.map(({fn:ee})=>ee).join(" or ")}`;c.add(ne),l.push(ee=>{let{callee:xe}=ee;if(xe.type===re.AST_NODE_TYPES.Identifier){for(let{fn:G,withArgs:ye}of z)if(xe.name===G){c.delete(ne);for(let fe of ye){let se=ee.arguments[fe.atIndex],Te=typeof fe.literal=="string"?N(fe.literal):fe.literal;if(!se){e.report({node:ee,messageId:"default",data:{message:`Missing argument with value "${Te}" at index ${fe.atIndex}${B?`: ${N(B)}`:""}`}});continue}if(se.type!==re.AST_NODE_TYPES.Literal){e.report({node:se,messageId:"default",data:{message:`Argument at position ${fe.atIndex} should the literal "${Te}"${B?`: ${N(B)}`:""}`}});continue}se.value!==Te&&e.report({node:se,messageId:"default",data:{message:`Argument should have the value "${Te}"${B?`: ${N(B)}`:""}`},fix:Fe=>Fe.replaceText(se,typeof Te=="string"?`'${Te}'`:String(Te))})}break}}})}for(let{selector:z,message:B}of k??[])f.set(z,N(B)),p.set(N(z),()=>{f.delete(z)});for(let{name:z,type:B,message:ne}of A??[]){let ee=N(z),xe=N(ne);y.add(`${ee}:${B}:${xe}`)}}for(let{fn:m,withArgs:S,message:k,replaceWith:A,ignoreRegex:C}of i??[])C&&new RegExp(C).test(s)||l.push(N=>{let{callee:z}=N;if(z.type!==re.AST_NODE_TYPES.Identifier||!R(z.name,m))return;if(S)for(let ne of S){let ee=N.arguments[ne.atIndex];if(!ee){e.report({node:N,messageId:"default",data:{message:`Missing argument with value "${ne.value}" at index ${ne.atIndex}: ${k}`}});return}if(ee.type!==re.AST_NODE_TYPES.Literal||ee.value!==ne.value)return}let B=ne=>A?ne.replaceText(N,A):null;e.report({node:N,messageId:"default",data:{message:k},suggest:A?[{messageId:"default",data:{message:`Replace with "${A}"`},fix:B}]:void 0})});function b(m,S){let k=r[m];k?r[m]=A=>{k(A),S(A)}:r[m]=S}for(let{selector:m,message:S,replace:k,replaceType:A="suggestion"}of a??[]){if(m==="CallExpression"){l.push(C=>{g(k,C,S,A)});continue}r[m]=C=>{g(k,C,S,A)}}if(p.size>0)for(let[m,S]of p)b(m,S);return l.length>0&&(r.CallExpression=m=>{if(m.type===re.AST_NODE_TYPES.CallExpression)for(let S of l)S(m)}),r.ImportDeclaration=m=>{m.type===re.AST_NODE_TYPES.ImportDeclaration&&I(m)},r.ExportNamedDeclaration=m=>{m.type===re.AST_NODE_TYPES.ExportNamedDeclaration&&x(m)},r.VariableDeclarator=m=>{m.type===re.AST_NODE_TYPES.VariableDeclarator&&E(m)},r["Program:exit"]=m=>{for(let S of c)e.report({node:m,messageId:"default",data:{message:S}});for(let[,S]of f)e.report({node:m,messageId:"default",data:{message:S}});for(let S of y){let[k,A,C]=S.split(":");e.report({node:m,messageId:"default",data:{message:`Missing required export "${k}" of type ${A}: ${C}`}})}},r;function g(m,S,k,A){let C=N=>{if(!m)return null;if(typeof m=="string")return N.replaceText(S,m);{let z=new RegExp(m.regex),B=e.sourceCode.getText(S);return N.replaceText(S,B.replace(z,m.with))}};e.report({node:S,messageId:"default",data:{message:k},fix:m&&A==="autofix"?C:void 0,suggest:m&&A==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof m=="string"?m:m.with}"`},fix:C}]:void 0})}}});function Tr(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...a]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:Qt(o)}),r.push({name:"$0_uncapitalize",value:en(o)}),r.push({name:"$0",value:o});for(let i=0;i<a.length;i++){let s=`$${i+1}`,l=a[i];r.push({name:`${s}_lowercase`,value:l.toLowerCase()}),r.push({name:`${s}_capitalize`,value:Qt(l)}),r.push({name:`${s}_uncapitalize`,value:en(l)}),r.push({name:s,value:l})}return r}function Qt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function en(e){return e.charAt(0).toLowerCase()+e.slice(1)}var _=require("@typescript-eslint/utils");var hr=_.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nn="collapse-simple-objs-in-one-line",Er=Y({maxLineLength:$(ge()),maxProperties:$(ge()),nestedObjMaxLineLength:$(ge()),nestedObjMaxProperties:$(ge()),ignoreTypesWithSuffix:$(te(H()))}),br=hr({name:nn,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:[Er]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,a=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function s(p){if(p.type===_.AST_NODE_TYPES.ObjectExpression){let c=p.parent.type===_.AST_NODE_TYPES.Property,f=c?i:o,y=p.properties.length;if(y>f)return!1;if(y===1){let I=p.properties[0];return I.type===_.AST_NODE_TYPES.Property&&I.value.type===_.AST_NODE_TYPES.ObjectExpression||I.type===_.AST_NODE_TYPES.Property&&I.value.type===_.AST_NODE_TYPES.ArrayExpression&&!I.value.elements.every(E=>E&&st(E))?!1:{text:r.getText(I),isNested:c,propsSize:y}}let T=[];for(let I of p.properties){if(I.type===_.AST_NODE_TYPES.Property&&!st(I.value))return!1;T.push(r.getText(I))}return{text:T.join(", "),isNested:c,propsSize:y}}else{let c=p.parent.parent?.type===_.AST_NODE_TYPES.TSPropertySignature,f=c?i:o,y=p.members.length;if(y>f)return!1;if(n.length>0&&p.parent.type===_.AST_NODE_TYPES.TSTypeAliasDeclaration){let I=p.parent.id.name;if(n.some(x=>I.endsWith(x)))return!1}if(y===1){let I=p.members[0];return I.type===_.AST_NODE_TYPES.TSPropertySignature&&I.typeAnnotation?.typeAnnotation.type===_.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(I),isNested:c,propsSize:1}}if(p.parent.type===_.AST_NODE_TYPES.TSIntersectionType||p.parent.type===_.AST_NODE_TYPES.TSUnionType&&p.parent.types[0]!==p)return!1;let T=[];for(let I of p.members){if(I.type!==_.AST_NODE_TYPES.TSPropertySignature)return!1;let x=I.typeAnnotation?.typeAnnotation;if(!x||x.type===_.AST_NODE_TYPES.TSTypeLiteral||!tn(x))return!1;if(x.type===_.AST_NODE_TYPES.TSTypeReference&&x.typeArguments){if(x.typeArguments.params.length>1)return!1;let u=x.typeArguments.params[0];if(!tn(u))return!1}let E=r.getText(I).trim();(E.endsWith(";")||E.endsWith(","))&&(E=E.slice(0,-1)),T.push(E)}return{text:T.join("; "),isNested:c,propsSize:y}}}function l(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==_.AST_NODE_TYPES.JSXExpressionContainer){let x=0,E=!1,u=r.getTokenAfter(p,{filter:b=>b.type!==_.AST_TOKEN_TYPES.Punctuator||E?!0:b.value===","?(x++,!1):b.value===";"?(x++,E=!0,!1):b.value===")"||b.value==="}"?(x++,!1):!0});if(x>4)return;let R=u?.type===_.AST_TOKEN_TYPES.Template&&u.value.startsWith(`}
2
2
  `);if(u?.loc.start.line===p.loc.end.line&&!R)return}let c=s(p);if(!c)return;let f=c.text;if(f.includes(`
3
- `)||r.getCommentsInside(p).length>0)return;f.endsWith(";")&&(f=f.slice(0,-1));let y=`{ ${f} }`,T=Ir(r,p),I=c.isNested&&c.propsSize>2?a:t.maxLineLength;I&&y.length+T.length+xr(p,r)>I||e.report({node:p,messageId:"singleLineProp",fix:x=>x.replaceText(p,y)})}return{TSTypeLiteral:l,ObjectExpression:l}}});function tn(e){return e.type===_.AST_NODE_TYPES.TSLiteralType||e.type===_.AST_NODE_TYPES.TSTypeReference||e.type===_.AST_NODE_TYPES.TSNumberKeyword||e.type===_.AST_NODE_TYPES.TSStringKeyword||e.type===_.AST_NODE_TYPES.TSBooleanKeyword||e.type===_.AST_NODE_TYPES.TSNullKeyword||e.type===_.AST_NODE_TYPES.TSUndefinedKeyword}function it(e,t){return!!(e.type===_.AST_NODE_TYPES.Literal||e.type===_.AST_NODE_TYPES.Identifier||e.type===_.AST_NODE_TYPES.TemplateLiteral||e.type===_.AST_NODE_TYPES.TaggedTemplateExpression||!t&&e.type===_.AST_NODE_TYPES.ArrayExpression&&e.elements.every(r=>r&&it(r,!0)))}function xr(e,t){let r=t.getLastToken(e);if(!r)return 0;let n=t.text.indexOf(`
4
- `,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function Ir(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var st={name:nn,rule:br};var Cr=/eslint +react-compiler\/react-compiler: +\["error/,sn={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"}}}]},create(e){let t=!1,r=typeof e.getSource=="function"?u=>r(u):u=>e.sourceCode.getText(u),n=typeof e.getScope=="function"?()=>n():u=>e.sourceCode.getScope(u),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,a=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:a};function s(u){a&&Array.isArray(u.suggest)&&u.suggest.length>0&&(u.fix=u.suggest[0].fix),e.report(u)}let l=e.getSourceCode().scopeManager,p=new WeakMap,c=new WeakSet,f=new WeakMap,y=new WeakMap,T=new WeakSet;function I(u,R){return function(b){if(R.has(b))return R.get(b);let g=u(b);return R.set(b,g),g}}function x(u,R,b,g,m){m&&u.async&&s({node:u,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
3
+ `)||r.getCommentsInside(p).length>0)return;f.endsWith(";")&&(f=f.slice(0,-1));let y=`{ ${f} }`,T=Ir(r,p),I=c.isNested&&c.propsSize>2?a:t.maxLineLength;I&&y.length+T.length+xr(p,r)>I||e.report({node:p,messageId:"singleLineProp",fix:x=>x.replaceText(p,y)})}return{TSTypeLiteral:l,ObjectExpression:l}}});function tn(e){return e.type===_.AST_NODE_TYPES.TSLiteralType||e.type===_.AST_NODE_TYPES.TSTypeReference||e.type===_.AST_NODE_TYPES.TSNumberKeyword||e.type===_.AST_NODE_TYPES.TSStringKeyword||e.type===_.AST_NODE_TYPES.TSBooleanKeyword||e.type===_.AST_NODE_TYPES.TSNullKeyword||e.type===_.AST_NODE_TYPES.TSUndefinedKeyword}function st(e,t){return!!(e.type===_.AST_NODE_TYPES.Literal||e.type===_.AST_NODE_TYPES.Identifier||e.type===_.AST_NODE_TYPES.TemplateLiteral||e.type===_.AST_NODE_TYPES.TaggedTemplateExpression||!t&&e.type===_.AST_NODE_TYPES.ArrayExpression&&e.elements.every(r=>r&&st(r,!0)))}function xr(e,t){let r=t.getLastToken(e);if(!r)return 0;let n=t.text.indexOf(`
4
+ `,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function Ir(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var ot={name:nn,rule:br};var Cr=/eslint +react-compiler\/react-compiler: +\["error/,sn={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"}}}]},create(e){let t=!1,r=typeof e.getSource=="function"?u=>r(u):u=>e.sourceCode.getText(u),n=typeof e.getScope=="function"?()=>n():u=>e.sourceCode.getScope(u),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,a=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:a};function s(u){a&&Array.isArray(u.suggest)&&u.suggest.length>0&&(u.fix=u.suggest[0].fix),e.report(u)}let l=e.getSourceCode().scopeManager,p=new WeakMap,c=new WeakSet,f=new WeakMap,y=new WeakMap,T=new WeakSet;function I(u,R){return function(b){if(R.has(b))return R.get(b);let g=u(b);return R.set(b,g),g}}function x(u,R,b,g,m){m&&u.async&&s({node:u,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
5
5
 
6
6
  useEffect(() => {
7
7
  async function fetchData() {
@@ -12,10 +12,10 @@ useEffect(() => {
12
12
  fetchData();
13
13
  }, [someId]); // Or [] if effect doesn't need props or state
14
14
 
15
- Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let S=l.acquire(u),k=new Set,A=null;{let d=S.upper;for(;d&&(k.add(d),d.type!=="function");)d=d.upper;if(!d)return;A=d}let C=Array.isArray;function N(d){if(!C(d.defs))return!1;let h=d.defs[0];if(h==null||h.node.type!=="VariableDeclarator")return!1;let v=h.node.init;if(v==null)return!1;for(;v.type==="TSAsExpression";)v=v.expression;let O=h.node.parent;if(O==null&&(lt(A.block,h.node.id),O=h.node.parent,O==null))return!1;if(O.kind==="const"&&v.type==="Literal"&&(typeof v.value=="string"||typeof v.value=="number"||v.value===null))return!0;if(v.type!=="CallExpression")return!1;let F=v.callee;if(F.type==="MemberExpression"&&F.object.name==="React"&&F.property!=null&&!F.computed&&(F=F.property),F.type!=="Identifier")return!1;let P=h.node.id,{name:M}=F;if(M==="useRef"&&P.type==="Identifier")return!0;if(kr(F)&&P.type==="Identifier"){for(let D of d.references)D!==P&&T.add(D.identifier);return!0}else if(M==="useState"||M==="useReducer"){if(P.type==="ArrayPattern"&&P.elements.length===2&&C(d.identifiers)){if(P.elements[1]===d.identifiers[0]){if(M==="useState"){let D=d.references,pe=0;for(let he=0;he<D.length;he++){if(D[he].isWrite()&&pe++,pe>1)return!1;p.set(D[he].identifier,P.elements[0])}}return!0}else if(P.elements[0]===d.identifiers[0]){if(M==="useState"){let D=d.references;for(let pe=0;pe<D.length;pe++)c.add(D[pe].identifier)}return!1}}}else if(M==="useTransition"&&P.type==="ArrayPattern"&&P.elements.length===2&&Array.isArray(d.identifiers)&&P.elements[1]===d.identifiers[0])return!0;return!1}function z(d){if(!C(d.defs))return!1;let h=d.defs[0];if(h==null||h.node==null||h.node.id==null)return!1;let v=h.node,O=A.childScopes,F=null,P;for(P=0;P<O.length;P++){let M=O[P],D=M.block;if(v.type==="FunctionDeclaration"&&D===v||v.type==="VariableDeclarator"&&D.parent===v){F=M;break}}if(F==null)return!1;for(P=0;P<F.through.length;P++){let M=F.through[P];if(M.resolved!=null&&k.has(M.resolved.scope)&&!B(M.resolved))return!1}return!0}let B=I(N,f),ne=I(z,y),ee=new Map;function xe(d){let h=d.from,v=!1;for(;h.block!==u;)h.type==="function"&&(v=h.block.parent!=null&&h.block.parent.type==="ReturnStatement"),h=h.upper;return v}let G=new Map,ye=new Map;fe(S);function fe(d){for(let h of d.references){if(!h.resolved||!k.has(h.resolved.scope))continue;let v=lt(u,h.identifier),O=on(v),F=Ee(O,ye);if(m&&O.type==="Identifier"&&(O.parent.type==="MemberExpression"||O.parent.type==="OptionalMemberExpression")&&!O.parent.computed&&O.parent.property.type==="Identifier"&&O.parent.property.name==="current"&&xe(h)&&ee.set(F,{reference:h,dependencyNode:O}),O.parent.type==="TSTypeQuery"||O.parent.type==="TSTypeReference")continue;let P=h.resolved.defs[0];if(P!=null&&!(P.node!=null&&P.node.init===u.parent)&&P.type!=="TypeParameter")if(G.has(F))G.get(F).references.push(h);else{let M=h.resolved,D=B(M)||ne(M);G.set(F,{isStable:D,references:[h]})}}for(let h of d.childScopes)fe(h)}ee.forEach(({reference:d,dependencyNode:h},v)=>{let O=d.resolved.references,F=!1;for(let P=0;P<O.length;P++){let{identifier:M}=O[P],{parent:D}=M;if(D!=null&&D.type==="MemberExpression"&&!D.computed&&D.property.type==="Identifier"&&D.property.name==="current"&&D.parent.type==="AssignmentExpression"&&D.parent.left===D){F=!0;break}}F||s({node:h.parent.property,message:`The ref value '${v}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${v}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let se=new Set;function Te(d,h){se.has(h)||(se.add(h),s({node:d,message:`Assignments to the '${h}' variable from inside React Hook ${r(b)} will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ${r(b)}.`}))}let Fe=new Set;if(G.forEach(({isStable:d,references:h},v)=>{d&&Fe.add(v),h.forEach(O=>{O.writeExpr&&Te(O.writeExpr,v)})}),se.size>0)return;if(!R){let d=null;if(G.forEach(({isStable:h,references:v},O)=>{d||v.forEach(F=>{if(d)return;let P=F.identifier;if(!p.has(P))return;let D=F.from;for(;D.type!=="function";)D=D.upper;D.block===u&&(d=O)})}),d){let{suggestedDependencies:h}=ot({dependencies:G,declaredDependencies:[],stableDependencies:Fe,externalDependencies:new Set,isEffect:!0});s({node:b,message:`React Hook ${g} contains a call to '${d}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+h.join(", ")+`] as a second argument to the ${g} Hook.`,suggest:[{desc:`Add dependencies array: [${h.join(", ")}]`,fix(v){return v.insertTextAfter(u,`, [${h.join(", ")}]`)}}]})}return}let Le=[],_e=new Set;R.type!=="ArrayExpression"?s({node:R,message:`React Hook ${r(b)} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.`}):R.elements.forEach(d=>{if(d===null)return;if(d.type==="SpreadElement"){s({node:d,message:`React Hook ${r(b)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}T.has(d)&&s({node:d,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(d)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(d)}\``,fix(F){return F.removeRange(d.range)}}]});let h;try{h=Ee(d,ye)}catch(F){if(/Unsupported node type/.test(F.message)){d.type==="Literal"?G.has(d.value)?s({node:d,message:`The ${d.raw} literal is not a valid dependency because it never changes. Did you mean to include ${d.value} in the array instead?`}):s({node:d,message:`The ${d.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:d,message:`React Hook ${r(b)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw F}let v=d;for(;v.type==="MemberExpression"||v.type==="OptionalMemberExpression"||v.type==="ChainExpression";)v=v.object||v.expression.object;let O=!A.through.some(F=>F.identifier===v);Le.push({key:h,node:d}),O||_e.add(h)});let{suggestedDependencies:er,unnecessaryDependencies:We,missingDependencies:Ie,duplicateDependencies:Ht}=ot({dependencies:G,declaredDependencies:Le,stableDependencies:Fe,externalDependencies:_e,isEffect:m}),Ve=er;if(Ht.size+Ie.size+We.size===0){if(t)return;wr({declaredDependencies:Le,declaredDependenciesNode:R,componentScope:A,scope:S}).forEach(({construction:h,isUsedOutsideOfHook:v,depType:O})=>{let F=O==="function"?"useCallback":"useMemo",P=O==="function"?"definition":"initialization",M=`wrap the ${P} of '${h.name.name}' in its own ${F}() Hook.`,D=v?`To fix this, ${M}`:`Move it inside the ${g} callback. Alternatively, ${M}`,pe=O==="conditional"||O==="logical expression"?"could make":"makes",he=`The '${h.name.name}' ${O} ${pe} the dependencies of ${g} Hook (at line ${R.loc.start.line}) change on every render. ${D}`,Yt;v&&h.type==="Variable"&&O==="function"&&(Yt=[{desc:`Wrap the ${P} of '${h.name.name}' in its own ${F}() Hook.`,fix(qt){let[nr,rr]=F==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[qt.insertTextBefore(h.node.init,nr),qt.insertTextAfter(h.node.init,rr)]}}]),s({node:h.node,message:he,suggest:Yt})});return}!m&&Ie.size>0&&(Ve=ot({dependencies:G,declaredDependencies:[],stableDependencies:Fe,externalDependencies:_e,isEffect:m}).suggestedDependencies);function tr(){if(Le.length===0)return!0;let d=Le.map(v=>v.key),h=d.slice().sort();return d.join(",")===h.join(",")}tr()&&Ve.sort();function Qe(d){let h=d.split("."),v="";for(let O=0;O<h.length;O++){if(O!==0){let F=h.slice(0,O+1).join("."),P=ye.get(F)===!0;v+=P?"?.":"."}v+=h[O]}return v}function et(d,h,v,O){return d.size===0?null:(d.size>1?"":h+" ")+v+" "+(d.size>1?"dependencies":"dependency")+": "+Rr(Array.from(d).sort().map(F=>"'"+Qe(F)+"'"))+`. Either ${O} ${d.size>1?"them":"it"} or remove the dependency array.`}let me="";if(We.size>0){let d=null;if(Array.from(We.keys()).forEach(h=>{d===null&&h.endsWith(".current")&&(d=h)}),d!==null)me=` Mutable values like '${d}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(_e.size>0){let h=Array.from(_e)[0];S.set.has(h)||(me=` Outer scope values like '${h}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!me&&Ie.has("props")){let d=G.get("props");if(d==null)return;let h=d.references;if(!Array.isArray(h))return;let v=!0;for(let O=0;O<h.length;O++){let F=h[O],P=lt(A.block,F.identifier);if(!P){v=!1;break}let M=P.parent;if(M==null){v=!1;break}if(M.type!=="MemberExpression"&&M.type!=="OptionalMemberExpression"){v=!1;break}}v&&(me=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${g} call and refer to those specific props inside ${r(b)}.`)}if(!me&&Ie.size>0){let d=null;Ie.forEach(h=>{if(d)return;let v=A.set.get(h),O=G.get(h);if(O.references[0].resolved!==v)return;let F=v.defs[0];if(F==null||F.name==null||F.type!=="Parameter")return;let P=!1,M;for(let D=0;D<O.references.length;D++)if(M=O.references[D].identifier,M!=null&&M.parent!=null&&(M.parent.type==="CallExpression"||M.parent.type==="OptionalCallExpression")&&M.parent.callee===M){P=!0;break}P&&(d=h)}),d!==null&&(me=` If '${d}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!me&&Ie.size>0){let d=null;if(Ie.forEach(h=>{if(d!==null)return;let O=G.get(h).references,F,P;for(let M=0;M<O.length;M++){for(F=O[M].identifier,P=F.parent;P!=null&&P!==A.block;){if(P.type==="CallExpression"){let D=p.get(P.callee);if(D!=null){if(D.name===h)d={missingDep:h,setter:P.callee.name,form:"updater"};else if(c.has(F))d={missingDep:h,setter:P.callee.name,form:"reducer"};else{let pe=O[M].resolved;if(pe!=null){let he=pe.defs[0];he!=null&&he.type==="Parameter"&&(d={missingDep:h,setter:P.callee.name,form:"inlineReducer"})}}break}}P=P.parent}if(d!==null)break}}),d!==null)switch(d.form){case"reducer":me=` You can also replace multiple useState variables with useReducer if '${d.setter}' needs the current value of '${d.missingDep}'.`;break;case"inlineReducer":me=` If '${d.setter}' needs the current value of '${d.missingDep}', you can also switch to useReducer instead of useState and read '${d.missingDep}' in the reducer.`;break;case"updater":me=` You can also do a functional update '${d.setter}(${d.missingDep.slice(0,1)} => ...)' if you only need '${d.missingDep}' in the '${d.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:R,message:`React Hook ${r(b)} has `+(et(Ie,"a","missing","include")||et(We,"an","unnecessary","exclude")||et(Ht,"a","duplicate","omit"))+me,suggest:[{desc:`Update the dependencies array to be: [${Ve.map(Qe).join(", ")}]`,fix(d){return d.replaceText(R,`[${Ve.map(Qe).join(", ")}]`)}}]})}function E(u){let R=Ar(u.callee,i);if(R===-1)return;let b=u.arguments[R],g=u.callee,m=an(g).name,S=u.arguments[R+1],k=/Effect($|[^a-z])/g.test(m);if(!b){s({node:g,message:`React Hook ${m} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!k)){if(!S&&!k){(m==="useMemo"||m==="useCallback")&&s({node:g,message:`React Hook ${m} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(b.type){case"FunctionExpression":case"ArrowFunctionExpression":x(b,S,g,m,k);return;case"Identifier":if(!S||S.elements&&S.elements.some(N=>N&&N.type==="Identifier"&&N.name===b.name))return;let A=n(u).set.get(b.name);if(A==null||A.defs==null)return;let C=A.defs[0];if(!C||!C.node||C.type!=="Variable"&&C.type!=="FunctionName")break;switch(C.node.type){case"FunctionDeclaration":x(C.node,S,g,m,k);return;case"VariableDeclarator":let N=C.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":x(N,S,g,m,k);return}break}break;default:s({node:g,message:`React Hook ${m} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:g,message:`React Hook ${m} has a missing dependency: '${b.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${b.name}]`,fix(A){return A.replaceText(S,`[${b.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let u of e.sourceCode.getAllComments())if(Cr.test(u.value))return t=!0,{CallExpression:R=>E(R,!0)}}return{CallExpression:u=>E(u)}}};function ot({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:o}){let a=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((x,E)=>{let u=s(a,E);u.isUsed=!0,l(a,E,R=>{R.isSubtreeUsed=!0})}),t.forEach(({key:x})=>{let E=s(a,x);E.isSatisfiedRecursively=!0}),r.forEach(x=>{let E=s(a,x);E.isSatisfiedRecursively=!0});function s(x,E){let u=E.split("."),R=x;for(let b of u){let g=R.children.get(b);g||(g=i(),R.children.set(b,g)),R=g}return R}function l(x,E,u){let R=E.split("."),b=x;for(let g of R){let m=b.children.get(g);if(!m)return;u(m),b=m}}let p=new Set,c=new Set;f(a,p,c,x=>x);function f(x,E,u,R){x.children.forEach((b,g)=>{let m=R(g);if(b.isSatisfiedRecursively){b.isSubtreeUsed&&u.add(m);return}if(b.isUsed){E.add(m);return}f(b,E,u,S=>m+"."+S)})}let y=[],T=new Set,I=new Set;return t.forEach(({key:x})=>{c.has(x)?y.indexOf(x)===-1?y.push(x):I.add(x):T.add(x)}),p.forEach(x=>{y.push(x)}),{suggestedDependencies:y,unnecessaryDependencies:T,duplicateDependencies:I,missingDependencies:p}}function we(e){switch(e.type){case"ObjectExpression":return"object";case"ArrayExpression":return"array";case"ArrowFunctionExpression":case"FunctionExpression":return"function";case"ClassExpression":return"class";case"ConditionalExpression":return we(e.consequent)!=null||we(e.alternate)!=null?"conditional":null;case"LogicalExpression":return we(e.left)!=null||we(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return we(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return we(e.expression);case"TSAsExpression":return we(e.expression)}return null}function wr({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let o=e.map(({key:i})=>{let s=r.variables.find(p=>p.name===i);if(s==null)return null;let l=s.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let p=we(l.node.init);if(p!=null)return[s,p]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[s,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[s,"class"]:null}).filter(Boolean);function a(i){let s=!1;for(let l=0;l<i.references.length;l++){let p=i.references[l];if(p.writeExpr){if(s)return!0;s=!0;continue}let c=p.from;for(;c!==n&&c!=null;)c=c.upper;if(c!==n&&!ln(t,p.identifier))return!0}return!1}return o.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:a(i)}))}function on(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)?on(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function at(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function Ee(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=Ee(e.object,t),n=Ee(e.property,null),o=`${r}.${n}`;return at(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=Ee(e.object,t),n=Ee(e.property,null),o=`${r}.${n}`;return at(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=Ee(r.object,t),o=Ee(r.property,null),a=`${n}.${o}`;return at(r,t,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function an(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Ar(e,t){let r=an(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=Ee(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 lt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),vr(n,t))return n;if(ln(n,t))for(let[o,a]of Object.entries(n))o!=="parent"&&(rn(a)?(a.parent=n,r.push(a)):Array.isArray(a)&&a.forEach(i=>{rn(i)&&(i.parent=n,r.push(i))}))}return null}function Rr(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 rn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function vr(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 ln(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function kr(e){return!1}var Ae=require("@typescript-eslint/utils");var ie=ve(require("typescript")),Or=Ae.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pn="improved-no-unnecessary-condition",Pr=Y({}),Fr=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Nr=new Set(Fr),pt={name:pn,rule:Or({name:pn,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".'},schema:[Pr]},defaultOptions:[{}],create(e){let t=Ae.ESLintUtils.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(s){return s.type===Ae.AST_NODE_TYPES.UnaryExpression&&s.operator==="typeof"}function o(s){return s.flags&ie.default.TypeFlags.Any||s.flags&ie.default.TypeFlags.Unknown?null:s.flags&ie.default.TypeFlags.StringLike?["string"]:s.flags&ie.default.TypeFlags.NumberLike?["number"]:s.flags&ie.default.TypeFlags.BigIntLike?["bigint"]:s.flags&ie.default.TypeFlags.BooleanLike?["boolean"]:s.flags&ie.default.TypeFlags.ESSymbolLike?["symbol"]:s.flags&ie.default.TypeFlags.Undefined||s.flags&ie.default.TypeFlags.Void?["undefined"]:s.flags&ie.default.TypeFlags.Null?["object"]:s.getCallSignatures().length>0?["function"]:s.flags&ie.default.TypeFlags.Object?s.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:s.flags&ie.default.TypeFlags.NonPrimitive?["object"]:s.flags&ie.default.TypeFlags.Never?["never"]:null}function a(s){if(!r)return null;let l=t.esTreeNodeToTSNodeMap.get(s),p=r.getTypeAtLocation(l.expression);if(p.flags&ie.default.TypeFlags.Any||p.flags&ie.default.TypeFlags.Unknown)return null;let c=[];if(p.isUnion()){for(let y of p.types){let T=o(y);if(T)c.push(...T);else return null}return c}let f=o(p);return f?(c.push(...f),c):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,c=null;if(n(s.left)?(p=s.left,c=s.right.type===Ae.AST_NODE_TYPES.Literal&&typeof s.right.value=="string"?s.right.value:null):n(s.right)&&(p=s.right,c=s.left.type===Ae.AST_NODE_TYPES.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!c||!jr(c,Nr))return;let f=a(p);if(!f)return;let y=s.operator==="!==",T=f.includes(c);f.length===1?T&&!y?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:c}}):!T&&y?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:Array.from(f)[0]}}):!T&&!y?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:He(f),conditionType:c}}):T&&y&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:He(f),conditionType:c}}):!T&&!y?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:He(f),conditionType:c}}):!T&&y&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:He(f)}})}return{BinaryExpression:i}}})};function He(e){return Array.from(new Set(e)).join(" | ")||"never"}function je(e,t){let r=e.argument;return r.type===Ae.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function jr(e,t){return t.has(e)}var Ye=require("@typescript-eslint/utils");var Mr=Ye.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cn="no-call-with-explicit-generics",Dr=Y({functions:te(H())}),Lr=Mr({name:cn,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[Dr]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:o}=n;o.type===Ye.AST_NODE_TYPES.Identifier&&r.has(o.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),ct={name:cn,rule:Lr};var ke=require("@typescript-eslint/utils"),_r=ke.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),un="no-call-with-inferred-generics",$r=_r({name:un,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:o}=n;if(o.type!==ke.AST_NODE_TYPES.Identifier)return;let a=r.get(o.name);if(!a)return;let{minGenerics:i=1,allowAny:s,disallowTypes:l=t.disallowTypes}=a;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(s&&!l)&&n.typeArguments?.params?.some(c=>!s&&c.type===ke.AST_NODE_TYPES.TSAnyKeyword||l&&c.type===ke.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===ke.AST_NODE_TYPES.Identifier&&l.includes(c.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),ut={name:un,rule:$r};var mn=require("@typescript-eslint/utils"),Ur=mn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),dn="no-commented-out-code",Wr=["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:"],K={returnStatement:/^\s*return\s+/,stringAssignment:/\w=("|'|`)/,objectPropertyWithQuotes:/\w+:\s*('|"|`)/,computedPropertyAssignment:/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,kebabCaseProperty:/\w+-\w+:/,snakeCaseProperty:/\w+_\w+:/,ternaryOperator:/\?\s+\w/,colonWithWord:/:\s+\w/,quotedString:/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,numberWithComma:/^\s*\d+[,}]/,arrayWithComma:/^\s*\[[^\]]*\][,}]/,objectWithComma:/^\s*\{[^}]*\}[,}]/,methodCall:/\.\w+\(/,arrayAccess:/\[\w+\]/,quotedPropertyKey:/^\s*(['"`]).+?\1\s*:/,jsxSelfClosing:/^<[A-Z]\w*(\s|>|\/)/,jsxElement:/^<[a-z]+(\s|>|\/)/,jsxOpeningTag:/<[A-Z]\w*(\s.*)?>/,jsxClosingTag:/<\/[A-Z]\w*>/,htmlOpeningTag:/<[a-z]+(\s.*)?>/,htmlClosingTag:/<\/[a-z]+>/,jsdocComment:/^\s*[*\s]*$/};function Vr(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&/^[a-zA-Z]/.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||/\.[A-Za-z_][A-Za-z0-9_]*\(/.test(t)||/[{}[\]()`=<>]/.test(t)||/:\s*(['"`[{(]|\w+\s*=>)/.test(t)||/\bif\s*\(|\belse\b|=>/.test(t)?!1:!!(t.includes(":")&&/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/.test(t))}var zr=[") {","return;",K.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",K.stringAssignment,");",K.objectPropertyWithQuotes,K.computedPropertyAssignment,K.kebabCaseProperty,K.snakeCaseProperty,"&&","||","()",K.ternaryOperator,K.colonWithWord,K.quotedString,K.numberWithComma,K.arrayWithComma,K.objectWithComma,K.methodCall,K.arrayAccess,"?.(","??","=>",K.quotedPropertyKey],Hr=["/>","</",K.jsxSelfClosing,K.jsxElement,K.jsxOpeningTag,K.jsxClosingTag,K.htmlOpeningTag,K.htmlClosingTag],fn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Yr=Ur({name:dn,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(n,o){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||K.jsdocComment.test(n))return!1;for(let i of fn)if(a.startsWith(i))return!1;if(n.includes("https://")||Vr(a))return!1;if(o==="Block"){for(let i of Hr)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 Wr)if(a.startsWith(i))return{wrongPattern:i};for(let i of zr)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,o){let a=n,i=a.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let p=a.split(/```[\s\S]*?```/g);p.some(f=>/[a-zA-Z0-9]/.test(f))&&(a=p.join(""))}if(!a.includes("`"))return a;let s=a.split(/`[^`]*`/g);return s.some(p=>/[a-zA-Z0-9]/.test(p))?s.join(""):a}return{Program(){let o=e.sourceCode.getAllComments();for(let a of o){let i=r(a.value,a.type),s=t(i,a.type);s&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:fn.join(", ")}})}}}}}),ft={name:dn,rule:Yr};var qe=require("@typescript-eslint/utils"),qr=qe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yn="no-default-export",Jr=qr({name:yn,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let r of t.specifiers)r.exported.type===qe.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),mt={name:yn,rule:Jr};var gn=require("@typescript-eslint/utils"),Br=gn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sn="no-leaked-text-in-jsx",Xr=[",",";","[","]","(",")"],Gr=Br({name:Sn,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="";Xr.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),dt={name:Sn,rule:Gr};var Re=require("@typescript-eslint/utils"),Kr=Re.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),hn="no-non-camel-case-functions",Zr=/^(\$?[a-z][a-zA-Z0-9]*)$/;function Tn(e){if(e.typeName.type!==Re.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Re.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var Qr=Kr({name:hn,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&&!Zr.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Re.AST_NODE_TYPES.TSTypeReference?Tn(r):r.type===Re.AST_NODE_TYPES.TSUnionType&&r.types.some(o=>o.type===Re.AST_NODE_TYPES.TSTypeReference&&Tn(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),yt={name:hn,rule:Qr};var W=require("@typescript-eslint/utils");var gt=require("@typescript-eslint/utils");function Me(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:Me(e.parent,t,r===1/0?r:r-1)}function*St(e){yield e,e.parent&&(yield*St(e.parent))}function Tt(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function En(e,t,r){let o=r.getDeclaredVariables(e).find(a=>a.name===t||a.identifiers[0]?.parent.type===gt.AST_NODE_TYPES.Property&&a.identifiers[0]?.parent.key.type===gt.AST_NODE_TYPES.Identifier&&a.identifiers[0]?.parent.key.name===t);return o?o.references.filter(a=>!a.init):[]}var ei=W.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),bn="no-optional-root-props",ti=ei({name:bn,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function t(n){let a=e.sourceCode.getDeclaredVariables(n)[0];if(!a||a.references.length!==1)return!1;let i=a.references[0];if(!i)return!1;for(let s of St(i.identifier)){if("returnType"in s||s.type===W.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=s.parent;if(!l)return!1;if(l.type===W.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===W.TSESTree.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===W.TSESTree.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let c=Me(l.parent.parent,W.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!c)return!1;let f=Je(c,e.sourceCode);return f?!(f.parent.type===W.TSESTree.AST_NODE_TYPES.CallExpression&&f.parent.callee.type===W.TSESTree.AST_NODE_TYPES.Identifier&&f.parent.callee.name==="memo"):!1}if(s.type===W.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===W.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let p=Me(l,W.TSESTree.AST_NODE_TYPES.VariableDeclaration);return p?!!Je(p,e.sourceCode):!1}if(l.type===W.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!Je(l,e.sourceCode)}return!1}function r(n){n.key.type!==W.TSESTree.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:o=>{let a=Me(n,W.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let i=e.sourceCode.getText(a);return o.replaceText(a,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===W.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(Be(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===W.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(Be(n)||!t(n)))for(let o of n.body.body)o.type===W.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(n){if(n.typeName.type!==W.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==W.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let a=Me(n.parent,W.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let i=Je(a,e.sourceCode);if(!(!i||i.parent.type===W.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===W.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of o.members)l.type===W.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function Be(e){return e?e.parent?.type===W.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===W.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Je(e,t){if(Be(e))return;let r;if(e.type===W.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===W.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===W.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let o=n.variables.find(i=>i.identifiers.includes(r));if(!o)return;let a=o.references.filter(i=>i.identifier!==r);if(!(a.length!==1||!a[0])&&!Be(a[0].identifier.parent.parent))return a[0].identifier}var ht={name:bn,rule:ti};var xn=require("@typescript-eslint/utils"),Xe=ve(require("path"));var ni=xn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),In="no-relative-imports",ri=Y({find:H(),replacement:H()}),ii=Y({aliases:te(ri),rootDir:$(H()),allowNotFoundAliases:$(Ne()),_dev_simulateFileName:$(H())}),si=ni({name:In,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:[ii]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function o(i,s){let l=Xe.default.dirname(s);return Xe.default.resolve(l,i)}function a(i){let s=t.rootDir??process.cwd(),l=Xe.default.relative(s,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:c}of t.aliases)if(l.startsWith(c)){let f=l.replace(c,p);return{alias:p,newPath:f}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!n(s))return;let l=o(s,r),p=a(l);!p&&t.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?c=>c.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),Et={name:In,rule:si};var bt=X({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Import and export separately instead."}},defaultOptions:[],create(e){return{ExportNamedDeclaration(t){t.source&&e.report({node:t,messageId:"noReexport"})},ExportAllDeclaration(t){e.report({node:t,messageId:"noReexport"})}}}});var $e=require("@typescript-eslint/utils"),Oe=ve(require("zod/v4"));var oi=Oe.object({alternativeMsgs:Oe.object({inArrayFind:Oe.string().optional(),inArrayFilter:Oe.string().optional()}).optional(),__dev_simulateFileName:Oe.string().optional()});function ai(e){return e.typeAnnotation.type!==$e.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}function li(e){return/\.(typeGuards|type-guards)\.(ts|tsx)$/.test(e)}function pi(e){let t=e.parent;for(;t;){if(t.type===$e.AST_NODE_TYPES.CallExpression&&t.callee.type===$e.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===$e.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var xt=X({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[Ce(oi)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(li(r))return{};function n(o){if(!ai(o))return;let a=pi(o),i=[];if(t.alternativeMsgs&&a){let s=a.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(s){let l=a.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:l,data:{message:s}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});var Pe=require("@typescript-eslint/utils");var ci="no-unnecessary-async-on-jsx-props";function ui(e){if(e.body.type!==Pe.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!==Pe.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===Pe.AST_NODE_TYPES.AwaitExpression}var It=X({name:ci,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){ui(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,a=[],i=o.getFirstToken(r,l=>l.value==="async");if(i){let l=o.getTokenAfter(i);l?a.push(n.replaceTextRange([i.range[0],l.range[0]],"")):a.push(n.remove(i))}function s(l){if(l.type===Pe.AST_NODE_TYPES.AwaitExpression){let p=o.getFirstToken(l);if(p&&p.value==="await"){let c=o.getTokenAfter(p);c?a.push(n.replaceTextRange([p.range[0],c.range[0]],"")):a.push(n.remove(p))}}if(l.type===Pe.AST_NODE_TYPES.BlockStatement)for(let p of l.body)s(p);else l.type===Pe.AST_NODE_TYPES.ExpressionStatement&&s(l.expression)}return s(r.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var be=require("@typescript-eslint/utils");var Ct=ve(require("typescript")),fi=be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cn="no-unnecessary-casting",mi=Y({additionalCastFunctions:$(te(Y({name:H(),expectedType:Bt(["string","number"])})))}),wt={name:Cn,rule:fi({name:Cn,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:[mi],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=be.ESLintUtils.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function i(c,f){switch(c.type){case be.AST_NODE_TYPES.Literal:return f==="number"?typeof c.value=="number":typeof c.value=="string";case be.AST_NODE_TYPES.TemplateLiteral:return f==="string";case be.AST_NODE_TYPES.UnaryExpression:return f==="number"?c.operator==="+"||c.operator==="-"||c.operator==="~":!1;default:return!1}}function s(c,f){return f==="number"?!!(c.flags&Ct.TypeFlags.NumberLike):!!(c.flags&Ct.TypeFlags.StringLike)}function l(c,f){return y=>y.replaceText(c,e.sourceCode.getText(f))}function p(c){if(!a||c.arguments.length!==1)return;let f=c.arguments[0];if(!f||f.type===be.AST_NODE_TYPES.SpreadElement)return;let{callee:y}=c;if(y.type!==be.AST_NODE_TYPES.Identifier)return;let T=y.name,I=n.find(E=>E.name===T);if(!I)return;if(i(f,I.expectedType)||s(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(f)),I.expectedType)){let E,u;T==="Number"?E="unnecessaryNumberCasting":T==="String"?E="unnecessaryStringCasting":(E="unnecessaryCustomCasting",u={name:I.name,type:I.expectedType}),e.report({node:c,messageId:E,...u?{data:u}:{},fix:l(c,f)})}}return{CallExpression:p}}})};var Ue=require("@typescript-eslint/utils"),ce=ve(require("zod/v4"));var di=ce.object({methods:ce.union([ce.array(ce.string()),ce.literal("array")])}),At=X({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[ce.toJSONSchema(di)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(r)?r.includes(s):n.has(s)}function a(s){let{callee:l}=s;if(l.type===Ue.AST_NODE_TYPES.MemberExpression){let p=l.property;if(p.type===Ue.AST_NODE_TYPES.Identifier)return p.name}return null}function i(s,l){if(s.type!==Ue.AST_NODE_TYPES.Identifier||!s.typeAnnotation)return;let p=l.parent;if(p.type===Ue.AST_NODE_TYPES.CallExpression){let c=a(p);c&&o(c)&&p.arguments.indexOf(l)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(y){return y.remove(s.typeAnnotation)}})}}return{ArrowFunctionExpression(s){for(let l of s.params)i(l,s)},FunctionExpression(s){for(let l of s.params)i(l,s)}}}});var le=require("@typescript-eslint/utils");var Rt=X({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===le.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==le.AST_NODE_TYPES.ObjectExpression||t.id.type===le.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===le.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===le.AST_NODE_TYPES.Property&&i.key.type===le.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==le.AST_NODE_TYPES.Identifier)return;let n=yi(t,e.sourceCode);if(n.length===0)return;let o=t.init.properties.some(i=>i.type!==le.AST_NODE_TYPES.Property?!1:i.value.type===le.AST_NODE_TYPES.FunctionExpression),a=new Set;for(let i of n){if(i.identifier.parent.type!==le.AST_NODE_TYPES.MemberExpression)return;let s=i.identifier.parent;if(s.object!==i.identifier)return;if(s.computed)if(s.property.type===le.AST_NODE_TYPES.Literal&&typeof s.property.value=="string")a.add(s.property.value);else return;else{if(s.property.type!==le.AST_NODE_TYPES.Identifier)return;a.add(s.property.name)}if(s.parent.type===le.AST_NODE_TYPES.CallExpression&&o)return}for(let[i,s]of r)a.has(i)||e.report({node:s,messageId:"unusedObjectProperty",data:{name:i}})}}}});function yi(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 V=require("@typescript-eslint/utils");var gi=Y({selectors:te(Y({name:H(),selectorProp:$(H()),selectorArgPos:$(ge()),returnProp:$(H())}))}),Si=V.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),wn="no-unused-selected-values",vt={name:wn,rule:Si({name:wn,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[gi]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===V.AST_NODE_TYPES.CallExpression&&(a=o.init),!a)return;let i=hi(a);if(!i)return;let s=n.get(i);if(!s)return;let l=Ti(a,s.selectorArgPos??0,s.selectorProp);if(!l)return;let p=Ei(l);if(!p)return;let c=An(p.properties,void 0);if(!c)return;if(o.id.type===V.AST_NODE_TYPES.ObjectPattern){let T=An(o.id.properties,s.returnProp);if(!T)return;for(let[I,x]of c)T.has(I)||e.report({node:x,messageId:"unusedSelectedValue",data:{name:I}});return}if(o.id.type!==V.AST_NODE_TYPES.Identifier||s.returnProp)return;let f=bi(o,e.sourceCode);if(f.length===0)return;let y=new Set;for(let T of f){if(T.identifier.parent.type!==V.AST_NODE_TYPES.MemberExpression)return;let I=T.identifier.parent.property;if(I.type!==V.AST_NODE_TYPES.Identifier)return;y.add(I.name)}for(let[T,I]of c)y.has(T)||e.report({node:I,messageId:"unusedSelectedValue",data:{name:T}})}}}})};function Ti(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===V.AST_NODE_TYPES.ArrowFunctionExpression||n.type===V.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===V.AST_NODE_TYPES.ObjectExpression){let o=n.properties.find(i=>i.type===V.AST_NODE_TYPES.Property&&i.key.type===V.AST_NODE_TYPES.Identifier&&i.key.name===r);if(o?.type!==V.AST_NODE_TYPES.Property)return null;let a=o.value;if(a.type===V.AST_NODE_TYPES.ArrowFunctionExpression||a.type===V.AST_NODE_TYPES.FunctionExpression)return a}return null}function hi(e){return e.callee.type===V.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===V.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===V.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Ei(e){if(e.body.type===V.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===V.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===V.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==V.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function An(e,t){let r=e;if(t){let o=e.find(a=>a.type===V.AST_NODE_TYPES.Property&&a.key.type===V.AST_NODE_TYPES.Identifier&&a.key.name===t);if(o?.type!==V.AST_NODE_TYPES.Property||o.value.type!==V.AST_NODE_TYPES.ObjectPattern)return null;r=o.value.properties}let n=new Map;for(let o of r){if(o.type!==V.AST_NODE_TYPES.Property||o.key.type!==V.AST_NODE_TYPES.Identifier)return null;n.set(o.key.name,o)}return n.size>0?n:null}function bi(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 q=require("@typescript-eslint/utils");var kt=X({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(a=>a.type===q.AST_NODE_TYPES.ImportDeclaration&&a.source.value==="t-state-form"))return{};let n=null,o=!1;return{CallExpression(a){if(o)return;if(!n){let s=xi(a);s&&(n=s);return}let i=Ii(a,e.sourceCode);if(i){o=!0;for(let s of i)n.delete(s);if(n.size!==0)for(let[s,l]of n)e.report({node:l,messageId:"unusedField",data:{name:s}})}}}}});function xi(e){if(!(e.callee.type===q.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==q.AST_NODE_TYPES.ObjectExpression)return null;let n=Tt(r.properties,a=>a.type!==q.AST_NODE_TYPES.Property||a.key.type!==q.AST_NODE_TYPES.Identifier||a.key.name!=="initialConfig"?null:a.value.type===q.AST_NODE_TYPES.ObjectExpression?a.value:a.value.type===q.AST_NODE_TYPES.ArrowFunctionExpression||a.value.type===q.AST_NODE_TYPES.FunctionExpression?Ci(a.value):null);if(!n)return null;let o=new Map;for(let a of n.properties)a.type===q.AST_NODE_TYPES.Property&&a.key.type===q.AST_NODE_TYPES.Identifier&&o.set(a.key.name,a);return o}function Ii(e,t){if(!(e.callee.type===q.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==q.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==q.AST_NODE_TYPES.ObjectPattern||!Tt(e.parent.id.properties,i=>i.type===q.AST_NODE_TYPES.Property&&i.key.type===q.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let o=En(e.parent,"formFields",t),a=new Set;for(let{identifier:i}of o){if(i.type!==q.AST_NODE_TYPES.Identifier||i.parent.type===q.AST_NODE_TYPES.Property&&i.parent.parent.type===q.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===q.AST_NODE_TYPES.ReturnStatement||i.parent.type===q.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===q.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==q.AST_NODE_TYPES.Identifier||i.parent.property.type!==q.AST_NODE_TYPES.Identifier)return null;a.add(i.parent.property.name)}}return a}function Ci(e){if(e.body.type===q.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===q.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===q.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==q.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var U=require("@typescript-eslint/utils");var wi=U.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Rn(e){let t=[];for(let r of e.members)r.type===U.AST_NODE_TYPES.TSPropertySignature&&r.key.type===U.AST_NODE_TYPES.Identifier&&t.push([r.key.name,r]);return t}function vn(e,...t){for(let r of t)e.set(...r);return e}var Ai=Y({forceCheckOnFCPropTypesWithName:$(te(H()))}),kn="no-unused-type-props-in-args",Ot=null,Ri=wi({name:kn,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:[Ai],fixable:"code"},defaultOptions:[{}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r}=t;r&&!Ot&&(Ot=r.map(s=>new RegExp(s)));function n(s,l,p,c,f=!0){let y=p.name,T=e.sourceCode.getScope(l).references.find(E=>E.identifier.name===y)?.resolved,I=s&&Ot?.some(E=>E.test(y));if(!T||!I&&T.references.filter(E=>E.isTypeReference).length>1)return;let x=T?.defs[0]?.node;if(!(f&&x?.parent?.type===U.AST_NODE_TYPES.ExportNamedDeclaration)){if(x?.type===U.AST_NODE_TYPES.TSTypeAliasDeclaration){o(s,l,c,x.typeAnnotation,!0);return}if(x?.type===U.AST_NODE_TYPES.TSInterfaceDeclaration){o(s,l,c,x.body,!0);return}}}function o(s,l,p,c,f){if(c.type===U.AST_NODE_TYPES.TSInterfaceBody){for(let y of c.body)y.type===U.AST_NODE_TYPES.TSPropertySignature&&y.key.type===U.AST_NODE_TYPES.Identifier&&p.set(y.key.name,y);return}if(c.type===U.AST_NODE_TYPES.TSTypeLiteral){vn(p,...Rn(c));return}if(c.type===U.AST_NODE_TYPES.TSIntersectionType){for(let y of c.types)o(s,l,p,y,!0);return}f||c.type===U.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===U.AST_NODE_TYPES.Identifier&&n(s,l,c.typeName,p)}function a(s,l,p){for(let c of p)if(c.type==="ObjectPattern"&&c.typeAnnotation){let f=new Map;if(o(s,l,f,c.typeAnnotation.typeAnnotation,!1),f.size===0)continue;i(c,f)}else c.type===U.AST_NODE_TYPES.AssignmentPattern&&c.left.type===U.AST_NODE_TYPES.ObjectPattern&&a(s,l,[c.left])}function i(s,l){let p=[];if(s.properties.at(-1)?.type===U.AST_NODE_TYPES.RestElement)return;for(let T of s.properties)T.type===U.AST_NODE_TYPES.Property&&T.key.type===U.AST_NODE_TYPES.Identifier&&p.push(T.key.name);let f=[],y=[];for(let[T,I]of l)p.includes(T)||(y.push(T),f.push({node:I,messageId:"unusedObjectTypeProperty",data:{propertyName:T}}));for(let[T,I]of f.entries())e.report({...I,fix:T===f.length-1?x=>{let E=s.properties.at(-1),u=y.join(", ");return E?E?.type===U.AST_NODE_TYPES.RestElement?null:x.insertTextAfter(E,`, ${u}`):x.insertTextBeforeRange([s.range[0]+1,s.range[1]],`${u}`)}:void 0})}return{VariableDeclaration(s){let l=s.declarations[0];if(!l)return;let p=new Map,c=l.id.type===U.AST_NODE_TYPES.Identifier&&l.id.typeAnnotation?.typeAnnotation.type===U.AST_NODE_TYPES.TSTypeReference&&l.id.typeAnnotation.typeAnnotation.typeName.type===U.AST_NODE_TYPES.Identifier&&l.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&l.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(c){if(c.type===U.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===U.AST_NODE_TYPES.Identifier)n(!0,s,c.typeName,p,!1);else if(c.type===U.AST_NODE_TYPES.TSTypeLiteral)vn(p,...Rn(c));else if(c.type===U.AST_NODE_TYPES.TSIntersectionType)for(let f of c.types)f.type===U.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===U.AST_NODE_TYPES.Identifier?n(!0,s,f.typeName,p,!1):o(!0,s,p,f,!0);if(p.size!==0&&l.init?.type===U.AST_NODE_TYPES.ArrowFunctionExpression){let f=l.init.params[0];if(!f){e.report({node:l.init,messageId:"missingComponentParam"});return}f.type===U.AST_NODE_TYPES.ObjectPattern&&i(f,p)}}},FunctionDeclaration:function(s){a(!1,s,s.params)},ArrowFunctionExpression(s){a(!1,s,s.params)}}}}),Pt={name:kn,rule:Ri};var ue=require("@typescript-eslint/utils");var Ft=X({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let t=new Set;function r(n){return n.callee.type===ue.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===ue.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===ue.AST_NODE_TYPES.Identifier&&n.callee.property.type===ue.AST_NODE_TYPES.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let o of n.specifiers)o.type===ue.AST_NODE_TYPES.ImportSpecifier&&o.imported.type===ue.AST_NODE_TYPES.Identifier&&o.imported.name==="useRef"&&t.add(o.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===ue.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===ue.AST_NODE_TYPES.Identifier){let a=e.sourceCode.getScope(n).set.get(n.id.name);if(a){let i=!1;for(let s of a.references){let p=s.identifier.parent;if(p!==n&&!(p.type===ue.AST_NODE_TYPES.JSXExpressionContainer&&p.parent.type===ue.AST_NODE_TYPES.JSXAttribute&&p.parent.name.type===ue.AST_NODE_TYPES.JSXIdentifier&&p.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var De=require("@typescript-eslint/utils"),vi=De.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pn="prefer-named-functions",On=new Map,ki=vi({name:Pn,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=On.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),On.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===De.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===De.AST_NODE_TYPES.Identifier){let o=n.id.name;if(n.id.typeAnnotation||r&&r.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==De.AST_NODE_TYPES.BlockStatement)return;let a=n.parent,i=n.init.params,s=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(a,`${l.async?"async ":""}function ${o}(${i.map(c=>e.sourceCode.getText(c)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),Nt={name:Pn,rule:ki};var j=require("@typescript-eslint/utils");var Oi=Y({disallowedFunctions:te(Y({name:H(),allowUsingWithArgs:$(Ne()),hookAlternative:$(H()),message:$(H()),allowUseInside:$(te(H()))}))});function Ge(e){return/^use[A-Z]/.test(e)}function Fn(e){return/^[A-Z]/.test(e)}function Pi(e){return e.type===j.AST_NODE_TYPES.Identifier?Ge(e.name):e.type===j.AST_NODE_TYPES.MemberExpression&&e.property.type===j.AST_NODE_TYPES.Identifier?Ge(e.property.name):!1}function Nn(e,t){return e.type===j.AST_NODE_TYPES.Identifier?e.name===t:e.type===j.AST_NODE_TYPES.MemberExpression&&e.object.type===j.AST_NODE_TYPES.Identifier&&e.property.type===j.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function jn(e){return!!(e.parent&&e.parent.type===j.AST_NODE_TYPES.CallExpression&&Nn(e.parent.callee,"forwardRef"))}function Mn(e){return!!(e.parent&&e.parent.type===j.AST_NODE_TYPES.CallExpression&&Nn(e.parent.callee,"memo"))}function jt(e){if(e.type===j.AST_NODE_TYPES.FunctionDeclaration||e.type===j.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===j.AST_NODE_TYPES.FunctionExpression||e.type===j.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===j.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===j.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===j.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===j.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Fi(e){let t=e.parent,r=!1;for(;t;){if(t.type===j.AST_NODE_TYPES.FunctionDeclaration||t.type===j.AST_NODE_TYPES.FunctionExpression||t.type===j.AST_NODE_TYPES.ArrowFunctionExpression){let n=jt(t);if(n&&n.type===j.AST_NODE_TYPES.Identifier){if(Fn(n.name)||Ge(n.name))return!r;r=!0}else{if(jn(t)||Mn(t))return!r;if(t.parent.type===j.AST_NODE_TYPES.CallExpression){let o=t.parent;Pi(o.callee)||(r=!0)}else t.parent.type===j.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Dn(e){return e.callee.type===j.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===j.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===j.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Ni(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===j.AST_NODE_TYPES.FunctionDeclaration||r.type===j.AST_NODE_TYPES.FunctionExpression||r.type===j.AST_NODE_TYPES.ArrowFunctionExpression){let n=jt(r);if(n&&n.type===j.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===j.AST_NODE_TYPES.CallExpression){let n=Dn(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function ji(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===j.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function Mi(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===j.AST_NODE_TYPES.FunctionDeclaration||n.type===j.AST_NODE_TYPES.FunctionExpression||n.type===j.AST_NODE_TYPES.ArrowFunctionExpression){let o=jt(n);if(o&&o.type===j.AST_NODE_TYPES.Identifier){if(Fn(o.name)||Ge(o.name)){r=!0;break}}else if(jn(n)||Mn(n)){r=!0;break}}n=n.parent}return r?t.length===0?Fi(e):!Ni(e,t):!1}var Mt=X({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[Oi],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let a=Dn(o);if(!a)return;let i=n.get(a);if(!i||i.allowUsingWithArgs&&ji(o))return;let s=i.allowUseInside||[];Mi(o,s)&&e.report({node:o,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:l=>{let p=i.hookAlternative;return o.callee.type===j.AST_NODE_TYPES.Identifier?l.replaceText(o.callee,p):o.callee.type===j.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===j.AST_NODE_TYPES.Identifier?l.replaceText(o.callee.property,p):null}}]:[]})}}}});var J=require("@typescript-eslint/utils");var Di=J.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_n="prefer-single-line-if",Li=Y({maxLineLength:$(ge()),maxNonSimpleConditionLength:$(ge())}),_i=Di({name:_n,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:[Li]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==J.AST_NODE_TYPES.BlockStatement||n.loc.start.line===n.loc.end.line||r.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let a=n.consequent.body[0];if(a.type===J.AST_NODE_TYPES.ReturnStatement){if(!Un(a))return}else if(!(a.type===J.AST_NODE_TYPES.ContinueStatement||a.type===J.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===J.AST_NODE_TYPES.LogicalExpression||n.test.type===J.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let f=Ln(n.test);if(!f&&n.test.type===J.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let y=n.test.argument;Ln(y)&&(f=!0)}if(f&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let s=r.getText(a);if(i.includes(`
16
- `))return;let l=r.getTokenAfter(n);if(l&&l.type===J.AST_TOKEN_TYPES.Punctuator&&l.value==="}"){let f=r.getTokenAfter(l);if(f&&f.type===J.AST_TOKEN_TYPES.Keyword&&(f.value==="else"||f.value==="catch"))return}let p=$i(r,n),c=`if (${i}) ${s}`;t.maxLineLength&&c.length+p.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:f=>f.replaceText(n,c)})}}}});function Ln(e){return e.type===J.AST_NODE_TYPES.CallExpression||e.type===J.AST_NODE_TYPES.BinaryExpression||e.type===J.AST_NODE_TYPES.MemberExpression&&$n(e)}function $n(e){return e.object.type===J.AST_NODE_TYPES.MemberExpression?$n(e.object):e.object.type!==J.AST_NODE_TYPES.Identifier}function $i(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Un(e){if(!e.argument)return!0;let t=e.argument;return t.type===J.AST_NODE_TYPES.ArrayExpression&&t.elements.length===0||t.type===J.AST_NODE_TYPES.ObjectExpression&&t.properties.length===0||t.type===J.AST_NODE_TYPES.Literal||t.type===J.AST_NODE_TYPES.Identifier||t.type===J.AST_NODE_TYPES.TemplateLiteral||t.type===J.AST_NODE_TYPES.TaggedTemplateExpression?!0:t.type===J.AST_NODE_TYPES.CallExpression?t.arguments.length===0:t.type===J.AST_NODE_TYPES.UnaryExpression?Un(t):!1}var Dt={name:_n,rule:_i};var oe=require("@typescript-eslint/utils");var Ui=oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Wn="react-compiler-migration",Wi=Y({disallowHooks:$(te(Y({name:H(),replacement:H()}))),disallowMethods:$(te(Y({name:H(),replacement:$(H()),requireTrueProp:$(H())})))}),Vi=/eslint +react-compiler\/react-compiler: +\["error/;function zi(e){return e.type===oe.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===oe.AST_NODE_TYPES.MemberExpression&&e.property.type===oe.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var Hi=Ui({name:Wn,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:[Wi]},defaultOptions:[{}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(Vi.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let o=null,a=null;if(n.callee.type===oe.AST_NODE_TYPES.Identifier?(o=n.callee.name,a=n.callee):n.callee.type===oe.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===oe.AST_NODE_TYPES.Identifier&&(o=n.callee.property.name,a=n.callee.property),o){let i=t.disallowHooks.find(s=>s.name===o);i&&a&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:s=>s.replaceText(a,i.replacement)}]})}}if(t.disallowMethods?.length&&zi(n.callee)){for(let o of n.arguments)if(o.type===oe.AST_NODE_TYPES.ObjectExpression){for(let a of o.properties)if(a.type===oe.AST_NODE_TYPES.Property&&a.key.type===oe.AST_NODE_TYPES.Identifier){let i=a.key.name,s=t.disallowMethods.find(l=>l.name===i);if(s){if(s.requireTrueProp){let l=s.requireTrueProp,p=!1;for(let c of o.properties)if(c.type===oe.AST_NODE_TYPES.Property&&c.key.type===oe.AST_NODE_TYPES.Identifier&&c.key.name===l&&c.value.type===oe.AST_NODE_TYPES.Literal&&c.value.value===!0){p=!0;break}if(!p){e.report({node:a,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:s.name,requireTrueProp:l}});continue}}s.replacement&&e.report({node:a,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:s.name,replacement:s.replacement},suggest:[{messageId:"replace",data:{replacement:s.replacement},fix:l=>l.replaceText(a.key,s.replacement)}]})}}}}}}:{}}}),Lt={name:Wn,rule:Hi};var Ke=require("@typescript-eslint/utils"),Yi=Ke.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Vn="require-description",qi=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Ji=/^eslint-disable-(next-)?line$/u,Bi=Yi({name:Vn,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of r.getAllComments()){let a=Xi(o);a!=null&&(n.has(a.kind)||a.description||e.report({loc:Ki(o.loc),messageId:"missingDescription"}))}}}}}),zn={name:Vn,rule:Bi};function Xi(e){let{text:t,description:r}=Gi(e.value);if(!t)return null;let n=qi.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let a=Ji.test(o);if(e.type===Ke.TSESTree.AST_TOKEN_TYPES.Line&&!a||a&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+o.length);return{kind:o,value:i.trim(),description:r}}function Gi(e){let t=e.split(/\s-{2,}\s/u);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Ki(e){return{start:{line:e.start.line,column:-1},end:e.end}}var L=require("@typescript-eslint/utils"),Se=require("zod/v4");var Zi=Se.z.object({varsToCheck:Se.z.array(Se.z.object({selector:Se.z.string().optional(),fromFnCall:Se.z.string().optional(),prop:Se.z.string().or(Se.z.array(Se.z.string())),errorMsg:Se.z.string().optional()}))}),_t=X({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[Ce(Zi)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map,n=(i,s,l,p)=>{let c=new Set;for(let y of i.properties)y.type===L.AST_NODE_TYPES.Property&&y.key.type===L.AST_NODE_TYPES.Identifier&&c.add(y.key.name);let f=s.filter(y=>!c.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(T=>`"${T}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:p,customMsg:l||""}})}},o=i=>{if(i.init?.type===L.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===L.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===L.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===L.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===L.AST_NODE_TYPES.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"},a={};for(let i of t.varsToCheck)i.selector&&(a[i.selector]=s=>{if(s.type===L.AST_NODE_TYPES.VariableDeclarator&&s.id.type===L.AST_NODE_TYPES.Identifier&&r.set(s.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:s.id,fnName:o(s)}),s.type===L.AST_NODE_TYPES.VariableDeclarator&&s.id.type===L.AST_NODE_TYPES.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(s.id,l,i.errorMsg,o(s))}});for(let i of t.varsToCheck)if(i.fromFnCall){let s=i.fromFnCall;if(s.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${s.slice(2)}"]`;a[p]=c=>{if(c.type!==L.AST_NODE_TYPES.MemberExpression||c.parent.type!==L.AST_NODE_TYPES.CallExpression)return;let f=c.parent;if(f.parent.type!==L.AST_NODE_TYPES.VariableDeclarator)return;let y=f.parent;if(y.id.type===L.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===L.AST_NODE_TYPES.ObjectPattern){let T=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,T,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(s.includes(".")){let[l,p]=s.split("."),c=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;a[c]=f=>{if(f.type!==L.AST_NODE_TYPES.MemberExpression||f.parent.type!==L.AST_NODE_TYPES.CallExpression)return;let y=f.parent;if(y.parent.type!==L.AST_NODE_TYPES.VariableDeclarator)return;let T=y.parent;if(T.id.type===L.AST_NODE_TYPES.Identifier)r.set(T.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:T.id,fnName:i.fromFnCall||"unknown function"});else if(T.id.type===L.AST_NODE_TYPES.ObjectPattern){let I=Array.isArray(i.prop)?i.prop:[i.prop];n(T.id,I,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${s}"]`;a[l]=p=>{if(p.type!==L.AST_NODE_TYPES.Identifier||p.parent.type!==L.AST_NODE_TYPES.CallExpression)return;let c=p.parent;if(c.parent.type!==L.AST_NODE_TYPES.VariableDeclarator)return;let f=c.parent;if(f.id.type===L.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===L.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{...a,"Program:exit"(){for(let[i,{props:s,errorMsg:l,node:p,fnName:c}]of r){let y=e.sourceCode.getScope(p).set.get(i);if(y){let T=new Set(s);for(let I of y.references){let x=I.identifier,E=x.parent;if(!(E.type===L.AST_NODE_TYPES.VariableDeclarator&&E.id===x)){if(E.type===L.AST_NODE_TYPES.MemberExpression&&E.object===x&&E.property.type===L.AST_NODE_TYPES.Identifier&&T.has(E.property.name)){if(T.delete(E.property.name),T.size===0)break;continue}if(E.type===L.AST_NODE_TYPES.VariableDeclarator&&E.init===x&&E.id.type===L.AST_NODE_TYPES.ObjectPattern){for(let u of E.id.properties)u.type===L.AST_NODE_TYPES.Property&&u.key.type===L.AST_NODE_TYPES.Identifier&&T.has(u.key.name)&&T.delete(u.key.name);if(T.size===0)break;continue}if(!(E.type===L.AST_NODE_TYPES.MemberExpression&&E.object===x&&E.property.type===L.AST_NODE_TYPES.Identifier&&!s.includes(E.property.name))){T.clear();break}}}if(T.size>0){let I=Array.from(T);if(I.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:I[0],fnName:c,customMsg:l||""}});else{let x=I.map(E=>`"${E}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:x,fnName:c,customMsg:l||""}})}}}}}}}});function qn(e){return/^use[A-Z0-9]/.test(e)}function Ze(e){return e.type==="Identifier"?qn(e.name):e.type==="MemberExpression"&&!e.computed&&Ze(e.property)?e.object.type==="Identifier":!1}function Jn(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Bn(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Xn(e){return!!(e.parent&&e.parent.callee&&Bn(e.parent.callee,"forwardRef"))}function Gn(e){return!!(e.parent&&e.parent.callee&&Bn(e.parent.callee,"memo"))}function $t(e){for(;e;){let t=Zn(e);if(t&&(Jn(t)||Ze(t))||Xn(e)||Gn(e))return!0;e=e.parent}return!1}function Hn(e){return!1}function Ut(e){return!1}var Qi=/eslint +react-compiler\/react-compiler: +\["error/,Kn={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let l of e.sourceCode.getAllComments())if(Qi.test(l.value))return{CallExpression(p){let c=null;p.callee.name==="useMemo"?c="useMemo":p.callee.name==="useCallback"&&(c="useCallback"),c&&e.report({node:p,message:`"${c}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?l=>t(l):l=>e.sourceCode.getText(l),r=typeof e.getScope=="function"?()=>r():l=>e.sourceCode.getScope(l),n=null,o=[],a=[],i=new WeakSet;function s(l){for(let p of l.references){let c=p.identifier.parent;if(c.type==="VariableDeclarator"&&c.init&&c.init.type==="CallExpression"&&c.init.callee&&Hn(c.init.callee))for(let f of p.resolved.references)f!==p&&i.add(f.identifier)}}return{onCodePathSegmentStart:l=>a.push(l),onCodePathSegmentEnd:()=>a.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(l,p){let c=o.pop();if(c.size===0)return;let f=new Set;function y(g,m){let{cache:S}=y,k=S.get(g.id),A=new Set(m);if(A.has(g.id)){let C=[...A],N=C.slice(C.indexOf(g.id)+1);for(let z of N)f.add(z);return BigInt("0")}if(A.add(g.id),k!==void 0)return k;if(l.thrownSegments.includes(g))k=BigInt("0");else if(g.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let C of g.prevSegments)k+=y(C,A)}return g.reachable&&k===BigInt("0")?S.delete(g.id):S.set(g.id,k),k}function T(g,m){let{cache:S}=T,k=S.get(g.id),A=new Set(m);if(A.has(g.id)){let C=Array.from(A),N=C.slice(C.indexOf(g.id)+1);for(let z of N)f.add(z);return BigInt("0")}if(A.add(g.id),k!==void 0)return k;if(l.thrownSegments.includes(g))k=BigInt("0");else if(g.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let C of g.nextSegments)k+=T(C,A)}return S.set(g.id,k),k}function I(g){let{cache:m}=I,S=m.get(g.id);if(S===null)return 1/0;if(S!==void 0)return S;if(m.set(g.id,null),g.prevSegments.length===0)S=1;else{S=1/0;for(let k of g.prevSegments){let A=I(k);A<S&&(S=A)}S+=1}return m.set(g.id,S),S}y.cache=new Map,T.cache=new Map,I.cache=new Map;let x=T(l.initialSegment),E=Zn(p),u=$t(p),R=E?Jn(E)||Ze(E):Xn(p)||Gn(p),b=1/0;for(let g of l.finalSegments){if(!g.reachable)continue;let m=I(g);m<b&&(b=m)}for(let[g,m]of c){if(!g.reachable)continue;let S=g.nextSegments.length===0?b<=I(g):b<I(g),k=y(g)*T(g),A=f.has(g.id);for(let C of m)if(A&&!Ut(C)&&e.report({node:C,message:`React Hook "${t(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.`}),R){if(p.async&&e.report({node:C,message:`React Hook "${t(C)}" cannot be called in an async function.`}),!A&&k!==x&&!Ut(C)){let z=`React Hook "${t(C)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(S?" Did you accidentally call a React Hook after an early return?":"");e.report({node:C,message:z})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let N=`React Hook "${t(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:N})}else if(E){let N=`React Hook "${t(C)}" is called in function "${t(E)}" 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:N})}else if(p.type==="Program"){let N=`React Hook "${t(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:N})}else if(u&&!Ut(C)){if(p.parent.type==="CallExpression"&&p.parent.callee.type==="Identifier"&&p.parent.callee.name==="useCallback"){let z=p.parent;if(z.parent.type==="VariableDeclarator"&&qn(z.parent.id.name))return}let N=`React Hook "${t(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:N})}}},CallExpression(l){if(Ze(l.callee)){let p=Yn(o),c=Yn(a),f=p.get(c);f||(f=[],p.set(c,f)),f.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||Hn(l.callee))&&l.arguments.length>0&&(n=l)},Identifier(l){n==null&&i.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${t(l)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(l){l===n&&(n=null)},FunctionDeclaration(l){$t(l)&&s(r(l))},ArrowFunctionExpression(l){$t(l)&&s(r(l))}}}};function Zn(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 Yn(e){return e[e.length-1]}var Q=require("@typescript-eslint/utils"),ae=ve(require("zod/v4"));var es=ae.object({indent:ae.union([ae.string().regex(/^\s+$/),ae.number().int().min(1)]).optional(),tags:ae.array(ae.string()).optional(),functions:ae.array(ae.string()).optional(),comments:ae.array(ae.string()).optional()}),Wt=X({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[Ce(es)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:a}=e.options[0],i=r.map(u=>u.toLowerCase());function s(u){let R=u.split(/\r?\n/),b=R.filter(m=>m.trim()!=="");if(b.length===0)return u;let g=Number.POSITIVE_INFINITY;for(let m of b){let S=m.match(/^(\s*)/);S&&(g=Math.min(g,S[1]?.length??0))}return!isFinite(g)||g===0?u:R.map(m=>m.slice(g)).join(`
15
+ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let S=l.acquire(u),k=new Set,A=null;{let d=S.upper;for(;d&&(k.add(d),d.type!=="function");)d=d.upper;if(!d)return;A=d}let C=Array.isArray;function N(d){if(!C(d.defs))return!1;let h=d.defs[0];if(h==null||h.node.type!=="VariableDeclarator")return!1;let v=h.node.init;if(v==null)return!1;for(;v.type==="TSAsExpression";)v=v.expression;let O=h.node.parent;if(O==null&&(pt(A.block,h.node.id),O=h.node.parent,O==null))return!1;if(O.kind==="const"&&v.type==="Literal"&&(typeof v.value=="string"||typeof v.value=="number"||v.value===null))return!0;if(v.type!=="CallExpression")return!1;let F=v.callee;if(F.type==="MemberExpression"&&F.object.name==="React"&&F.property!=null&&!F.computed&&(F=F.property),F.type!=="Identifier")return!1;let P=h.node.id,{name:M}=F;if(M==="useRef"&&P.type==="Identifier")return!0;if(kr(F)&&P.type==="Identifier"){for(let D of d.references)D!==P&&T.add(D.identifier);return!0}else if(M==="useState"||M==="useReducer"){if(P.type==="ArrayPattern"&&P.elements.length===2&&C(d.identifiers)){if(P.elements[1]===d.identifiers[0]){if(M==="useState"){let D=d.references,pe=0;for(let he=0;he<D.length;he++){if(D[he].isWrite()&&pe++,pe>1)return!1;p.set(D[he].identifier,P.elements[0])}}return!0}else if(P.elements[0]===d.identifiers[0]){if(M==="useState"){let D=d.references;for(let pe=0;pe<D.length;pe++)c.add(D[pe].identifier)}return!1}}}else if(M==="useTransition"&&P.type==="ArrayPattern"&&P.elements.length===2&&Array.isArray(d.identifiers)&&P.elements[1]===d.identifiers[0])return!0;return!1}function z(d){if(!C(d.defs))return!1;let h=d.defs[0];if(h==null||h.node==null||h.node.id==null)return!1;let v=h.node,O=A.childScopes,F=null,P;for(P=0;P<O.length;P++){let M=O[P],D=M.block;if(v.type==="FunctionDeclaration"&&D===v||v.type==="VariableDeclarator"&&D.parent===v){F=M;break}}if(F==null)return!1;for(P=0;P<F.through.length;P++){let M=F.through[P];if(M.resolved!=null&&k.has(M.resolved.scope)&&!B(M.resolved))return!1}return!0}let B=I(N,f),ne=I(z,y),ee=new Map;function xe(d){let h=d.from,v=!1;for(;h.block!==u;)h.type==="function"&&(v=h.block.parent!=null&&h.block.parent.type==="ReturnStatement"),h=h.upper;return v}let G=new Map,ye=new Map;fe(S);function fe(d){for(let h of d.references){if(!h.resolved||!k.has(h.resolved.scope))continue;let v=pt(u,h.identifier),O=on(v),F=Ee(O,ye);if(m&&O.type==="Identifier"&&(O.parent.type==="MemberExpression"||O.parent.type==="OptionalMemberExpression")&&!O.parent.computed&&O.parent.property.type==="Identifier"&&O.parent.property.name==="current"&&xe(h)&&ee.set(F,{reference:h,dependencyNode:O}),O.parent.type==="TSTypeQuery"||O.parent.type==="TSTypeReference")continue;let P=h.resolved.defs[0];if(P!=null&&!(P.node!=null&&P.node.init===u.parent)&&P.type!=="TypeParameter")if(G.has(F))G.get(F).references.push(h);else{let M=h.resolved,D=B(M)||ne(M);G.set(F,{isStable:D,references:[h]})}}for(let h of d.childScopes)fe(h)}ee.forEach(({reference:d,dependencyNode:h},v)=>{let O=d.resolved.references,F=!1;for(let P=0;P<O.length;P++){let{identifier:M}=O[P],{parent:D}=M;if(D!=null&&D.type==="MemberExpression"&&!D.computed&&D.property.type==="Identifier"&&D.property.name==="current"&&D.parent.type==="AssignmentExpression"&&D.parent.left===D){F=!0;break}}F||s({node:h.parent.property,message:`The ref value '${v}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${v}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let se=new Set;function Te(d,h){se.has(h)||(se.add(h),s({node:d,message:`Assignments to the '${h}' variable from inside React Hook ${r(b)} will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ${r(b)}.`}))}let Fe=new Set;if(G.forEach(({isStable:d,references:h},v)=>{d&&Fe.add(v),h.forEach(O=>{O.writeExpr&&Te(O.writeExpr,v)})}),se.size>0)return;if(!R){let d=null;if(G.forEach(({isStable:h,references:v},O)=>{d||v.forEach(F=>{if(d)return;let P=F.identifier;if(!p.has(P))return;let D=F.from;for(;D.type!=="function";)D=D.upper;D.block===u&&(d=O)})}),d){let{suggestedDependencies:h}=at({dependencies:G,declaredDependencies:[],stableDependencies:Fe,externalDependencies:new Set,isEffect:!0});s({node:b,message:`React Hook ${g} contains a call to '${d}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+h.join(", ")+`] as a second argument to the ${g} Hook.`,suggest:[{desc:`Add dependencies array: [${h.join(", ")}]`,fix(v){return v.insertTextAfter(u,`, [${h.join(", ")}]`)}}]})}return}let Le=[],_e=new Set;R.type!=="ArrayExpression"?s({node:R,message:`React Hook ${r(b)} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.`}):R.elements.forEach(d=>{if(d===null)return;if(d.type==="SpreadElement"){s({node:d,message:`React Hook ${r(b)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}T.has(d)&&s({node:d,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(d)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(d)}\``,fix(F){return F.removeRange(d.range)}}]});let h;try{h=Ee(d,ye)}catch(F){if(/Unsupported node type/.test(F.message)){d.type==="Literal"?G.has(d.value)?s({node:d,message:`The ${d.raw} literal is not a valid dependency because it never changes. Did you mean to include ${d.value} in the array instead?`}):s({node:d,message:`The ${d.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:d,message:`React Hook ${r(b)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw F}let v=d;for(;v.type==="MemberExpression"||v.type==="OptionalMemberExpression"||v.type==="ChainExpression";)v=v.object||v.expression.object;let O=!A.through.some(F=>F.identifier===v);Le.push({key:h,node:d}),O||_e.add(h)});let{suggestedDependencies:er,unnecessaryDependencies:Ve,missingDependencies:Ie,duplicateDependencies:Ht}=at({dependencies:G,declaredDependencies:Le,stableDependencies:Fe,externalDependencies:_e,isEffect:m}),ze=er;if(Ht.size+Ie.size+Ve.size===0){if(t)return;wr({declaredDependencies:Le,declaredDependenciesNode:R,componentScope:A,scope:S}).forEach(({construction:h,isUsedOutsideOfHook:v,depType:O})=>{let F=O==="function"?"useCallback":"useMemo",P=O==="function"?"definition":"initialization",M=`wrap the ${P} of '${h.name.name}' in its own ${F}() Hook.`,D=v?`To fix this, ${M}`:`Move it inside the ${g} callback. Alternatively, ${M}`,pe=O==="conditional"||O==="logical expression"?"could make":"makes",he=`The '${h.name.name}' ${O} ${pe} the dependencies of ${g} Hook (at line ${R.loc.start.line}) change on every render. ${D}`,Yt;v&&h.type==="Variable"&&O==="function"&&(Yt=[{desc:`Wrap the ${P} of '${h.name.name}' in its own ${F}() Hook.`,fix(qt){let[nr,rr]=F==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[qt.insertTextBefore(h.node.init,nr),qt.insertTextAfter(h.node.init,rr)]}}]),s({node:h.node,message:he,suggest:Yt})});return}!m&&Ie.size>0&&(ze=at({dependencies:G,declaredDependencies:[],stableDependencies:Fe,externalDependencies:_e,isEffect:m}).suggestedDependencies);function tr(){if(Le.length===0)return!0;let d=Le.map(v=>v.key),h=d.slice().sort();return d.join(",")===h.join(",")}tr()&&ze.sort();function et(d){let h=d.split("."),v="";for(let O=0;O<h.length;O++){if(O!==0){let F=h.slice(0,O+1).join("."),P=ye.get(F)===!0;v+=P?"?.":"."}v+=h[O]}return v}function tt(d,h,v,O){return d.size===0?null:(d.size>1?"":h+" ")+v+" "+(d.size>1?"dependencies":"dependency")+": "+Rr(Array.from(d).sort().map(F=>"'"+et(F)+"'"))+`. Either ${O} ${d.size>1?"them":"it"} or remove the dependency array.`}let me="";if(Ve.size>0){let d=null;if(Array.from(Ve.keys()).forEach(h=>{d===null&&h.endsWith(".current")&&(d=h)}),d!==null)me=` Mutable values like '${d}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(_e.size>0){let h=Array.from(_e)[0];S.set.has(h)||(me=` Outer scope values like '${h}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!me&&Ie.has("props")){let d=G.get("props");if(d==null)return;let h=d.references;if(!Array.isArray(h))return;let v=!0;for(let O=0;O<h.length;O++){let F=h[O],P=pt(A.block,F.identifier);if(!P){v=!1;break}let M=P.parent;if(M==null){v=!1;break}if(M.type!=="MemberExpression"&&M.type!=="OptionalMemberExpression"){v=!1;break}}v&&(me=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${g} call and refer to those specific props inside ${r(b)}.`)}if(!me&&Ie.size>0){let d=null;Ie.forEach(h=>{if(d)return;let v=A.set.get(h),O=G.get(h);if(O.references[0].resolved!==v)return;let F=v.defs[0];if(F==null||F.name==null||F.type!=="Parameter")return;let P=!1,M;for(let D=0;D<O.references.length;D++)if(M=O.references[D].identifier,M!=null&&M.parent!=null&&(M.parent.type==="CallExpression"||M.parent.type==="OptionalCallExpression")&&M.parent.callee===M){P=!0;break}P&&(d=h)}),d!==null&&(me=` If '${d}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!me&&Ie.size>0){let d=null;if(Ie.forEach(h=>{if(d!==null)return;let O=G.get(h).references,F,P;for(let M=0;M<O.length;M++){for(F=O[M].identifier,P=F.parent;P!=null&&P!==A.block;){if(P.type==="CallExpression"){let D=p.get(P.callee);if(D!=null){if(D.name===h)d={missingDep:h,setter:P.callee.name,form:"updater"};else if(c.has(F))d={missingDep:h,setter:P.callee.name,form:"reducer"};else{let pe=O[M].resolved;if(pe!=null){let he=pe.defs[0];he!=null&&he.type==="Parameter"&&(d={missingDep:h,setter:P.callee.name,form:"inlineReducer"})}}break}}P=P.parent}if(d!==null)break}}),d!==null)switch(d.form){case"reducer":me=` You can also replace multiple useState variables with useReducer if '${d.setter}' needs the current value of '${d.missingDep}'.`;break;case"inlineReducer":me=` If '${d.setter}' needs the current value of '${d.missingDep}', you can also switch to useReducer instead of useState and read '${d.missingDep}' in the reducer.`;break;case"updater":me=` You can also do a functional update '${d.setter}(${d.missingDep.slice(0,1)} => ...)' if you only need '${d.missingDep}' in the '${d.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:R,message:`React Hook ${r(b)} has `+(tt(Ie,"a","missing","include")||tt(Ve,"an","unnecessary","exclude")||tt(Ht,"a","duplicate","omit"))+me,suggest:[{desc:`Update the dependencies array to be: [${ze.map(et).join(", ")}]`,fix(d){return d.replaceText(R,`[${ze.map(et).join(", ")}]`)}}]})}function E(u){let R=Ar(u.callee,i);if(R===-1)return;let b=u.arguments[R],g=u.callee,m=an(g).name,S=u.arguments[R+1],k=/Effect($|[^a-z])/g.test(m);if(!b){s({node:g,message:`React Hook ${m} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!k)){if(!S&&!k){(m==="useMemo"||m==="useCallback")&&s({node:g,message:`React Hook ${m} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(b.type){case"FunctionExpression":case"ArrowFunctionExpression":x(b,S,g,m,k);return;case"Identifier":if(!S||S.elements&&S.elements.some(N=>N&&N.type==="Identifier"&&N.name===b.name))return;let A=n(u).set.get(b.name);if(A==null||A.defs==null)return;let C=A.defs[0];if(!C||!C.node||C.type!=="Variable"&&C.type!=="FunctionName")break;switch(C.node.type){case"FunctionDeclaration":x(C.node,S,g,m,k);return;case"VariableDeclarator":let N=C.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":x(N,S,g,m,k);return}break}break;default:s({node:g,message:`React Hook ${m} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:g,message:`React Hook ${m} has a missing dependency: '${b.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${b.name}]`,fix(A){return A.replaceText(S,`[${b.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let u of e.sourceCode.getAllComments())if(Cr.test(u.value))return t=!0,{CallExpression:R=>E(R,!0)}}return{CallExpression:u=>E(u)}}};function at({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:o}){let a=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((x,E)=>{let u=s(a,E);u.isUsed=!0,l(a,E,R=>{R.isSubtreeUsed=!0})}),t.forEach(({key:x})=>{let E=s(a,x);E.isSatisfiedRecursively=!0}),r.forEach(x=>{let E=s(a,x);E.isSatisfiedRecursively=!0});function s(x,E){let u=E.split("."),R=x;for(let b of u){let g=R.children.get(b);g||(g=i(),R.children.set(b,g)),R=g}return R}function l(x,E,u){let R=E.split("."),b=x;for(let g of R){let m=b.children.get(g);if(!m)return;u(m),b=m}}let p=new Set,c=new Set;f(a,p,c,x=>x);function f(x,E,u,R){x.children.forEach((b,g)=>{let m=R(g);if(b.isSatisfiedRecursively){b.isSubtreeUsed&&u.add(m);return}if(b.isUsed){E.add(m);return}f(b,E,u,S=>m+"."+S)})}let y=[],T=new Set,I=new Set;return t.forEach(({key:x})=>{c.has(x)?y.indexOf(x)===-1?y.push(x):I.add(x):T.add(x)}),p.forEach(x=>{y.push(x)}),{suggestedDependencies:y,unnecessaryDependencies:T,duplicateDependencies:I,missingDependencies:p}}function we(e){switch(e.type){case"ObjectExpression":return"object";case"ArrayExpression":return"array";case"ArrowFunctionExpression":case"FunctionExpression":return"function";case"ClassExpression":return"class";case"ConditionalExpression":return we(e.consequent)!=null||we(e.alternate)!=null?"conditional":null;case"LogicalExpression":return we(e.left)!=null||we(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return we(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return we(e.expression);case"TSAsExpression":return we(e.expression)}return null}function wr({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let o=e.map(({key:i})=>{let s=r.variables.find(p=>p.name===i);if(s==null)return null;let l=s.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let p=we(l.node.init);if(p!=null)return[s,p]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[s,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[s,"class"]:null}).filter(Boolean);function a(i){let s=!1;for(let l=0;l<i.references.length;l++){let p=i.references[l];if(p.writeExpr){if(s)return!0;s=!0;continue}let c=p.from;for(;c!==n&&c!=null;)c=c.upper;if(c!==n&&!ln(t,p.identifier))return!0}return!1}return o.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:a(i)}))}function on(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)?on(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function lt(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function Ee(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=Ee(e.object,t),n=Ee(e.property,null),o=`${r}.${n}`;return lt(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=Ee(e.object,t),n=Ee(e.property,null),o=`${r}.${n}`;return lt(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=Ee(r.object,t),o=Ee(r.property,null),a=`${n}.${o}`;return lt(r,t,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function an(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Ar(e,t){let r=an(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=Ee(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 pt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),vr(n,t))return n;if(ln(n,t))for(let[o,a]of Object.entries(n))o!=="parent"&&(rn(a)?(a.parent=n,r.push(a)):Array.isArray(a)&&a.forEach(i=>{rn(i)&&(i.parent=n,r.push(i))}))}return null}function Rr(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 rn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function vr(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 ln(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function kr(e){return!1}var Ae=require("@typescript-eslint/utils");var ie=ve(require("typescript")),Or=Ae.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pn="improved-no-unnecessary-condition",Pr=Y({}),Fr=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Nr=new Set(Fr),ct={name:pn,rule:Or({name:pn,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".'},schema:[Pr]},defaultOptions:[{}],create(e){let t=Ae.ESLintUtils.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(s){return s.type===Ae.AST_NODE_TYPES.UnaryExpression&&s.operator==="typeof"}function o(s){return s.flags&ie.default.TypeFlags.Any||s.flags&ie.default.TypeFlags.Unknown?null:s.flags&ie.default.TypeFlags.StringLike?["string"]:s.flags&ie.default.TypeFlags.NumberLike?["number"]:s.flags&ie.default.TypeFlags.BigIntLike?["bigint"]:s.flags&ie.default.TypeFlags.BooleanLike?["boolean"]:s.flags&ie.default.TypeFlags.ESSymbolLike?["symbol"]:s.flags&ie.default.TypeFlags.Undefined||s.flags&ie.default.TypeFlags.Void?["undefined"]:s.flags&ie.default.TypeFlags.Null?["object"]:s.getCallSignatures().length>0?["function"]:s.flags&ie.default.TypeFlags.Object?s.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:s.flags&ie.default.TypeFlags.NonPrimitive?["object"]:s.flags&ie.default.TypeFlags.Never?["never"]:null}function a(s){if(!r)return null;let l=t.esTreeNodeToTSNodeMap.get(s),p=r.getTypeAtLocation(l.expression);if(p.flags&ie.default.TypeFlags.Any||p.flags&ie.default.TypeFlags.Unknown)return null;let c=[];if(p.isUnion()){for(let y of p.types){let T=o(y);if(T)c.push(...T);else return null}return c}let f=o(p);return f?(c.push(...f),c):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,c=null;if(n(s.left)?(p=s.left,c=s.right.type===Ae.AST_NODE_TYPES.Literal&&typeof s.right.value=="string"?s.right.value:null):n(s.right)&&(p=s.right,c=s.left.type===Ae.AST_NODE_TYPES.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!c||!jr(c,Nr))return;let f=a(p);if(!f)return;let y=s.operator==="!==",T=f.includes(c);f.length===1?T&&!y?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:c}}):!T&&y?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:Array.from(f)[0]}}):!T&&!y?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:Ye(f),conditionType:c}}):T&&y&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:Ye(f),conditionType:c}}):!T&&!y?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:Ye(f),conditionType:c}}):!T&&y&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:Ye(f)}})}return{BinaryExpression:i}}})};function Ye(e){return Array.from(new Set(e)).join(" | ")||"never"}function je(e,t){let r=e.argument;return r.type===Ae.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function jr(e,t){return t.has(e)}var qe=require("@typescript-eslint/utils");var Mr=qe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cn="no-call-with-explicit-generics",Dr=Y({functions:te(H())}),Lr=Mr({name:cn,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[Dr]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:o}=n;o.type===qe.AST_NODE_TYPES.Identifier&&r.has(o.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),ut={name:cn,rule:Lr};var ke=require("@typescript-eslint/utils"),_r=ke.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),un="no-call-with-inferred-generics",$r=_r({name:un,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:o}=n;if(o.type!==ke.AST_NODE_TYPES.Identifier)return;let a=r.get(o.name);if(!a)return;let{minGenerics:i=1,allowAny:s,disallowTypes:l=t.disallowTypes}=a;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(s&&!l)&&n.typeArguments?.params?.some(c=>!s&&c.type===ke.AST_NODE_TYPES.TSAnyKeyword||l&&c.type===ke.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===ke.AST_NODE_TYPES.Identifier&&l.includes(c.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),ft={name:un,rule:$r};var mn=require("@typescript-eslint/utils"),Ur=mn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),dn="no-commented-out-code",Wr=["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:"],K={returnStatement:/^\s*return\s+/,stringAssignment:/\w=("|'|`)/,objectPropertyWithQuotes:/\w+:\s*('|"|`)/,computedPropertyAssignment:/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,kebabCaseProperty:/\w+-\w+:/,snakeCaseProperty:/\w+_\w+:/,ternaryOperator:/\?\s+\w/,colonWithWord:/:\s+\w/,quotedString:/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,numberWithComma:/^\s*\d+[,}]/,arrayWithComma:/^\s*\[[^\]]*\][,}]/,objectWithComma:/^\s*\{[^}]*\}[,}]/,methodCall:/\.\w+\(/,arrayAccess:/\[\w+\]/,quotedPropertyKey:/^\s*(['"`]).+?\1\s*:/,jsxSelfClosing:/^<[A-Z]\w*(\s|>|\/)/,jsxElement:/^<[a-z]+(\s|>|\/)/,jsxOpeningTag:/<[A-Z]\w*(\s.*)?>/,jsxClosingTag:/<\/[A-Z]\w*>/,htmlOpeningTag:/<[a-z]+(\s.*)?>/,htmlClosingTag:/<\/[a-z]+>/,jsdocComment:/^\s*[*\s]*$/};function Vr(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&/^[a-zA-Z]/.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||/\.[A-Za-z_][A-Za-z0-9_]*\(/.test(t)||/[{}[\]()`=<>]/.test(t)||/:\s*(['"`[{(]|\w+\s*=>)/.test(t)||/\bif\s*\(|\belse\b|=>/.test(t)?!1:!!(t.includes(":")&&/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/.test(t))}var zr=[") {","return;",K.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",K.stringAssignment,");",K.objectPropertyWithQuotes,K.computedPropertyAssignment,K.kebabCaseProperty,K.snakeCaseProperty,"&&","||","()",K.ternaryOperator,K.colonWithWord,K.quotedString,K.numberWithComma,K.arrayWithComma,K.objectWithComma,K.methodCall,K.arrayAccess,"?.(","??","=>",K.quotedPropertyKey],Hr=["/>","</",K.jsxSelfClosing,K.jsxElement,K.jsxOpeningTag,K.jsxClosingTag,K.htmlOpeningTag,K.htmlClosingTag],fn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Yr=Ur({name:dn,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(n,o){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||K.jsdocComment.test(n))return!1;for(let i of fn)if(a.startsWith(i))return!1;if(n.includes("https://")||Vr(a))return!1;if(o==="Block"){for(let i of Hr)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 Wr)if(a.startsWith(i))return{wrongPattern:i};for(let i of zr)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,o){let a=n,i=a.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let p=a.split(/```[\s\S]*?```/g);p.some(f=>/[a-zA-Z0-9]/.test(f))&&(a=p.join(""))}if(!a.includes("`"))return a;let s=a.split(/`[^`]*`/g);return s.some(p=>/[a-zA-Z0-9]/.test(p))?s.join(""):a}return{Program(){let o=e.sourceCode.getAllComments();for(let a of o){let i=r(a.value,a.type),s=t(i,a.type);s&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:fn.join(", ")}})}}}}}),mt={name:dn,rule:Yr};var Je=require("@typescript-eslint/utils"),qr=Je.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yn="no-default-export",Jr=qr({name:yn,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===Je.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),dt={name:yn,rule:Jr};var gn=require("@typescript-eslint/utils"),Br=gn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sn="no-leaked-text-in-jsx",Xr=[",",";","[","]","(",")"],Gr=Br({name:Sn,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="";Xr.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),yt={name:Sn,rule:Gr};var Re=require("@typescript-eslint/utils"),Kr=Re.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),hn="no-non-camel-case-functions",Zr=/^(\$?[a-z][a-zA-Z0-9]*)$/;function Tn(e){if(e.typeName.type!==Re.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Re.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var Qr=Kr({name:hn,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&&!Zr.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Re.AST_NODE_TYPES.TSTypeReference?Tn(r):r.type===Re.AST_NODE_TYPES.TSUnionType&&r.types.some(o=>o.type===Re.AST_NODE_TYPES.TSTypeReference&&Tn(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),gt={name:hn,rule:Qr};var W=require("@typescript-eslint/utils");var St=require("@typescript-eslint/utils");function Me(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:Me(e.parent,t,r===1/0?r:r-1)}function*Tt(e){yield e,e.parent&&(yield*Tt(e.parent))}function ht(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function En(e,t,r){let o=r.getDeclaredVariables(e).find(a=>a.name===t||a.identifiers[0]?.parent.type===St.AST_NODE_TYPES.Property&&a.identifiers[0]?.parent.key.type===St.AST_NODE_TYPES.Identifier&&a.identifiers[0]?.parent.key.name===t);return o?o.references.filter(a=>!a.init):[]}var ei=W.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),bn="no-optional-root-props",ti=ei({name:bn,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function t(n){let a=e.sourceCode.getDeclaredVariables(n)[0];if(!a||a.references.length!==1)return!1;let i=a.references[0];if(!i)return!1;for(let s of Tt(i.identifier)){if("returnType"in s||s.type===W.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=s.parent;if(!l)return!1;if(l.type===W.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===W.TSESTree.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===W.TSESTree.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let c=Me(l.parent.parent,W.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!c)return!1;let f=Be(c,e.sourceCode);return f?!(f.parent.type===W.TSESTree.AST_NODE_TYPES.CallExpression&&f.parent.callee.type===W.TSESTree.AST_NODE_TYPES.Identifier&&f.parent.callee.name==="memo"):!1}if(s.type===W.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===W.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let p=Me(l,W.TSESTree.AST_NODE_TYPES.VariableDeclaration);return p?!!Be(p,e.sourceCode):!1}if(l.type===W.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!Be(l,e.sourceCode)}return!1}function r(n){n.key.type!==W.TSESTree.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:o=>{let a=Me(n,W.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let i=e.sourceCode.getText(a);return o.replaceText(a,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===W.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(Xe(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===W.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(Xe(n)||!t(n)))for(let o of n.body.body)o.type===W.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(n){if(n.typeName.type!==W.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==W.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let a=Me(n.parent,W.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let i=Be(a,e.sourceCode);if(!(!i||i.parent.type===W.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===W.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of o.members)l.type===W.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function Xe(e){return e?e.parent?.type===W.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===W.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Be(e,t){if(Xe(e))return;let r;if(e.type===W.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===W.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===W.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let o=n.variables.find(i=>i.identifiers.includes(r));if(!o)return;let a=o.references.filter(i=>i.identifier!==r);if(!(a.length!==1||!a[0])&&!Xe(a[0].identifier.parent.parent))return a[0].identifier}var Et={name:bn,rule:ti};var $e=X({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){return{ExportNamedDeclaration(t){t.source&&e.report({node:t,messageId:"noReexport"})},ExportAllDeclaration(t){e.report({node:t,messageId:"noReexport"})}}}});var xn=require("@typescript-eslint/utils"),Ge=ve(require("path"));var ni=xn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),In="no-relative-imports",ri=Y({find:H(),replacement:H()}),ii=Y({aliases:te(ri),rootDir:$(H()),allowNotFoundAliases:$(Ne()),_dev_simulateFileName:$(H())}),si=ni({name:In,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:[ii]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function o(i,s){let l=Ge.default.dirname(s);return Ge.default.resolve(l,i)}function a(i){let s=t.rootDir??process.cwd(),l=Ge.default.relative(s,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:c}of t.aliases)if(l.startsWith(c)){let f=l.replace(c,p);return{alias:p,newPath:f}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!n(s))return;let l=o(s,r),p=a(l);!p&&t.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?c=>c.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),bt={name:In,rule:si};var Ue=require("@typescript-eslint/utils"),Oe=ve(require("zod/v4"));var oi=Oe.object({alternativeMsgs:Oe.object({inArrayFind:Oe.string().optional(),inArrayFilter:Oe.string().optional()}).optional(),__dev_simulateFileName:Oe.string().optional()});function ai(e){return e.typeAnnotation.type!==Ue.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}function li(e){return/\.(typeGuards|type-guards)\.(ts|tsx)$/.test(e)}function pi(e){let t=e.parent;for(;t;){if(t.type===Ue.AST_NODE_TYPES.CallExpression&&t.callee.type===Ue.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===Ue.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var xt=X({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[Ce(oi)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(li(r))return{};function n(o){if(!ai(o))return;let a=pi(o),i=[];if(t.alternativeMsgs&&a){let s=a.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(s){let l=a.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:l,data:{message:s}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});var Pe=require("@typescript-eslint/utils");var ci="no-unnecessary-async-on-jsx-props";function ui(e){if(e.body.type!==Pe.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!==Pe.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===Pe.AST_NODE_TYPES.AwaitExpression}var It=X({name:ci,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){ui(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,a=[],i=o.getFirstToken(r,l=>l.value==="async");if(i){let l=o.getTokenAfter(i);l?a.push(n.replaceTextRange([i.range[0],l.range[0]],"")):a.push(n.remove(i))}function s(l){if(l.type===Pe.AST_NODE_TYPES.AwaitExpression){let p=o.getFirstToken(l);if(p&&p.value==="await"){let c=o.getTokenAfter(p);c?a.push(n.replaceTextRange([p.range[0],c.range[0]],"")):a.push(n.remove(p))}}if(l.type===Pe.AST_NODE_TYPES.BlockStatement)for(let p of l.body)s(p);else l.type===Pe.AST_NODE_TYPES.ExpressionStatement&&s(l.expression)}return s(r.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var be=require("@typescript-eslint/utils");var Ct=ve(require("typescript")),fi=be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cn="no-unnecessary-casting",mi=Y({additionalCastFunctions:$(te(Y({name:H(),expectedType:Bt(["string","number"])})))}),wt={name:Cn,rule:fi({name:Cn,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:[mi],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=be.ESLintUtils.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function i(c,f){switch(c.type){case be.AST_NODE_TYPES.Literal:return f==="number"?typeof c.value=="number":typeof c.value=="string";case be.AST_NODE_TYPES.TemplateLiteral:return f==="string";case be.AST_NODE_TYPES.UnaryExpression:return f==="number"?c.operator==="+"||c.operator==="-"||c.operator==="~":!1;default:return!1}}function s(c,f){return f==="number"?!!(c.flags&Ct.TypeFlags.NumberLike):!!(c.flags&Ct.TypeFlags.StringLike)}function l(c,f){return y=>y.replaceText(c,e.sourceCode.getText(f))}function p(c){if(!a||c.arguments.length!==1)return;let f=c.arguments[0];if(!f||f.type===be.AST_NODE_TYPES.SpreadElement)return;let{callee:y}=c;if(y.type!==be.AST_NODE_TYPES.Identifier)return;let T=y.name,I=n.find(E=>E.name===T);if(!I)return;if(i(f,I.expectedType)||s(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(f)),I.expectedType)){let E,u;T==="Number"?E="unnecessaryNumberCasting":T==="String"?E="unnecessaryStringCasting":(E="unnecessaryCustomCasting",u={name:I.name,type:I.expectedType}),e.report({node:c,messageId:E,...u?{data:u}:{},fix:l(c,f)})}}return{CallExpression:p}}})};var We=require("@typescript-eslint/utils"),ce=ve(require("zod/v4"));var di=ce.object({methods:ce.union([ce.array(ce.string()),ce.literal("array")])}),At=X({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[ce.toJSONSchema(di)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(r)?r.includes(s):n.has(s)}function a(s){let{callee:l}=s;if(l.type===We.AST_NODE_TYPES.MemberExpression){let p=l.property;if(p.type===We.AST_NODE_TYPES.Identifier)return p.name}return null}function i(s,l){if(s.type!==We.AST_NODE_TYPES.Identifier||!s.typeAnnotation)return;let p=l.parent;if(p.type===We.AST_NODE_TYPES.CallExpression){let c=a(p);c&&o(c)&&p.arguments.indexOf(l)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(y){return y.remove(s.typeAnnotation)}})}}return{ArrowFunctionExpression(s){for(let l of s.params)i(l,s)},FunctionExpression(s){for(let l of s.params)i(l,s)}}}});var le=require("@typescript-eslint/utils");var Rt=X({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===le.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==le.AST_NODE_TYPES.ObjectExpression||t.id.type===le.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===le.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===le.AST_NODE_TYPES.Property&&i.key.type===le.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==le.AST_NODE_TYPES.Identifier)return;let n=yi(t,e.sourceCode);if(n.length===0)return;let o=t.init.properties.some(i=>i.type!==le.AST_NODE_TYPES.Property?!1:i.value.type===le.AST_NODE_TYPES.FunctionExpression),a=new Set;for(let i of n){if(i.identifier.parent.type!==le.AST_NODE_TYPES.MemberExpression)return;let s=i.identifier.parent;if(s.object!==i.identifier)return;if(s.computed)if(s.property.type===le.AST_NODE_TYPES.Literal&&typeof s.property.value=="string")a.add(s.property.value);else return;else{if(s.property.type!==le.AST_NODE_TYPES.Identifier)return;a.add(s.property.name)}if(s.parent.type===le.AST_NODE_TYPES.CallExpression&&o)return}for(let[i,s]of r)a.has(i)||e.report({node:s,messageId:"unusedObjectProperty",data:{name:i}})}}}});function yi(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 V=require("@typescript-eslint/utils");var gi=Y({selectors:te(Y({name:H(),selectorProp:$(H()),selectorArgPos:$(ge()),returnProp:$(H())}))}),Si=V.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),wn="no-unused-selected-values",vt={name:wn,rule:Si({name:wn,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[gi]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===V.AST_NODE_TYPES.CallExpression&&(a=o.init),!a)return;let i=hi(a);if(!i)return;let s=n.get(i);if(!s)return;let l=Ti(a,s.selectorArgPos??0,s.selectorProp);if(!l)return;let p=Ei(l);if(!p)return;let c=An(p.properties,void 0);if(!c)return;if(o.id.type===V.AST_NODE_TYPES.ObjectPattern){let T=An(o.id.properties,s.returnProp);if(!T)return;for(let[I,x]of c)T.has(I)||e.report({node:x,messageId:"unusedSelectedValue",data:{name:I}});return}if(o.id.type!==V.AST_NODE_TYPES.Identifier||s.returnProp)return;let f=bi(o,e.sourceCode);if(f.length===0)return;let y=new Set;for(let T of f){if(T.identifier.parent.type!==V.AST_NODE_TYPES.MemberExpression)return;let I=T.identifier.parent.property;if(I.type!==V.AST_NODE_TYPES.Identifier)return;y.add(I.name)}for(let[T,I]of c)y.has(T)||e.report({node:I,messageId:"unusedSelectedValue",data:{name:T}})}}}})};function Ti(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===V.AST_NODE_TYPES.ArrowFunctionExpression||n.type===V.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===V.AST_NODE_TYPES.ObjectExpression){let o=n.properties.find(i=>i.type===V.AST_NODE_TYPES.Property&&i.key.type===V.AST_NODE_TYPES.Identifier&&i.key.name===r);if(o?.type!==V.AST_NODE_TYPES.Property)return null;let a=o.value;if(a.type===V.AST_NODE_TYPES.ArrowFunctionExpression||a.type===V.AST_NODE_TYPES.FunctionExpression)return a}return null}function hi(e){return e.callee.type===V.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===V.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===V.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Ei(e){if(e.body.type===V.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===V.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===V.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==V.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function An(e,t){let r=e;if(t){let o=e.find(a=>a.type===V.AST_NODE_TYPES.Property&&a.key.type===V.AST_NODE_TYPES.Identifier&&a.key.name===t);if(o?.type!==V.AST_NODE_TYPES.Property||o.value.type!==V.AST_NODE_TYPES.ObjectPattern)return null;r=o.value.properties}let n=new Map;for(let o of r){if(o.type!==V.AST_NODE_TYPES.Property||o.key.type!==V.AST_NODE_TYPES.Identifier)return null;n.set(o.key.name,o)}return n.size>0?n:null}function bi(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 q=require("@typescript-eslint/utils");var kt=X({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(a=>a.type===q.AST_NODE_TYPES.ImportDeclaration&&a.source.value==="t-state-form"))return{};let n=null,o=!1;return{CallExpression(a){if(o)return;if(!n){let s=xi(a);s&&(n=s);return}let i=Ii(a,e.sourceCode);if(i){o=!0;for(let s of i)n.delete(s);if(n.size!==0)for(let[s,l]of n)e.report({node:l,messageId:"unusedField",data:{name:s}})}}}}});function xi(e){if(!(e.callee.type===q.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==q.AST_NODE_TYPES.ObjectExpression)return null;let n=ht(r.properties,a=>a.type!==q.AST_NODE_TYPES.Property||a.key.type!==q.AST_NODE_TYPES.Identifier||a.key.name!=="initialConfig"?null:a.value.type===q.AST_NODE_TYPES.ObjectExpression?a.value:a.value.type===q.AST_NODE_TYPES.ArrowFunctionExpression||a.value.type===q.AST_NODE_TYPES.FunctionExpression?Ci(a.value):null);if(!n)return null;let o=new Map;for(let a of n.properties)a.type===q.AST_NODE_TYPES.Property&&a.key.type===q.AST_NODE_TYPES.Identifier&&o.set(a.key.name,a);return o}function Ii(e,t){if(!(e.callee.type===q.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==q.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==q.AST_NODE_TYPES.ObjectPattern||!ht(e.parent.id.properties,i=>i.type===q.AST_NODE_TYPES.Property&&i.key.type===q.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let o=En(e.parent,"formFields",t),a=new Set;for(let{identifier:i}of o){if(i.type!==q.AST_NODE_TYPES.Identifier||i.parent.type===q.AST_NODE_TYPES.Property&&i.parent.parent.type===q.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===q.AST_NODE_TYPES.ReturnStatement||i.parent.type===q.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===q.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==q.AST_NODE_TYPES.Identifier||i.parent.property.type!==q.AST_NODE_TYPES.Identifier)return null;a.add(i.parent.property.name)}}return a}function Ci(e){if(e.body.type===q.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===q.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===q.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==q.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var U=require("@typescript-eslint/utils");var wi=U.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Rn(e){let t=[];for(let r of e.members)r.type===U.AST_NODE_TYPES.TSPropertySignature&&r.key.type===U.AST_NODE_TYPES.Identifier&&t.push([r.key.name,r]);return t}function vn(e,...t){for(let r of t)e.set(...r);return e}var Ai=Y({forceCheckOnFCPropTypesWithName:$(te(H()))}),kn="no-unused-type-props-in-args",Ot=null,Ri=wi({name:kn,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:[Ai],fixable:"code"},defaultOptions:[{}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r}=t;r&&!Ot&&(Ot=r.map(s=>new RegExp(s)));function n(s,l,p,c,f=!0){let y=p.name,T=e.sourceCode.getScope(l).references.find(E=>E.identifier.name===y)?.resolved,I=s&&Ot?.some(E=>E.test(y));if(!T||!I&&T.references.filter(E=>E.isTypeReference).length>1)return;let x=T?.defs[0]?.node;if(!(f&&x?.parent?.type===U.AST_NODE_TYPES.ExportNamedDeclaration)){if(x?.type===U.AST_NODE_TYPES.TSTypeAliasDeclaration){o(s,l,c,x.typeAnnotation,!0);return}if(x?.type===U.AST_NODE_TYPES.TSInterfaceDeclaration){o(s,l,c,x.body,!0);return}}}function o(s,l,p,c,f){if(c.type===U.AST_NODE_TYPES.TSInterfaceBody){for(let y of c.body)y.type===U.AST_NODE_TYPES.TSPropertySignature&&y.key.type===U.AST_NODE_TYPES.Identifier&&p.set(y.key.name,y);return}if(c.type===U.AST_NODE_TYPES.TSTypeLiteral){vn(p,...Rn(c));return}if(c.type===U.AST_NODE_TYPES.TSIntersectionType){for(let y of c.types)o(s,l,p,y,!0);return}f||c.type===U.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===U.AST_NODE_TYPES.Identifier&&n(s,l,c.typeName,p)}function a(s,l,p){for(let c of p)if(c.type==="ObjectPattern"&&c.typeAnnotation){let f=new Map;if(o(s,l,f,c.typeAnnotation.typeAnnotation,!1),f.size===0)continue;i(c,f)}else c.type===U.AST_NODE_TYPES.AssignmentPattern&&c.left.type===U.AST_NODE_TYPES.ObjectPattern&&a(s,l,[c.left])}function i(s,l){let p=[];if(s.properties.at(-1)?.type===U.AST_NODE_TYPES.RestElement)return;for(let T of s.properties)T.type===U.AST_NODE_TYPES.Property&&T.key.type===U.AST_NODE_TYPES.Identifier&&p.push(T.key.name);let f=[],y=[];for(let[T,I]of l)p.includes(T)||(y.push(T),f.push({node:I,messageId:"unusedObjectTypeProperty",data:{propertyName:T}}));for(let[T,I]of f.entries())e.report({...I,fix:T===f.length-1?x=>{let E=s.properties.at(-1),u=y.join(", ");return E?E?.type===U.AST_NODE_TYPES.RestElement?null:x.insertTextAfter(E,`, ${u}`):x.insertTextBeforeRange([s.range[0]+1,s.range[1]],`${u}`)}:void 0})}return{VariableDeclaration(s){let l=s.declarations[0];if(!l)return;let p=new Map,c=l.id.type===U.AST_NODE_TYPES.Identifier&&l.id.typeAnnotation?.typeAnnotation.type===U.AST_NODE_TYPES.TSTypeReference&&l.id.typeAnnotation.typeAnnotation.typeName.type===U.AST_NODE_TYPES.Identifier&&l.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&l.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(c){if(c.type===U.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===U.AST_NODE_TYPES.Identifier)n(!0,s,c.typeName,p,!1);else if(c.type===U.AST_NODE_TYPES.TSTypeLiteral)vn(p,...Rn(c));else if(c.type===U.AST_NODE_TYPES.TSIntersectionType)for(let f of c.types)f.type===U.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===U.AST_NODE_TYPES.Identifier?n(!0,s,f.typeName,p,!1):o(!0,s,p,f,!0);if(p.size!==0&&l.init?.type===U.AST_NODE_TYPES.ArrowFunctionExpression){let f=l.init.params[0];if(!f){e.report({node:l.init,messageId:"missingComponentParam"});return}f.type===U.AST_NODE_TYPES.ObjectPattern&&i(f,p)}}},FunctionDeclaration:function(s){a(!1,s,s.params)},ArrowFunctionExpression(s){a(!1,s,s.params)}}}}),Pt={name:kn,rule:Ri};var ue=require("@typescript-eslint/utils");var Ft=X({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let t=new Set;function r(n){return n.callee.type===ue.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===ue.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===ue.AST_NODE_TYPES.Identifier&&n.callee.property.type===ue.AST_NODE_TYPES.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let o of n.specifiers)o.type===ue.AST_NODE_TYPES.ImportSpecifier&&o.imported.type===ue.AST_NODE_TYPES.Identifier&&o.imported.name==="useRef"&&t.add(o.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===ue.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===ue.AST_NODE_TYPES.Identifier){let a=e.sourceCode.getScope(n).set.get(n.id.name);if(a){let i=!1;for(let s of a.references){let p=s.identifier.parent;if(p!==n&&!(p.type===ue.AST_NODE_TYPES.JSXExpressionContainer&&p.parent.type===ue.AST_NODE_TYPES.JSXAttribute&&p.parent.name.type===ue.AST_NODE_TYPES.JSXIdentifier&&p.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var De=require("@typescript-eslint/utils"),vi=De.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pn="prefer-named-functions",On=new Map,ki=vi({name:Pn,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=On.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),On.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===De.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===De.AST_NODE_TYPES.Identifier){let o=n.id.name;if(n.id.typeAnnotation||r&&r.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==De.AST_NODE_TYPES.BlockStatement)return;let a=n.parent,i=n.init.params,s=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(a,`${l.async?"async ":""}function ${o}(${i.map(c=>e.sourceCode.getText(c)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),Nt={name:Pn,rule:ki};var j=require("@typescript-eslint/utils");var Oi=Y({disallowedFunctions:te(Y({name:H(),allowUsingWithArgs:$(Ne()),hookAlternative:$(H()),message:$(H()),allowUseInside:$(te(H()))}))});function Ke(e){return/^use[A-Z]/.test(e)}function Fn(e){return/^[A-Z]/.test(e)}function Pi(e){return e.type===j.AST_NODE_TYPES.Identifier?Ke(e.name):e.type===j.AST_NODE_TYPES.MemberExpression&&e.property.type===j.AST_NODE_TYPES.Identifier?Ke(e.property.name):!1}function Nn(e,t){return e.type===j.AST_NODE_TYPES.Identifier?e.name===t:e.type===j.AST_NODE_TYPES.MemberExpression&&e.object.type===j.AST_NODE_TYPES.Identifier&&e.property.type===j.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function jn(e){return!!(e.parent&&e.parent.type===j.AST_NODE_TYPES.CallExpression&&Nn(e.parent.callee,"forwardRef"))}function Mn(e){return!!(e.parent&&e.parent.type===j.AST_NODE_TYPES.CallExpression&&Nn(e.parent.callee,"memo"))}function jt(e){if(e.type===j.AST_NODE_TYPES.FunctionDeclaration||e.type===j.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===j.AST_NODE_TYPES.FunctionExpression||e.type===j.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===j.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===j.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===j.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===j.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Fi(e){let t=e.parent,r=!1;for(;t;){if(t.type===j.AST_NODE_TYPES.FunctionDeclaration||t.type===j.AST_NODE_TYPES.FunctionExpression||t.type===j.AST_NODE_TYPES.ArrowFunctionExpression){let n=jt(t);if(n&&n.type===j.AST_NODE_TYPES.Identifier){if(Fn(n.name)||Ke(n.name))return!r;r=!0}else{if(jn(t)||Mn(t))return!r;if(t.parent.type===j.AST_NODE_TYPES.CallExpression){let o=t.parent;Pi(o.callee)||(r=!0)}else t.parent.type===j.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Dn(e){return e.callee.type===j.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===j.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===j.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Ni(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===j.AST_NODE_TYPES.FunctionDeclaration||r.type===j.AST_NODE_TYPES.FunctionExpression||r.type===j.AST_NODE_TYPES.ArrowFunctionExpression){let n=jt(r);if(n&&n.type===j.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===j.AST_NODE_TYPES.CallExpression){let n=Dn(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function ji(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===j.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function Mi(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===j.AST_NODE_TYPES.FunctionDeclaration||n.type===j.AST_NODE_TYPES.FunctionExpression||n.type===j.AST_NODE_TYPES.ArrowFunctionExpression){let o=jt(n);if(o&&o.type===j.AST_NODE_TYPES.Identifier){if(Fn(o.name)||Ke(o.name)){r=!0;break}}else if(jn(n)||Mn(n)){r=!0;break}}n=n.parent}return r?t.length===0?Fi(e):!Ni(e,t):!1}var Mt=X({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[Oi],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let a=Dn(o);if(!a)return;let i=n.get(a);if(!i||i.allowUsingWithArgs&&ji(o))return;let s=i.allowUseInside||[];Mi(o,s)&&e.report({node:o,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:l=>{let p=i.hookAlternative;return o.callee.type===j.AST_NODE_TYPES.Identifier?l.replaceText(o.callee,p):o.callee.type===j.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===j.AST_NODE_TYPES.Identifier?l.replaceText(o.callee.property,p):null}}]:[]})}}}});var J=require("@typescript-eslint/utils");var Di=J.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_n="prefer-single-line-if",Li=Y({maxLineLength:$(ge()),maxNonSimpleConditionLength:$(ge())}),_i=Di({name:_n,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:[Li]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==J.AST_NODE_TYPES.BlockStatement||n.loc.start.line===n.loc.end.line||r.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let a=n.consequent.body[0];if(a.type===J.AST_NODE_TYPES.ReturnStatement){if(!Un(a))return}else if(!(a.type===J.AST_NODE_TYPES.ContinueStatement||a.type===J.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===J.AST_NODE_TYPES.LogicalExpression||n.test.type===J.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let f=Ln(n.test);if(!f&&n.test.type===J.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let y=n.test.argument;Ln(y)&&(f=!0)}if(f&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let s=r.getText(a);if(i.includes(`
16
+ `))return;let l=r.getTokenAfter(n);if(l&&l.type===J.AST_TOKEN_TYPES.Punctuator&&l.value==="}"){let f=r.getTokenAfter(l);if(f&&f.type===J.AST_TOKEN_TYPES.Keyword&&(f.value==="else"||f.value==="catch"))return}let p=$i(r,n),c=`if (${i}) ${s}`;t.maxLineLength&&c.length+p.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:f=>f.replaceText(n,c)})}}}});function Ln(e){return e.type===J.AST_NODE_TYPES.CallExpression||e.type===J.AST_NODE_TYPES.BinaryExpression||e.type===J.AST_NODE_TYPES.MemberExpression&&$n(e)}function $n(e){return e.object.type===J.AST_NODE_TYPES.MemberExpression?$n(e.object):e.object.type!==J.AST_NODE_TYPES.Identifier}function $i(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Un(e){if(!e.argument)return!0;let t=e.argument;return t.type===J.AST_NODE_TYPES.ArrayExpression&&t.elements.length===0||t.type===J.AST_NODE_TYPES.ObjectExpression&&t.properties.length===0||t.type===J.AST_NODE_TYPES.Literal||t.type===J.AST_NODE_TYPES.Identifier||t.type===J.AST_NODE_TYPES.TemplateLiteral||t.type===J.AST_NODE_TYPES.TaggedTemplateExpression?!0:t.type===J.AST_NODE_TYPES.CallExpression?t.arguments.length===0:t.type===J.AST_NODE_TYPES.UnaryExpression?Un(t):!1}var Dt={name:_n,rule:_i};var oe=require("@typescript-eslint/utils");var Ui=oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Wn="react-compiler-migration",Wi=Y({disallowHooks:$(te(Y({name:H(),replacement:H()}))),disallowMethods:$(te(Y({name:H(),replacement:$(H()),requireTrueProp:$(H())})))}),Vi=/eslint +react-compiler\/react-compiler: +\["error/;function zi(e){return e.type===oe.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===oe.AST_NODE_TYPES.MemberExpression&&e.property.type===oe.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var Hi=Ui({name:Wn,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:[Wi]},defaultOptions:[{}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(Vi.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let o=null,a=null;if(n.callee.type===oe.AST_NODE_TYPES.Identifier?(o=n.callee.name,a=n.callee):n.callee.type===oe.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===oe.AST_NODE_TYPES.Identifier&&(o=n.callee.property.name,a=n.callee.property),o){let i=t.disallowHooks.find(s=>s.name===o);i&&a&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:s=>s.replaceText(a,i.replacement)}]})}}if(t.disallowMethods?.length&&zi(n.callee)){for(let o of n.arguments)if(o.type===oe.AST_NODE_TYPES.ObjectExpression){for(let a of o.properties)if(a.type===oe.AST_NODE_TYPES.Property&&a.key.type===oe.AST_NODE_TYPES.Identifier){let i=a.key.name,s=t.disallowMethods.find(l=>l.name===i);if(s){if(s.requireTrueProp){let l=s.requireTrueProp,p=!1;for(let c of o.properties)if(c.type===oe.AST_NODE_TYPES.Property&&c.key.type===oe.AST_NODE_TYPES.Identifier&&c.key.name===l&&c.value.type===oe.AST_NODE_TYPES.Literal&&c.value.value===!0){p=!0;break}if(!p){e.report({node:a,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:s.name,requireTrueProp:l}});continue}}s.replacement&&e.report({node:a,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:s.name,replacement:s.replacement},suggest:[{messageId:"replace",data:{replacement:s.replacement},fix:l=>l.replaceText(a.key,s.replacement)}]})}}}}}}:{}}}),Lt={name:Wn,rule:Hi};var Ze=require("@typescript-eslint/utils"),Yi=Ze.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Vn="require-description",qi=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Ji=/^eslint-disable-(next-)?line$/u,Bi=Yi({name:Vn,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of r.getAllComments()){let a=Xi(o);a!=null&&(n.has(a.kind)||a.description||e.report({loc:Ki(o.loc),messageId:"missingDescription"}))}}}}}),zn={name:Vn,rule:Bi};function Xi(e){let{text:t,description:r}=Gi(e.value);if(!t)return null;let n=qi.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let a=Ji.test(o);if(e.type===Ze.TSESTree.AST_TOKEN_TYPES.Line&&!a||a&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+o.length);return{kind:o,value:i.trim(),description:r}}function Gi(e){let t=e.split(/\s-{2,}\s/u);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Ki(e){return{start:{line:e.start.line,column:-1},end:e.end}}var L=require("@typescript-eslint/utils"),Se=require("zod/v4");var Zi=Se.z.object({varsToCheck:Se.z.array(Se.z.object({selector:Se.z.string().optional(),fromFnCall:Se.z.string().optional(),prop:Se.z.string().or(Se.z.array(Se.z.string())),errorMsg:Se.z.string().optional()}))}),_t=X({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[Ce(Zi)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map,n=(i,s,l,p)=>{let c=new Set;for(let y of i.properties)y.type===L.AST_NODE_TYPES.Property&&y.key.type===L.AST_NODE_TYPES.Identifier&&c.add(y.key.name);let f=s.filter(y=>!c.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(T=>`"${T}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:p,customMsg:l||""}})}},o=i=>{if(i.init?.type===L.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===L.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===L.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===L.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===L.AST_NODE_TYPES.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"},a={};for(let i of t.varsToCheck)i.selector&&(a[i.selector]=s=>{if(s.type===L.AST_NODE_TYPES.VariableDeclarator&&s.id.type===L.AST_NODE_TYPES.Identifier&&r.set(s.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:s.id,fnName:o(s)}),s.type===L.AST_NODE_TYPES.VariableDeclarator&&s.id.type===L.AST_NODE_TYPES.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(s.id,l,i.errorMsg,o(s))}});for(let i of t.varsToCheck)if(i.fromFnCall){let s=i.fromFnCall;if(s.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${s.slice(2)}"]`;a[p]=c=>{if(c.type!==L.AST_NODE_TYPES.MemberExpression||c.parent.type!==L.AST_NODE_TYPES.CallExpression)return;let f=c.parent;if(f.parent.type!==L.AST_NODE_TYPES.VariableDeclarator)return;let y=f.parent;if(y.id.type===L.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===L.AST_NODE_TYPES.ObjectPattern){let T=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,T,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(s.includes(".")){let[l,p]=s.split("."),c=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;a[c]=f=>{if(f.type!==L.AST_NODE_TYPES.MemberExpression||f.parent.type!==L.AST_NODE_TYPES.CallExpression)return;let y=f.parent;if(y.parent.type!==L.AST_NODE_TYPES.VariableDeclarator)return;let T=y.parent;if(T.id.type===L.AST_NODE_TYPES.Identifier)r.set(T.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:T.id,fnName:i.fromFnCall||"unknown function"});else if(T.id.type===L.AST_NODE_TYPES.ObjectPattern){let I=Array.isArray(i.prop)?i.prop:[i.prop];n(T.id,I,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${s}"]`;a[l]=p=>{if(p.type!==L.AST_NODE_TYPES.Identifier||p.parent.type!==L.AST_NODE_TYPES.CallExpression)return;let c=p.parent;if(c.parent.type!==L.AST_NODE_TYPES.VariableDeclarator)return;let f=c.parent;if(f.id.type===L.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===L.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{...a,"Program:exit"(){for(let[i,{props:s,errorMsg:l,node:p,fnName:c}]of r){let y=e.sourceCode.getScope(p).set.get(i);if(y){let T=new Set(s);for(let I of y.references){let x=I.identifier,E=x.parent;if(!(E.type===L.AST_NODE_TYPES.VariableDeclarator&&E.id===x)){if(E.type===L.AST_NODE_TYPES.MemberExpression&&E.object===x&&E.property.type===L.AST_NODE_TYPES.Identifier&&T.has(E.property.name)){if(T.delete(E.property.name),T.size===0)break;continue}if(E.type===L.AST_NODE_TYPES.VariableDeclarator&&E.init===x&&E.id.type===L.AST_NODE_TYPES.ObjectPattern){for(let u of E.id.properties)u.type===L.AST_NODE_TYPES.Property&&u.key.type===L.AST_NODE_TYPES.Identifier&&T.has(u.key.name)&&T.delete(u.key.name);if(T.size===0)break;continue}if(!(E.type===L.AST_NODE_TYPES.MemberExpression&&E.object===x&&E.property.type===L.AST_NODE_TYPES.Identifier&&!s.includes(E.property.name))){T.clear();break}}}if(T.size>0){let I=Array.from(T);if(I.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:I[0],fnName:c,customMsg:l||""}});else{let x=I.map(E=>`"${E}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:x,fnName:c,customMsg:l||""}})}}}}}}}});function qn(e){return/^use[A-Z0-9]/.test(e)}function Qe(e){return e.type==="Identifier"?qn(e.name):e.type==="MemberExpression"&&!e.computed&&Qe(e.property)?e.object.type==="Identifier":!1}function Jn(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Bn(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Xn(e){return!!(e.parent&&e.parent.callee&&Bn(e.parent.callee,"forwardRef"))}function Gn(e){return!!(e.parent&&e.parent.callee&&Bn(e.parent.callee,"memo"))}function $t(e){for(;e;){let t=Zn(e);if(t&&(Jn(t)||Qe(t))||Xn(e)||Gn(e))return!0;e=e.parent}return!1}function Hn(e){return!1}function Ut(e){return!1}var Qi=/eslint +react-compiler\/react-compiler: +\["error/,Kn={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let l of e.sourceCode.getAllComments())if(Qi.test(l.value))return{CallExpression(p){let c=null;p.callee.name==="useMemo"?c="useMemo":p.callee.name==="useCallback"&&(c="useCallback"),c&&e.report({node:p,message:`"${c}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?l=>t(l):l=>e.sourceCode.getText(l),r=typeof e.getScope=="function"?()=>r():l=>e.sourceCode.getScope(l),n=null,o=[],a=[],i=new WeakSet;function s(l){for(let p of l.references){let c=p.identifier.parent;if(c.type==="VariableDeclarator"&&c.init&&c.init.type==="CallExpression"&&c.init.callee&&Hn(c.init.callee))for(let f of p.resolved.references)f!==p&&i.add(f.identifier)}}return{onCodePathSegmentStart:l=>a.push(l),onCodePathSegmentEnd:()=>a.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(l,p){let c=o.pop();if(c.size===0)return;let f=new Set;function y(g,m){let{cache:S}=y,k=S.get(g.id),A=new Set(m);if(A.has(g.id)){let C=[...A],N=C.slice(C.indexOf(g.id)+1);for(let z of N)f.add(z);return BigInt("0")}if(A.add(g.id),k!==void 0)return k;if(l.thrownSegments.includes(g))k=BigInt("0");else if(g.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let C of g.prevSegments)k+=y(C,A)}return g.reachable&&k===BigInt("0")?S.delete(g.id):S.set(g.id,k),k}function T(g,m){let{cache:S}=T,k=S.get(g.id),A=new Set(m);if(A.has(g.id)){let C=Array.from(A),N=C.slice(C.indexOf(g.id)+1);for(let z of N)f.add(z);return BigInt("0")}if(A.add(g.id),k!==void 0)return k;if(l.thrownSegments.includes(g))k=BigInt("0");else if(g.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let C of g.nextSegments)k+=T(C,A)}return S.set(g.id,k),k}function I(g){let{cache:m}=I,S=m.get(g.id);if(S===null)return 1/0;if(S!==void 0)return S;if(m.set(g.id,null),g.prevSegments.length===0)S=1;else{S=1/0;for(let k of g.prevSegments){let A=I(k);A<S&&(S=A)}S+=1}return m.set(g.id,S),S}y.cache=new Map,T.cache=new Map,I.cache=new Map;let x=T(l.initialSegment),E=Zn(p),u=$t(p),R=E?Jn(E)||Qe(E):Xn(p)||Gn(p),b=1/0;for(let g of l.finalSegments){if(!g.reachable)continue;let m=I(g);m<b&&(b=m)}for(let[g,m]of c){if(!g.reachable)continue;let S=g.nextSegments.length===0?b<=I(g):b<I(g),k=y(g)*T(g),A=f.has(g.id);for(let C of m)if(A&&!Ut(C)&&e.report({node:C,message:`React Hook "${t(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.`}),R){if(p.async&&e.report({node:C,message:`React Hook "${t(C)}" cannot be called in an async function.`}),!A&&k!==x&&!Ut(C)){let z=`React Hook "${t(C)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(S?" Did you accidentally call a React Hook after an early return?":"");e.report({node:C,message:z})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let N=`React Hook "${t(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:N})}else if(E){let N=`React Hook "${t(C)}" is called in function "${t(E)}" 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:N})}else if(p.type==="Program"){let N=`React Hook "${t(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:N})}else if(u&&!Ut(C)){if(p.parent.type==="CallExpression"&&p.parent.callee.type==="Identifier"&&p.parent.callee.name==="useCallback"){let z=p.parent;if(z.parent.type==="VariableDeclarator"&&qn(z.parent.id.name))return}let N=`React Hook "${t(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:N})}}},CallExpression(l){if(Qe(l.callee)){let p=Yn(o),c=Yn(a),f=p.get(c);f||(f=[],p.set(c,f)),f.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||Hn(l.callee))&&l.arguments.length>0&&(n=l)},Identifier(l){n==null&&i.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${t(l)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(l){l===n&&(n=null)},FunctionDeclaration(l){$t(l)&&s(r(l))},ArrowFunctionExpression(l){$t(l)&&s(r(l))}}}};function Zn(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 Yn(e){return e[e.length-1]}var Q=require("@typescript-eslint/utils"),ae=ve(require("zod/v4"));var es=ae.object({indent:ae.union([ae.string().regex(/^\s+$/),ae.number().int().min(1)]).optional(),tags:ae.array(ae.string()).optional(),functions:ae.array(ae.string()).optional(),comments:ae.array(ae.string()).optional()}),Wt=X({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[Ce(es)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:a}=e.options[0],i=r.map(u=>u.toLowerCase());function s(u){let R=u.split(/\r?\n/),b=R.filter(m=>m.trim()!=="");if(b.length===0)return u;let g=Number.POSITIVE_INFINITY;for(let m of b){let S=m.match(/^(\s*)/);S&&(g=Math.min(g,S[1]?.length??0))}return!isFinite(g)||g===0?u:R.map(m=>m.slice(g)).join(`
17
17
  `)}function l(u,R,b){return u.split(/\r?\n/).map(m=>m.trim()===""?m:b.repeat(R)+m).join(`
18
18
  `)}function p(u){if(u.type===Q.AST_NODE_TYPES.Identifier)return u.name;if(u.type===Q.AST_NODE_TYPES.MemberExpression){let R=u.object.type===Q.AST_NODE_TYPES.Identifier?u.object.name:null,b=u.property.type===Q.AST_NODE_TYPES.Identifier?u.property.name:null;return R&&b?`${R}.${b}`:b}return null}function c(u,R){if(!u)return!1;for(let b of R)if(b.includes(".")){let g=b.split(".");if(u.type===Q.AST_NODE_TYPES.MemberExpression&&u.object.type===Q.AST_NODE_TYPES.Identifier&&u.property.type===Q.AST_NODE_TYPES.Identifier&&u.object.name===g[0]&&u.property.name===g[1])return!0}else if(u.type===Q.AST_NODE_TYPES.Identifier&&u.name===b)return!0;return!1}function f(u,R){let b=u.parent;if(b.type!==Q.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let g=p(b.tag);return g?R.includes(g):!1}function y(u,R){if(!u||u.type!==Q.AST_NODE_TYPES.CallExpression)return!1;let{method:b,argumentsLength:g,optionalCall:m=!0,optionalMember:S=!0}=R;return g!==void 0&&u.arguments.length!==g||!m&&u.optional||u.callee.type!==Q.AST_NODE_TYPES.MemberExpression||!S&&u.callee.optional||u.callee.property.type!==Q.AST_NODE_TYPES.Identifier?!1:u.callee.property.name===b}function T(u,R){if(!u||u.type!==Q.AST_NODE_TYPES.CallExpression)return!1;let{name:b,argumentsLength:g,optionalCall:m=!0}=R;return g!==void 0&&u.arguments.length!==g||!m&&u.optional||u.callee.type!==Q.AST_NODE_TYPES.Identifier?!1:u.callee.name===b}function I(u){return y(u.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&u.parent.type===Q.AST_NODE_TYPES.CallExpression&&u.parent.arguments[0]===u&&T(u.parent.callee.type===Q.AST_NODE_TYPES.MemberExpression?u.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function x(u){if(i.length>0){let R=t.getTokenBefore(u,{includeComments:!0});if(R?.type===Q.AST_TOKEN_TYPES.Block&&i.includes(R.value.trim().toLowerCase()))return!0}return!!(I(u)||o.length>0&&f(u,o)||n.length>0&&u.parent.type===Q.AST_NODE_TYPES.CallExpression&&u.parent.arguments.includes(u)&&c(u.parent.callee,n))}function E(u){let R=`__PLACEHOLDER__${Math.random()}`,b=u.quasis.map(G=>t.getText(G).slice(1,G.tail?-1:-2)).join(R),g=b.match(/\r?\n/);if(!g)return;let m=g[0],S=t.lines[t.getLocFromIndex(u.range[0]).line-1];if(!S)return;let A=S.match(/^(\s*)\S/)?.[1]??"",C;typeof a=="string"?C=a:typeof a=="number"?C=" ".repeat(a):C=A.startsWith(" ")?" ":" ";let z=s(b).replace(new RegExp(`^${m}|${m}[ ]*$`,"g"),""),B=m+l(z,1,A+C)+m+A,ne=b.includes(`\r
19
19
  `)?`\r
20
20
  `:`
21
- `,ee=b.split(/\r?\n/),xe=ee.map((G,ye)=>ye!==ee.length-1&&G===C+A?"":G).join(ne);if(B!==xe)return{node:u,messageId:"improperlyIndented",fix:G=>B.split(R).map((ye,fe)=>{let se=u.quasis[fe];return se?G.replaceTextRange([se.range[0]+1,se.range[1]-(se.tail?1:2)],ye):[]}).flat()}}return{TemplateLiteral(u){if(!x(u))return;let R=E(u);if(R)return e.report(R)}}}});var Vt=require("@typescript-eslint/utils");function ts(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function ns(e){let t=e.parent;return t?.type===Vt.AST_NODE_TYPES.NewExpression&&t.callee.type===Vt.AST_NODE_TYPES.Identifier&&t.callee.name==="RegExp"}var zt=X({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){ts(r)||ns(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var Qn={[Pt.name]:Pt.rule,[ft.name]:ft.rule,[ut.name]:ut.rule,"rules-of-hooks":Kn,"exhaustive-deps":sn,"require-description":zn.rule,[mt.name]:mt.rule,[yt.name]:yt.rule,[Nt.name]:Nt.rule,[rt.name]:rt.rule,[ct.name]:ct.rule,[Et.name]:Et.rule,[bt.name]:bt.rule,[Dt.name]:Dt.rule,[ht.name]:ht.rule,[dt.name]:dt.rule,[st.name]:st.rule,[Lt.name]:Lt.rule,[nt.name]:nt.rule,[pt.name]:pt.rule,[wt.name]:wt.rule,[At.name]:At.rule,[vt.name]:vt.rule,[kt.name]:kt.rule,[Rt.name]:Rt.rule,[Mt.name]:Mt.rule,[It.name]:It.rule,[xt.name]:xt.rule,[zt.name]:zt.rule,[Ft.name]:Ft.rule,[_t.name]:_t.rule,[Wt.name]:Wt.rule};var rs={rules:Qn};0&&(module.exports={extendedLintPlugin});
21
+ `,ee=b.split(/\r?\n/),xe=ee.map((G,ye)=>ye!==ee.length-1&&G===C+A?"":G).join(ne);if(B!==xe)return{node:u,messageId:"improperlyIndented",fix:G=>B.split(R).map((ye,fe)=>{let se=u.quasis[fe];return se?G.replaceTextRange([se.range[0]+1,se.range[1]-(se.tail?1:2)],ye):[]}).flat()}}return{TemplateLiteral(u){if(!x(u))return;let R=E(u);if(R)return e.report(R)}}}});var Vt=require("@typescript-eslint/utils");function ts(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function ns(e){let t=e.parent;return t?.type===Vt.AST_NODE_TYPES.NewExpression&&t.callee.type===Vt.AST_NODE_TYPES.Identifier&&t.callee.name==="RegExp"}var zt=X({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){ts(r)||ns(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var Qn={[Pt.name]:Pt.rule,[mt.name]:mt.rule,[ft.name]:ft.rule,"rules-of-hooks":Kn,"exhaustive-deps":sn,"require-description":zn.rule,[dt.name]:dt.rule,[gt.name]:gt.rule,[Nt.name]:Nt.rule,[it.name]:it.rule,[ut.name]:ut.rule,[bt.name]:bt.rule,[$e.name]:$e.rule,[Dt.name]:Dt.rule,[Et.name]:Et.rule,[yt.name]:yt.rule,[ot.name]:ot.rule,[Lt.name]:Lt.rule,[rt.name]:rt.rule,[ct.name]:ct.rule,[wt.name]:wt.rule,[At.name]:At.rule,[vt.name]:vt.rule,[kt.name]:kt.rule,[Rt.name]:Rt.rule,[Mt.name]:Mt.rule,[It.name]:It.rule,[xt.name]:xt.rule,[zt.name]:zt.rule,[Ft.name]:Ft.rule,[_t.name]:_t.rule,[Wt.name]:Wt.rule,[$e.name]:$e.rule};var rs={rules:Qn};0&&(module.exports={extendedLintPlugin});
@@ -1,7 +1,7 @@
1
- import{AST_NODE_TYPES as ee,ESLintUtils as Zn}from"@typescript-eslint/utils";var Be=Symbol.for("optional");function _(e){return{...e,[Be]:!0}}function Ut(e,t){return{enum:e,...t}}function Re(e){return{...e,type:"boolean"}}function V(e){return{...e,type:"string"}}function ge(e){return{...e,type:"number"}}function Q(e,t){return{...t,type:"array",items:e}}function z(e,t){let r={...t,type:"object",properties:e};if(e&&(r.additionalProperties||=!1,!r.required)){let n,o=[];for(n in e)e[n][Be]?e[n][Be]=void 0:o.push(n);o.length>0&&(r.required=o)}return r}var Qn=Zn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Vt="react-compiler-extra",er=z({runOnlyWithEnableCompilerDirective:_(Re())}),tr=/eslint +react-compiler\/react-compiler: +\["error/;function nr(e){return e.type===ee.Identifier?e.name.startsWith("use"):e.type===ee.MemberExpression&&e.property.type===ee.Identifier?e.property.name.startsWith("use"):!1}var rr=/\bthis[.[]/;function Wt(e){return rr.test(e)}var ir=Qn({name:Vt,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."},hasSuggestions:!0,schema:[er]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let a of e.sourceCode.getAllComments())if(tr.test(a.value)){r=!0;break}if(!r)return{}}function n(a){for(let i of a.properties)if(i.type===ee.Property&&i.method&&i.value.type===ee.FunctionExpression){let s=e.sourceCode,l=s.getText(i.key),p=i.value,c=s.getText(p.body);if(Wt(c))e.report({node:i,messageId:"thisKeywordInMethod"});else{let f=p.params.map(T=>s.getText(T)).join(", "),y="";p.generator?y=`${l}: function* (${f}) ${c}`:y=`${l}: (${f}) => ${c}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:T=>T.replaceText(i,y)})}}}function o(a){for(let i of a.properties)if(i.type===ee.Property&&i.value.type===ee.ObjectExpression){for(let s of i.value.properties)if(s.type===ee.Property&&s.method&&s.value.type===ee.FunctionExpression){let p=e.sourceCode.getText(s.value.body);Wt(p)&&e.report({node:s,messageId:"thisKeywordInMethod"})}}}return{CallExpression(a){if(nr(a.callee))for(let i of a.arguments){if(i.type===ee.ObjectExpression&&(n(i),o(i)),i.type===ee.ArrowFunctionExpression&&(i.body.type===ee.ObjectExpression&&(n(i.body),o(i.body)),i.body.type===ee.BlockStatement))for(let s of i.body.body)s.type===ee.ReturnStatement&&s.argument?.type===ee.ObjectExpression&&(n(s.argument),o(s.argument));if(i.type===ee.FunctionExpression)for(let s of i.body.body)s.type===ee.ReturnStatement&&s.argument?.type===ee.ObjectExpression&&(n(s.argument),o(s.argument))}}}}}),Xe={name:Vt,rule:ir};import{AST_NODE_TYPES as re}from"@typescript-eslint/utils";import{z as w}from"zod/v4";import{ESLintUtils as sr}from"@typescript-eslint/utils";import*as zt from"zod/v4";function B(e){let r=sr.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function Ie(e){return zt.toJSONSchema(e)}var or=w.object({disallow:w.array(w.object({selector:w.string(),message:w.string(),replace:w.optional(w.union([w.string(),w.object({regex:w.string(),with:w.string()})])),replaceType:w.optional(w.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:w.optional(w.array(w.object({fn:w.string(),withArgs:w.optional(w.array(w.object({atIndex:w.number(),value:w.union([w.string(),w.number(),w.boolean()])}))),message:w.string(),replaceWith:w.optional(w.string()),ignoreRegex:w.optional(w.string())}))),__dev_simulateFileName:w.optional(w.string()),mustMatchSyntax:w.optional(w.array(w.object({includeRegex:w.string(),mustCallFn:w.optional(w.array(w.object({anyCall:w.array(w.object({fn:w.string(),withArgs:w.array(w.object({atIndex:w.number(),literal:w.union([w.string(),w.number(),w.boolean()])}))})),message:w.optional(w.string())}))),mustMatchSelector:w.optional(w.array(w.object({selector:w.string(),message:w.string()}))),mustHaveExport:w.optional(w.array(w.object({name:w.string(),type:w.enum(["function","variable","any"]).default("any"),message:w.string()})))})))}),Ge=B({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[Ie(or)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:a,disallowFnCalls:i}=t,s=o??e.filename,l=[],p=new Map,c=new Set,f=new Map,y=new Set,T=new Map;function I(m){for(let S of m.specifiers)S.type===re.ImportSpecifier&&S.imported.type===re.Identifier&&S.imported.name!==S.local.name&&T.set(S.local.name,S.imported.name)}function x(m){if(m.declaration){if(m.declaration.type===re.FunctionDeclaration&&m.declaration.id){let S=m.declaration.id.name;for(let k of Array.from(y)){let[A,C]=k.split(":");A===S&&(C==="function"||C==="any")&&y.delete(k)}}else if(m.declaration.type===re.VariableDeclaration){for(let S of m.declaration.declarations)if(S.id.type===re.Identifier){let k=S.id.name;for(let A of Array.from(y)){let[C,N]=A.split(":");C===k&&(N==="variable"||N==="any")&&y.delete(A)}}}}for(let S of m.specifiers)if(S.exported.type===re.Identifier){let k=S.exported.name;for(let A of Array.from(y)){let[C,N]=A.split(":");C===k&&N==="any"&&y.delete(A)}}}function E(m){m.id.type===re.Identifier&&m.init?.type===re.Identifier&&T.set(m.id.name,m.init.name)}function u(m){return T.get(m)??m}function R(m,S){return u(m)===S||m===S}for(let{includeRegex:m,mustCallFn:S,mustMatchSelector:k,mustHaveExport:A}of n??[]){let C=ar(s,new RegExp(m));if(!C)continue;let N=W=>{let J=W;for(let{name:te,value:Z}of C)J=J.replaceAll(te,Z);return J};for(let{anyCall:W,message:J}of S??[]){let te=`Expected file to call the function: ${W.map(({fn:Z})=>Z).join(" or ")}`;c.add(te),l.push(Z=>{let{callee:be}=Z;if(be.type===re.Identifier){for(let{fn:X,withArgs:ye}of W)if(be.name===X){c.delete(te);for(let ue of ye){let ie=Z.arguments[ue.atIndex],Se=typeof ue.literal=="string"?N(ue.literal):ue.literal;if(!ie){e.report({node:Z,messageId:"default",data:{message:`Missing argument with value "${Se}" at index ${ue.atIndex}${J?`: ${N(J)}`:""}`}});continue}if(ie.type!==re.Literal){e.report({node:ie,messageId:"default",data:{message:`Argument at position ${ue.atIndex} should the literal "${Se}"${J?`: ${N(J)}`:""}`}});continue}ie.value!==Se&&e.report({node:ie,messageId:"default",data:{message:`Argument should have the value "${Se}"${J?`: ${N(J)}`:""}`},fix:Ae=>Ae.replaceText(ie,typeof Se=="string"?`'${Se}'`:String(Se))})}break}}})}for(let{selector:W,message:J}of k??[])f.set(W,N(J)),p.set(N(W),()=>{f.delete(W)});for(let{name:W,type:J,message:te}of A??[]){let Z=N(W),be=N(te);y.add(`${Z}:${J}:${be}`)}}for(let{fn:m,withArgs:S,message:k,replaceWith:A,ignoreRegex:C}of i??[])C&&new RegExp(C).test(s)||l.push(N=>{let{callee:W}=N;if(W.type!==re.Identifier||!R(W.name,m))return;if(S)for(let te of S){let Z=N.arguments[te.atIndex];if(!Z){e.report({node:N,messageId:"default",data:{message:`Missing argument with value "${te.value}" at index ${te.atIndex}: ${k}`}});return}if(Z.type!==re.Literal||Z.value!==te.value)return}let J=te=>A?te.replaceText(N,A):null;e.report({node:N,messageId:"default",data:{message:k},suggest:A?[{messageId:"default",data:{message:`Replace with "${A}"`},fix:J}]:void 0})});function b(m,S){let k=r[m];k?r[m]=A=>{k(A),S(A)}:r[m]=S}for(let{selector:m,message:S,replace:k,replaceType:A="suggestion"}of a??[]){if(m==="CallExpression"){l.push(C=>{g(k,C,S,A)});continue}r[m]=C=>{g(k,C,S,A)}}if(p.size>0)for(let[m,S]of p)b(m,S);return l.length>0&&(r.CallExpression=m=>{if(m.type===re.CallExpression)for(let S of l)S(m)}),r.ImportDeclaration=m=>{m.type===re.ImportDeclaration&&I(m)},r.ExportNamedDeclaration=m=>{m.type===re.ExportNamedDeclaration&&x(m)},r.VariableDeclarator=m=>{m.type===re.VariableDeclarator&&E(m)},r["Program:exit"]=m=>{for(let S of c)e.report({node:m,messageId:"default",data:{message:S}});for(let[,S]of f)e.report({node:m,messageId:"default",data:{message:S}});for(let S of y){let[k,A,C]=S.split(":");e.report({node:m,messageId:"default",data:{message:`Missing required export "${k}" of type ${A}: ${C}`}})}},r;function g(m,S,k,A){let C=N=>{if(!m)return null;if(typeof m=="string")return N.replaceText(S,m);{let W=new RegExp(m.regex),J=e.sourceCode.getText(S);return N.replaceText(S,J.replace(W,m.with))}};e.report({node:S,messageId:"default",data:{message:k},fix:m&&A==="autofix"?C:void 0,suggest:m&&A==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof m=="string"?m:m.with}"`},fix:C}]:void 0})}}});function ar(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...a]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:Ht(o)}),r.push({name:"$0_uncapitalize",value:Yt(o)}),r.push({name:"$0",value:o});for(let i=0;i<a.length;i++){let s=`$${i+1}`,l=a[i];r.push({name:`${s}_lowercase`,value:l.toLowerCase()}),r.push({name:`${s}_capitalize`,value:Ht(l)}),r.push({name:`${s}_uncapitalize`,value:Yt(l)}),r.push({name:s,value:l})}return r}function Ht(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Yt(e){return e.charAt(0).toLowerCase()+e.slice(1)}import{AST_NODE_TYPES as $,AST_TOKEN_TYPES as qt,ESLintUtils as lr}from"@typescript-eslint/utils";var pr=lr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Bt="collapse-simple-objs-in-one-line",cr=z({maxLineLength:_(ge()),maxProperties:_(ge()),nestedObjMaxLineLength:_(ge()),nestedObjMaxProperties:_(ge()),ignoreTypesWithSuffix:_(Q(V()))}),ur=pr({name:Bt,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:[cr]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,a=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function s(p){if(p.type===$.ObjectExpression){let c=p.parent.type===$.Property,f=c?i:o,y=p.properties.length;if(y>f)return!1;if(y===1){let I=p.properties[0];return I.type===$.Property&&I.value.type===$.ObjectExpression||I.type===$.Property&&I.value.type===$.ArrayExpression&&!I.value.elements.every(E=>E&&Ke(E))?!1:{text:r.getText(I),isNested:c,propsSize:y}}let T=[];for(let I of p.properties){if(I.type===$.Property&&!Ke(I.value))return!1;T.push(r.getText(I))}return{text:T.join(", "),isNested:c,propsSize:y}}else{let c=p.parent.parent?.type===$.TSPropertySignature,f=c?i:o,y=p.members.length;if(y>f)return!1;if(n.length>0&&p.parent.type===$.TSTypeAliasDeclaration){let I=p.parent.id.name;if(n.some(x=>I.endsWith(x)))return!1}if(y===1){let I=p.members[0];return I.type===$.TSPropertySignature&&I.typeAnnotation?.typeAnnotation.type===$.TSTypeLiteral?!1:{text:r.getText(I),isNested:c,propsSize:1}}if(p.parent.type===$.TSIntersectionType||p.parent.type===$.TSUnionType&&p.parent.types[0]!==p)return!1;let T=[];for(let I of p.members){if(I.type!==$.TSPropertySignature)return!1;let x=I.typeAnnotation?.typeAnnotation;if(!x||x.type===$.TSTypeLiteral||!Jt(x))return!1;if(x.type===$.TSTypeReference&&x.typeArguments){if(x.typeArguments.params.length>1)return!1;let u=x.typeArguments.params[0];if(!Jt(u))return!1}let E=r.getText(I).trim();(E.endsWith(";")||E.endsWith(","))&&(E=E.slice(0,-1)),T.push(E)}return{text:T.join("; "),isNested:c,propsSize:y}}}function l(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==$.JSXExpressionContainer){let x=0,E=!1,u=r.getTokenAfter(p,{filter:b=>b.type!==qt.Punctuator||E?!0:b.value===","?(x++,!1):b.value===";"?(x++,E=!0,!1):b.value===")"||b.value==="}"?(x++,!1):!0});if(x>4)return;let R=u?.type===qt.Template&&u.value.startsWith(`}
1
+ import{AST_NODE_TYPES as ee,ESLintUtils as Zn}from"@typescript-eslint/utils";var Xe=Symbol.for("optional");function _(e){return{...e,[Xe]:!0}}function Ut(e,t){return{enum:e,...t}}function Re(e){return{...e,type:"boolean"}}function V(e){return{...e,type:"string"}}function ge(e){return{...e,type:"number"}}function Q(e,t){return{...t,type:"array",items:e}}function z(e,t){let r={...t,type:"object",properties:e};if(e&&(r.additionalProperties||=!1,!r.required)){let n,o=[];for(n in e)e[n][Xe]?e[n][Xe]=void 0:o.push(n);o.length>0&&(r.required=o)}return r}var Qn=Zn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Vt="react-compiler-extra",er=z({runOnlyWithEnableCompilerDirective:_(Re())}),tr=/eslint +react-compiler\/react-compiler: +\["error/;function nr(e){return e.type===ee.Identifier?e.name.startsWith("use"):e.type===ee.MemberExpression&&e.property.type===ee.Identifier?e.property.name.startsWith("use"):!1}var rr=/\bthis[.[]/;function Wt(e){return rr.test(e)}var ir=Qn({name:Vt,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."},hasSuggestions:!0,schema:[er]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let a of e.sourceCode.getAllComments())if(tr.test(a.value)){r=!0;break}if(!r)return{}}function n(a){for(let i of a.properties)if(i.type===ee.Property&&i.method&&i.value.type===ee.FunctionExpression){let s=e.sourceCode,l=s.getText(i.key),p=i.value,c=s.getText(p.body);if(Wt(c))e.report({node:i,messageId:"thisKeywordInMethod"});else{let f=p.params.map(T=>s.getText(T)).join(", "),y="";p.generator?y=`${l}: function* (${f}) ${c}`:y=`${l}: (${f}) => ${c}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:T=>T.replaceText(i,y)})}}}function o(a){for(let i of a.properties)if(i.type===ee.Property&&i.value.type===ee.ObjectExpression){for(let s of i.value.properties)if(s.type===ee.Property&&s.method&&s.value.type===ee.FunctionExpression){let p=e.sourceCode.getText(s.value.body);Wt(p)&&e.report({node:s,messageId:"thisKeywordInMethod"})}}}return{CallExpression(a){if(nr(a.callee))for(let i of a.arguments){if(i.type===ee.ObjectExpression&&(n(i),o(i)),i.type===ee.ArrowFunctionExpression&&(i.body.type===ee.ObjectExpression&&(n(i.body),o(i.body)),i.body.type===ee.BlockStatement))for(let s of i.body.body)s.type===ee.ReturnStatement&&s.argument?.type===ee.ObjectExpression&&(n(s.argument),o(s.argument));if(i.type===ee.FunctionExpression)for(let s of i.body.body)s.type===ee.ReturnStatement&&s.argument?.type===ee.ObjectExpression&&(n(s.argument),o(s.argument))}}}}}),Ge={name:Vt,rule:ir};import{AST_NODE_TYPES as re}from"@typescript-eslint/utils";import{z as w}from"zod/v4";import{ESLintUtils as sr}from"@typescript-eslint/utils";import*as zt from"zod/v4";function B(e){let r=sr.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function Ie(e){return zt.toJSONSchema(e)}var or=w.object({disallow:w.array(w.object({selector:w.string(),message:w.string(),replace:w.optional(w.union([w.string(),w.object({regex:w.string(),with:w.string()})])),replaceType:w.optional(w.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:w.optional(w.array(w.object({fn:w.string(),withArgs:w.optional(w.array(w.object({atIndex:w.number(),value:w.union([w.string(),w.number(),w.boolean()])}))),message:w.string(),replaceWith:w.optional(w.string()),ignoreRegex:w.optional(w.string())}))),__dev_simulateFileName:w.optional(w.string()),mustMatchSyntax:w.optional(w.array(w.object({includeRegex:w.string(),mustCallFn:w.optional(w.array(w.object({anyCall:w.array(w.object({fn:w.string(),withArgs:w.array(w.object({atIndex:w.number(),literal:w.union([w.string(),w.number(),w.boolean()])}))})),message:w.optional(w.string())}))),mustMatchSelector:w.optional(w.array(w.object({selector:w.string(),message:w.string()}))),mustHaveExport:w.optional(w.array(w.object({name:w.string(),type:w.enum(["function","variable","any"]).default("any"),message:w.string()})))})))}),Ke=B({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[Ie(or)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:a,disallowFnCalls:i}=t,s=o??e.filename,l=[],p=new Map,c=new Set,f=new Map,y=new Set,T=new Map;function I(m){for(let S of m.specifiers)S.type===re.ImportSpecifier&&S.imported.type===re.Identifier&&S.imported.name!==S.local.name&&T.set(S.local.name,S.imported.name)}function x(m){if(m.declaration){if(m.declaration.type===re.FunctionDeclaration&&m.declaration.id){let S=m.declaration.id.name;for(let k of Array.from(y)){let[A,C]=k.split(":");A===S&&(C==="function"||C==="any")&&y.delete(k)}}else if(m.declaration.type===re.VariableDeclaration){for(let S of m.declaration.declarations)if(S.id.type===re.Identifier){let k=S.id.name;for(let A of Array.from(y)){let[C,N]=A.split(":");C===k&&(N==="variable"||N==="any")&&y.delete(A)}}}}for(let S of m.specifiers)if(S.exported.type===re.Identifier){let k=S.exported.name;for(let A of Array.from(y)){let[C,N]=A.split(":");C===k&&N==="any"&&y.delete(A)}}}function E(m){m.id.type===re.Identifier&&m.init?.type===re.Identifier&&T.set(m.id.name,m.init.name)}function u(m){return T.get(m)??m}function R(m,S){return u(m)===S||m===S}for(let{includeRegex:m,mustCallFn:S,mustMatchSelector:k,mustHaveExport:A}of n??[]){let C=ar(s,new RegExp(m));if(!C)continue;let N=W=>{let J=W;for(let{name:te,value:Z}of C)J=J.replaceAll(te,Z);return J};for(let{anyCall:W,message:J}of S??[]){let te=`Expected file to call the function: ${W.map(({fn:Z})=>Z).join(" or ")}`;c.add(te),l.push(Z=>{let{callee:be}=Z;if(be.type===re.Identifier){for(let{fn:X,withArgs:ye}of W)if(be.name===X){c.delete(te);for(let ue of ye){let ie=Z.arguments[ue.atIndex],Se=typeof ue.literal=="string"?N(ue.literal):ue.literal;if(!ie){e.report({node:Z,messageId:"default",data:{message:`Missing argument with value "${Se}" at index ${ue.atIndex}${J?`: ${N(J)}`:""}`}});continue}if(ie.type!==re.Literal){e.report({node:ie,messageId:"default",data:{message:`Argument at position ${ue.atIndex} should the literal "${Se}"${J?`: ${N(J)}`:""}`}});continue}ie.value!==Se&&e.report({node:ie,messageId:"default",data:{message:`Argument should have the value "${Se}"${J?`: ${N(J)}`:""}`},fix:Ae=>Ae.replaceText(ie,typeof Se=="string"?`'${Se}'`:String(Se))})}break}}})}for(let{selector:W,message:J}of k??[])f.set(W,N(J)),p.set(N(W),()=>{f.delete(W)});for(let{name:W,type:J,message:te}of A??[]){let Z=N(W),be=N(te);y.add(`${Z}:${J}:${be}`)}}for(let{fn:m,withArgs:S,message:k,replaceWith:A,ignoreRegex:C}of i??[])C&&new RegExp(C).test(s)||l.push(N=>{let{callee:W}=N;if(W.type!==re.Identifier||!R(W.name,m))return;if(S)for(let te of S){let Z=N.arguments[te.atIndex];if(!Z){e.report({node:N,messageId:"default",data:{message:`Missing argument with value "${te.value}" at index ${te.atIndex}: ${k}`}});return}if(Z.type!==re.Literal||Z.value!==te.value)return}let J=te=>A?te.replaceText(N,A):null;e.report({node:N,messageId:"default",data:{message:k},suggest:A?[{messageId:"default",data:{message:`Replace with "${A}"`},fix:J}]:void 0})});function b(m,S){let k=r[m];k?r[m]=A=>{k(A),S(A)}:r[m]=S}for(let{selector:m,message:S,replace:k,replaceType:A="suggestion"}of a??[]){if(m==="CallExpression"){l.push(C=>{g(k,C,S,A)});continue}r[m]=C=>{g(k,C,S,A)}}if(p.size>0)for(let[m,S]of p)b(m,S);return l.length>0&&(r.CallExpression=m=>{if(m.type===re.CallExpression)for(let S of l)S(m)}),r.ImportDeclaration=m=>{m.type===re.ImportDeclaration&&I(m)},r.ExportNamedDeclaration=m=>{m.type===re.ExportNamedDeclaration&&x(m)},r.VariableDeclarator=m=>{m.type===re.VariableDeclarator&&E(m)},r["Program:exit"]=m=>{for(let S of c)e.report({node:m,messageId:"default",data:{message:S}});for(let[,S]of f)e.report({node:m,messageId:"default",data:{message:S}});for(let S of y){let[k,A,C]=S.split(":");e.report({node:m,messageId:"default",data:{message:`Missing required export "${k}" of type ${A}: ${C}`}})}},r;function g(m,S,k,A){let C=N=>{if(!m)return null;if(typeof m=="string")return N.replaceText(S,m);{let W=new RegExp(m.regex),J=e.sourceCode.getText(S);return N.replaceText(S,J.replace(W,m.with))}};e.report({node:S,messageId:"default",data:{message:k},fix:m&&A==="autofix"?C:void 0,suggest:m&&A==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof m=="string"?m:m.with}"`},fix:C}]:void 0})}}});function ar(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...a]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:Ht(o)}),r.push({name:"$0_uncapitalize",value:Yt(o)}),r.push({name:"$0",value:o});for(let i=0;i<a.length;i++){let s=`$${i+1}`,l=a[i];r.push({name:`${s}_lowercase`,value:l.toLowerCase()}),r.push({name:`${s}_capitalize`,value:Ht(l)}),r.push({name:`${s}_uncapitalize`,value:Yt(l)}),r.push({name:s,value:l})}return r}function Ht(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Yt(e){return e.charAt(0).toLowerCase()+e.slice(1)}import{AST_NODE_TYPES as $,AST_TOKEN_TYPES as qt,ESLintUtils as lr}from"@typescript-eslint/utils";var pr=lr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Bt="collapse-simple-objs-in-one-line",cr=z({maxLineLength:_(ge()),maxProperties:_(ge()),nestedObjMaxLineLength:_(ge()),nestedObjMaxProperties:_(ge()),ignoreTypesWithSuffix:_(Q(V()))}),ur=pr({name:Bt,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:[cr]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,a=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function s(p){if(p.type===$.ObjectExpression){let c=p.parent.type===$.Property,f=c?i:o,y=p.properties.length;if(y>f)return!1;if(y===1){let I=p.properties[0];return I.type===$.Property&&I.value.type===$.ObjectExpression||I.type===$.Property&&I.value.type===$.ArrayExpression&&!I.value.elements.every(E=>E&&Ze(E))?!1:{text:r.getText(I),isNested:c,propsSize:y}}let T=[];for(let I of p.properties){if(I.type===$.Property&&!Ze(I.value))return!1;T.push(r.getText(I))}return{text:T.join(", "),isNested:c,propsSize:y}}else{let c=p.parent.parent?.type===$.TSPropertySignature,f=c?i:o,y=p.members.length;if(y>f)return!1;if(n.length>0&&p.parent.type===$.TSTypeAliasDeclaration){let I=p.parent.id.name;if(n.some(x=>I.endsWith(x)))return!1}if(y===1){let I=p.members[0];return I.type===$.TSPropertySignature&&I.typeAnnotation?.typeAnnotation.type===$.TSTypeLiteral?!1:{text:r.getText(I),isNested:c,propsSize:1}}if(p.parent.type===$.TSIntersectionType||p.parent.type===$.TSUnionType&&p.parent.types[0]!==p)return!1;let T=[];for(let I of p.members){if(I.type!==$.TSPropertySignature)return!1;let x=I.typeAnnotation?.typeAnnotation;if(!x||x.type===$.TSTypeLiteral||!Jt(x))return!1;if(x.type===$.TSTypeReference&&x.typeArguments){if(x.typeArguments.params.length>1)return!1;let u=x.typeArguments.params[0];if(!Jt(u))return!1}let E=r.getText(I).trim();(E.endsWith(";")||E.endsWith(","))&&(E=E.slice(0,-1)),T.push(E)}return{text:T.join("; "),isNested:c,propsSize:y}}}function l(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==$.JSXExpressionContainer){let x=0,E=!1,u=r.getTokenAfter(p,{filter:b=>b.type!==qt.Punctuator||E?!0:b.value===","?(x++,!1):b.value===";"?(x++,E=!0,!1):b.value===")"||b.value==="}"?(x++,!1):!0});if(x>4)return;let R=u?.type===qt.Template&&u.value.startsWith(`}
2
2
  `);if(u?.loc.start.line===p.loc.end.line&&!R)return}let c=s(p);if(!c)return;let f=c.text;if(f.includes(`
3
- `)||r.getCommentsInside(p).length>0)return;f.endsWith(";")&&(f=f.slice(0,-1));let y=`{ ${f} }`,T=mr(r,p),I=c.isNested&&c.propsSize>2?a:t.maxLineLength;I&&y.length+T.length+fr(p,r)>I||e.report({node:p,messageId:"singleLineProp",fix:x=>x.replaceText(p,y)})}return{TSTypeLiteral:l,ObjectExpression:l}}});function Jt(e){return e.type===$.TSLiteralType||e.type===$.TSTypeReference||e.type===$.TSNumberKeyword||e.type===$.TSStringKeyword||e.type===$.TSBooleanKeyword||e.type===$.TSNullKeyword||e.type===$.TSUndefinedKeyword}function Ke(e,t){return!!(e.type===$.Literal||e.type===$.Identifier||e.type===$.TemplateLiteral||e.type===$.TaggedTemplateExpression||!t&&e.type===$.ArrayExpression&&e.elements.every(r=>r&&Ke(r,!0)))}function fr(e,t){let r=t.getLastToken(e);if(!r)return 0;let n=t.text.indexOf(`
4
- `,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function mr(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var Ze={name:Bt,rule:ur};var dr=/eslint +react-compiler\/react-compiler: +\["error/,Gt={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"}}}]},create(e){let t=!1,r=typeof e.getSource=="function"?u=>r(u):u=>e.sourceCode.getText(u),n=typeof e.getScope=="function"?()=>n():u=>e.sourceCode.getScope(u),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,a=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:a};function s(u){a&&Array.isArray(u.suggest)&&u.suggest.length>0&&(u.fix=u.suggest[0].fix),e.report(u)}let l=e.getSourceCode().scopeManager,p=new WeakMap,c=new WeakSet,f=new WeakMap,y=new WeakMap,T=new WeakSet;function I(u,R){return function(b){if(R.has(b))return R.get(b);let g=u(b);return R.set(b,g),g}}function x(u,R,b,g,m){m&&u.async&&s({node:u,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
3
+ `)||r.getCommentsInside(p).length>0)return;f.endsWith(";")&&(f=f.slice(0,-1));let y=`{ ${f} }`,T=mr(r,p),I=c.isNested&&c.propsSize>2?a:t.maxLineLength;I&&y.length+T.length+fr(p,r)>I||e.report({node:p,messageId:"singleLineProp",fix:x=>x.replaceText(p,y)})}return{TSTypeLiteral:l,ObjectExpression:l}}});function Jt(e){return e.type===$.TSLiteralType||e.type===$.TSTypeReference||e.type===$.TSNumberKeyword||e.type===$.TSStringKeyword||e.type===$.TSBooleanKeyword||e.type===$.TSNullKeyword||e.type===$.TSUndefinedKeyword}function Ze(e,t){return!!(e.type===$.Literal||e.type===$.Identifier||e.type===$.TemplateLiteral||e.type===$.TaggedTemplateExpression||!t&&e.type===$.ArrayExpression&&e.elements.every(r=>r&&Ze(r,!0)))}function fr(e,t){let r=t.getLastToken(e);if(!r)return 0;let n=t.text.indexOf(`
4
+ `,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function mr(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var Qe={name:Bt,rule:ur};var dr=/eslint +react-compiler\/react-compiler: +\["error/,Gt={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"}}}]},create(e){let t=!1,r=typeof e.getSource=="function"?u=>r(u):u=>e.sourceCode.getText(u),n=typeof e.getScope=="function"?()=>n():u=>e.sourceCode.getScope(u),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,a=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:a};function s(u){a&&Array.isArray(u.suggest)&&u.suggest.length>0&&(u.fix=u.suggest[0].fix),e.report(u)}let l=e.getSourceCode().scopeManager,p=new WeakMap,c=new WeakSet,f=new WeakMap,y=new WeakMap,T=new WeakSet;function I(u,R){return function(b){if(R.has(b))return R.get(b);let g=u(b);return R.set(b,g),g}}function x(u,R,b,g,m){m&&u.async&&s({node:u,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
5
5
 
6
6
  useEffect(() => {
7
7
  async function fetchData() {
@@ -12,10 +12,10 @@ useEffect(() => {
12
12
  fetchData();
13
13
  }, [someId]); // Or [] if effect doesn't need props or state
14
14
 
15
- Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let S=l.acquire(u),k=new Set,A=null;{let d=S.upper;for(;d&&(k.add(d),d.type!=="function");)d=d.upper;if(!d)return;A=d}let C=Array.isArray;function N(d){if(!C(d.defs))return!1;let h=d.defs[0];if(h==null||h.node.type!=="VariableDeclarator")return!1;let v=h.node.init;if(v==null)return!1;for(;v.type==="TSAsExpression";)v=v.expression;let O=h.node.parent;if(O==null&&(tt(A.block,h.node.id),O=h.node.parent,O==null))return!1;if(O.kind==="const"&&v.type==="Literal"&&(typeof v.value=="string"||typeof v.value=="number"||v.value===null))return!0;if(v.type!=="CallExpression")return!1;let F=v.callee;if(F.type==="MemberExpression"&&F.object.name==="React"&&F.property!=null&&!F.computed&&(F=F.property),F.type!=="Identifier")return!1;let P=h.node.id,{name:j}=F;if(j==="useRef"&&P.type==="Identifier")return!0;if(hr(F)&&P.type==="Identifier"){for(let D of d.references)D!==P&&T.add(D.identifier);return!0}else if(j==="useState"||j==="useReducer"){if(P.type==="ArrayPattern"&&P.elements.length===2&&C(d.identifiers)){if(P.elements[1]===d.identifiers[0]){if(j==="useState"){let D=d.references,le=0;for(let Te=0;Te<D.length;Te++){if(D[Te].isWrite()&&le++,le>1)return!1;p.set(D[Te].identifier,P.elements[0])}}return!0}else if(P.elements[0]===d.identifiers[0]){if(j==="useState"){let D=d.references;for(let le=0;le<D.length;le++)c.add(D[le].identifier)}return!1}}}else if(j==="useTransition"&&P.type==="ArrayPattern"&&P.elements.length===2&&Array.isArray(d.identifiers)&&P.elements[1]===d.identifiers[0])return!0;return!1}function W(d){if(!C(d.defs))return!1;let h=d.defs[0];if(h==null||h.node==null||h.node.id==null)return!1;let v=h.node,O=A.childScopes,F=null,P;for(P=0;P<O.length;P++){let j=O[P],D=j.block;if(v.type==="FunctionDeclaration"&&D===v||v.type==="VariableDeclarator"&&D.parent===v){F=j;break}}if(F==null)return!1;for(P=0;P<F.through.length;P++){let j=F.through[P];if(j.resolved!=null&&k.has(j.resolved.scope)&&!J(j.resolved))return!1}return!0}let J=I(N,f),te=I(W,y),Z=new Map;function be(d){let h=d.from,v=!1;for(;h.block!==u;)h.type==="function"&&(v=h.block.parent!=null&&h.block.parent.type==="ReturnStatement"),h=h.upper;return v}let X=new Map,ye=new Map;ue(S);function ue(d){for(let h of d.references){if(!h.resolved||!k.has(h.resolved.scope))continue;let v=tt(u,h.identifier),O=Kt(v),F=he(O,ye);if(m&&O.type==="Identifier"&&(O.parent.type==="MemberExpression"||O.parent.type==="OptionalMemberExpression")&&!O.parent.computed&&O.parent.property.type==="Identifier"&&O.parent.property.name==="current"&&be(h)&&Z.set(F,{reference:h,dependencyNode:O}),O.parent.type==="TSTypeQuery"||O.parent.type==="TSTypeReference")continue;let P=h.resolved.defs[0];if(P!=null&&!(P.node!=null&&P.node.init===u.parent)&&P.type!=="TypeParameter")if(X.has(F))X.get(F).references.push(h);else{let j=h.resolved,D=J(j)||te(j);X.set(F,{isStable:D,references:[h]})}}for(let h of d.childScopes)ue(h)}Z.forEach(({reference:d,dependencyNode:h},v)=>{let O=d.resolved.references,F=!1;for(let P=0;P<O.length;P++){let{identifier:j}=O[P],{parent:D}=j;if(D!=null&&D.type==="MemberExpression"&&!D.computed&&D.property.type==="Identifier"&&D.property.name==="current"&&D.parent.type==="AssignmentExpression"&&D.parent.left===D){F=!0;break}}F||s({node:h.parent.property,message:`The ref value '${v}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${v}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ie=new Set;function Se(d,h){ie.has(h)||(ie.add(h),s({node:d,message:`Assignments to the '${h}' variable from inside React Hook ${r(b)} will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ${r(b)}.`}))}let Ae=new Set;if(X.forEach(({isStable:d,references:h},v)=>{d&&Ae.add(v),h.forEach(O=>{O.writeExpr&&Se(O.writeExpr,v)})}),ie.size>0)return;if(!R){let d=null;if(X.forEach(({isStable:h,references:v},O)=>{d||v.forEach(F=>{if(d)return;let P=F.identifier;if(!p.has(P))return;let D=F.from;for(;D.type!=="function";)D=D.upper;D.block===u&&(d=O)})}),d){let{suggestedDependencies:h}=Qe({dependencies:X,declaredDependencies:[],stableDependencies:Ae,externalDependencies:new Set,isEffect:!0});s({node:b,message:`React Hook ${g} contains a call to '${d}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+h.join(", ")+`] as a second argument to the ${g} Hook.`,suggest:[{desc:`Add dependencies array: [${h.join(", ")}]`,fix(v){return v.insertTextAfter(u,`, [${h.join(", ")}]`)}}]})}return}let Pe=[],Fe=new Set;R.type!=="ArrayExpression"?s({node:R,message:`React Hook ${r(b)} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.`}):R.elements.forEach(d=>{if(d===null)return;if(d.type==="SpreadElement"){s({node:d,message:`React Hook ${r(b)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}T.has(d)&&s({node:d,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(d)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(d)}\``,fix(F){return F.removeRange(d.range)}}]});let h;try{h=he(d,ye)}catch(F){if(/Unsupported node type/.test(F.message)){d.type==="Literal"?X.has(d.value)?s({node:d,message:`The ${d.raw} literal is not a valid dependency because it never changes. Did you mean to include ${d.value} in the array instead?`}):s({node:d,message:`The ${d.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:d,message:`React Hook ${r(b)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw F}let v=d;for(;v.type==="MemberExpression"||v.type==="OptionalMemberExpression"||v.type==="ChainExpression";)v=v.object||v.expression.object;let O=!A.through.some(F=>F.identifier===v);Pe.push({key:h,node:d}),O||Fe.add(h)});let{suggestedDependencies:Bn,unnecessaryDependencies:Me,missingDependencies:xe,duplicateDependencies:Lt}=Qe({dependencies:X,declaredDependencies:Pe,stableDependencies:Ae,externalDependencies:Fe,isEffect:m}),De=Bn;if(Lt.size+xe.size+Me.size===0){if(t)return;yr({declaredDependencies:Pe,declaredDependenciesNode:R,componentScope:A,scope:S}).forEach(({construction:h,isUsedOutsideOfHook:v,depType:O})=>{let F=O==="function"?"useCallback":"useMemo",P=O==="function"?"definition":"initialization",j=`wrap the ${P} of '${h.name.name}' in its own ${F}() Hook.`,D=v?`To fix this, ${j}`:`Move it inside the ${g} callback. Alternatively, ${j}`,le=O==="conditional"||O==="logical expression"?"could make":"makes",Te=`The '${h.name.name}' ${O} ${le} the dependencies of ${g} Hook (at line ${R.loc.start.line}) change on every render. ${D}`,_t;v&&h.type==="Variable"&&O==="function"&&(_t=[{desc:`Wrap the ${P} of '${h.name.name}' in its own ${F}() Hook.`,fix($t){let[Gn,Kn]=F==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[$t.insertTextBefore(h.node.init,Gn),$t.insertTextAfter(h.node.init,Kn)]}}]),s({node:h.node,message:Te,suggest:_t})});return}!m&&xe.size>0&&(De=Qe({dependencies:X,declaredDependencies:[],stableDependencies:Ae,externalDependencies:Fe,isEffect:m}).suggestedDependencies);function Xn(){if(Pe.length===0)return!0;let d=Pe.map(v=>v.key),h=d.slice().sort();return d.join(",")===h.join(",")}Xn()&&De.sort();function qe(d){let h=d.split("."),v="";for(let O=0;O<h.length;O++){if(O!==0){let F=h.slice(0,O+1).join("."),P=ye.get(F)===!0;v+=P?"?.":"."}v+=h[O]}return v}function Je(d,h,v,O){return d.size===0?null:(d.size>1?"":h+" ")+v+" "+(d.size>1?"dependencies":"dependency")+": "+Sr(Array.from(d).sort().map(F=>"'"+qe(F)+"'"))+`. Either ${O} ${d.size>1?"them":"it"} or remove the dependency array.`}let fe="";if(Me.size>0){let d=null;if(Array.from(Me.keys()).forEach(h=>{d===null&&h.endsWith(".current")&&(d=h)}),d!==null)fe=` Mutable values like '${d}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Fe.size>0){let h=Array.from(Fe)[0];S.set.has(h)||(fe=` Outer scope values like '${h}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!fe&&xe.has("props")){let d=X.get("props");if(d==null)return;let h=d.references;if(!Array.isArray(h))return;let v=!0;for(let O=0;O<h.length;O++){let F=h[O],P=tt(A.block,F.identifier);if(!P){v=!1;break}let j=P.parent;if(j==null){v=!1;break}if(j.type!=="MemberExpression"&&j.type!=="OptionalMemberExpression"){v=!1;break}}v&&(fe=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${g} call and refer to those specific props inside ${r(b)}.`)}if(!fe&&xe.size>0){let d=null;xe.forEach(h=>{if(d)return;let v=A.set.get(h),O=X.get(h);if(O.references[0].resolved!==v)return;let F=v.defs[0];if(F==null||F.name==null||F.type!=="Parameter")return;let P=!1,j;for(let D=0;D<O.references.length;D++)if(j=O.references[D].identifier,j!=null&&j.parent!=null&&(j.parent.type==="CallExpression"||j.parent.type==="OptionalCallExpression")&&j.parent.callee===j){P=!0;break}P&&(d=h)}),d!==null&&(fe=` If '${d}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!fe&&xe.size>0){let d=null;if(xe.forEach(h=>{if(d!==null)return;let O=X.get(h).references,F,P;for(let j=0;j<O.length;j++){for(F=O[j].identifier,P=F.parent;P!=null&&P!==A.block;){if(P.type==="CallExpression"){let D=p.get(P.callee);if(D!=null){if(D.name===h)d={missingDep:h,setter:P.callee.name,form:"updater"};else if(c.has(F))d={missingDep:h,setter:P.callee.name,form:"reducer"};else{let le=O[j].resolved;if(le!=null){let Te=le.defs[0];Te!=null&&Te.type==="Parameter"&&(d={missingDep:h,setter:P.callee.name,form:"inlineReducer"})}}break}}P=P.parent}if(d!==null)break}}),d!==null)switch(d.form){case"reducer":fe=` You can also replace multiple useState variables with useReducer if '${d.setter}' needs the current value of '${d.missingDep}'.`;break;case"inlineReducer":fe=` If '${d.setter}' needs the current value of '${d.missingDep}', you can also switch to useReducer instead of useState and read '${d.missingDep}' in the reducer.`;break;case"updater":fe=` You can also do a functional update '${d.setter}(${d.missingDep.slice(0,1)} => ...)' if you only need '${d.missingDep}' in the '${d.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:R,message:`React Hook ${r(b)} has `+(Je(xe,"a","missing","include")||Je(Me,"an","unnecessary","exclude")||Je(Lt,"a","duplicate","omit"))+fe,suggest:[{desc:`Update the dependencies array to be: [${De.map(qe).join(", ")}]`,fix(d){return d.replaceText(R,`[${De.map(qe).join(", ")}]`)}}]})}function E(u){let R=gr(u.callee,i);if(R===-1)return;let b=u.arguments[R],g=u.callee,m=Zt(g).name,S=u.arguments[R+1],k=/Effect($|[^a-z])/g.test(m);if(!b){s({node:g,message:`React Hook ${m} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!k)){if(!S&&!k){(m==="useMemo"||m==="useCallback")&&s({node:g,message:`React Hook ${m} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(b.type){case"FunctionExpression":case"ArrowFunctionExpression":x(b,S,g,m,k);return;case"Identifier":if(!S||S.elements&&S.elements.some(N=>N&&N.type==="Identifier"&&N.name===b.name))return;let A=n(u).set.get(b.name);if(A==null||A.defs==null)return;let C=A.defs[0];if(!C||!C.node||C.type!=="Variable"&&C.type!=="FunctionName")break;switch(C.node.type){case"FunctionDeclaration":x(C.node,S,g,m,k);return;case"VariableDeclarator":let N=C.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":x(N,S,g,m,k);return}break}break;default:s({node:g,message:`React Hook ${m} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:g,message:`React Hook ${m} has a missing dependency: '${b.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${b.name}]`,fix(A){return A.replaceText(S,`[${b.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let u of e.sourceCode.getAllComments())if(dr.test(u.value))return t=!0,{CallExpression:R=>E(R,!0)}}return{CallExpression:u=>E(u)}}};function Qe({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:o}){let a=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((x,E)=>{let u=s(a,E);u.isUsed=!0,l(a,E,R=>{R.isSubtreeUsed=!0})}),t.forEach(({key:x})=>{let E=s(a,x);E.isSatisfiedRecursively=!0}),r.forEach(x=>{let E=s(a,x);E.isSatisfiedRecursively=!0});function s(x,E){let u=E.split("."),R=x;for(let b of u){let g=R.children.get(b);g||(g=i(),R.children.set(b,g)),R=g}return R}function l(x,E,u){let R=E.split("."),b=x;for(let g of R){let m=b.children.get(g);if(!m)return;u(m),b=m}}let p=new Set,c=new Set;f(a,p,c,x=>x);function f(x,E,u,R){x.children.forEach((b,g)=>{let m=R(g);if(b.isSatisfiedRecursively){b.isSubtreeUsed&&u.add(m);return}if(b.isUsed){E.add(m);return}f(b,E,u,S=>m+"."+S)})}let y=[],T=new Set,I=new Set;return t.forEach(({key:x})=>{c.has(x)?y.indexOf(x)===-1?y.push(x):I.add(x):T.add(x)}),p.forEach(x=>{y.push(x)}),{suggestedDependencies:y,unnecessaryDependencies:T,duplicateDependencies:I,missingDependencies:p}}function Ce(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 Ce(e.consequent)!=null||Ce(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Ce(e.left)!=null||Ce(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Ce(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Ce(e.expression);case"TSAsExpression":return Ce(e.expression)}return null}function yr({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let o=e.map(({key:i})=>{let s=r.variables.find(p=>p.name===i);if(s==null)return null;let l=s.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let p=Ce(l.node.init);if(p!=null)return[s,p]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[s,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[s,"class"]:null}).filter(Boolean);function a(i){let s=!1;for(let l=0;l<i.references.length;l++){let p=i.references[l];if(p.writeExpr){if(s)return!0;s=!0;continue}let c=p.from;for(;c!==n&&c!=null;)c=c.upper;if(c!==n&&!Qt(t,p.identifier))return!0}return!1}return o.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:a(i)}))}function Kt(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)?Kt(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function et(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function he(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=he(e.object,t),n=he(e.property,null),o=`${r}.${n}`;return et(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=he(e.object,t),n=he(e.property,null),o=`${r}.${n}`;return et(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=he(r.object,t),o=he(r.property,null),a=`${n}.${o}`;return et(r,t,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function Zt(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function gr(e,t){let r=Zt(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=he(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 tt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),Tr(n,t))return n;if(Qt(n,t))for(let[o,a]of Object.entries(n))o!=="parent"&&(Xt(a)?(a.parent=n,r.push(a)):Array.isArray(a)&&a.forEach(i=>{Xt(i)&&(i.parent=n,r.push(i))}))}return null}function Sr(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 Xt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Tr(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 Qt(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function hr(e){return!1}import{AST_NODE_TYPES as _e,ESLintUtils as tn}from"@typescript-eslint/utils";import se from"typescript";var Er=tn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),en="improved-no-unnecessary-condition",br=z({}),xr=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Ir=new Set(xr),nt={name:en,rule:Er({name:en,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".'},schema:[br]},defaultOptions:[{}],create(e){let t=tn.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(s){return s.type===_e.UnaryExpression&&s.operator==="typeof"}function o(s){return s.flags&se.TypeFlags.Any||s.flags&se.TypeFlags.Unknown?null:s.flags&se.TypeFlags.StringLike?["string"]:s.flags&se.TypeFlags.NumberLike?["number"]:s.flags&se.TypeFlags.BigIntLike?["bigint"]:s.flags&se.TypeFlags.BooleanLike?["boolean"]:s.flags&se.TypeFlags.ESSymbolLike?["symbol"]:s.flags&se.TypeFlags.Undefined||s.flags&se.TypeFlags.Void?["undefined"]:s.flags&se.TypeFlags.Null?["object"]:s.getCallSignatures().length>0?["function"]:s.flags&se.TypeFlags.Object?s.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:s.flags&se.TypeFlags.NonPrimitive?["object"]:s.flags&se.TypeFlags.Never?["never"]:null}function a(s){if(!r)return null;let l=t.esTreeNodeToTSNodeMap.get(s),p=r.getTypeAtLocation(l.expression);if(p.flags&se.TypeFlags.Any||p.flags&se.TypeFlags.Unknown)return null;let c=[];if(p.isUnion()){for(let y of p.types){let T=o(y);if(T)c.push(...T);else return null}return c}let f=o(p);return f?(c.push(...f),c):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,c=null;if(n(s.left)?(p=s.left,c=s.right.type===_e.Literal&&typeof s.right.value=="string"?s.right.value:null):n(s.right)&&(p=s.right,c=s.left.type===_e.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!c||!Cr(c,Ir))return;let f=a(p);if(!f)return;let y=s.operator==="!==",T=f.includes(c);f.length===1?T&&!y?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:c}}):!T&&y?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:Array.from(f)[0]}}):!T&&!y?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:Le(f),conditionType:c}}):T&&y&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:Le(f),conditionType:c}}):!T&&!y?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:Le(f),conditionType:c}}):!T&&y&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:Le(f)}})}return{BinaryExpression:i}}})};function Le(e){return Array.from(new Set(e)).join(" | ")||"never"}function ve(e,t){let r=e.argument;return r.type===_e.Identifier?r.name:t.sourceCode.getText(r)}function Cr(e,t){return t.has(e)}import{AST_NODE_TYPES as wr,ESLintUtils as Ar}from"@typescript-eslint/utils";var Rr=Ar.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nn="no-call-with-explicit-generics",vr=z({functions:Q(V())}),kr=Rr({name:nn,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[vr]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:o}=n;o.type===wr.Identifier&&r.has(o.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),rt={name:nn,rule:kr};import{AST_NODE_TYPES as $e,ESLintUtils as Or}from"@typescript-eslint/utils";var Pr=Or.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),rn="no-call-with-inferred-generics",Fr=Pr({name:rn,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:o}=n;if(o.type!==$e.Identifier)return;let a=r.get(o.name);if(!a)return;let{minGenerics:i=1,allowAny:s,disallowTypes:l=t.disallowTypes}=a;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(s&&!l)&&n.typeArguments?.params?.some(c=>!s&&c.type===$e.TSAnyKeyword||l&&c.type===$e.TSTypeReference&&c.typeName.type===$e.Identifier&&l.includes(c.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),it={name:rn,rule:Fr};import{ESLintUtils as Nr}from"@typescript-eslint/utils";var jr=Nr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),on="no-commented-out-code",Mr=["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:"],G={returnStatement:/^\s*return\s+/,stringAssignment:/\w=("|'|`)/,objectPropertyWithQuotes:/\w+:\s*('|"|`)/,computedPropertyAssignment:/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,kebabCaseProperty:/\w+-\w+:/,snakeCaseProperty:/\w+_\w+:/,ternaryOperator:/\?\s+\w/,colonWithWord:/:\s+\w/,quotedString:/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,numberWithComma:/^\s*\d+[,}]/,arrayWithComma:/^\s*\[[^\]]*\][,}]/,objectWithComma:/^\s*\{[^}]*\}[,}]/,methodCall:/\.\w+\(/,arrayAccess:/\[\w+\]/,quotedPropertyKey:/^\s*(['"`]).+?\1\s*:/,jsxSelfClosing:/^<[A-Z]\w*(\s|>|\/)/,jsxElement:/^<[a-z]+(\s|>|\/)/,jsxOpeningTag:/<[A-Z]\w*(\s.*)?>/,jsxClosingTag:/<\/[A-Z]\w*>/,htmlOpeningTag:/<[a-z]+(\s.*)?>/,htmlClosingTag:/<\/[a-z]+>/,jsdocComment:/^\s*[*\s]*$/};function Dr(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&/^[a-zA-Z]/.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||/\.[A-Za-z_][A-Za-z0-9_]*\(/.test(t)||/[{}[\]()`=<>]/.test(t)||/:\s*(['"`[{(]|\w+\s*=>)/.test(t)||/\bif\s*\(|\belse\b|=>/.test(t)?!1:!!(t.includes(":")&&/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/.test(t))}var Lr=[") {","return;",G.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",G.stringAssignment,");",G.objectPropertyWithQuotes,G.computedPropertyAssignment,G.kebabCaseProperty,G.snakeCaseProperty,"&&","||","()",G.ternaryOperator,G.colonWithWord,G.quotedString,G.numberWithComma,G.arrayWithComma,G.objectWithComma,G.methodCall,G.arrayAccess,"?.(","??","=>",G.quotedPropertyKey],_r=["/>","</",G.jsxSelfClosing,G.jsxElement,G.jsxOpeningTag,G.jsxClosingTag,G.htmlOpeningTag,G.htmlClosingTag],sn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],$r=jr({name:on,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(n,o){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||G.jsdocComment.test(n))return!1;for(let i of sn)if(a.startsWith(i))return!1;if(n.includes("https://")||Dr(a))return!1;if(o==="Block"){for(let i of _r)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 Mr)if(a.startsWith(i))return{wrongPattern:i};for(let i of Lr)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,o){let a=n,i=a.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let p=a.split(/```[\s\S]*?```/g);p.some(f=>/[a-zA-Z0-9]/.test(f))&&(a=p.join(""))}if(!a.includes("`"))return a;let s=a.split(/`[^`]*`/g);return s.some(p=>/[a-zA-Z0-9]/.test(p))?s.join(""):a}return{Program(){let o=e.sourceCode.getAllComments();for(let a of o){let i=r(a.value,a.type),s=t(i,a.type);s&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:sn.join(", ")}})}}}}}),st={name:on,rule:$r};import{ESLintUtils as Ur,TSESTree as Wr}from"@typescript-eslint/utils";var Vr=Ur.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),an="no-default-export",zr=Vr({name:an,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===Wr.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),ot={name:an,rule:zr};import{ESLintUtils as Hr}from"@typescript-eslint/utils";var Yr=Hr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ln="no-leaked-text-in-jsx",qr=[",",";","[","]","(",")"],Jr=Yr({name:ln,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="";qr.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),at={name:ln,rule:Jr};import{AST_NODE_TYPES as Ne,ESLintUtils as Br}from"@typescript-eslint/utils";var Xr=Br.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cn="no-non-camel-case-functions",Gr=/^(\$?[a-z][a-zA-Z0-9]*)$/;function pn(e){if(e.typeName.type!==Ne.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Ne.Identifier&&t.name==="JSX"&&r.name==="Element"}var Kr=Xr({name:cn,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&&!Gr.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Ne.TSTypeReference?pn(r):r.type===Ne.TSUnionType&&r.types.some(o=>o.type===Ne.TSTypeReference&&pn(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),lt={name:cn,rule:Kr};import{ESLintUtils as Zr,TSESTree as H}from"@typescript-eslint/utils";import{AST_NODE_TYPES as un}from"@typescript-eslint/utils";function ke(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:ke(e.parent,t,r===1/0?r:r-1)}function*pt(e){yield e,e.parent&&(yield*pt(e.parent))}function ct(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function fn(e,t,r){let o=r.getDeclaredVariables(e).find(a=>a.name===t||a.identifiers[0]?.parent.type===un.Property&&a.identifiers[0]?.parent.key.type===un.Identifier&&a.identifiers[0]?.parent.key.name===t);return o?o.references.filter(a=>!a.init):[]}var Qr=Zr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mn="no-optional-root-props",ei=Qr({name:mn,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function t(n){let a=e.sourceCode.getDeclaredVariables(n)[0];if(!a||a.references.length!==1)return!1;let i=a.references[0];if(!i)return!1;for(let s of pt(i.identifier)){if("returnType"in s||s.type===H.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=s.parent;if(!l)return!1;if(l.type===H.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===H.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===H.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let c=ke(l.parent.parent,H.AST_NODE_TYPES.VariableDeclaration,4);if(!c)return!1;let f=Ue(c,e.sourceCode);return f?!(f.parent.type===H.AST_NODE_TYPES.CallExpression&&f.parent.callee.type===H.AST_NODE_TYPES.Identifier&&f.parent.callee.name==="memo"):!1}if(s.type===H.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===H.AST_NODE_TYPES.ArrowFunctionExpression){let p=ke(l,H.AST_NODE_TYPES.VariableDeclaration);return p?!!Ue(p,e.sourceCode):!1}if(l.type===H.AST_NODE_TYPES.FunctionDeclaration)return!!Ue(l,e.sourceCode)}return!1}function r(n){n.key.type!==H.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:o=>{let a=ke(n,H.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let i=e.sourceCode.getText(a);return o.replaceText(a,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===H.AST_NODE_TYPES.TSTypeLiteral&&!(We(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===H.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(We(n)||!t(n)))for(let o of n.body.body)o.type===H.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(n){if(n.typeName.type!==H.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==H.AST_NODE_TYPES.TSTypeLiteral)return;let a=ke(n.parent,H.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let i=Ue(a,e.sourceCode);if(!(!i||i.parent.type===H.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===H.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of o.members)l.type===H.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function We(e){return e?e.parent?.type===H.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===H.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Ue(e,t){if(We(e))return;let r;if(e.type===H.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===H.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===H.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let o=n.variables.find(i=>i.identifiers.includes(r));if(!o)return;let a=o.references.filter(i=>i.identifier!==r);if(!(a.length!==1||!a[0])&&!We(a[0].identifier.parent.parent))return a[0].identifier}var ut={name:mn,rule:ei};import{ESLintUtils as ti}from"@typescript-eslint/utils";import ft from"node:path";var ni=ti.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),dn="no-relative-imports",ri=z({find:V(),replacement:V()}),ii=z({aliases:Q(ri),rootDir:_(V()),allowNotFoundAliases:_(Re()),_dev_simulateFileName:_(V())}),si=ni({name:dn,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:[ii]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function o(i,s){let l=ft.dirname(s);return ft.resolve(l,i)}function a(i){let s=t.rootDir??process.cwd(),l=ft.relative(s,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:c}of t.aliases)if(l.startsWith(c)){let f=l.replace(c,p);return{alias:p,newPath:f}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!n(s))return;let l=o(s,r),p=a(l);!p&&t.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?c=>c.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),mt={name:dn,rule:si};var dt=B({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Import and export separately instead."}},defaultOptions:[],create(e){return{ExportNamedDeclaration(t){t.source&&e.report({node:t,messageId:"noReexport"})},ExportAllDeclaration(t){e.report({node:t,messageId:"noReexport"})}}}});import{AST_NODE_TYPES as Ve}from"@typescript-eslint/utils";import*as we from"zod/v4";var oi=we.object({alternativeMsgs:we.object({inArrayFind:we.string().optional(),inArrayFilter:we.string().optional()}).optional(),__dev_simulateFileName:we.string().optional()});function ai(e){return e.typeAnnotation.type!==Ve.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}function li(e){return/\.(typeGuards|type-guards)\.(ts|tsx)$/.test(e)}function pi(e){let t=e.parent;for(;t;){if(t.type===Ve.CallExpression&&t.callee.type===Ve.MemberExpression&&t.callee.property.type===Ve.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var yt=B({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:[Ie(oi)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(li(r))return{};function n(o){if(!ai(o))return;let a=pi(o),i=[];if(t.alternativeMsgs&&a){let s=a.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(s){let l=a.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:l,data:{message:s}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});import{AST_NODE_TYPES as Oe}from"@typescript-eslint/utils";var ci="no-unnecessary-async-on-jsx-props";function ui(e){if(e.body.type!==Oe.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let r=t[0];return!r||r.type!==Oe.ExpressionStatement?!1:r.expression.type===Oe.AwaitExpression}var gt=B({name:ci,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){ui(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,a=[],i=o.getFirstToken(r,l=>l.value==="async");if(i){let l=o.getTokenAfter(i);l?a.push(n.replaceTextRange([i.range[0],l.range[0]],"")):a.push(n.remove(i))}function s(l){if(l.type===Oe.AwaitExpression){let p=o.getFirstToken(l);if(p&&p.value==="await"){let c=o.getTokenAfter(p);c?a.push(n.replaceTextRange([p.range[0],c.range[0]],"")):a.push(n.remove(p))}}if(l.type===Oe.BlockStatement)for(let p of l.body)s(p);else l.type===Oe.ExpressionStatement&&s(l.expression)}return s(r.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});import{AST_NODE_TYPES as je,ESLintUtils as gn}from"@typescript-eslint/utils";import*as St from"typescript";var fi=gn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yn="no-unnecessary-casting",mi=z({additionalCastFunctions:_(Q(z({name:V(),expectedType:Ut(["string","number"])})))}),Tt={name:yn,rule:fi({name:yn,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:[mi],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=gn.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function i(c,f){switch(c.type){case je.Literal:return f==="number"?typeof c.value=="number":typeof c.value=="string";case je.TemplateLiteral:return f==="string";case je.UnaryExpression:return f==="number"?c.operator==="+"||c.operator==="-"||c.operator==="~":!1;default:return!1}}function s(c,f){return f==="number"?!!(c.flags&St.TypeFlags.NumberLike):!!(c.flags&St.TypeFlags.StringLike)}function l(c,f){return y=>y.replaceText(c,e.sourceCode.getText(f))}function p(c){if(!a||c.arguments.length!==1)return;let f=c.arguments[0];if(!f||f.type===je.SpreadElement)return;let{callee:y}=c;if(y.type!==je.Identifier)return;let T=y.name,I=n.find(E=>E.name===T);if(!I)return;if(i(f,I.expectedType)||s(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(f)),I.expectedType)){let E,u;T==="Number"?E="unnecessaryNumberCasting":T==="String"?E="unnecessaryStringCasting":(E="unnecessaryCustomCasting",u={name:I.name,type:I.expectedType}),e.report({node:c,messageId:E,...u?{data:u}:{},fix:l(c,f)})}}return{CallExpression:p}}})};import{AST_NODE_TYPES as ze}from"@typescript-eslint/utils";import*as pe from"zod/v4";var di=pe.object({methods:pe.union([pe.array(pe.string()),pe.literal("array")])}),ht=B({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:[pe.toJSONSchema(di)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(r)?r.includes(s):n.has(s)}function a(s){let{callee:l}=s;if(l.type===ze.MemberExpression){let p=l.property;if(p.type===ze.Identifier)return p.name}return null}function i(s,l){if(s.type!==ze.Identifier||!s.typeAnnotation)return;let p=l.parent;if(p.type===ze.CallExpression){let c=a(p);c&&o(c)&&p.arguments.indexOf(l)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(y){return y.remove(s.typeAnnotation)}})}}return{ArrowFunctionExpression(s){for(let l of s.params)i(l,s)},FunctionExpression(s){for(let l of s.params)i(l,s)}}}});import{AST_NODE_TYPES as ae}from"@typescript-eslint/utils";var Et=B({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===ae.ObjectPattern||!t.init||t.init.type!==ae.ObjectExpression||t.id.type===ae.Identifier&&t.id.typeAnnotation||t.parent.parent.type===ae.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===ae.Property&&i.key.type===ae.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==ae.Identifier)return;let n=yi(t,e.sourceCode);if(n.length===0)return;let o=t.init.properties.some(i=>i.type!==ae.Property?!1:i.value.type===ae.FunctionExpression),a=new Set;for(let i of n){if(i.identifier.parent.type!==ae.MemberExpression)return;let s=i.identifier.parent;if(s.object!==i.identifier)return;if(s.computed)if(s.property.type===ae.Literal&&typeof s.property.value=="string")a.add(s.property.value);else return;else{if(s.property.type!==ae.Identifier)return;a.add(s.property.name)}if(s.parent.type===ae.CallExpression&&o)return}for(let[i,s]of r)a.has(i)||e.report({node:s,messageId:"unusedObjectProperty",data:{name:i}})}}}});function yi(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):[]}import{AST_NODE_TYPES as q,ESLintUtils as gi}from"@typescript-eslint/utils";var Si=z({selectors:Q(z({name:V(),selectorProp:_(V()),selectorArgPos:_(ge()),returnProp:_(V())}))}),Ti=gi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sn="no-unused-selected-values",bt={name:Sn,rule:Ti({name:Sn,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[Si]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===q.CallExpression&&(a=o.init),!a)return;let i=Ei(a);if(!i)return;let s=n.get(i);if(!s)return;let l=hi(a,s.selectorArgPos??0,s.selectorProp);if(!l)return;let p=bi(l);if(!p)return;let c=Tn(p.properties,void 0);if(!c)return;if(o.id.type===q.ObjectPattern){let T=Tn(o.id.properties,s.returnProp);if(!T)return;for(let[I,x]of c)T.has(I)||e.report({node:x,messageId:"unusedSelectedValue",data:{name:I}});return}if(o.id.type!==q.Identifier||s.returnProp)return;let f=xi(o,e.sourceCode);if(f.length===0)return;let y=new Set;for(let T of f){if(T.identifier.parent.type!==q.MemberExpression)return;let I=T.identifier.parent.property;if(I.type!==q.Identifier)return;y.add(I.name)}for(let[T,I]of c)y.has(T)||e.report({node:I,messageId:"unusedSelectedValue",data:{name:T}})}}}})};function hi(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===q.ArrowFunctionExpression||n.type===q.FunctionExpression)return n;if(r&&n.type===q.ObjectExpression){let o=n.properties.find(i=>i.type===q.Property&&i.key.type===q.Identifier&&i.key.name===r);if(o?.type!==q.Property)return null;let a=o.value;if(a.type===q.ArrowFunctionExpression||a.type===q.FunctionExpression)return a}return null}function Ei(e){return e.callee.type===q.Identifier?e.callee.name:e.callee.type===q.MemberExpression&&e.callee.property.type===q.Identifier?e.callee.property.name:null}function bi(e){if(e.body.type===q.ObjectExpression)return e.body;if(e.body.type===q.BlockStatement){let t=e.body.body.filter(r=>r.type===q.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==q.ObjectExpression?null:t[0].argument}return null}function Tn(e,t){let r=e;if(t){let o=e.find(a=>a.type===q.Property&&a.key.type===q.Identifier&&a.key.name===t);if(o?.type!==q.Property||o.value.type!==q.ObjectPattern)return null;r=o.value.properties}let n=new Map;for(let o of r){if(o.type!==q.Property||o.key.type!==q.Identifier)return null;n.set(o.key.name,o)}return n.size>0?n:null}function xi(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):[]}import{AST_NODE_TYPES as Y}from"@typescript-eslint/utils";var xt=B({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(a=>a.type===Y.ImportDeclaration&&a.source.value==="t-state-form"))return{};let n=null,o=!1;return{CallExpression(a){if(o)return;if(!n){let s=Ii(a);s&&(n=s);return}let i=Ci(a,e.sourceCode);if(i){o=!0;for(let s of i)n.delete(s);if(n.size!==0)for(let[s,l]of n)e.report({node:l,messageId:"unusedField",data:{name:s}})}}}}});function Ii(e){if(!(e.callee.type===Y.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==Y.ObjectExpression)return null;let n=ct(r.properties,a=>a.type!==Y.Property||a.key.type!==Y.Identifier||a.key.name!=="initialConfig"?null:a.value.type===Y.ObjectExpression?a.value:a.value.type===Y.ArrowFunctionExpression||a.value.type===Y.FunctionExpression?wi(a.value):null);if(!n)return null;let o=new Map;for(let a of n.properties)a.type===Y.Property&&a.key.type===Y.Identifier&&o.set(a.key.name,a);return o}function Ci(e,t){if(!(e.callee.type===Y.Identifier&&e.callee.name==="useFormState")||e.parent.type!==Y.VariableDeclarator||e.parent.id.type!==Y.ObjectPattern||!ct(e.parent.id.properties,i=>i.type===Y.Property&&i.key.type===Y.Identifier&&i.key.name==="formFields"&&i))return null;let o=fn(e.parent,"formFields",t),a=new Set;for(let{identifier:i}of o){if(i.type!==Y.Identifier||i.parent.type===Y.Property&&i.parent.parent.type===Y.ObjectExpression&&i.parent.parent.parent.type===Y.ReturnStatement||i.parent.type===Y.ReturnStatement)return null;if(i.parent.type===Y.MemberExpression){if(i.parent.object.type!==Y.Identifier||i.parent.property.type!==Y.Identifier)return null;a.add(i.parent.property.name)}}return a}function wi(e){if(e.body.type===Y.ObjectExpression)return e.body;if(e.body.type===Y.BlockStatement){let t=e.body.body.filter(r=>r.type===Y.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==Y.ObjectExpression?null:t[0].argument}return null}import{AST_NODE_TYPES as U,ESLintUtils as Ai}from"@typescript-eslint/utils";var Ri=Ai.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function hn(e){let t=[];for(let r of e.members)r.type===U.TSPropertySignature&&r.key.type===U.Identifier&&t.push([r.key.name,r]);return t}function En(e,...t){for(let r of t)e.set(...r);return e}var vi=z({forceCheckOnFCPropTypesWithName:_(Q(V()))}),bn="no-unused-type-props-in-args",It=null,ki=Ri({name:bn,meta:{type:"problem",docs:{description:"Disallow unused undestructured object type properties"},messages:{unusedObjectTypeProperty:"Object type property '{{ propertyName }}' is defined but never used",missingComponentParam:"Component has declared props but no props are used"},schema:[vi],fixable:"code"},defaultOptions:[{}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r}=t;r&&!It&&(It=r.map(s=>new RegExp(s)));function n(s,l,p,c,f=!0){let y=p.name,T=e.sourceCode.getScope(l).references.find(E=>E.identifier.name===y)?.resolved,I=s&&It?.some(E=>E.test(y));if(!T||!I&&T.references.filter(E=>E.isTypeReference).length>1)return;let x=T?.defs[0]?.node;if(!(f&&x?.parent?.type===U.ExportNamedDeclaration)){if(x?.type===U.TSTypeAliasDeclaration){o(s,l,c,x.typeAnnotation,!0);return}if(x?.type===U.TSInterfaceDeclaration){o(s,l,c,x.body,!0);return}}}function o(s,l,p,c,f){if(c.type===U.TSInterfaceBody){for(let y of c.body)y.type===U.TSPropertySignature&&y.key.type===U.Identifier&&p.set(y.key.name,y);return}if(c.type===U.TSTypeLiteral){En(p,...hn(c));return}if(c.type===U.TSIntersectionType){for(let y of c.types)o(s,l,p,y,!0);return}f||c.type===U.TSTypeReference&&c.typeName.type===U.Identifier&&n(s,l,c.typeName,p)}function a(s,l,p){for(let c of p)if(c.type==="ObjectPattern"&&c.typeAnnotation){let f=new Map;if(o(s,l,f,c.typeAnnotation.typeAnnotation,!1),f.size===0)continue;i(c,f)}else c.type===U.AssignmentPattern&&c.left.type===U.ObjectPattern&&a(s,l,[c.left])}function i(s,l){let p=[];if(s.properties.at(-1)?.type===U.RestElement)return;for(let T of s.properties)T.type===U.Property&&T.key.type===U.Identifier&&p.push(T.key.name);let f=[],y=[];for(let[T,I]of l)p.includes(T)||(y.push(T),f.push({node:I,messageId:"unusedObjectTypeProperty",data:{propertyName:T}}));for(let[T,I]of f.entries())e.report({...I,fix:T===f.length-1?x=>{let E=s.properties.at(-1),u=y.join(", ");return E?E?.type===U.RestElement?null:x.insertTextAfter(E,`, ${u}`):x.insertTextBeforeRange([s.range[0]+1,s.range[1]],`${u}`)}:void 0})}return{VariableDeclaration(s){let l=s.declarations[0];if(!l)return;let p=new Map,c=l.id.type===U.Identifier&&l.id.typeAnnotation?.typeAnnotation.type===U.TSTypeReference&&l.id.typeAnnotation.typeAnnotation.typeName.type===U.Identifier&&l.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&l.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(c){if(c.type===U.TSTypeReference&&c.typeName.type===U.Identifier)n(!0,s,c.typeName,p,!1);else if(c.type===U.TSTypeLiteral)En(p,...hn(c));else if(c.type===U.TSIntersectionType)for(let f of c.types)f.type===U.TSTypeReference&&f.typeName.type===U.Identifier?n(!0,s,f.typeName,p,!1):o(!0,s,p,f,!0);if(p.size!==0&&l.init?.type===U.ArrowFunctionExpression){let f=l.init.params[0];if(!f){e.report({node:l.init,messageId:"missingComponentParam"});return}f.type===U.ObjectPattern&&i(f,p)}}},FunctionDeclaration:function(s){a(!1,s,s.params)},ArrowFunctionExpression(s){a(!1,s,s.params)}}}}),Ct={name:bn,rule:ki};import{AST_NODE_TYPES as de}from"@typescript-eslint/utils";var wt=B({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.Identifier?t.has(n.callee.name):n.callee.type===de.MemberExpression&&n.callee.object.type===de.Identifier&&n.callee.property.type===de.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let o of n.specifiers)o.type===de.ImportSpecifier&&o.imported.type===de.Identifier&&o.imported.name==="useRef"&&t.add(o.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===de.CallExpression&&r(n.init)&&n.id.type===de.Identifier){let a=e.sourceCode.getScope(n).set.get(n.id.name);if(a){let i=!1;for(let s of a.references){let p=s.identifier.parent;if(p!==n&&!(p.type===de.JSXExpressionContainer&&p.parent.type===de.JSXAttribute&&p.parent.name.type===de.JSXIdentifier&&p.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});import{AST_NODE_TYPES as At,ESLintUtils as Oi}from"@typescript-eslint/utils";var Pi=Oi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),In="prefer-named-functions",xn=new Map,Fi=Pi({name:In,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=xn.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),xn.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===At.ArrowFunctionExpression&&n.id.type===At.Identifier){let o=n.id.name;if(n.id.typeAnnotation||r&&r.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==At.BlockStatement)return;let a=n.parent,i=n.init.params,s=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(a,`${l.async?"async ":""}function ${o}(${i.map(c=>e.sourceCode.getText(c)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),Rt={name:In,rule:Fi};import{AST_NODE_TYPES as M}from"@typescript-eslint/utils";var Ni=z({disallowedFunctions:Q(z({name:V(),allowUsingWithArgs:_(Re()),hookAlternative:_(V()),message:_(V()),allowUseInside:_(Q(V()))}))});function He(e){return/^use[A-Z]/.test(e)}function Cn(e){return/^[A-Z]/.test(e)}function ji(e){return e.type===M.Identifier?He(e.name):e.type===M.MemberExpression&&e.property.type===M.Identifier?He(e.property.name):!1}function wn(e,t){return e.type===M.Identifier?e.name===t:e.type===M.MemberExpression&&e.object.type===M.Identifier&&e.property.type===M.Identifier?e.object.name==="React"&&e.property.name===t:!1}function An(e){return!!(e.parent&&e.parent.type===M.CallExpression&&wn(e.parent.callee,"forwardRef"))}function Rn(e){return!!(e.parent&&e.parent.type===M.CallExpression&&wn(e.parent.callee,"memo"))}function vt(e){if(e.type===M.FunctionDeclaration||e.type===M.FunctionExpression&&e.id)return e.id||void 0;if(e.type===M.FunctionExpression||e.type===M.ArrowFunctionExpression){if(e.parent.type===M.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===M.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===M.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===M.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Mi(e){let t=e.parent,r=!1;for(;t;){if(t.type===M.FunctionDeclaration||t.type===M.FunctionExpression||t.type===M.ArrowFunctionExpression){let n=vt(t);if(n&&n.type===M.Identifier){if(Cn(n.name)||He(n.name))return!r;r=!0}else{if(An(t)||Rn(t))return!r;if(t.parent.type===M.CallExpression){let o=t.parent;ji(o.callee)||(r=!0)}else t.parent.type===M.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function vn(e){return e.callee.type===M.Identifier?e.callee.name:e.callee.type===M.MemberExpression&&e.callee.property.type===M.Identifier?e.callee.property.name:null}function Di(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===M.FunctionDeclaration||r.type===M.FunctionExpression||r.type===M.ArrowFunctionExpression){let n=vt(r);if(n&&n.type===M.Identifier&&t.includes(n.name))return!0}else if(r.type===M.CallExpression){let n=vn(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function Li(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===M.Identifier&&t.name==="undefined")}function _i(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===M.FunctionDeclaration||n.type===M.FunctionExpression||n.type===M.ArrowFunctionExpression){let o=vt(n);if(o&&o.type===M.Identifier){if(Cn(o.name)||He(o.name)){r=!0;break}}else if(An(n)||Rn(n)){r=!0;break}}n=n.parent}return r?t.length===0?Mi(e):!Di(e,t):!1}var kt=B({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:[Ni],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let a=vn(o);if(!a)return;let i=n.get(a);if(!i||i.allowUsingWithArgs&&Li(o))return;let s=i.allowUseInside||[];_i(o,s)&&e.report({node:o,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:l=>{let p=i.hookAlternative;return o.callee.type===M.Identifier?l.replaceText(o.callee,p):o.callee.type===M.MemberExpression&&o.callee.property.type===M.Identifier?l.replaceText(o.callee.property,p):null}}]:[]})}}}});import{AST_NODE_TYPES as K,AST_TOKEN_TYPES as kn,ESLintUtils as $i}from"@typescript-eslint/utils";var Ui=$i.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pn="prefer-single-line-if",Wi=z({maxLineLength:_(ge()),maxNonSimpleConditionLength:_(ge())}),Vi=Ui({name:Pn,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:[Wi]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==K.BlockStatement||n.loc.start.line===n.loc.end.line||r.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let a=n.consequent.body[0];if(a.type===K.ReturnStatement){if(!Nn(a))return}else if(!(a.type===K.ContinueStatement||a.type===K.BreakStatement))return;if(n.test.type===K.LogicalExpression||n.test.type===K.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let f=On(n.test);if(!f&&n.test.type===K.UnaryExpression&&n.test.operator==="!"){let y=n.test.argument;On(y)&&(f=!0)}if(f&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let s=r.getText(a);if(i.includes(`
16
- `))return;let l=r.getTokenAfter(n);if(l&&l.type===kn.Punctuator&&l.value==="}"){let f=r.getTokenAfter(l);if(f&&f.type===kn.Keyword&&(f.value==="else"||f.value==="catch"))return}let p=zi(r,n),c=`if (${i}) ${s}`;t.maxLineLength&&c.length+p.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:f=>f.replaceText(n,c)})}}}});function On(e){return e.type===K.CallExpression||e.type===K.BinaryExpression||e.type===K.MemberExpression&&Fn(e)}function Fn(e){return e.object.type===K.MemberExpression?Fn(e.object):e.object.type!==K.Identifier}function zi(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Nn(e){if(!e.argument)return!0;let t=e.argument;return t.type===K.ArrayExpression&&t.elements.length===0||t.type===K.ObjectExpression&&t.properties.length===0||t.type===K.Literal||t.type===K.Identifier||t.type===K.TemplateLiteral||t.type===K.TaggedTemplateExpression?!0:t.type===K.CallExpression?t.arguments.length===0:t.type===K.UnaryExpression?Nn(t):!1}var Ot={name:Pn,rule:Vi};import{AST_NODE_TYPES as ce,ESLintUtils as Hi}from"@typescript-eslint/utils";var Yi=Hi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),jn="react-compiler-migration",qi=z({disallowHooks:_(Q(z({name:V(),replacement:V()}))),disallowMethods:_(Q(z({name:V(),replacement:_(V()),requireTrueProp:_(V())})))}),Ji=/eslint +react-compiler\/react-compiler: +\["error/;function Bi(e){return e.type===ce.Identifier?e.name.startsWith("use"):e.type===ce.MemberExpression&&e.property.type===ce.Identifier?e.property.name.startsWith("use"):!1}var Xi=Yi({name:jn,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:[qi]},defaultOptions:[{}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(Ji.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let o=null,a=null;if(n.callee.type===ce.Identifier?(o=n.callee.name,a=n.callee):n.callee.type===ce.MemberExpression&&n.callee.property.type===ce.Identifier&&(o=n.callee.property.name,a=n.callee.property),o){let i=t.disallowHooks.find(s=>s.name===o);i&&a&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:s=>s.replaceText(a,i.replacement)}]})}}if(t.disallowMethods?.length&&Bi(n.callee)){for(let o of n.arguments)if(o.type===ce.ObjectExpression){for(let a of o.properties)if(a.type===ce.Property&&a.key.type===ce.Identifier){let i=a.key.name,s=t.disallowMethods.find(l=>l.name===i);if(s){if(s.requireTrueProp){let l=s.requireTrueProp,p=!1;for(let c of o.properties)if(c.type===ce.Property&&c.key.type===ce.Identifier&&c.key.name===l&&c.value.type===ce.Literal&&c.value.value===!0){p=!0;break}if(!p){e.report({node:a,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:s.name,requireTrueProp:l}});continue}}s.replacement&&e.report({node:a,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:s.name,replacement:s.replacement},suggest:[{messageId:"replace",data:{replacement:s.replacement},fix:l=>l.replaceText(a.key,s.replacement)}]})}}}}}}:{}}}),Pt={name:jn,rule:Xi};import{ESLintUtils as Gi,TSESTree as Ki}from"@typescript-eslint/utils";var Zi=Gi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mn="require-description",Qi=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,es=/^eslint-disable-(next-)?line$/u,ts=Zi({name:Mn,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of r.getAllComments()){let a=ns(o);a!=null&&(n.has(a.kind)||a.description||e.report({loc:is(o.loc),messageId:"missingDescription"}))}}}}}),Dn={name:Mn,rule:ts};function ns(e){let{text:t,description:r}=rs(e.value);if(!t)return null;let n=Qi.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let a=es.test(o);if(e.type===Ki.AST_TOKEN_TYPES.Line&&!a||a&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+o.length);return{kind:o,value:i.trim(),description:r}}function rs(e){let t=e.split(/\s-{2,}\s/u);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function is(e){return{start:{line:e.start.line,column:-1},end:e.end}}import{AST_NODE_TYPES as L}from"@typescript-eslint/utils";import{z as Ee}from"zod/v4";var ss=Ee.object({varsToCheck:Ee.array(Ee.object({selector:Ee.string().optional(),fromFnCall:Ee.string().optional(),prop:Ee.string().or(Ee.array(Ee.string())),errorMsg:Ee.string().optional()}))}),Ft=B({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:[Ie(ss)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map,n=(i,s,l,p)=>{let c=new Set;for(let y of i.properties)y.type===L.Property&&y.key.type===L.Identifier&&c.add(y.key.name);let f=s.filter(y=>!c.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(T=>`"${T}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:p,customMsg:l||""}})}},o=i=>{if(i.init?.type===L.CallExpression){if(i.init.callee.type===L.Identifier)return i.init.callee.name;if(i.init.callee.type===L.MemberExpression&&i.init.callee.property.type===L.Identifier)return i.init.callee.object.type===L.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"},a={};for(let i of t.varsToCheck)i.selector&&(a[i.selector]=s=>{if(s.type===L.VariableDeclarator&&s.id.type===L.Identifier&&r.set(s.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:s.id,fnName:o(s)}),s.type===L.VariableDeclarator&&s.id.type===L.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(s.id,l,i.errorMsg,o(s))}});for(let i of t.varsToCheck)if(i.fromFnCall){let s=i.fromFnCall;if(s.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${s.slice(2)}"]`;a[p]=c=>{if(c.type!==L.MemberExpression||c.parent.type!==L.CallExpression)return;let f=c.parent;if(f.parent.type!==L.VariableDeclarator)return;let y=f.parent;if(y.id.type===L.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===L.ObjectPattern){let T=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,T,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(s.includes(".")){let[l,p]=s.split("."),c=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;a[c]=f=>{if(f.type!==L.MemberExpression||f.parent.type!==L.CallExpression)return;let y=f.parent;if(y.parent.type!==L.VariableDeclarator)return;let T=y.parent;if(T.id.type===L.Identifier)r.set(T.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:T.id,fnName:i.fromFnCall||"unknown function"});else if(T.id.type===L.ObjectPattern){let I=Array.isArray(i.prop)?i.prop:[i.prop];n(T.id,I,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${s}"]`;a[l]=p=>{if(p.type!==L.Identifier||p.parent.type!==L.CallExpression)return;let c=p.parent;if(c.parent.type!==L.VariableDeclarator)return;let f=c.parent;if(f.id.type===L.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===L.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];n(f.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...a,"Program:exit"(){for(let[i,{props:s,errorMsg:l,node:p,fnName:c}]of r){let y=e.sourceCode.getScope(p).set.get(i);if(y){let T=new Set(s);for(let I of y.references){let x=I.identifier,E=x.parent;if(!(E.type===L.VariableDeclarator&&E.id===x)){if(E.type===L.MemberExpression&&E.object===x&&E.property.type===L.Identifier&&T.has(E.property.name)){if(T.delete(E.property.name),T.size===0)break;continue}if(E.type===L.VariableDeclarator&&E.init===x&&E.id.type===L.ObjectPattern){for(let u of E.id.properties)u.type===L.Property&&u.key.type===L.Identifier&&T.has(u.key.name)&&T.delete(u.key.name);if(T.size===0)break;continue}if(!(E.type===L.MemberExpression&&E.object===x&&E.property.type===L.Identifier&&!s.includes(E.property.name))){T.clear();break}}}if(T.size>0){let I=Array.from(T);if(I.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:I[0],fnName:c,customMsg:l||""}});else{let x=I.map(E=>`"${E}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:x,fnName:c,customMsg:l||""}})}}}}}}}});function $n(e){return/^use[A-Z0-9]/.test(e)}function Ye(e){return e.type==="Identifier"?$n(e.name):e.type==="MemberExpression"&&!e.computed&&Ye(e.property)?e.object.type==="Identifier":!1}function Un(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Wn(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Vn(e){return!!(e.parent&&e.parent.callee&&Wn(e.parent.callee,"forwardRef"))}function zn(e){return!!(e.parent&&e.parent.callee&&Wn(e.parent.callee,"memo"))}function Nt(e){for(;e;){let t=Yn(e);if(t&&(Un(t)||Ye(t))||Vn(e)||zn(e))return!0;e=e.parent}return!1}function Ln(e){return!1}function jt(e){return!1}var os=/eslint +react-compiler\/react-compiler: +\["error/,Hn={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let l of e.sourceCode.getAllComments())if(os.test(l.value))return{CallExpression(p){let c=null;p.callee.name==="useMemo"?c="useMemo":p.callee.name==="useCallback"&&(c="useCallback"),c&&e.report({node:p,message:`"${c}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?l=>t(l):l=>e.sourceCode.getText(l),r=typeof e.getScope=="function"?()=>r():l=>e.sourceCode.getScope(l),n=null,o=[],a=[],i=new WeakSet;function s(l){for(let p of l.references){let c=p.identifier.parent;if(c.type==="VariableDeclarator"&&c.init&&c.init.type==="CallExpression"&&c.init.callee&&Ln(c.init.callee))for(let f of p.resolved.references)f!==p&&i.add(f.identifier)}}return{onCodePathSegmentStart:l=>a.push(l),onCodePathSegmentEnd:()=>a.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(l,p){let c=o.pop();if(c.size===0)return;let f=new Set;function y(g,m){let{cache:S}=y,k=S.get(g.id),A=new Set(m);if(A.has(g.id)){let C=[...A],N=C.slice(C.indexOf(g.id)+1);for(let W of N)f.add(W);return BigInt("0")}if(A.add(g.id),k!==void 0)return k;if(l.thrownSegments.includes(g))k=BigInt("0");else if(g.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let C of g.prevSegments)k+=y(C,A)}return g.reachable&&k===BigInt("0")?S.delete(g.id):S.set(g.id,k),k}function T(g,m){let{cache:S}=T,k=S.get(g.id),A=new Set(m);if(A.has(g.id)){let C=Array.from(A),N=C.slice(C.indexOf(g.id)+1);for(let W of N)f.add(W);return BigInt("0")}if(A.add(g.id),k!==void 0)return k;if(l.thrownSegments.includes(g))k=BigInt("0");else if(g.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let C of g.nextSegments)k+=T(C,A)}return S.set(g.id,k),k}function I(g){let{cache:m}=I,S=m.get(g.id);if(S===null)return 1/0;if(S!==void 0)return S;if(m.set(g.id,null),g.prevSegments.length===0)S=1;else{S=1/0;for(let k of g.prevSegments){let A=I(k);A<S&&(S=A)}S+=1}return m.set(g.id,S),S}y.cache=new Map,T.cache=new Map,I.cache=new Map;let x=T(l.initialSegment),E=Yn(p),u=Nt(p),R=E?Un(E)||Ye(E):Vn(p)||zn(p),b=1/0;for(let g of l.finalSegments){if(!g.reachable)continue;let m=I(g);m<b&&(b=m)}for(let[g,m]of c){if(!g.reachable)continue;let S=g.nextSegments.length===0?b<=I(g):b<I(g),k=y(g)*T(g),A=f.has(g.id);for(let C of m)if(A&&!jt(C)&&e.report({node:C,message:`React Hook "${t(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.`}),R){if(p.async&&e.report({node:C,message:`React Hook "${t(C)}" cannot be called in an async function.`}),!A&&k!==x&&!jt(C)){let W=`React Hook "${t(C)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(S?" Did you accidentally call a React Hook after an early return?":"");e.report({node:C,message:W})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let N=`React Hook "${t(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:N})}else if(E){let N=`React Hook "${t(C)}" is called in function "${t(E)}" 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:N})}else if(p.type==="Program"){let N=`React Hook "${t(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:N})}else if(u&&!jt(C)){if(p.parent.type==="CallExpression"&&p.parent.callee.type==="Identifier"&&p.parent.callee.name==="useCallback"){let W=p.parent;if(W.parent.type==="VariableDeclarator"&&$n(W.parent.id.name))return}let N=`React Hook "${t(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:N})}}},CallExpression(l){if(Ye(l.callee)){let p=_n(o),c=_n(a),f=p.get(c);f||(f=[],p.set(c,f)),f.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||Ln(l.callee))&&l.arguments.length>0&&(n=l)},Identifier(l){n==null&&i.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${t(l)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(l){l===n&&(n=null)},FunctionDeclaration(l){Nt(l)&&s(r(l))},ArrowFunctionExpression(l){Nt(l)&&s(r(l))}}}};function Yn(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 _n(e){return e[e.length-1]}import{AST_NODE_TYPES as ne,AST_TOKEN_TYPES as as}from"@typescript-eslint/utils";import*as oe from"zod/v4";var ls=oe.object({indent:oe.union([oe.string().regex(/^\s+$/),oe.number().int().min(1)]).optional(),tags:oe.array(oe.string()).optional(),functions:oe.array(oe.string()).optional(),comments:oe.array(oe.string()).optional()}),Mt=B({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[Ie(ls)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:a}=e.options[0],i=r.map(u=>u.toLowerCase());function s(u){let R=u.split(/\r?\n/),b=R.filter(m=>m.trim()!=="");if(b.length===0)return u;let g=Number.POSITIVE_INFINITY;for(let m of b){let S=m.match(/^(\s*)/);S&&(g=Math.min(g,S[1]?.length??0))}return!isFinite(g)||g===0?u:R.map(m=>m.slice(g)).join(`
15
+ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let S=l.acquire(u),k=new Set,A=null;{let d=S.upper;for(;d&&(k.add(d),d.type!=="function");)d=d.upper;if(!d)return;A=d}let C=Array.isArray;function N(d){if(!C(d.defs))return!1;let h=d.defs[0];if(h==null||h.node.type!=="VariableDeclarator")return!1;let v=h.node.init;if(v==null)return!1;for(;v.type==="TSAsExpression";)v=v.expression;let O=h.node.parent;if(O==null&&(nt(A.block,h.node.id),O=h.node.parent,O==null))return!1;if(O.kind==="const"&&v.type==="Literal"&&(typeof v.value=="string"||typeof v.value=="number"||v.value===null))return!0;if(v.type!=="CallExpression")return!1;let F=v.callee;if(F.type==="MemberExpression"&&F.object.name==="React"&&F.property!=null&&!F.computed&&(F=F.property),F.type!=="Identifier")return!1;let P=h.node.id,{name:j}=F;if(j==="useRef"&&P.type==="Identifier")return!0;if(hr(F)&&P.type==="Identifier"){for(let D of d.references)D!==P&&T.add(D.identifier);return!0}else if(j==="useState"||j==="useReducer"){if(P.type==="ArrayPattern"&&P.elements.length===2&&C(d.identifiers)){if(P.elements[1]===d.identifiers[0]){if(j==="useState"){let D=d.references,le=0;for(let Te=0;Te<D.length;Te++){if(D[Te].isWrite()&&le++,le>1)return!1;p.set(D[Te].identifier,P.elements[0])}}return!0}else if(P.elements[0]===d.identifiers[0]){if(j==="useState"){let D=d.references;for(let le=0;le<D.length;le++)c.add(D[le].identifier)}return!1}}}else if(j==="useTransition"&&P.type==="ArrayPattern"&&P.elements.length===2&&Array.isArray(d.identifiers)&&P.elements[1]===d.identifiers[0])return!0;return!1}function W(d){if(!C(d.defs))return!1;let h=d.defs[0];if(h==null||h.node==null||h.node.id==null)return!1;let v=h.node,O=A.childScopes,F=null,P;for(P=0;P<O.length;P++){let j=O[P],D=j.block;if(v.type==="FunctionDeclaration"&&D===v||v.type==="VariableDeclarator"&&D.parent===v){F=j;break}}if(F==null)return!1;for(P=0;P<F.through.length;P++){let j=F.through[P];if(j.resolved!=null&&k.has(j.resolved.scope)&&!J(j.resolved))return!1}return!0}let J=I(N,f),te=I(W,y),Z=new Map;function be(d){let h=d.from,v=!1;for(;h.block!==u;)h.type==="function"&&(v=h.block.parent!=null&&h.block.parent.type==="ReturnStatement"),h=h.upper;return v}let X=new Map,ye=new Map;ue(S);function ue(d){for(let h of d.references){if(!h.resolved||!k.has(h.resolved.scope))continue;let v=nt(u,h.identifier),O=Kt(v),F=he(O,ye);if(m&&O.type==="Identifier"&&(O.parent.type==="MemberExpression"||O.parent.type==="OptionalMemberExpression")&&!O.parent.computed&&O.parent.property.type==="Identifier"&&O.parent.property.name==="current"&&be(h)&&Z.set(F,{reference:h,dependencyNode:O}),O.parent.type==="TSTypeQuery"||O.parent.type==="TSTypeReference")continue;let P=h.resolved.defs[0];if(P!=null&&!(P.node!=null&&P.node.init===u.parent)&&P.type!=="TypeParameter")if(X.has(F))X.get(F).references.push(h);else{let j=h.resolved,D=J(j)||te(j);X.set(F,{isStable:D,references:[h]})}}for(let h of d.childScopes)ue(h)}Z.forEach(({reference:d,dependencyNode:h},v)=>{let O=d.resolved.references,F=!1;for(let P=0;P<O.length;P++){let{identifier:j}=O[P],{parent:D}=j;if(D!=null&&D.type==="MemberExpression"&&!D.computed&&D.property.type==="Identifier"&&D.property.name==="current"&&D.parent.type==="AssignmentExpression"&&D.parent.left===D){F=!0;break}}F||s({node:h.parent.property,message:`The ref value '${v}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${v}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ie=new Set;function Se(d,h){ie.has(h)||(ie.add(h),s({node:d,message:`Assignments to the '${h}' variable from inside React Hook ${r(b)} will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ${r(b)}.`}))}let Ae=new Set;if(X.forEach(({isStable:d,references:h},v)=>{d&&Ae.add(v),h.forEach(O=>{O.writeExpr&&Se(O.writeExpr,v)})}),ie.size>0)return;if(!R){let d=null;if(X.forEach(({isStable:h,references:v},O)=>{d||v.forEach(F=>{if(d)return;let P=F.identifier;if(!p.has(P))return;let D=F.from;for(;D.type!=="function";)D=D.upper;D.block===u&&(d=O)})}),d){let{suggestedDependencies:h}=et({dependencies:X,declaredDependencies:[],stableDependencies:Ae,externalDependencies:new Set,isEffect:!0});s({node:b,message:`React Hook ${g} contains a call to '${d}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+h.join(", ")+`] as a second argument to the ${g} Hook.`,suggest:[{desc:`Add dependencies array: [${h.join(", ")}]`,fix(v){return v.insertTextAfter(u,`, [${h.join(", ")}]`)}}]})}return}let Pe=[],Fe=new Set;R.type!=="ArrayExpression"?s({node:R,message:`React Hook ${r(b)} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.`}):R.elements.forEach(d=>{if(d===null)return;if(d.type==="SpreadElement"){s({node:d,message:`React Hook ${r(b)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}T.has(d)&&s({node:d,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(d)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(d)}\``,fix(F){return F.removeRange(d.range)}}]});let h;try{h=he(d,ye)}catch(F){if(/Unsupported node type/.test(F.message)){d.type==="Literal"?X.has(d.value)?s({node:d,message:`The ${d.raw} literal is not a valid dependency because it never changes. Did you mean to include ${d.value} in the array instead?`}):s({node:d,message:`The ${d.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:d,message:`React Hook ${r(b)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw F}let v=d;for(;v.type==="MemberExpression"||v.type==="OptionalMemberExpression"||v.type==="ChainExpression";)v=v.object||v.expression.object;let O=!A.through.some(F=>F.identifier===v);Pe.push({key:h,node:d}),O||Fe.add(h)});let{suggestedDependencies:Bn,unnecessaryDependencies:De,missingDependencies:xe,duplicateDependencies:Lt}=et({dependencies:X,declaredDependencies:Pe,stableDependencies:Ae,externalDependencies:Fe,isEffect:m}),Le=Bn;if(Lt.size+xe.size+De.size===0){if(t)return;yr({declaredDependencies:Pe,declaredDependenciesNode:R,componentScope:A,scope:S}).forEach(({construction:h,isUsedOutsideOfHook:v,depType:O})=>{let F=O==="function"?"useCallback":"useMemo",P=O==="function"?"definition":"initialization",j=`wrap the ${P} of '${h.name.name}' in its own ${F}() Hook.`,D=v?`To fix this, ${j}`:`Move it inside the ${g} callback. Alternatively, ${j}`,le=O==="conditional"||O==="logical expression"?"could make":"makes",Te=`The '${h.name.name}' ${O} ${le} the dependencies of ${g} Hook (at line ${R.loc.start.line}) change on every render. ${D}`,_t;v&&h.type==="Variable"&&O==="function"&&(_t=[{desc:`Wrap the ${P} of '${h.name.name}' in its own ${F}() Hook.`,fix($t){let[Gn,Kn]=F==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[$t.insertTextBefore(h.node.init,Gn),$t.insertTextAfter(h.node.init,Kn)]}}]),s({node:h.node,message:Te,suggest:_t})});return}!m&&xe.size>0&&(Le=et({dependencies:X,declaredDependencies:[],stableDependencies:Ae,externalDependencies:Fe,isEffect:m}).suggestedDependencies);function Xn(){if(Pe.length===0)return!0;let d=Pe.map(v=>v.key),h=d.slice().sort();return d.join(",")===h.join(",")}Xn()&&Le.sort();function Je(d){let h=d.split("."),v="";for(let O=0;O<h.length;O++){if(O!==0){let F=h.slice(0,O+1).join("."),P=ye.get(F)===!0;v+=P?"?.":"."}v+=h[O]}return v}function Be(d,h,v,O){return d.size===0?null:(d.size>1?"":h+" ")+v+" "+(d.size>1?"dependencies":"dependency")+": "+Sr(Array.from(d).sort().map(F=>"'"+Je(F)+"'"))+`. Either ${O} ${d.size>1?"them":"it"} or remove the dependency array.`}let fe="";if(De.size>0){let d=null;if(Array.from(De.keys()).forEach(h=>{d===null&&h.endsWith(".current")&&(d=h)}),d!==null)fe=` Mutable values like '${d}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Fe.size>0){let h=Array.from(Fe)[0];S.set.has(h)||(fe=` Outer scope values like '${h}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!fe&&xe.has("props")){let d=X.get("props");if(d==null)return;let h=d.references;if(!Array.isArray(h))return;let v=!0;for(let O=0;O<h.length;O++){let F=h[O],P=nt(A.block,F.identifier);if(!P){v=!1;break}let j=P.parent;if(j==null){v=!1;break}if(j.type!=="MemberExpression"&&j.type!=="OptionalMemberExpression"){v=!1;break}}v&&(fe=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${g} call and refer to those specific props inside ${r(b)}.`)}if(!fe&&xe.size>0){let d=null;xe.forEach(h=>{if(d)return;let v=A.set.get(h),O=X.get(h);if(O.references[0].resolved!==v)return;let F=v.defs[0];if(F==null||F.name==null||F.type!=="Parameter")return;let P=!1,j;for(let D=0;D<O.references.length;D++)if(j=O.references[D].identifier,j!=null&&j.parent!=null&&(j.parent.type==="CallExpression"||j.parent.type==="OptionalCallExpression")&&j.parent.callee===j){P=!0;break}P&&(d=h)}),d!==null&&(fe=` If '${d}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!fe&&xe.size>0){let d=null;if(xe.forEach(h=>{if(d!==null)return;let O=X.get(h).references,F,P;for(let j=0;j<O.length;j++){for(F=O[j].identifier,P=F.parent;P!=null&&P!==A.block;){if(P.type==="CallExpression"){let D=p.get(P.callee);if(D!=null){if(D.name===h)d={missingDep:h,setter:P.callee.name,form:"updater"};else if(c.has(F))d={missingDep:h,setter:P.callee.name,form:"reducer"};else{let le=O[j].resolved;if(le!=null){let Te=le.defs[0];Te!=null&&Te.type==="Parameter"&&(d={missingDep:h,setter:P.callee.name,form:"inlineReducer"})}}break}}P=P.parent}if(d!==null)break}}),d!==null)switch(d.form){case"reducer":fe=` You can also replace multiple useState variables with useReducer if '${d.setter}' needs the current value of '${d.missingDep}'.`;break;case"inlineReducer":fe=` If '${d.setter}' needs the current value of '${d.missingDep}', you can also switch to useReducer instead of useState and read '${d.missingDep}' in the reducer.`;break;case"updater":fe=` You can also do a functional update '${d.setter}(${d.missingDep.slice(0,1)} => ...)' if you only need '${d.missingDep}' in the '${d.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:R,message:`React Hook ${r(b)} has `+(Be(xe,"a","missing","include")||Be(De,"an","unnecessary","exclude")||Be(Lt,"a","duplicate","omit"))+fe,suggest:[{desc:`Update the dependencies array to be: [${Le.map(Je).join(", ")}]`,fix(d){return d.replaceText(R,`[${Le.map(Je).join(", ")}]`)}}]})}function E(u){let R=gr(u.callee,i);if(R===-1)return;let b=u.arguments[R],g=u.callee,m=Zt(g).name,S=u.arguments[R+1],k=/Effect($|[^a-z])/g.test(m);if(!b){s({node:g,message:`React Hook ${m} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!k)){if(!S&&!k){(m==="useMemo"||m==="useCallback")&&s({node:g,message:`React Hook ${m} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(b.type){case"FunctionExpression":case"ArrowFunctionExpression":x(b,S,g,m,k);return;case"Identifier":if(!S||S.elements&&S.elements.some(N=>N&&N.type==="Identifier"&&N.name===b.name))return;let A=n(u).set.get(b.name);if(A==null||A.defs==null)return;let C=A.defs[0];if(!C||!C.node||C.type!=="Variable"&&C.type!=="FunctionName")break;switch(C.node.type){case"FunctionDeclaration":x(C.node,S,g,m,k);return;case"VariableDeclarator":let N=C.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":x(N,S,g,m,k);return}break}break;default:s({node:g,message:`React Hook ${m} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:g,message:`React Hook ${m} has a missing dependency: '${b.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${b.name}]`,fix(A){return A.replaceText(S,`[${b.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let u of e.sourceCode.getAllComments())if(dr.test(u.value))return t=!0,{CallExpression:R=>E(R,!0)}}return{CallExpression:u=>E(u)}}};function et({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:o}){let a=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((x,E)=>{let u=s(a,E);u.isUsed=!0,l(a,E,R=>{R.isSubtreeUsed=!0})}),t.forEach(({key:x})=>{let E=s(a,x);E.isSatisfiedRecursively=!0}),r.forEach(x=>{let E=s(a,x);E.isSatisfiedRecursively=!0});function s(x,E){let u=E.split("."),R=x;for(let b of u){let g=R.children.get(b);g||(g=i(),R.children.set(b,g)),R=g}return R}function l(x,E,u){let R=E.split("."),b=x;for(let g of R){let m=b.children.get(g);if(!m)return;u(m),b=m}}let p=new Set,c=new Set;f(a,p,c,x=>x);function f(x,E,u,R){x.children.forEach((b,g)=>{let m=R(g);if(b.isSatisfiedRecursively){b.isSubtreeUsed&&u.add(m);return}if(b.isUsed){E.add(m);return}f(b,E,u,S=>m+"."+S)})}let y=[],T=new Set,I=new Set;return t.forEach(({key:x})=>{c.has(x)?y.indexOf(x)===-1?y.push(x):I.add(x):T.add(x)}),p.forEach(x=>{y.push(x)}),{suggestedDependencies:y,unnecessaryDependencies:T,duplicateDependencies:I,missingDependencies:p}}function Ce(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 Ce(e.consequent)!=null||Ce(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Ce(e.left)!=null||Ce(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Ce(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Ce(e.expression);case"TSAsExpression":return Ce(e.expression)}return null}function yr({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let o=e.map(({key:i})=>{let s=r.variables.find(p=>p.name===i);if(s==null)return null;let l=s.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let p=Ce(l.node.init);if(p!=null)return[s,p]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[s,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[s,"class"]:null}).filter(Boolean);function a(i){let s=!1;for(let l=0;l<i.references.length;l++){let p=i.references[l];if(p.writeExpr){if(s)return!0;s=!0;continue}let c=p.from;for(;c!==n&&c!=null;)c=c.upper;if(c!==n&&!Qt(t,p.identifier))return!0}return!1}return o.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:a(i)}))}function Kt(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)?Kt(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function tt(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function he(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=he(e.object,t),n=he(e.property,null),o=`${r}.${n}`;return tt(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=he(e.object,t),n=he(e.property,null),o=`${r}.${n}`;return tt(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=he(r.object,t),o=he(r.property,null),a=`${n}.${o}`;return tt(r,t,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function Zt(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function gr(e,t){let r=Zt(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=he(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 nt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),Tr(n,t))return n;if(Qt(n,t))for(let[o,a]of Object.entries(n))o!=="parent"&&(Xt(a)?(a.parent=n,r.push(a)):Array.isArray(a)&&a.forEach(i=>{Xt(i)&&(i.parent=n,r.push(i))}))}return null}function Sr(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 Xt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Tr(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 Qt(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function hr(e){return!1}import{AST_NODE_TYPES as $e,ESLintUtils as tn}from"@typescript-eslint/utils";import se from"typescript";var Er=tn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),en="improved-no-unnecessary-condition",br=z({}),xr=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Ir=new Set(xr),rt={name:en,rule:Er({name:en,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".'},schema:[br]},defaultOptions:[{}],create(e){let t=tn.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(s){return s.type===$e.UnaryExpression&&s.operator==="typeof"}function o(s){return s.flags&se.TypeFlags.Any||s.flags&se.TypeFlags.Unknown?null:s.flags&se.TypeFlags.StringLike?["string"]:s.flags&se.TypeFlags.NumberLike?["number"]:s.flags&se.TypeFlags.BigIntLike?["bigint"]:s.flags&se.TypeFlags.BooleanLike?["boolean"]:s.flags&se.TypeFlags.ESSymbolLike?["symbol"]:s.flags&se.TypeFlags.Undefined||s.flags&se.TypeFlags.Void?["undefined"]:s.flags&se.TypeFlags.Null?["object"]:s.getCallSignatures().length>0?["function"]:s.flags&se.TypeFlags.Object?s.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:s.flags&se.TypeFlags.NonPrimitive?["object"]:s.flags&se.TypeFlags.Never?["never"]:null}function a(s){if(!r)return null;let l=t.esTreeNodeToTSNodeMap.get(s),p=r.getTypeAtLocation(l.expression);if(p.flags&se.TypeFlags.Any||p.flags&se.TypeFlags.Unknown)return null;let c=[];if(p.isUnion()){for(let y of p.types){let T=o(y);if(T)c.push(...T);else return null}return c}let f=o(p);return f?(c.push(...f),c):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,c=null;if(n(s.left)?(p=s.left,c=s.right.type===$e.Literal&&typeof s.right.value=="string"?s.right.value:null):n(s.right)&&(p=s.right,c=s.left.type===$e.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!c||!Cr(c,Ir))return;let f=a(p);if(!f)return;let y=s.operator==="!==",T=f.includes(c);f.length===1?T&&!y?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:c}}):!T&&y?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:Array.from(f)[0]}}):!T&&!y?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:_e(f),conditionType:c}}):T&&y&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:_e(f),conditionType:c}}):!T&&!y?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:_e(f),conditionType:c}}):!T&&y&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:_e(f)}})}return{BinaryExpression:i}}})};function _e(e){return Array.from(new Set(e)).join(" | ")||"never"}function ve(e,t){let r=e.argument;return r.type===$e.Identifier?r.name:t.sourceCode.getText(r)}function Cr(e,t){return t.has(e)}import{AST_NODE_TYPES as wr,ESLintUtils as Ar}from"@typescript-eslint/utils";var Rr=Ar.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nn="no-call-with-explicit-generics",vr=z({functions:Q(V())}),kr=Rr({name:nn,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[vr]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:o}=n;o.type===wr.Identifier&&r.has(o.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),it={name:nn,rule:kr};import{AST_NODE_TYPES as Ue,ESLintUtils as Or}from"@typescript-eslint/utils";var Pr=Or.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),rn="no-call-with-inferred-generics",Fr=Pr({name:rn,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:o}=n;if(o.type!==Ue.Identifier)return;let a=r.get(o.name);if(!a)return;let{minGenerics:i=1,allowAny:s,disallowTypes:l=t.disallowTypes}=a;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(s&&!l)&&n.typeArguments?.params?.some(c=>!s&&c.type===Ue.TSAnyKeyword||l&&c.type===Ue.TSTypeReference&&c.typeName.type===Ue.Identifier&&l.includes(c.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),st={name:rn,rule:Fr};import{ESLintUtils as Nr}from"@typescript-eslint/utils";var jr=Nr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),on="no-commented-out-code",Mr=["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:"],G={returnStatement:/^\s*return\s+/,stringAssignment:/\w=("|'|`)/,objectPropertyWithQuotes:/\w+:\s*('|"|`)/,computedPropertyAssignment:/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,kebabCaseProperty:/\w+-\w+:/,snakeCaseProperty:/\w+_\w+:/,ternaryOperator:/\?\s+\w/,colonWithWord:/:\s+\w/,quotedString:/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,numberWithComma:/^\s*\d+[,}]/,arrayWithComma:/^\s*\[[^\]]*\][,}]/,objectWithComma:/^\s*\{[^}]*\}[,}]/,methodCall:/\.\w+\(/,arrayAccess:/\[\w+\]/,quotedPropertyKey:/^\s*(['"`]).+?\1\s*:/,jsxSelfClosing:/^<[A-Z]\w*(\s|>|\/)/,jsxElement:/^<[a-z]+(\s|>|\/)/,jsxOpeningTag:/<[A-Z]\w*(\s.*)?>/,jsxClosingTag:/<\/[A-Z]\w*>/,htmlOpeningTag:/<[a-z]+(\s.*)?>/,htmlClosingTag:/<\/[a-z]+>/,jsdocComment:/^\s*[*\s]*$/};function Dr(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&/^[a-zA-Z]/.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||/\.[A-Za-z_][A-Za-z0-9_]*\(/.test(t)||/[{}[\]()`=<>]/.test(t)||/:\s*(['"`[{(]|\w+\s*=>)/.test(t)||/\bif\s*\(|\belse\b|=>/.test(t)?!1:!!(t.includes(":")&&/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/.test(t))}var Lr=[") {","return;",G.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",G.stringAssignment,");",G.objectPropertyWithQuotes,G.computedPropertyAssignment,G.kebabCaseProperty,G.snakeCaseProperty,"&&","||","()",G.ternaryOperator,G.colonWithWord,G.quotedString,G.numberWithComma,G.arrayWithComma,G.objectWithComma,G.methodCall,G.arrayAccess,"?.(","??","=>",G.quotedPropertyKey],_r=["/>","</",G.jsxSelfClosing,G.jsxElement,G.jsxOpeningTag,G.jsxClosingTag,G.htmlOpeningTag,G.htmlClosingTag],sn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],$r=jr({name:on,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(n,o){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||G.jsdocComment.test(n))return!1;for(let i of sn)if(a.startsWith(i))return!1;if(n.includes("https://")||Dr(a))return!1;if(o==="Block"){for(let i of _r)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 Mr)if(a.startsWith(i))return{wrongPattern:i};for(let i of Lr)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,o){let a=n,i=a.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let p=a.split(/```[\s\S]*?```/g);p.some(f=>/[a-zA-Z0-9]/.test(f))&&(a=p.join(""))}if(!a.includes("`"))return a;let s=a.split(/`[^`]*`/g);return s.some(p=>/[a-zA-Z0-9]/.test(p))?s.join(""):a}return{Program(){let o=e.sourceCode.getAllComments();for(let a of o){let i=r(a.value,a.type),s=t(i,a.type);s&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:sn.join(", ")}})}}}}}),ot={name:on,rule:$r};import{ESLintUtils as Ur,TSESTree as Wr}from"@typescript-eslint/utils";var Vr=Ur.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),an="no-default-export",zr=Vr({name:an,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===Wr.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),at={name:an,rule:zr};import{ESLintUtils as Hr}from"@typescript-eslint/utils";var Yr=Hr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ln="no-leaked-text-in-jsx",qr=[",",";","[","]","(",")"],Jr=Yr({name:ln,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="";qr.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),lt={name:ln,rule:Jr};import{AST_NODE_TYPES as Ne,ESLintUtils as Br}from"@typescript-eslint/utils";var Xr=Br.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cn="no-non-camel-case-functions",Gr=/^(\$?[a-z][a-zA-Z0-9]*)$/;function pn(e){if(e.typeName.type!==Ne.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Ne.Identifier&&t.name==="JSX"&&r.name==="Element"}var Kr=Xr({name:cn,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&&!Gr.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Ne.TSTypeReference?pn(r):r.type===Ne.TSUnionType&&r.types.some(o=>o.type===Ne.TSTypeReference&&pn(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),pt={name:cn,rule:Kr};import{ESLintUtils as Zr,TSESTree as H}from"@typescript-eslint/utils";import{AST_NODE_TYPES as un}from"@typescript-eslint/utils";function ke(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:ke(e.parent,t,r===1/0?r:r-1)}function*ct(e){yield e,e.parent&&(yield*ct(e.parent))}function ut(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function fn(e,t,r){let o=r.getDeclaredVariables(e).find(a=>a.name===t||a.identifiers[0]?.parent.type===un.Property&&a.identifiers[0]?.parent.key.type===un.Identifier&&a.identifiers[0]?.parent.key.name===t);return o?o.references.filter(a=>!a.init):[]}var Qr=Zr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mn="no-optional-root-props",ei=Qr({name:mn,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function t(n){let a=e.sourceCode.getDeclaredVariables(n)[0];if(!a||a.references.length!==1)return!1;let i=a.references[0];if(!i)return!1;for(let s of ct(i.identifier)){if("returnType"in s||s.type===H.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=s.parent;if(!l)return!1;if(l.type===H.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===H.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===H.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let c=ke(l.parent.parent,H.AST_NODE_TYPES.VariableDeclaration,4);if(!c)return!1;let f=We(c,e.sourceCode);return f?!(f.parent.type===H.AST_NODE_TYPES.CallExpression&&f.parent.callee.type===H.AST_NODE_TYPES.Identifier&&f.parent.callee.name==="memo"):!1}if(s.type===H.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===H.AST_NODE_TYPES.ArrowFunctionExpression){let p=ke(l,H.AST_NODE_TYPES.VariableDeclaration);return p?!!We(p,e.sourceCode):!1}if(l.type===H.AST_NODE_TYPES.FunctionDeclaration)return!!We(l,e.sourceCode)}return!1}function r(n){n.key.type!==H.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:o=>{let a=ke(n,H.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let i=e.sourceCode.getText(a);return o.replaceText(a,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===H.AST_NODE_TYPES.TSTypeLiteral&&!(Ve(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===H.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(Ve(n)||!t(n)))for(let o of n.body.body)o.type===H.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(n){if(n.typeName.type!==H.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==H.AST_NODE_TYPES.TSTypeLiteral)return;let a=ke(n.parent,H.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let i=We(a,e.sourceCode);if(!(!i||i.parent.type===H.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===H.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of o.members)l.type===H.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function Ve(e){return e?e.parent?.type===H.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===H.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function We(e,t){if(Ve(e))return;let r;if(e.type===H.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===H.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===H.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let o=n.variables.find(i=>i.identifiers.includes(r));if(!o)return;let a=o.references.filter(i=>i.identifier!==r);if(!(a.length!==1||!a[0])&&!Ve(a[0].identifier.parent.parent))return a[0].identifier}var ft={name:mn,rule:ei};var je=B({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){return{ExportNamedDeclaration(t){t.source&&e.report({node:t,messageId:"noReexport"})},ExportAllDeclaration(t){e.report({node:t,messageId:"noReexport"})}}}});import{ESLintUtils as ti}from"@typescript-eslint/utils";import mt from"node:path";var ni=ti.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),dn="no-relative-imports",ri=z({find:V(),replacement:V()}),ii=z({aliases:Q(ri),rootDir:_(V()),allowNotFoundAliases:_(Re()),_dev_simulateFileName:_(V())}),si=ni({name:dn,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:[ii]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function o(i,s){let l=mt.dirname(s);return mt.resolve(l,i)}function a(i){let s=t.rootDir??process.cwd(),l=mt.relative(s,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:c}of t.aliases)if(l.startsWith(c)){let f=l.replace(c,p);return{alias:p,newPath:f}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!n(s))return;let l=o(s,r),p=a(l);!p&&t.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?c=>c.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),dt={name:dn,rule:si};import{AST_NODE_TYPES as ze}from"@typescript-eslint/utils";import*as we from"zod/v4";var oi=we.object({alternativeMsgs:we.object({inArrayFind:we.string().optional(),inArrayFilter:we.string().optional()}).optional(),__dev_simulateFileName:we.string().optional()});function ai(e){return e.typeAnnotation.type!==ze.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}function li(e){return/\.(typeGuards|type-guards)\.(ts|tsx)$/.test(e)}function pi(e){let t=e.parent;for(;t;){if(t.type===ze.CallExpression&&t.callee.type===ze.MemberExpression&&t.callee.property.type===ze.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var yt=B({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:[Ie(oi)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(li(r))return{};function n(o){if(!ai(o))return;let a=pi(o),i=[];if(t.alternativeMsgs&&a){let s=a.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(s){let l=a.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:l,data:{message:s}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});import{AST_NODE_TYPES as Oe}from"@typescript-eslint/utils";var ci="no-unnecessary-async-on-jsx-props";function ui(e){if(e.body.type!==Oe.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let r=t[0];return!r||r.type!==Oe.ExpressionStatement?!1:r.expression.type===Oe.AwaitExpression}var gt=B({name:ci,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){ui(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,a=[],i=o.getFirstToken(r,l=>l.value==="async");if(i){let l=o.getTokenAfter(i);l?a.push(n.replaceTextRange([i.range[0],l.range[0]],"")):a.push(n.remove(i))}function s(l){if(l.type===Oe.AwaitExpression){let p=o.getFirstToken(l);if(p&&p.value==="await"){let c=o.getTokenAfter(p);c?a.push(n.replaceTextRange([p.range[0],c.range[0]],"")):a.push(n.remove(p))}}if(l.type===Oe.BlockStatement)for(let p of l.body)s(p);else l.type===Oe.ExpressionStatement&&s(l.expression)}return s(r.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});import{AST_NODE_TYPES as Me,ESLintUtils as gn}from"@typescript-eslint/utils";import*as St from"typescript";var fi=gn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yn="no-unnecessary-casting",mi=z({additionalCastFunctions:_(Q(z({name:V(),expectedType:Ut(["string","number"])})))}),Tt={name:yn,rule:fi({name:yn,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:[mi],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=gn.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function i(c,f){switch(c.type){case Me.Literal:return f==="number"?typeof c.value=="number":typeof c.value=="string";case Me.TemplateLiteral:return f==="string";case Me.UnaryExpression:return f==="number"?c.operator==="+"||c.operator==="-"||c.operator==="~":!1;default:return!1}}function s(c,f){return f==="number"?!!(c.flags&St.TypeFlags.NumberLike):!!(c.flags&St.TypeFlags.StringLike)}function l(c,f){return y=>y.replaceText(c,e.sourceCode.getText(f))}function p(c){if(!a||c.arguments.length!==1)return;let f=c.arguments[0];if(!f||f.type===Me.SpreadElement)return;let{callee:y}=c;if(y.type!==Me.Identifier)return;let T=y.name,I=n.find(E=>E.name===T);if(!I)return;if(i(f,I.expectedType)||s(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(f)),I.expectedType)){let E,u;T==="Number"?E="unnecessaryNumberCasting":T==="String"?E="unnecessaryStringCasting":(E="unnecessaryCustomCasting",u={name:I.name,type:I.expectedType}),e.report({node:c,messageId:E,...u?{data:u}:{},fix:l(c,f)})}}return{CallExpression:p}}})};import{AST_NODE_TYPES as He}from"@typescript-eslint/utils";import*as pe from"zod/v4";var di=pe.object({methods:pe.union([pe.array(pe.string()),pe.literal("array")])}),ht=B({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:[pe.toJSONSchema(di)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(r)?r.includes(s):n.has(s)}function a(s){let{callee:l}=s;if(l.type===He.MemberExpression){let p=l.property;if(p.type===He.Identifier)return p.name}return null}function i(s,l){if(s.type!==He.Identifier||!s.typeAnnotation)return;let p=l.parent;if(p.type===He.CallExpression){let c=a(p);c&&o(c)&&p.arguments.indexOf(l)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(y){return y.remove(s.typeAnnotation)}})}}return{ArrowFunctionExpression(s){for(let l of s.params)i(l,s)},FunctionExpression(s){for(let l of s.params)i(l,s)}}}});import{AST_NODE_TYPES as ae}from"@typescript-eslint/utils";var Et=B({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===ae.ObjectPattern||!t.init||t.init.type!==ae.ObjectExpression||t.id.type===ae.Identifier&&t.id.typeAnnotation||t.parent.parent.type===ae.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===ae.Property&&i.key.type===ae.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==ae.Identifier)return;let n=yi(t,e.sourceCode);if(n.length===0)return;let o=t.init.properties.some(i=>i.type!==ae.Property?!1:i.value.type===ae.FunctionExpression),a=new Set;for(let i of n){if(i.identifier.parent.type!==ae.MemberExpression)return;let s=i.identifier.parent;if(s.object!==i.identifier)return;if(s.computed)if(s.property.type===ae.Literal&&typeof s.property.value=="string")a.add(s.property.value);else return;else{if(s.property.type!==ae.Identifier)return;a.add(s.property.name)}if(s.parent.type===ae.CallExpression&&o)return}for(let[i,s]of r)a.has(i)||e.report({node:s,messageId:"unusedObjectProperty",data:{name:i}})}}}});function yi(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):[]}import{AST_NODE_TYPES as q,ESLintUtils as gi}from"@typescript-eslint/utils";var Si=z({selectors:Q(z({name:V(),selectorProp:_(V()),selectorArgPos:_(ge()),returnProp:_(V())}))}),Ti=gi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sn="no-unused-selected-values",bt={name:Sn,rule:Ti({name:Sn,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[Si]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===q.CallExpression&&(a=o.init),!a)return;let i=Ei(a);if(!i)return;let s=n.get(i);if(!s)return;let l=hi(a,s.selectorArgPos??0,s.selectorProp);if(!l)return;let p=bi(l);if(!p)return;let c=Tn(p.properties,void 0);if(!c)return;if(o.id.type===q.ObjectPattern){let T=Tn(o.id.properties,s.returnProp);if(!T)return;for(let[I,x]of c)T.has(I)||e.report({node:x,messageId:"unusedSelectedValue",data:{name:I}});return}if(o.id.type!==q.Identifier||s.returnProp)return;let f=xi(o,e.sourceCode);if(f.length===0)return;let y=new Set;for(let T of f){if(T.identifier.parent.type!==q.MemberExpression)return;let I=T.identifier.parent.property;if(I.type!==q.Identifier)return;y.add(I.name)}for(let[T,I]of c)y.has(T)||e.report({node:I,messageId:"unusedSelectedValue",data:{name:T}})}}}})};function hi(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===q.ArrowFunctionExpression||n.type===q.FunctionExpression)return n;if(r&&n.type===q.ObjectExpression){let o=n.properties.find(i=>i.type===q.Property&&i.key.type===q.Identifier&&i.key.name===r);if(o?.type!==q.Property)return null;let a=o.value;if(a.type===q.ArrowFunctionExpression||a.type===q.FunctionExpression)return a}return null}function Ei(e){return e.callee.type===q.Identifier?e.callee.name:e.callee.type===q.MemberExpression&&e.callee.property.type===q.Identifier?e.callee.property.name:null}function bi(e){if(e.body.type===q.ObjectExpression)return e.body;if(e.body.type===q.BlockStatement){let t=e.body.body.filter(r=>r.type===q.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==q.ObjectExpression?null:t[0].argument}return null}function Tn(e,t){let r=e;if(t){let o=e.find(a=>a.type===q.Property&&a.key.type===q.Identifier&&a.key.name===t);if(o?.type!==q.Property||o.value.type!==q.ObjectPattern)return null;r=o.value.properties}let n=new Map;for(let o of r){if(o.type!==q.Property||o.key.type!==q.Identifier)return null;n.set(o.key.name,o)}return n.size>0?n:null}function xi(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):[]}import{AST_NODE_TYPES as Y}from"@typescript-eslint/utils";var xt=B({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(a=>a.type===Y.ImportDeclaration&&a.source.value==="t-state-form"))return{};let n=null,o=!1;return{CallExpression(a){if(o)return;if(!n){let s=Ii(a);s&&(n=s);return}let i=Ci(a,e.sourceCode);if(i){o=!0;for(let s of i)n.delete(s);if(n.size!==0)for(let[s,l]of n)e.report({node:l,messageId:"unusedField",data:{name:s}})}}}}});function Ii(e){if(!(e.callee.type===Y.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==Y.ObjectExpression)return null;let n=ut(r.properties,a=>a.type!==Y.Property||a.key.type!==Y.Identifier||a.key.name!=="initialConfig"?null:a.value.type===Y.ObjectExpression?a.value:a.value.type===Y.ArrowFunctionExpression||a.value.type===Y.FunctionExpression?wi(a.value):null);if(!n)return null;let o=new Map;for(let a of n.properties)a.type===Y.Property&&a.key.type===Y.Identifier&&o.set(a.key.name,a);return o}function Ci(e,t){if(!(e.callee.type===Y.Identifier&&e.callee.name==="useFormState")||e.parent.type!==Y.VariableDeclarator||e.parent.id.type!==Y.ObjectPattern||!ut(e.parent.id.properties,i=>i.type===Y.Property&&i.key.type===Y.Identifier&&i.key.name==="formFields"&&i))return null;let o=fn(e.parent,"formFields",t),a=new Set;for(let{identifier:i}of o){if(i.type!==Y.Identifier||i.parent.type===Y.Property&&i.parent.parent.type===Y.ObjectExpression&&i.parent.parent.parent.type===Y.ReturnStatement||i.parent.type===Y.ReturnStatement)return null;if(i.parent.type===Y.MemberExpression){if(i.parent.object.type!==Y.Identifier||i.parent.property.type!==Y.Identifier)return null;a.add(i.parent.property.name)}}return a}function wi(e){if(e.body.type===Y.ObjectExpression)return e.body;if(e.body.type===Y.BlockStatement){let t=e.body.body.filter(r=>r.type===Y.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==Y.ObjectExpression?null:t[0].argument}return null}import{AST_NODE_TYPES as U,ESLintUtils as Ai}from"@typescript-eslint/utils";var Ri=Ai.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function hn(e){let t=[];for(let r of e.members)r.type===U.TSPropertySignature&&r.key.type===U.Identifier&&t.push([r.key.name,r]);return t}function En(e,...t){for(let r of t)e.set(...r);return e}var vi=z({forceCheckOnFCPropTypesWithName:_(Q(V()))}),bn="no-unused-type-props-in-args",It=null,ki=Ri({name:bn,meta:{type:"problem",docs:{description:"Disallow unused undestructured object type properties"},messages:{unusedObjectTypeProperty:"Object type property '{{ propertyName }}' is defined but never used",missingComponentParam:"Component has declared props but no props are used"},schema:[vi],fixable:"code"},defaultOptions:[{}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r}=t;r&&!It&&(It=r.map(s=>new RegExp(s)));function n(s,l,p,c,f=!0){let y=p.name,T=e.sourceCode.getScope(l).references.find(E=>E.identifier.name===y)?.resolved,I=s&&It?.some(E=>E.test(y));if(!T||!I&&T.references.filter(E=>E.isTypeReference).length>1)return;let x=T?.defs[0]?.node;if(!(f&&x?.parent?.type===U.ExportNamedDeclaration)){if(x?.type===U.TSTypeAliasDeclaration){o(s,l,c,x.typeAnnotation,!0);return}if(x?.type===U.TSInterfaceDeclaration){o(s,l,c,x.body,!0);return}}}function o(s,l,p,c,f){if(c.type===U.TSInterfaceBody){for(let y of c.body)y.type===U.TSPropertySignature&&y.key.type===U.Identifier&&p.set(y.key.name,y);return}if(c.type===U.TSTypeLiteral){En(p,...hn(c));return}if(c.type===U.TSIntersectionType){for(let y of c.types)o(s,l,p,y,!0);return}f||c.type===U.TSTypeReference&&c.typeName.type===U.Identifier&&n(s,l,c.typeName,p)}function a(s,l,p){for(let c of p)if(c.type==="ObjectPattern"&&c.typeAnnotation){let f=new Map;if(o(s,l,f,c.typeAnnotation.typeAnnotation,!1),f.size===0)continue;i(c,f)}else c.type===U.AssignmentPattern&&c.left.type===U.ObjectPattern&&a(s,l,[c.left])}function i(s,l){let p=[];if(s.properties.at(-1)?.type===U.RestElement)return;for(let T of s.properties)T.type===U.Property&&T.key.type===U.Identifier&&p.push(T.key.name);let f=[],y=[];for(let[T,I]of l)p.includes(T)||(y.push(T),f.push({node:I,messageId:"unusedObjectTypeProperty",data:{propertyName:T}}));for(let[T,I]of f.entries())e.report({...I,fix:T===f.length-1?x=>{let E=s.properties.at(-1),u=y.join(", ");return E?E?.type===U.RestElement?null:x.insertTextAfter(E,`, ${u}`):x.insertTextBeforeRange([s.range[0]+1,s.range[1]],`${u}`)}:void 0})}return{VariableDeclaration(s){let l=s.declarations[0];if(!l)return;let p=new Map,c=l.id.type===U.Identifier&&l.id.typeAnnotation?.typeAnnotation.type===U.TSTypeReference&&l.id.typeAnnotation.typeAnnotation.typeName.type===U.Identifier&&l.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&l.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(c){if(c.type===U.TSTypeReference&&c.typeName.type===U.Identifier)n(!0,s,c.typeName,p,!1);else if(c.type===U.TSTypeLiteral)En(p,...hn(c));else if(c.type===U.TSIntersectionType)for(let f of c.types)f.type===U.TSTypeReference&&f.typeName.type===U.Identifier?n(!0,s,f.typeName,p,!1):o(!0,s,p,f,!0);if(p.size!==0&&l.init?.type===U.ArrowFunctionExpression){let f=l.init.params[0];if(!f){e.report({node:l.init,messageId:"missingComponentParam"});return}f.type===U.ObjectPattern&&i(f,p)}}},FunctionDeclaration:function(s){a(!1,s,s.params)},ArrowFunctionExpression(s){a(!1,s,s.params)}}}}),Ct={name:bn,rule:ki};import{AST_NODE_TYPES as de}from"@typescript-eslint/utils";var wt=B({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.Identifier?t.has(n.callee.name):n.callee.type===de.MemberExpression&&n.callee.object.type===de.Identifier&&n.callee.property.type===de.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let o of n.specifiers)o.type===de.ImportSpecifier&&o.imported.type===de.Identifier&&o.imported.name==="useRef"&&t.add(o.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===de.CallExpression&&r(n.init)&&n.id.type===de.Identifier){let a=e.sourceCode.getScope(n).set.get(n.id.name);if(a){let i=!1;for(let s of a.references){let p=s.identifier.parent;if(p!==n&&!(p.type===de.JSXExpressionContainer&&p.parent.type===de.JSXAttribute&&p.parent.name.type===de.JSXIdentifier&&p.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});import{AST_NODE_TYPES as At,ESLintUtils as Oi}from"@typescript-eslint/utils";var Pi=Oi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),In="prefer-named-functions",xn=new Map,Fi=Pi({name:In,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=xn.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),xn.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===At.ArrowFunctionExpression&&n.id.type===At.Identifier){let o=n.id.name;if(n.id.typeAnnotation||r&&r.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==At.BlockStatement)return;let a=n.parent,i=n.init.params,s=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(a,`${l.async?"async ":""}function ${o}(${i.map(c=>e.sourceCode.getText(c)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),Rt={name:In,rule:Fi};import{AST_NODE_TYPES as M}from"@typescript-eslint/utils";var Ni=z({disallowedFunctions:Q(z({name:V(),allowUsingWithArgs:_(Re()),hookAlternative:_(V()),message:_(V()),allowUseInside:_(Q(V()))}))});function Ye(e){return/^use[A-Z]/.test(e)}function Cn(e){return/^[A-Z]/.test(e)}function ji(e){return e.type===M.Identifier?Ye(e.name):e.type===M.MemberExpression&&e.property.type===M.Identifier?Ye(e.property.name):!1}function wn(e,t){return e.type===M.Identifier?e.name===t:e.type===M.MemberExpression&&e.object.type===M.Identifier&&e.property.type===M.Identifier?e.object.name==="React"&&e.property.name===t:!1}function An(e){return!!(e.parent&&e.parent.type===M.CallExpression&&wn(e.parent.callee,"forwardRef"))}function Rn(e){return!!(e.parent&&e.parent.type===M.CallExpression&&wn(e.parent.callee,"memo"))}function vt(e){if(e.type===M.FunctionDeclaration||e.type===M.FunctionExpression&&e.id)return e.id||void 0;if(e.type===M.FunctionExpression||e.type===M.ArrowFunctionExpression){if(e.parent.type===M.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===M.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===M.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===M.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Mi(e){let t=e.parent,r=!1;for(;t;){if(t.type===M.FunctionDeclaration||t.type===M.FunctionExpression||t.type===M.ArrowFunctionExpression){let n=vt(t);if(n&&n.type===M.Identifier){if(Cn(n.name)||Ye(n.name))return!r;r=!0}else{if(An(t)||Rn(t))return!r;if(t.parent.type===M.CallExpression){let o=t.parent;ji(o.callee)||(r=!0)}else t.parent.type===M.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function vn(e){return e.callee.type===M.Identifier?e.callee.name:e.callee.type===M.MemberExpression&&e.callee.property.type===M.Identifier?e.callee.property.name:null}function Di(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===M.FunctionDeclaration||r.type===M.FunctionExpression||r.type===M.ArrowFunctionExpression){let n=vt(r);if(n&&n.type===M.Identifier&&t.includes(n.name))return!0}else if(r.type===M.CallExpression){let n=vn(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function Li(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===M.Identifier&&t.name==="undefined")}function _i(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===M.FunctionDeclaration||n.type===M.FunctionExpression||n.type===M.ArrowFunctionExpression){let o=vt(n);if(o&&o.type===M.Identifier){if(Cn(o.name)||Ye(o.name)){r=!0;break}}else if(An(n)||Rn(n)){r=!0;break}}n=n.parent}return r?t.length===0?Mi(e):!Di(e,t):!1}var kt=B({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:[Ni],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let a=vn(o);if(!a)return;let i=n.get(a);if(!i||i.allowUsingWithArgs&&Li(o))return;let s=i.allowUseInside||[];_i(o,s)&&e.report({node:o,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:l=>{let p=i.hookAlternative;return o.callee.type===M.Identifier?l.replaceText(o.callee,p):o.callee.type===M.MemberExpression&&o.callee.property.type===M.Identifier?l.replaceText(o.callee.property,p):null}}]:[]})}}}});import{AST_NODE_TYPES as K,AST_TOKEN_TYPES as kn,ESLintUtils as $i}from"@typescript-eslint/utils";var Ui=$i.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pn="prefer-single-line-if",Wi=z({maxLineLength:_(ge()),maxNonSimpleConditionLength:_(ge())}),Vi=Ui({name:Pn,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:[Wi]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==K.BlockStatement||n.loc.start.line===n.loc.end.line||r.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let a=n.consequent.body[0];if(a.type===K.ReturnStatement){if(!Nn(a))return}else if(!(a.type===K.ContinueStatement||a.type===K.BreakStatement))return;if(n.test.type===K.LogicalExpression||n.test.type===K.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let f=On(n.test);if(!f&&n.test.type===K.UnaryExpression&&n.test.operator==="!"){let y=n.test.argument;On(y)&&(f=!0)}if(f&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let s=r.getText(a);if(i.includes(`
16
+ `))return;let l=r.getTokenAfter(n);if(l&&l.type===kn.Punctuator&&l.value==="}"){let f=r.getTokenAfter(l);if(f&&f.type===kn.Keyword&&(f.value==="else"||f.value==="catch"))return}let p=zi(r,n),c=`if (${i}) ${s}`;t.maxLineLength&&c.length+p.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:f=>f.replaceText(n,c)})}}}});function On(e){return e.type===K.CallExpression||e.type===K.BinaryExpression||e.type===K.MemberExpression&&Fn(e)}function Fn(e){return e.object.type===K.MemberExpression?Fn(e.object):e.object.type!==K.Identifier}function zi(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Nn(e){if(!e.argument)return!0;let t=e.argument;return t.type===K.ArrayExpression&&t.elements.length===0||t.type===K.ObjectExpression&&t.properties.length===0||t.type===K.Literal||t.type===K.Identifier||t.type===K.TemplateLiteral||t.type===K.TaggedTemplateExpression?!0:t.type===K.CallExpression?t.arguments.length===0:t.type===K.UnaryExpression?Nn(t):!1}var Ot={name:Pn,rule:Vi};import{AST_NODE_TYPES as ce,ESLintUtils as Hi}from"@typescript-eslint/utils";var Yi=Hi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),jn="react-compiler-migration",qi=z({disallowHooks:_(Q(z({name:V(),replacement:V()}))),disallowMethods:_(Q(z({name:V(),replacement:_(V()),requireTrueProp:_(V())})))}),Ji=/eslint +react-compiler\/react-compiler: +\["error/;function Bi(e){return e.type===ce.Identifier?e.name.startsWith("use"):e.type===ce.MemberExpression&&e.property.type===ce.Identifier?e.property.name.startsWith("use"):!1}var Xi=Yi({name:jn,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:[qi]},defaultOptions:[{}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(Ji.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let o=null,a=null;if(n.callee.type===ce.Identifier?(o=n.callee.name,a=n.callee):n.callee.type===ce.MemberExpression&&n.callee.property.type===ce.Identifier&&(o=n.callee.property.name,a=n.callee.property),o){let i=t.disallowHooks.find(s=>s.name===o);i&&a&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:s=>s.replaceText(a,i.replacement)}]})}}if(t.disallowMethods?.length&&Bi(n.callee)){for(let o of n.arguments)if(o.type===ce.ObjectExpression){for(let a of o.properties)if(a.type===ce.Property&&a.key.type===ce.Identifier){let i=a.key.name,s=t.disallowMethods.find(l=>l.name===i);if(s){if(s.requireTrueProp){let l=s.requireTrueProp,p=!1;for(let c of o.properties)if(c.type===ce.Property&&c.key.type===ce.Identifier&&c.key.name===l&&c.value.type===ce.Literal&&c.value.value===!0){p=!0;break}if(!p){e.report({node:a,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:s.name,requireTrueProp:l}});continue}}s.replacement&&e.report({node:a,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:s.name,replacement:s.replacement},suggest:[{messageId:"replace",data:{replacement:s.replacement},fix:l=>l.replaceText(a.key,s.replacement)}]})}}}}}}:{}}}),Pt={name:jn,rule:Xi};import{ESLintUtils as Gi,TSESTree as Ki}from"@typescript-eslint/utils";var Zi=Gi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mn="require-description",Qi=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,es=/^eslint-disable-(next-)?line$/u,ts=Zi({name:Mn,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of r.getAllComments()){let a=ns(o);a!=null&&(n.has(a.kind)||a.description||e.report({loc:is(o.loc),messageId:"missingDescription"}))}}}}}),Dn={name:Mn,rule:ts};function ns(e){let{text:t,description:r}=rs(e.value);if(!t)return null;let n=Qi.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let a=es.test(o);if(e.type===Ki.AST_TOKEN_TYPES.Line&&!a||a&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+o.length);return{kind:o,value:i.trim(),description:r}}function rs(e){let t=e.split(/\s-{2,}\s/u);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function is(e){return{start:{line:e.start.line,column:-1},end:e.end}}import{AST_NODE_TYPES as L}from"@typescript-eslint/utils";import{z as Ee}from"zod/v4";var ss=Ee.object({varsToCheck:Ee.array(Ee.object({selector:Ee.string().optional(),fromFnCall:Ee.string().optional(),prop:Ee.string().or(Ee.array(Ee.string())),errorMsg:Ee.string().optional()}))}),Ft=B({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:[Ie(ss)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map,n=(i,s,l,p)=>{let c=new Set;for(let y of i.properties)y.type===L.Property&&y.key.type===L.Identifier&&c.add(y.key.name);let f=s.filter(y=>!c.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(T=>`"${T}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:p,customMsg:l||""}})}},o=i=>{if(i.init?.type===L.CallExpression){if(i.init.callee.type===L.Identifier)return i.init.callee.name;if(i.init.callee.type===L.MemberExpression&&i.init.callee.property.type===L.Identifier)return i.init.callee.object.type===L.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"},a={};for(let i of t.varsToCheck)i.selector&&(a[i.selector]=s=>{if(s.type===L.VariableDeclarator&&s.id.type===L.Identifier&&r.set(s.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:s.id,fnName:o(s)}),s.type===L.VariableDeclarator&&s.id.type===L.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(s.id,l,i.errorMsg,o(s))}});for(let i of t.varsToCheck)if(i.fromFnCall){let s=i.fromFnCall;if(s.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${s.slice(2)}"]`;a[p]=c=>{if(c.type!==L.MemberExpression||c.parent.type!==L.CallExpression)return;let f=c.parent;if(f.parent.type!==L.VariableDeclarator)return;let y=f.parent;if(y.id.type===L.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===L.ObjectPattern){let T=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,T,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(s.includes(".")){let[l,p]=s.split("."),c=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;a[c]=f=>{if(f.type!==L.MemberExpression||f.parent.type!==L.CallExpression)return;let y=f.parent;if(y.parent.type!==L.VariableDeclarator)return;let T=y.parent;if(T.id.type===L.Identifier)r.set(T.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:T.id,fnName:i.fromFnCall||"unknown function"});else if(T.id.type===L.ObjectPattern){let I=Array.isArray(i.prop)?i.prop:[i.prop];n(T.id,I,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${s}"]`;a[l]=p=>{if(p.type!==L.Identifier||p.parent.type!==L.CallExpression)return;let c=p.parent;if(c.parent.type!==L.VariableDeclarator)return;let f=c.parent;if(f.id.type===L.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===L.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];n(f.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...a,"Program:exit"(){for(let[i,{props:s,errorMsg:l,node:p,fnName:c}]of r){let y=e.sourceCode.getScope(p).set.get(i);if(y){let T=new Set(s);for(let I of y.references){let x=I.identifier,E=x.parent;if(!(E.type===L.VariableDeclarator&&E.id===x)){if(E.type===L.MemberExpression&&E.object===x&&E.property.type===L.Identifier&&T.has(E.property.name)){if(T.delete(E.property.name),T.size===0)break;continue}if(E.type===L.VariableDeclarator&&E.init===x&&E.id.type===L.ObjectPattern){for(let u of E.id.properties)u.type===L.Property&&u.key.type===L.Identifier&&T.has(u.key.name)&&T.delete(u.key.name);if(T.size===0)break;continue}if(!(E.type===L.MemberExpression&&E.object===x&&E.property.type===L.Identifier&&!s.includes(E.property.name))){T.clear();break}}}if(T.size>0){let I=Array.from(T);if(I.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:I[0],fnName:c,customMsg:l||""}});else{let x=I.map(E=>`"${E}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:x,fnName:c,customMsg:l||""}})}}}}}}}});function $n(e){return/^use[A-Z0-9]/.test(e)}function qe(e){return e.type==="Identifier"?$n(e.name):e.type==="MemberExpression"&&!e.computed&&qe(e.property)?e.object.type==="Identifier":!1}function Un(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Wn(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Vn(e){return!!(e.parent&&e.parent.callee&&Wn(e.parent.callee,"forwardRef"))}function zn(e){return!!(e.parent&&e.parent.callee&&Wn(e.parent.callee,"memo"))}function Nt(e){for(;e;){let t=Yn(e);if(t&&(Un(t)||qe(t))||Vn(e)||zn(e))return!0;e=e.parent}return!1}function Ln(e){return!1}function jt(e){return!1}var os=/eslint +react-compiler\/react-compiler: +\["error/,Hn={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let l of e.sourceCode.getAllComments())if(os.test(l.value))return{CallExpression(p){let c=null;p.callee.name==="useMemo"?c="useMemo":p.callee.name==="useCallback"&&(c="useCallback"),c&&e.report({node:p,message:`"${c}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?l=>t(l):l=>e.sourceCode.getText(l),r=typeof e.getScope=="function"?()=>r():l=>e.sourceCode.getScope(l),n=null,o=[],a=[],i=new WeakSet;function s(l){for(let p of l.references){let c=p.identifier.parent;if(c.type==="VariableDeclarator"&&c.init&&c.init.type==="CallExpression"&&c.init.callee&&Ln(c.init.callee))for(let f of p.resolved.references)f!==p&&i.add(f.identifier)}}return{onCodePathSegmentStart:l=>a.push(l),onCodePathSegmentEnd:()=>a.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(l,p){let c=o.pop();if(c.size===0)return;let f=new Set;function y(g,m){let{cache:S}=y,k=S.get(g.id),A=new Set(m);if(A.has(g.id)){let C=[...A],N=C.slice(C.indexOf(g.id)+1);for(let W of N)f.add(W);return BigInt("0")}if(A.add(g.id),k!==void 0)return k;if(l.thrownSegments.includes(g))k=BigInt("0");else if(g.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let C of g.prevSegments)k+=y(C,A)}return g.reachable&&k===BigInt("0")?S.delete(g.id):S.set(g.id,k),k}function T(g,m){let{cache:S}=T,k=S.get(g.id),A=new Set(m);if(A.has(g.id)){let C=Array.from(A),N=C.slice(C.indexOf(g.id)+1);for(let W of N)f.add(W);return BigInt("0")}if(A.add(g.id),k!==void 0)return k;if(l.thrownSegments.includes(g))k=BigInt("0");else if(g.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let C of g.nextSegments)k+=T(C,A)}return S.set(g.id,k),k}function I(g){let{cache:m}=I,S=m.get(g.id);if(S===null)return 1/0;if(S!==void 0)return S;if(m.set(g.id,null),g.prevSegments.length===0)S=1;else{S=1/0;for(let k of g.prevSegments){let A=I(k);A<S&&(S=A)}S+=1}return m.set(g.id,S),S}y.cache=new Map,T.cache=new Map,I.cache=new Map;let x=T(l.initialSegment),E=Yn(p),u=Nt(p),R=E?Un(E)||qe(E):Vn(p)||zn(p),b=1/0;for(let g of l.finalSegments){if(!g.reachable)continue;let m=I(g);m<b&&(b=m)}for(let[g,m]of c){if(!g.reachable)continue;let S=g.nextSegments.length===0?b<=I(g):b<I(g),k=y(g)*T(g),A=f.has(g.id);for(let C of m)if(A&&!jt(C)&&e.report({node:C,message:`React Hook "${t(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.`}),R){if(p.async&&e.report({node:C,message:`React Hook "${t(C)}" cannot be called in an async function.`}),!A&&k!==x&&!jt(C)){let W=`React Hook "${t(C)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(S?" Did you accidentally call a React Hook after an early return?":"");e.report({node:C,message:W})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let N=`React Hook "${t(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:N})}else if(E){let N=`React Hook "${t(C)}" is called in function "${t(E)}" 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:N})}else if(p.type==="Program"){let N=`React Hook "${t(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:N})}else if(u&&!jt(C)){if(p.parent.type==="CallExpression"&&p.parent.callee.type==="Identifier"&&p.parent.callee.name==="useCallback"){let W=p.parent;if(W.parent.type==="VariableDeclarator"&&$n(W.parent.id.name))return}let N=`React Hook "${t(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:N})}}},CallExpression(l){if(qe(l.callee)){let p=_n(o),c=_n(a),f=p.get(c);f||(f=[],p.set(c,f)),f.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||Ln(l.callee))&&l.arguments.length>0&&(n=l)},Identifier(l){n==null&&i.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${t(l)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(l){l===n&&(n=null)},FunctionDeclaration(l){Nt(l)&&s(r(l))},ArrowFunctionExpression(l){Nt(l)&&s(r(l))}}}};function Yn(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 _n(e){return e[e.length-1]}import{AST_NODE_TYPES as ne,AST_TOKEN_TYPES as as}from"@typescript-eslint/utils";import*as oe from"zod/v4";var ls=oe.object({indent:oe.union([oe.string().regex(/^\s+$/),oe.number().int().min(1)]).optional(),tags:oe.array(oe.string()).optional(),functions:oe.array(oe.string()).optional(),comments:oe.array(oe.string()).optional()}),Mt=B({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[Ie(ls)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:a}=e.options[0],i=r.map(u=>u.toLowerCase());function s(u){let R=u.split(/\r?\n/),b=R.filter(m=>m.trim()!=="");if(b.length===0)return u;let g=Number.POSITIVE_INFINITY;for(let m of b){let S=m.match(/^(\s*)/);S&&(g=Math.min(g,S[1]?.length??0))}return!isFinite(g)||g===0?u:R.map(m=>m.slice(g)).join(`
17
17
  `)}function l(u,R,b){return u.split(/\r?\n/).map(m=>m.trim()===""?m:b.repeat(R)+m).join(`
18
18
  `)}function p(u){if(u.type===ne.Identifier)return u.name;if(u.type===ne.MemberExpression){let R=u.object.type===ne.Identifier?u.object.name:null,b=u.property.type===ne.Identifier?u.property.name:null;return R&&b?`${R}.${b}`:b}return null}function c(u,R){if(!u)return!1;for(let b of R)if(b.includes(".")){let g=b.split(".");if(u.type===ne.MemberExpression&&u.object.type===ne.Identifier&&u.property.type===ne.Identifier&&u.object.name===g[0]&&u.property.name===g[1])return!0}else if(u.type===ne.Identifier&&u.name===b)return!0;return!1}function f(u,R){let b=u.parent;if(b.type!==ne.TaggedTemplateExpression)return!1;let g=p(b.tag);return g?R.includes(g):!1}function y(u,R){if(!u||u.type!==ne.CallExpression)return!1;let{method:b,argumentsLength:g,optionalCall:m=!0,optionalMember:S=!0}=R;return g!==void 0&&u.arguments.length!==g||!m&&u.optional||u.callee.type!==ne.MemberExpression||!S&&u.callee.optional||u.callee.property.type!==ne.Identifier?!1:u.callee.property.name===b}function T(u,R){if(!u||u.type!==ne.CallExpression)return!1;let{name:b,argumentsLength:g,optionalCall:m=!0}=R;return g!==void 0&&u.arguments.length!==g||!m&&u.optional||u.callee.type!==ne.Identifier?!1:u.callee.name===b}function I(u){return y(u.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&u.parent.type===ne.CallExpression&&u.parent.arguments[0]===u&&T(u.parent.callee.type===ne.MemberExpression?u.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function x(u){if(i.length>0){let R=t.getTokenBefore(u,{includeComments:!0});if(R?.type===as.Block&&i.includes(R.value.trim().toLowerCase()))return!0}return!!(I(u)||o.length>0&&f(u,o)||n.length>0&&u.parent.type===ne.CallExpression&&u.parent.arguments.includes(u)&&c(u.parent.callee,n))}function E(u){let R=`__PLACEHOLDER__${Math.random()}`,b=u.quasis.map(X=>t.getText(X).slice(1,X.tail?-1:-2)).join(R),g=b.match(/\r?\n/);if(!g)return;let m=g[0],S=t.lines[t.getLocFromIndex(u.range[0]).line-1];if(!S)return;let A=S.match(/^(\s*)\S/)?.[1]??"",C;typeof a=="string"?C=a:typeof a=="number"?C=" ".repeat(a):C=A.startsWith(" ")?" ":" ";let W=s(b).replace(new RegExp(`^${m}|${m}[ ]*$`,"g"),""),J=m+l(W,1,A+C)+m+A,te=b.includes(`\r
19
19
  `)?`\r
20
20
  `:`
21
- `,Z=b.split(/\r?\n/),be=Z.map((X,ye)=>ye!==Z.length-1&&X===C+A?"":X).join(te);if(J!==be)return{node:u,messageId:"improperlyIndented",fix:X=>J.split(R).map((ye,ue)=>{let ie=u.quasis[ue];return ie?X.replaceTextRange([ie.range[0]+1,ie.range[1]-(ie.tail?1:2)],ye):[]}).flat()}}return{TemplateLiteral(u){if(!x(u))return;let R=E(u);if(R)return e.report(R)}}}});import{AST_NODE_TYPES as qn}from"@typescript-eslint/utils";function ps(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function cs(e){let t=e.parent;return t?.type===qn.NewExpression&&t.callee.type===qn.Identifier&&t.callee.name==="RegExp"}var Dt=B({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){ps(r)||cs(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var Jn={[Ct.name]:Ct.rule,[st.name]:st.rule,[it.name]:it.rule,"rules-of-hooks":Hn,"exhaustive-deps":Gt,"require-description":Dn.rule,[ot.name]:ot.rule,[lt.name]:lt.rule,[Rt.name]:Rt.rule,[Ge.name]:Ge.rule,[rt.name]:rt.rule,[mt.name]:mt.rule,[dt.name]:dt.rule,[Ot.name]:Ot.rule,[ut.name]:ut.rule,[at.name]:at.rule,[Ze.name]:Ze.rule,[Pt.name]:Pt.rule,[Xe.name]:Xe.rule,[nt.name]:nt.rule,[Tt.name]:Tt.rule,[ht.name]:ht.rule,[bt.name]:bt.rule,[xt.name]:xt.rule,[Et.name]:Et.rule,[kt.name]:kt.rule,[gt.name]:gt.rule,[yt.name]:yt.rule,[Dt.name]:Dt.rule,[wt.name]:wt.rule,[Ft.name]:Ft.rule,[Mt.name]:Mt.rule};var tl={rules:Jn};export{tl as extendedLintPlugin};
21
+ `,Z=b.split(/\r?\n/),be=Z.map((X,ye)=>ye!==Z.length-1&&X===C+A?"":X).join(te);if(J!==be)return{node:u,messageId:"improperlyIndented",fix:X=>J.split(R).map((ye,ue)=>{let ie=u.quasis[ue];return ie?X.replaceTextRange([ie.range[0]+1,ie.range[1]-(ie.tail?1:2)],ye):[]}).flat()}}return{TemplateLiteral(u){if(!x(u))return;let R=E(u);if(R)return e.report(R)}}}});import{AST_NODE_TYPES as qn}from"@typescript-eslint/utils";function ps(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function cs(e){let t=e.parent;return t?.type===qn.NewExpression&&t.callee.type===qn.Identifier&&t.callee.name==="RegExp"}var Dt=B({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){ps(r)||cs(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var Jn={[Ct.name]:Ct.rule,[ot.name]:ot.rule,[st.name]:st.rule,"rules-of-hooks":Hn,"exhaustive-deps":Gt,"require-description":Dn.rule,[at.name]:at.rule,[pt.name]:pt.rule,[Rt.name]:Rt.rule,[Ke.name]:Ke.rule,[it.name]:it.rule,[dt.name]:dt.rule,[je.name]:je.rule,[Ot.name]:Ot.rule,[ft.name]:ft.rule,[lt.name]:lt.rule,[Qe.name]:Qe.rule,[Pt.name]:Pt.rule,[Ge.name]:Ge.rule,[rt.name]:rt.rule,[Tt.name]:Tt.rule,[ht.name]:ht.rule,[bt.name]:bt.rule,[xt.name]:xt.rule,[Et.name]:Et.rule,[kt.name]:kt.rule,[gt.name]:gt.rule,[yt.name]:yt.rule,[Dt.name]:Dt.rule,[wt.name]:wt.rule,[Ft.name]:Ft.rule,[Mt.name]:Mt.rule,[je.name]:je.rule};var tl={rules:Jn};export{tl as extendedLintPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ls-stack/extended-lint",
3
- "version": "0.57.0",
3
+ "version": "0.57.2",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"