@ls-stack/extended-lint 0.58.0 → 0.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- "use strict";var sn=Object.create;var Ye=Object.defineProperty;var on=Object.getOwnPropertyDescriptor;var an=Object.getOwnPropertyNames;var ln=Object.getPrototypeOf,pn=Object.prototype.hasOwnProperty;var cn=(e,t)=>{for(var n in t)Ye(e,n,{get:t[n],enumerable:!0})},Bt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of an(t))!pn.call(e,o)&&o!==n&&Ye(e,o,{get:()=>t[o],enumerable:!(r=on(t,o))||r.enumerable});return e};var ke=(e,t,n)=>(n=e!=null?sn(ln(e)):{},Bt(t||!e||!e.__esModule?Ye(n,"default",{value:e,enumerable:!0}):n,e)),un=e=>Bt(Ye({},"__esModule",{value:!0}),e);var ss={};cn(ss,{extendedLintPlugin:()=>is});module.exports=un(ss);var Z=require("@typescript-eslint/utils");var nt=Symbol.for("optional");function $(e){return{...e,[nt]:!0}}function Xt(e,t){return{enum:e,...t}}function Ce(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 n={...t,type:"object",properties:e};if(e&&(n.additionalProperties||=!1,!n.required)){let r,o=[];for(r in e)e[r][nt]?e[r][nt]=void 0:o.push(r);o.length>0&&(n.required=o)}return n}var fn=Z.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Kt="react-compiler-extra",mn=Y({runOnlyWithEnableCompilerDirective:$(Ce())}),dn=/eslint +react-compiler\/react-compiler: +\["error/;function yn(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 gn=/\bthis[.[]/;function Gt(e){return gn.test(e)}var Sn=fn({name:Kt,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:[mn]},defaultOptions:[{}],create(e,[t]){let n=!1;if(t.runOnlyWithEnableCompilerDirective){for(let l of e.sourceCode.getAllComments())if(dn.test(l.value)){n=!0;break}if(!n)return{}}function r(l){for(let i of l.properties)if(i.type===Z.AST_NODE_TYPES.Property&&i.method&&i.value.type===Z.AST_NODE_TYPES.FunctionExpression){let s=e.sourceCode,a=s.getText(i.key),p=i.value,c=s.getText(p.body);if(Gt(c))e.report({node:i,messageId:"thisKeywordInMethod"});else{let u=p.params.map(T=>s.getText(T)).join(", "),d="";p.generator?d=`${a}: function* (${u}) ${c}`:d=`${a}: (${u}) => ${c}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:T=>T.replaceText(i,d)})}}}function o(l){for(let i of l.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);Gt(p)&&e.report({node:s,messageId:"thisKeywordInMethod"})}}}return{CallExpression(l){if(yn(l.callee))for(let i of l.arguments){if(i.type===Z.AST_NODE_TYPES.ObjectExpression&&(r(i),o(i)),i.type===Z.AST_NODE_TYPES.ArrowFunctionExpression&&(i.body.type===Z.AST_NODE_TYPES.ObjectExpression&&(r(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&&(r(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&&(r(s.argument),o(s.argument))}}}}}),it={name:Kt,rule:Sn};var ne=require("@typescript-eslint/utils"),A=require("zod/v4");var Zt=require("@typescript-eslint/utils"),Qt=ke(require("zod/v4"));function X(e){let n=Zt.ESLintUtils.RuleCreator(r=>`https://github.com/lucasols/extended-lint#${r}`)(e);return{name:e.name,rule:n}}function we(e){return Qt.toJSONSchema(e)}var Tn=A.z.object({disallow:A.z.array(A.z.object({selector:A.z.string(),message:A.z.string(),replace:A.z.optional(A.z.union([A.z.string(),A.z.object({regex:A.z.string(),with:A.z.string()})])),replaceType:A.z.optional(A.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:A.z.optional(A.z.array(A.z.object({fn:A.z.string(),withArgs:A.z.optional(A.z.array(A.z.object({atIndex:A.z.number(),value:A.z.union([A.z.string(),A.z.number(),A.z.boolean()])}))),message:A.z.string(),replaceWith:A.z.optional(A.z.string()),ignoreRegex:A.z.optional(A.z.string())}))),__dev_simulateFileName:A.z.optional(A.z.string()),mustMatchSyntax:A.z.optional(A.z.array(A.z.object({includeRegex:A.z.string(),mustCallFn:A.z.optional(A.z.array(A.z.object({anyCall:A.z.array(A.z.object({fn:A.z.string(),withArgs:A.z.array(A.z.object({atIndex:A.z.number(),literal:A.z.union([A.z.string(),A.z.number(),A.z.boolean()])}))})),message:A.z.optional(A.z.string())}))),mustMatchSelector:A.z.optional(A.z.array(A.z.object({selector:A.z.string(),message:A.z.string()}))),mustHaveExport:A.z.optional(A.z.array(A.z.object({name:A.z.string(),type:A.z.enum(["function","variable","any"]).default("any"),message:A.z.string()})))})))}),st=X({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[we(Tn)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let n={},{mustMatchSyntax:r,__dev_simulateFileName:o,disallow:l,disallowFnCalls:i}=t,s=o??e.filename,a=[],p=new Map,c=new Set,u=new Map,d=new Set,T=new Map;function E(m){for(let S of m.specifiers)S.type===ne.AST_NODE_TYPES.ImportSpecifier&&S.imported.type===ne.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===ne.AST_NODE_TYPES.FunctionDeclaration&&m.declaration.id){let S=m.declaration.id.name;for(let k of Array.from(d)){let[R,w]=k.split(":");R===S&&(w==="function"||w==="any")&&d.delete(k)}}else if(m.declaration.type===ne.AST_NODE_TYPES.VariableDeclaration){for(let S of m.declaration.declarations)if(S.id.type===ne.AST_NODE_TYPES.Identifier){let k=S.id.name;for(let R of Array.from(d)){let[w,N]=R.split(":");w===k&&(N==="variable"||N==="any")&&d.delete(R)}}}}for(let S of m.specifiers)if(S.exported.type===ne.AST_NODE_TYPES.Identifier){let k=S.exported.name;for(let R of Array.from(d)){let[w,N]=R.split(":");w===k&&N==="any"&&d.delete(R)}}}function C(m){m.id.type===ne.AST_NODE_TYPES.Identifier&&m.init?.type===ne.AST_NODE_TYPES.Identifier&&T.set(m.id.name,m.init.name)}function f(m){return T.get(m)??m}function I(m,S){return f(m)===S||m===S}for(let{includeRegex:m,mustCallFn:S,mustMatchSelector:k,mustHaveExport:R}of r??[]){let w=hn(s,new RegExp(m));if(!w)continue;let N=z=>{let B=z;for(let{name:re,value:ee}of w)B=B.replaceAll(re,ee);return B};for(let{anyCall:z,message:B}of S??[]){let re=`Expected file to call the function: ${z.map(({fn:ee})=>ee).join(" or ")}`;c.add(re),a.push(ee=>{let{callee:xe}=ee;if(xe.type===ne.AST_NODE_TYPES.Identifier){for(let{fn:G,withArgs:ye}of z)if(xe.name===G){c.delete(re);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!==ne.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:Ne=>Ne.replaceText(se,typeof Te=="string"?`'${Te}'`:String(Te))})}break}}})}for(let{selector:z,message:B}of k??[])u.set(z,N(B)),p.set(N(z),()=>{u.delete(z)});for(let{name:z,type:B,message:re}of R??[]){let ee=N(z),xe=N(re);d.add(`${ee}:${B}:${xe}`)}}for(let{fn:m,withArgs:S,message:k,replaceWith:R,ignoreRegex:w}of i??[])w&&new RegExp(w).test(s)||a.push(N=>{let{callee:z}=N;if(z.type!==ne.AST_NODE_TYPES.Identifier||!I(z.name,m))return;if(S)for(let re of S){let ee=N.arguments[re.atIndex];if(!ee){e.report({node:N,messageId:"default",data:{message:`Missing argument with value "${re.value}" at index ${re.atIndex}: ${k}`}});return}if(ee.type!==ne.AST_NODE_TYPES.Literal||ee.value!==re.value)return}let B=re=>R?re.replaceText(N,R):null;e.report({node:N,messageId:"default",data:{message:k},suggest:R?[{messageId:"default",data:{message:`Replace with "${R}"`},fix:B}]:void 0})});function b(m,S){let k=n[m];k?n[m]=R=>{k(R),S(R)}:n[m]=S}for(let{selector:m,message:S,replace:k,replaceType:R="suggestion"}of l??[]){if(m==="CallExpression"){a.push(w=>{g(k,w,S,R)});continue}n[m]=w=>{g(k,w,S,R)}}if(p.size>0)for(let[m,S]of p)b(m,S);return a.length>0&&(n.CallExpression=m=>{if(m.type===ne.AST_NODE_TYPES.CallExpression)for(let S of a)S(m)}),n.ImportDeclaration=m=>{m.type===ne.AST_NODE_TYPES.ImportDeclaration&&E(m)},n.ExportNamedDeclaration=m=>{m.type===ne.AST_NODE_TYPES.ExportNamedDeclaration&&x(m)},n.VariableDeclarator=m=>{m.type===ne.AST_NODE_TYPES.VariableDeclarator&&C(m)},n["Program:exit"]=m=>{for(let S of c)e.report({node:m,messageId:"default",data:{message:S}});for(let[,S]of u)e.report({node:m,messageId:"default",data:{message:S}});for(let S of d){let[k,R,w]=S.split(":");e.report({node:m,messageId:"default",data:{message:`Missing required export "${k}" of type ${R}: ${w}`}})}},n;function g(m,S,k,R){let w=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&&R==="autofix"?w:void 0,suggest:m&&R==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof m=="string"?m:m.with}"`},fix:w}]:void 0})}}});function hn(e,t){let n=[],r=t.exec(e);if(!r)return null;let[o,...l]=r;n.push({name:"$0_lowercase",value:o.toLowerCase()}),n.push({name:"$0_capitalize",value:er(o)}),n.push({name:"$0_uncapitalize",value:tr(o)}),n.push({name:"$0",value:o});for(let i=0;i<l.length;i++){let s=`$${i+1}`,a=l[i];n.push({name:`${s}_lowercase`,value:a.toLowerCase()}),n.push({name:`${s}_capitalize`,value:er(a)}),n.push({name:`${s}_uncapitalize`,value:tr(a)}),n.push({name:s,value:a})}return n}function er(e){return e.charAt(0).toUpperCase()+e.slice(1)}function tr(e){return e.charAt(0).toLowerCase()+e.slice(1)}var _=require("@typescript-eslint/utils");var En=_.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nr="collapse-simple-objs-in-one-line",bn=Y({maxLineLength:$(ge()),maxProperties:$(ge()),nestedObjMaxLineLength:$(ge()),nestedObjMaxProperties:$(ge()),ignoreTypesWithSuffix:$(te(H()))}),xn=En({name:nr,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:[bn]},defaultOptions:[{}],create(e,[t]){let n=e.sourceCode,r=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,l=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,u=c?i:o,d=p.properties.length;if(d>u)return!1;if(d===1){let E=p.properties[0];return E.type===_.AST_NODE_TYPES.Property&&E.value.type===_.AST_NODE_TYPES.ObjectExpression||E.type===_.AST_NODE_TYPES.Property&&E.value.type===_.AST_NODE_TYPES.ArrayExpression&&!E.value.elements.every(C=>C&&ot(C))?!1:{text:n.getText(E),isNested:c,propsSize:d}}let T=[];for(let E of p.properties){if(E.type===_.AST_NODE_TYPES.Property&&!ot(E.value))return!1;T.push(n.getText(E))}return{text:T.join(", "),isNested:c,propsSize:d}}else{let c=p.parent.parent?.type===_.AST_NODE_TYPES.TSPropertySignature,u=c?i:o,d=p.members.length;if(d>u)return!1;if(r.length>0&&p.parent.type===_.AST_NODE_TYPES.TSTypeAliasDeclaration){let E=p.parent.id.name;if(r.some(x=>E.endsWith(x)))return!1}if(d===1){let E=p.members[0];return E.type===_.AST_NODE_TYPES.TSPropertySignature&&E.typeAnnotation?.typeAnnotation.type===_.AST_NODE_TYPES.TSTypeLiteral?!1:{text:n.getText(E),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 E of p.members){if(E.type!==_.AST_NODE_TYPES.TSPropertySignature)return!1;let x=E.typeAnnotation?.typeAnnotation;if(!x||x.type===_.AST_NODE_TYPES.TSTypeLiteral||!rr(x))return!1;if(x.type===_.AST_NODE_TYPES.TSTypeReference&&x.typeArguments){if(x.typeArguments.params.length>1)return!1;let f=x.typeArguments.params[0];if(!rr(f))return!1}let C=n.getText(E).trim();(C.endsWith(";")||C.endsWith(","))&&(C=C.slice(0,-1)),T.push(C)}return{text:T.join("; "),isNested:c,propsSize:d}}}function a(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==_.AST_NODE_TYPES.JSXExpressionContainer){let x=0,C=!1,f=n.getTokenAfter(p,{filter:b=>b.type!==_.AST_TOKEN_TYPES.Punctuator||C?!0:b.value===","?(x++,!1):b.value===";"?(x++,C=!0,!1):b.value===")"||b.value==="}"?(x++,!1):!0});if(x>4)return;let I=f?.type===_.AST_TOKEN_TYPES.Template&&f.value.startsWith(`}
2
- `);if(f?.loc.start.line===p.loc.end.line&&!I)return}let c=s(p);if(!c)return;let u=c.text;if(u.includes(`
3
- `)||n.getCommentsInside(p).length>0)return;u.endsWith(";")&&(u=u.slice(0,-1));let d=`{ ${u} }`,T=Cn(n,p),E=c.isNested&&c.propsSize>2?l:t.maxLineLength;E&&d.length+T.length+In(p,n)>E||e.report({node:p,messageId:"singleLineProp",fix:x=>x.replaceText(p,d)})}return{TSTypeLiteral:a,ObjectExpression:a}}});function rr(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 ot(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(n=>n&&ot(n,!0)))}function In(e,t){let n=t.getLastToken(e);if(!n)return 0;let r=t.text.indexOf(`
4
- `,n.range[1]);return(r!==-1?r:t.text.length)-n.range[1]}function Cn(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var at={name:nr,rule:xn};var wn=/eslint +react-compiler\/react-compiler: +\["error/,sr={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,n=typeof e.getSource=="function"?f=>n(f):f=>e.sourceCode.getText(f),r=typeof e.getScope=="function"?()=>r():f=>e.sourceCode.getScope(f),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,l=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:l};function s(f){l&&Array.isArray(f.suggest)&&f.suggest.length>0&&(f.fix=f.suggest[0].fix),e.report(f)}let a=e.getSourceCode().scopeManager,p=new WeakMap,c=new WeakSet,u=new WeakMap,d=new WeakMap,T=new WeakSet;function E(f,I){return function(b){if(I.has(b))return I.get(b);let g=f(b);return I.set(b,g),g}}function x(f,I,b,g,m){m&&f.async&&s({node:f,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
1
+ "use strict";var mn=Object.create;var qe=Object.defineProperty;var dn=Object.getOwnPropertyDescriptor;var yn=Object.getOwnPropertyNames;var gn=Object.getPrototypeOf,Sn=Object.prototype.hasOwnProperty;var Tn=(e,r)=>{for(var n in r)qe(e,n,{get:r[n],enumerable:!0})},rr=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of yn(r))!Sn.call(e,o)&&o!==n&&qe(e,o,{get:()=>r[o],enumerable:!(t=dn(r,o))||t.enumerable});return e};var he=(e,r,n)=>(n=e!=null?mn(gn(e)):{},rr(r||!e||!e.__esModule?qe(n,"default",{value:e,enumerable:!0}):n,e)),hn=e=>rr(qe({},"__esModule",{value:!0}),e);var ys={};Tn(ys,{extendedLintPlugin:()=>ds});module.exports=hn(ys);var G=require("@typescript-eslint/utils"),lt=require("zod/v4");var nr=require("@typescript-eslint/utils"),ir=he(require("zod/v4"));function H(e){let n=nr.ESLintUtils.RuleCreator(t=>`https://github.com/lucasols/extended-lint#${t}`)(e);return{name:e.name,rule:n}}function L(e){return ir.toJSONSchema(e)}var En=G.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),or="react-compiler-extra",bn=lt.z.object({runOnlyWithEnableCompilerDirective:lt.z.boolean().optional()}),xn=/eslint +react-compiler\/react-compiler: +\["error/;function Cn(e){return e.type===G.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===G.AST_NODE_TYPES.MemberExpression&&e.property.type===G.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var In=/\bthis[.[]/;function sr(e){return In.test(e)}var wn=En({name:or,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:[L(bn)]},defaultOptions:[{}],create(e,[r]){let n=!1;if(r.runOnlyWithEnableCompilerDirective){for(let l of e.sourceCode.getAllComments())if(xn.test(l.value)){n=!0;break}if(!n)return{}}function t(l){for(let i of l.properties)if(i.type===G.AST_NODE_TYPES.Property&&i.method&&i.value.type===G.AST_NODE_TYPES.FunctionExpression){let s=e.sourceCode,a=s.getText(i.key),p=i.value,u=s.getText(p.body);if(sr(u))e.report({node:i,messageId:"thisKeywordInMethod"});else{let c=p.params.map(d=>s.getText(d)).join(", "),m="";p.generator?m=`${a}: function* (${c}) ${u}`:m=`${a}: (${c}) => ${u}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:d=>d.replaceText(i,m)})}}}function o(l){for(let i of l.properties)if(i.type===G.AST_NODE_TYPES.Property&&i.value.type===G.AST_NODE_TYPES.ObjectExpression){for(let s of i.value.properties)if(s.type===G.AST_NODE_TYPES.Property&&s.method&&s.value.type===G.AST_NODE_TYPES.FunctionExpression){let p=e.sourceCode.getText(s.value.body);sr(p)&&e.report({node:s,messageId:"thisKeywordInMethod"})}}}return{CallExpression(l){if(Cn(l.callee))for(let i of l.arguments){if(i.type===G.AST_NODE_TYPES.ObjectExpression&&(t(i),o(i)),i.type===G.AST_NODE_TYPES.ArrowFunctionExpression&&(i.body.type===G.AST_NODE_TYPES.ObjectExpression&&(t(i.body),o(i.body)),i.body.type===G.AST_NODE_TYPES.BlockStatement))for(let s of i.body.body)s.type===G.AST_NODE_TYPES.ReturnStatement&&s.argument?.type===G.AST_NODE_TYPES.ObjectExpression&&(t(s.argument),o(s.argument));if(i.type===G.AST_NODE_TYPES.FunctionExpression)for(let s of i.body.body)s.type===G.AST_NODE_TYPES.ReturnStatement&&s.argument?.type===G.AST_NODE_TYPES.ObjectExpression&&(t(s.argument),o(s.argument))}}}}}),pt={name:or,rule:wn};var te=require("@typescript-eslint/utils"),A=require("zod/v4");var An=A.z.object({disallow:A.z.array(A.z.object({selector:A.z.string(),message:A.z.string(),replace:A.z.optional(A.z.union([A.z.string(),A.z.object({regex:A.z.string(),with:A.z.string()})])),replaceType:A.z.optional(A.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:A.z.optional(A.z.array(A.z.object({fn:A.z.string(),withArgs:A.z.optional(A.z.array(A.z.object({atIndex:A.z.number(),value:A.z.union([A.z.string(),A.z.number(),A.z.boolean()])}))),message:A.z.string(),replaceWith:A.z.optional(A.z.string()),ignoreRegex:A.z.optional(A.z.string())}))),__dev_simulateFileName:A.z.optional(A.z.string()),mustMatchSyntax:A.z.optional(A.z.array(A.z.object({includeRegex:A.z.string(),mustCallFn:A.z.optional(A.z.array(A.z.object({anyCall:A.z.array(A.z.object({fn:A.z.string(),withArgs:A.z.array(A.z.object({atIndex:A.z.number(),literal:A.z.union([A.z.string(),A.z.number(),A.z.boolean()])}))})),message:A.z.optional(A.z.string())}))),mustMatchSelector:A.z.optional(A.z.array(A.z.object({selector:A.z.string(),message:A.z.string()}))),mustHaveExport:A.z.optional(A.z.array(A.z.object({name:A.z.string(),type:A.z.enum(["function","variable","any"]).default("any"),message:A.z.string()})))})))}),ct=H({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[L(An)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[r]){let n={},{mustMatchSyntax:t,__dev_simulateFileName:o,disallow:l,disallowFnCalls:i}=r,s=o??e.filename,a=[],p=new Map,u=new Set,c=new Map,m=new Set,d=new Map;function T(y){for(let E of y.specifiers)E.type===te.AST_NODE_TYPES.ImportSpecifier&&E.imported.type===te.AST_NODE_TYPES.Identifier&&E.imported.name!==E.local.name&&d.set(E.local.name,E.imported.name)}function h(y){if(y.declaration){if(y.declaration.type===te.AST_NODE_TYPES.FunctionDeclaration&&y.declaration.id){let E=y.declaration.id.name;for(let k of Array.from(m)){let[R,w]=k.split(":");R===E&&(w==="function"||w==="any")&&m.delete(k)}}else if(y.declaration.type===te.AST_NODE_TYPES.VariableDeclaration){for(let E of y.declaration.declarations)if(E.id.type===te.AST_NODE_TYPES.Identifier){let k=E.id.name;for(let R of Array.from(m)){let[w,N]=R.split(":");w===k&&(N==="variable"||N==="any")&&m.delete(R)}}}}for(let E of y.specifiers)if(E.exported.type===te.AST_NODE_TYPES.Identifier){let k=E.exported.name;for(let R of Array.from(m)){let[w,N]=R.split(":");w===k&&N==="any"&&m.delete(R)}}}function x(y){y.id.type===te.AST_NODE_TYPES.Identifier&&y.init?.type===te.AST_NODE_TYPES.Identifier&&d.set(y.id.name,y.init.name)}function f(y){return d.get(y)??y}function b(y,E){return f(y)===E||y===E}for(let{includeRegex:y,mustCallFn:E,mustMatchSelector:k,mustHaveExport:R}of t??[]){let w=Rn(s,new RegExp(y));if(!w)continue;let N=V=>{let q=V;for(let{name:ee,value:Q}of w)q=q.replaceAll(ee,Q);return q};for(let{anyCall:V,message:q}of E??[]){let ee=`Expected file to call the function: ${V.map(({fn:Q})=>Q).join(" or ")}`;u.add(ee),a.push(Q=>{let{callee:Ce}=Q;if(Ce.type===te.AST_NODE_TYPES.Identifier){for(let{fn:B,withArgs:me}of V)if(Ce.name===B){u.delete(ee);for(let ce of me){let ne=Q.arguments[ce.atIndex],Se=typeof ce.literal=="string"?N(ce.literal):ce.literal;if(!ne){e.report({node:Q,messageId:"default",data:{message:`Missing argument with value "${Se}" at index ${ce.atIndex}${q?`: ${N(q)}`:""}`}});continue}if(ne.type!==te.AST_NODE_TYPES.Literal){e.report({node:ne,messageId:"default",data:{message:`Argument at position ${ce.atIndex} should the literal "${Se}"${q?`: ${N(q)}`:""}`}});continue}ne.value!==Se&&e.report({node:ne,messageId:"default",data:{message:`Argument should have the value "${Se}"${q?`: ${N(q)}`:""}`},fix:Ne=>Ne.replaceText(ne,typeof Se=="string"?`'${Se}'`:String(Se))})}break}}})}for(let{selector:V,message:q}of k??[])c.set(V,N(q)),p.set(N(V),()=>{c.delete(V)});for(let{name:V,type:q,message:ee}of R??[]){let Q=N(V),Ce=N(ee);m.add(`${Q}:${q}:${Ce}`)}}for(let{fn:y,withArgs:E,message:k,replaceWith:R,ignoreRegex:w}of i??[])w&&new RegExp(w).test(s)||a.push(N=>{let{callee:V}=N;if(V.type!==te.AST_NODE_TYPES.Identifier||!b(V.name,y))return;if(E)for(let ee of E){let Q=N.arguments[ee.atIndex];if(!Q){e.report({node:N,messageId:"default",data:{message:`Missing argument with value "${ee.value}" at index ${ee.atIndex}: ${k}`}});return}if(Q.type!==te.AST_NODE_TYPES.Literal||Q.value!==ee.value)return}let q=ee=>R?ee.replaceText(N,R):null;e.report({node:N,messageId:"default",data:{message:k},suggest:R?[{messageId:"default",data:{message:`Replace with "${R}"`},fix:q}]:void 0})});function I(y,E){let k=n[y];k?n[y]=R=>{k(R),E(R)}:n[y]=E}for(let{selector:y,message:E,replace:k,replaceType:R="suggestion"}of l??[]){if(y==="CallExpression"){a.push(w=>{S(k,w,E,R)});continue}n[y]=w=>{S(k,w,E,R)}}if(p.size>0)for(let[y,E]of p)I(y,E);return a.length>0&&(n.CallExpression=y=>{if(y.type===te.AST_NODE_TYPES.CallExpression)for(let E of a)E(y)}),n.ImportDeclaration=y=>{y.type===te.AST_NODE_TYPES.ImportDeclaration&&T(y)},n.ExportNamedDeclaration=y=>{y.type===te.AST_NODE_TYPES.ExportNamedDeclaration&&h(y)},n.VariableDeclarator=y=>{y.type===te.AST_NODE_TYPES.VariableDeclarator&&x(y)},n["Program:exit"]=y=>{for(let E of u)e.report({node:y,messageId:"default",data:{message:E}});for(let[,E]of c)e.report({node:y,messageId:"default",data:{message:E}});for(let E of m){let[k,R,w]=E.split(":");e.report({node:y,messageId:"default",data:{message:`Missing required export "${k}" of type ${R}: ${w}`}})}},n;function S(y,E,k,R){let w=N=>{if(!y)return null;if(typeof y=="string")return N.replaceText(E,y);{let V=new RegExp(y.regex),q=e.sourceCode.getText(E);return N.replaceText(E,q.replace(V,y.with))}};e.report({node:E,messageId:"default",data:{message:k},fix:y&&R==="autofix"?w:void 0,suggest:y&&R==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof y=="string"?y:y.with}"`},fix:w}]:void 0})}}});function Rn(e,r){let n=[],t=r.exec(e);if(!t)return null;let[o,...l]=t;n.push({name:"$0_lowercase",value:o.toLowerCase()}),n.push({name:"$0_capitalize",value:ar(o)}),n.push({name:"$0_uncapitalize",value:lr(o)}),n.push({name:"$0",value:o});for(let i=0;i<l.length;i++){let s=`$${i+1}`,a=l[i];a!==void 0&&(n.push({name:`${s}_lowercase`,value:a.toLowerCase()}),n.push({name:`${s}_capitalize`,value:ar(a)}),n.push({name:`${s}_uncapitalize`,value:lr(a)}),n.push({name:s,value:a}))}return n}function ar(e){return e.charAt(0).toUpperCase()+e.slice(1)}function lr(e){return e.charAt(0).toLowerCase()+e.slice(1)}var $=require("@typescript-eslint/utils"),we=require("zod/v4");var vn=$.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cr="collapse-simple-objs-in-one-line",kn=we.z.object({maxLineLength:we.z.number().optional(),maxProperties:we.z.number().optional(),nestedObjMaxLineLength:we.z.number().optional(),nestedObjMaxProperties:we.z.number().optional(),ignoreTypesWithSuffix:we.z.array(we.z.string()).optional()}),Fn=vn({name:cr,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[L(kn)]},defaultOptions:[{}],create(e,[r]){let n=e.sourceCode,t=r.ignoreTypesWithSuffix??[],o=r.maxProperties??2,l=r.nestedObjMaxLineLength??r.maxLineLength,i=r.nestedObjMaxProperties??3;function s(p){if(p.type===$.AST_NODE_TYPES.ObjectExpression){let u=p.parent.type===$.AST_NODE_TYPES.Property,c=u?i:o,m=p.properties.length;if(m>c)return!1;if(m===1){let T=p.properties[0];return!T||T.type===$.AST_NODE_TYPES.Property&&T.value.type===$.AST_NODE_TYPES.ObjectExpression||T.type===$.AST_NODE_TYPES.Property&&T.value.type===$.AST_NODE_TYPES.ArrayExpression&&!T.value.elements.every(x=>x&&ut(x))?!1:{text:n.getText(T),isNested:u,propsSize:m}}let d=[];for(let T of p.properties){if(T.type===$.AST_NODE_TYPES.Property&&!ut(T.value))return!1;d.push(n.getText(T))}return{text:d.join(", "),isNested:u,propsSize:m}}else{let u=p.parent.parent?.type===$.AST_NODE_TYPES.TSPropertySignature,c=u?i:o,m=p.members.length;if(m>c)return!1;if(t.length>0&&p.parent.type===$.AST_NODE_TYPES.TSTypeAliasDeclaration){let T=p.parent.id.name;if(t.some(h=>T.endsWith(h)))return!1}if(m===1){let T=p.members[0];return!T||T.type===$.AST_NODE_TYPES.TSPropertySignature&&T.typeAnnotation?.typeAnnotation.type===$.AST_NODE_TYPES.TSTypeLiteral?!1:{text:n.getText(T),isNested:u,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 d=[];for(let T of p.members){if(T.type!==$.AST_NODE_TYPES.TSPropertySignature)return!1;let h=T.typeAnnotation?.typeAnnotation;if(!h||h.type===$.AST_NODE_TYPES.TSTypeLiteral||!pr(h))return!1;if(h.type===$.AST_NODE_TYPES.TSTypeReference&&h.typeArguments){if(h.typeArguments.params.length>1)return!1;let f=h.typeArguments.params[0];if(!f||!pr(f))return!1}let x=n.getText(T).trim();(x.endsWith(";")||x.endsWith(","))&&(x=x.slice(0,-1)),d.push(x)}return{text:d.join("; "),isNested:u,propsSize:m}}}function a(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==$.AST_NODE_TYPES.JSXExpressionContainer){let h=0,x=!1,f=n.getTokenAfter(p,{filter:I=>I.type!==$.AST_TOKEN_TYPES.Punctuator||x?!0:I.value===","?(h++,!1):I.value===";"?(h++,x=!0,!1):I.value===")"||I.value==="}"?(h++,!1):!0});if(h>4)return;let b=f?.type===$.AST_TOKEN_TYPES.Template&&f.value.startsWith(`}
2
+ `);if(f?.loc.start.line===p.loc.end.line&&!b)return}let u=s(p);if(!u)return;let c=u.text;if(c.includes(`
3
+ `)||n.getCommentsInside(p).length>0)return;c.endsWith(";")&&(c=c.slice(0,-1));let m=`{ ${c} }`,d=Pn(n,p),T=u.isNested&&u.propsSize>2?l:r.maxLineLength;T&&m.length+d.length+On(p,n)>T||e.report({node:p,messageId:"singleLineProp",fix:h=>h.replaceText(p,m)})}return{TSTypeLiteral:a,ObjectExpression:a}}});function pr(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 ut(e,r){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||!r&&e.type===$.AST_NODE_TYPES.ArrayExpression&&e.elements.every(n=>n&&ut(n,!0)))}function On(e,r){let n=r.getLastToken(e);if(!n)return 0;let t=r.text.indexOf(`
4
+ `,n.range[1]);return(t!==-1?t:r.text.length)-n.range[1]}function Pn(e,r){return e.text.slice(r.range[0]-r.loc.start.column,r.range[0])}var ft={name:cr,rule:Fn};var Nn=/eslint +react-compiler\/react-compiler: +\["error/,fr={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 r=!1,n=typeof e.getSource=="function"?f=>n(f):f=>e.sourceCode.getText(f),t=typeof e.getScope=="function"?()=>t():f=>e.sourceCode.getScope(f),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,l=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:l};function s(f){l&&Array.isArray(f.suggest)&&f.suggest.length>0&&(f.fix=f.suggest[0].fix),e.report(f)}let a=e.getSourceCode().scopeManager,p=new WeakMap,u=new WeakSet,c=new WeakMap,m=new WeakMap,d=new WeakSet;function T(f,b){return function(I){if(b.has(I))return b.get(I);let S=f(I);return b.set(I,S),S}}function h(f,b,I,S,y){y&&f.async&&s({node:f,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
5
5
 
6
6
  useEffect(() => {
7
7
  async function fetchData() {
@@ -12,10 +12,15 @@ 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=a.acquire(f),k=new Set,R=null;{let y=S.upper;for(;y&&(k.add(y),y.type!=="function");)y=y.upper;if(!y)return;R=y}let w=Array.isArray;function N(y){if(!w(y.defs))return!1;let h=y.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&&(ct(R.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(On(F)&&P.type==="Identifier"){for(let D of y.references)D!==P&&T.add(D.identifier);return!0}else if(M==="useState"||M==="useReducer"){if(P.type==="ArrayPattern"&&P.elements.length===2&&w(y.identifiers)){if(P.elements[1]===y.identifiers[0]){if(M==="useState"){let D=y.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]===y.identifiers[0]){if(M==="useState"){let D=y.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(y.identifiers)&&P.elements[1]===y.identifiers[0])return!0;return!1}function z(y){if(!w(y.defs))return!1;let h=y.defs[0];if(h==null||h.node==null||h.node.id==null)return!1;let v=h.node,O=R.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=E(N,u),re=E(z,d),ee=new Map;function xe(y){let h=y.from,v=!1;for(;h.block!==f;)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(y){for(let h of y.references){if(!h.resolved||!k.has(h.resolved.scope))continue;let v=ct(f,h.identifier),O=or(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===f.parent)&&P.type!=="TypeParameter")if(G.has(F))G.get(F).references.push(h);else{let M=h.resolved,D=B(M)||re(M);G.set(F,{isStable:D,references:[h]})}}for(let h of y.childScopes)fe(h)}ee.forEach(({reference:y,dependencyNode:h},v)=>{let O=y.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(y,h){se.has(h)||(se.add(h),s({node:y,message:`Assignments to the '${h}' variable from inside React Hook ${n(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 ${n(b)}.`}))}let Ne=new Set;if(G.forEach(({isStable:y,references:h},v)=>{y&&Ne.add(v),h.forEach(O=>{O.writeExpr&&Te(O.writeExpr,v)})}),se.size>0)return;if(!I){let y=null;if(G.forEach(({isStable:h,references:v},O)=>{y||v.forEach(F=>{if(y)return;let P=F.identifier;if(!p.has(P))return;let D=F.from;for(;D.type!=="function";)D=D.upper;D.block===f&&(y=O)})}),y){let{suggestedDependencies:h}=lt({dependencies:G,declaredDependencies:[],stableDependencies:Ne,externalDependencies:new Set,isEffect:!0});s({node:b,message:`React Hook ${g} contains a call to '${y}'. 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(f,`, [${h.join(", ")}]`)}}]})}return}let Le=[],_e=new Set;I.type!=="ArrayExpression"?s({node:I,message:`React Hook ${n(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.`}):I.elements.forEach(y=>{if(y===null)return;if(y.type==="SpreadElement"){s({node:y,message:`React Hook ${n(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(y)&&s({node:y,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${n(y)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${n(y)}\``,fix(F){return F.removeRange(y.range)}}]});let h;try{h=Ee(y,ye)}catch(F){if(/Unsupported node type/.test(F.message)){y.type==="Literal"?G.has(y.value)?s({node:y,message:`The ${y.raw} literal is not a valid dependency because it never changes. Did you mean to include ${y.value} in the array instead?`}):s({node:y,message:`The ${y.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:y,message:`React Hook ${n(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=y;for(;v.type==="MemberExpression"||v.type==="OptionalMemberExpression"||v.type==="ChainExpression";)v=v.object||v.expression.object;let O=!R.through.some(F=>F.identifier===v);Le.push({key:h,node:y}),O||_e.add(h)});let{suggestedDependencies:en,unnecessaryDependencies:ze,missingDependencies:Ie,duplicateDependencies:Yt}=lt({dependencies:G,declaredDependencies:Le,stableDependencies:Ne,externalDependencies:_e,isEffect:m}),He=en;if(Yt.size+Ie.size+ze.size===0){if(t)return;An({declaredDependencies:Le,declaredDependenciesNode:I,componentScope:R,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 ${I.loc.start.line}) change on every render. ${D}`,qt;v&&h.type==="Variable"&&O==="function"&&(qt=[{desc:`Wrap the ${P} of '${h.name.name}' in its own ${F}() Hook.`,fix(Jt){let[rn,nn]=F==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Jt.insertTextBefore(h.node.init,rn),Jt.insertTextAfter(h.node.init,nn)]}}]),s({node:h.node,message:he,suggest:qt})});return}!m&&Ie.size>0&&(He=lt({dependencies:G,declaredDependencies:[],stableDependencies:Ne,externalDependencies:_e,isEffect:m}).suggestedDependencies);function tn(){if(Le.length===0)return!0;let y=Le.map(v=>v.key),h=y.slice().sort();return y.join(",")===h.join(",")}tn()&&He.sort();function tt(y){let h=y.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 rt(y,h,v,O){return y.size===0?null:(y.size>1?"":h+" ")+v+" "+(y.size>1?"dependencies":"dependency")+": "+vn(Array.from(y).sort().map(F=>"'"+tt(F)+"'"))+`. Either ${O} ${y.size>1?"them":"it"} or remove the dependency array.`}let me="";if(ze.size>0){let y=null;if(Array.from(ze.keys()).forEach(h=>{y===null&&h.endsWith(".current")&&(y=h)}),y!==null)me=` Mutable values like '${y}' 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 y=G.get("props");if(y==null)return;let h=y.references;if(!Array.isArray(h))return;let v=!0;for(let O=0;O<h.length;O++){let F=h[O],P=ct(R.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 ${n(b)}.`)}if(!me&&Ie.size>0){let y=null;Ie.forEach(h=>{if(y)return;let v=R.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&&(y=h)}),y!==null&&(me=` If '${y}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!me&&Ie.size>0){let y=null;if(Ie.forEach(h=>{if(y!==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!==R.block;){if(P.type==="CallExpression"){let D=p.get(P.callee);if(D!=null){if(D.name===h)y={missingDep:h,setter:P.callee.name,form:"updater"};else if(c.has(F))y={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"&&(y={missingDep:h,setter:P.callee.name,form:"inlineReducer"})}}break}}P=P.parent}if(y!==null)break}}),y!==null)switch(y.form){case"reducer":me=` You can also replace multiple useState variables with useReducer if '${y.setter}' needs the current value of '${y.missingDep}'.`;break;case"inlineReducer":me=` If '${y.setter}' needs the current value of '${y.missingDep}', you can also switch to useReducer instead of useState and read '${y.missingDep}' in the reducer.`;break;case"updater":me=` You can also do a functional update '${y.setter}(${y.missingDep.slice(0,1)} => ...)' if you only need '${y.missingDep}' in the '${y.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:I,message:`React Hook ${n(b)} has `+(rt(Ie,"a","missing","include")||rt(ze,"an","unnecessary","exclude")||rt(Yt,"a","duplicate","omit"))+me,suggest:[{desc:`Update the dependencies array to be: [${He.map(tt).join(", ")}]`,fix(y){return y.replaceText(I,`[${He.map(tt).join(", ")}]`)}}]})}function C(f){let I=Rn(f.callee,i);if(I===-1)return;let b=f.arguments[I],g=f.callee,m=ar(g).name,S=f.arguments[I+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 R=r(f).set.get(b.name);if(R==null||R.defs==null)return;let w=R.defs[0];if(!w||!w.node||w.type!=="Variable"&&w.type!=="FunctionName")break;switch(w.node.type){case"FunctionDeclaration":x(w.node,S,g,m,k);return;case"VariableDeclarator":let N=w.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(R){return R.replaceText(S,`[${b.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let f of e.sourceCode.getAllComments())if(wn.test(f.value))return t=!0,{CallExpression:I=>C(I,!0)}}return{CallExpression:f=>C(f)}}};function lt({dependencies:e,declaredDependencies:t,stableDependencies:n,externalDependencies:r,isEffect:o}){let l=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((x,C)=>{let f=s(l,C);f.isUsed=!0,a(l,C,I=>{I.isSubtreeUsed=!0})}),t.forEach(({key:x})=>{let C=s(l,x);C.isSatisfiedRecursively=!0}),n.forEach(x=>{let C=s(l,x);C.isSatisfiedRecursively=!0});function s(x,C){let f=C.split("."),I=x;for(let b of f){let g=I.children.get(b);g||(g=i(),I.children.set(b,g)),I=g}return I}function a(x,C,f){let I=C.split("."),b=x;for(let g of I){let m=b.children.get(g);if(!m)return;f(m),b=m}}let p=new Set,c=new Set;u(l,p,c,x=>x);function u(x,C,f,I){x.children.forEach((b,g)=>{let m=I(g);if(b.isSatisfiedRecursively){b.isSubtreeUsed&&f.add(m);return}if(b.isUsed){C.add(m);return}u(b,C,f,S=>m+"."+S)})}let d=[],T=new Set,E=new Set;return t.forEach(({key:x})=>{c.has(x)?d.indexOf(x)===-1?d.push(x):E.add(x):T.add(x)}),p.forEach(x=>{d.push(x)}),{suggestedDependencies:d,unnecessaryDependencies:T,duplicateDependencies:E,missingDependencies:p}}function Ae(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 Ae(e.consequent)!=null||Ae(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Ae(e.left)!=null||Ae(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Ae(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Ae(e.expression);case"TSAsExpression":return Ae(e.expression)}return null}function An({declaredDependencies:e,declaredDependenciesNode:t,componentScope:n,scope:r}){let o=e.map(({key:i})=>{let s=n.variables.find(p=>p.name===i);if(s==null)return null;let a=s.defs[0];if(a==null)return null;if(a.type==="Variable"&&a.node.type==="VariableDeclarator"&&a.node.id.type==="Identifier"&&a.node.init!=null){let p=Ae(a.node.init);if(p!=null)return[s,p]}return a.type==="FunctionName"&&a.node.type==="FunctionDeclaration"?[s,"function"]:a.type==="ClassName"&&a.node.type==="ClassDeclaration"?[s,"class"]:null}).filter(Boolean);function l(i){let s=!1;for(let a=0;a<i.references.length;a++){let p=i.references[a];if(p.writeExpr){if(s)return!0;s=!0;continue}let c=p.from;for(;c!==r&&c!=null;)c=c.upper;if(c!==r&&!lr(t,p.identifier))return!0}return!1}return o.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:l(i)}))}function or(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)?or(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function pt(e,t,n){t&&(e.optional?t.has(n)||t.set(n,!0):t.has(n)||t.set(n,!1))}function Ee(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let n=e.name;return t&&t.set(n,!1),n}else if(e.type==="MemberExpression"&&!e.computed){let n=Ee(e.object,t),r=Ee(e.property,null),o=`${n}.${r}`;return pt(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let n=Ee(e.object,t),r=Ee(e.property,null),o=`${n}.${r}`;return pt(e,t,o),o}else if(e.type==="ChainExpression"&&!e.computed){let n=e.expression;if(n.type==="CallExpression")throw new Error(`Unsupported node type: ${n.type}`);let r=Ee(n.object,t),o=Ee(n.property,null),l=`${r}.${o}`;return pt(n,t,l),l}else throw new Error(`Unsupported node type: ${e.type}`)}function ar(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Rn(e,t){let n=ar(e);if(n.type!=="Identifier")return-1;switch(n.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(n===e&&t&&t.additionalHooks){let r;try{r=Ee(n,null)}catch(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return t.additionalHooks.test(r)?0:-1}else return-1}}function ct(e,t){let n=[e],r=null;for(;n.length;){if(r=n.shift(),kn(r,t))return r;if(lr(r,t))for(let[o,l]of Object.entries(r))o!=="parent"&&(ir(l)?(l.parent=r,n.push(l)):Array.isArray(l)&&l.forEach(i=>{ir(i)&&(i.parent=r,n.push(i))}))}return null}function vn(e){let t="";for(let n=0;n<e.length;n++)t+=e[n],n===0&&e.length===2?t+=" and ":n===e.length-2&&e.length>2?t+=", and ":n<e.length-1&&(t+=", ");return t}function ir(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function kn(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 lr(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function On(e){return!1}var Re=require("@typescript-eslint/utils");var ie=ke(require("typescript")),Pn=Re.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pr="improved-no-unnecessary-condition",Fn=Y({}),Nn=["string","number","bigint","boolean","symbol","undefined","object","function","never"],jn=new Set(Nn),ut={name:pr,rule:Pn({name:pr,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:[Fn]},defaultOptions:[{}],create(e){let t=Re.ESLintUtils.getParserServices(e,!0),n=t.program?.getTypeChecker();if(!n||!t.program)throw new Error("TypeScript services or program not available");function r(s){return s.type===Re.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 l(s){if(!n)return null;let a=t.esTreeNodeToTSNodeMap.get(s),p=n.getTypeAtLocation(a.expression);if(p.flags&ie.default.TypeFlags.Any||p.flags&ie.default.TypeFlags.Unknown)return null;let c=[];if(p.isUnion()){for(let d of p.types){let T=o(d);if(T)c.push(...T);else return null}return c}let u=o(p);return u?(c.push(...u),c):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,c=null;if(r(s.left)?(p=s.left,c=s.right.type===Re.AST_NODE_TYPES.Literal&&typeof s.right.value=="string"?s.right.value:null):r(s.right)&&(p=s.right,c=s.left.type===Re.AST_NODE_TYPES.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!c||!Mn(c,jn))return;let u=l(p);if(!u)return;let d=s.operator==="!==",T=u.includes(c);u.length===1?T&&!d?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:c}}):!T&&d?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:Array.from(u)[0]}}):!T&&!d?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:qe(u),conditionType:c}}):T&&d&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:qe(u),conditionType:c}}):!T&&!d?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:qe(u),conditionType:c}}):!T&&d&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:qe(u)}})}return{BinaryExpression:i}}})};function qe(e){return Array.from(new Set(e)).join(" | ")||"never"}function je(e,t){let n=e.argument;return n.type===Re.AST_NODE_TYPES.Identifier?n.name:t.sourceCode.getText(n)}function Mn(e,t){return t.has(e)}var Je=require("@typescript-eslint/utils");var Dn=Je.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cr="no-call-with-explicit-generics",Ln=Y({functions:te(H())}),_n=Dn({name:cr,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:[Ln]},defaultOptions:[{functions:[]}],create(e,[t]){let n=new Set(t.functions);return{CallExpression(r){let{callee:o}=r;o.type===Je.AST_NODE_TYPES.Identifier&&n.has(o.name)&&r.typeArguments&&e.report({node:r,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),ft={name:cr,rule:_n};var Oe=require("@typescript-eslint/utils"),$n=Oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ur="no-call-with-inferred-generics",Un=$n({name:ur,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 n=new Map(t.functions.map(r=>[r.name,r]));return{CallExpression(r){let{callee:o}=r;if(o.type!==Oe.AST_NODE_TYPES.Identifier)return;let l=n.get(o.name);if(!l)return;let{minGenerics:i=1,allowAny:s,disallowTypes:a=t.disallowTypes}=l;(r.typeArguments?.params.length||0)<(i||0)&&e.report({node:r,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(s&&!a)&&r.typeArguments?.params.some(c=>!s&&c.type===Oe.AST_NODE_TYPES.TSAnyKeyword||a&&c.type===Oe.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===Oe.AST_NODE_TYPES.Identifier&&a.includes(c.typeName.name))&&e.report({node:r,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),mt={name:ur,rule:Un};var mr=require("@typescript-eslint/utils"),Wn=mr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),dr="no-commented-out-code",Vn=["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 zn(e){if(e.includes(":")){let n=e.split(":")[0]?.trim();if(n&&/^[a-zA-Z]/.test(n)&&n.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 Hn=[") {","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],Yn=["/>","</",K.jsxSelfClosing,K.jsxElement,K.jsxOpeningTag,K.jsxClosingTag,K.htmlOpeningTag,K.htmlClosingTag],fr=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],qn=Wn({name:dr,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(r,o){if(r.startsWith("/"))return!1;let l=r.trimStart();if(r.startsWith("*")||l.startsWith("eslint-disable")||r.includes("@deprecated")||r.includes("@example")||r.includes("@param")||r.includes("@returns")||r.includes("@throws")||r.includes("typescript-eslint")||r.includes("@ts-")||r.includes("prettier-ignore")||K.jsdocComment.test(r))return!1;for(let i of fr)if(l.startsWith(i))return!1;if(r.includes("https://")||zn(l))return!1;if(o==="Block"){for(let i of Yn)if(typeof i=="string"){if(r.includes(i))return{wrongPattern:i}}else if(i.test(r))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of Vn)if(l.startsWith(i))return{wrongPattern:i};for(let i of Hn)if(typeof i=="string"){if(r.includes(i))return{wrongPattern:i}}else if(i.test(r))return{wrongPattern:`regex(${i.toString()})`};return!1}function n(r,o){let l=r,i=l.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return l;if(o==="Block"&&l.includes("```")){let p=l.split(/```[\s\S]*?```/g);p.some(u=>/[a-zA-Z0-9]/.test(u))&&(l=p.join(""))}if(!l.includes("`"))return l;let s=l.split(/`[^`]*`/g);return s.some(p=>/[a-zA-Z0-9]/.test(p))?s.join(""):l}return{Program(){let o=e.sourceCode.getAllComments();for(let l of o){let i=n(l.value,l.type),s=t(i,l.type);s&&e.report({node:l,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:fr.join(", ")}})}}}}}),dt={name:dr,rule:qn};var Be=require("@typescript-eslint/utils"),Jn=Be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yr="no-default-export",Bn=Jn({name:yr,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 n of t.specifiers)n.exported.type===Be.TSESTree.AST_NODE_TYPES.Identifier&&n.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),yt={name:yr,rule:Bn};var gr=require("@typescript-eslint/utils"),Xn=gr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sr="no-leaked-text-in-jsx",Gn=[",",";","[","]","(",")"],Kn=Xn({name:Sr,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 n=t.value.trim();if(!n)return;let r="";Gn.includes(n)?r=n:n.includes("&&")?r="&&":n.includes("||")?r="||":n.endsWith("? (")&&(r="? ("),r&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:r}})}}}}),gt={name:Sr,rule:Kn};var ve=require("@typescript-eslint/utils"),Zn=ve.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),hr="no-non-camel-case-functions",Qn=/^(\$?[a-z][a-zA-Z0-9]*)$/;function Tr(e){if(e.typeName.type!==ve.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:n}=e.typeName;return t.type===ve.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&n.name==="Element"}var ei=Zn({name:hr,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&&!Qn.test(t.id.name)){let n=t.returnType?.typeAnnotation;if(n&&(n.type===ve.AST_NODE_TYPES.TSTypeReference?Tr(n):n.type===ve.AST_NODE_TYPES.TSUnionType&&n.types.some(o=>o.type===ve.AST_NODE_TYPES.TSTypeReference&&Tr(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),St={name:hr,rule:ei};var W=require("@typescript-eslint/utils");var Tt=require("@typescript-eslint/utils");function Me(e,t,n=1/0){if(n!==0&&e.parent)return e.type===t?e:Me(e.parent,t,n===1/0?n:n-1)}function*ht(e){yield e,e.parent&&(yield*ht(e.parent))}function Et(e,t){for(let n of e){let r=t(n);if(r!=null&&r!==!1)return r}}function Er(e,t,n){let o=n.getDeclaredVariables(e).find(l=>l.name===t||l.identifiers[0]?.parent.type===Tt.AST_NODE_TYPES.Property&&l.identifiers[0]?.parent.key.type===Tt.AST_NODE_TYPES.Identifier&&l.identifiers[0]?.parent.key.name===t);return o?o.references.filter(l=>!l.init):[]}var ti=W.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),br="no-optional-root-props",ri=ti({name:br,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(r){let l=e.sourceCode.getDeclaredVariables(r)[0];if(!l||l.references.length!==1)return!1;let i=l.references[0];if(!i)return!1;for(let s of ht(i.identifier)){if("returnType"in s||s.type===W.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let a=s.parent;if(!a)return!1;if(a.type===W.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&a.parent.type===W.TSESTree.AST_NODE_TYPES.TSTypeReference&&a.parent.typeName.type===W.TSESTree.AST_NODE_TYPES.Identifier&&a.parent.typeName.name==="FC"){let c=Me(a.parent.parent,W.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!c)return!1;let u=Xe(c,e.sourceCode);return u?!(u.parent.type===W.TSESTree.AST_NODE_TYPES.CallExpression&&u.parent.callee.type===W.TSESTree.AST_NODE_TYPES.Identifier&&u.parent.callee.name==="memo"):!1}if(s.type===W.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(a.type===W.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let p=Me(a,W.TSESTree.AST_NODE_TYPES.VariableDeclaration);return p?!!Xe(p,e.sourceCode):!1}if(a.type===W.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!Xe(a,e.sourceCode)}return!1}function n(r){r.key.type!==W.TSESTree.AST_NODE_TYPES.Identifier||!r.optional||e.report({node:r.key,messageId:"optionalNotAllowed",data:{propertyName:r.key.name},suggest:[{messageId:"suggestion",fix:o=>{let l=Me(r,W.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!l)return null;let i=e.sourceCode.getText(l);return o.replaceText(l,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(r){if(r.typeAnnotation.type===W.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(Ge(r)||!t(r)))for(let o of r.typeAnnotation.members)o.type===W.TSESTree.AST_NODE_TYPES.TSPropertySignature&&n(o)},TSInterfaceDeclaration(r){if(!(Ge(r)||!t(r)))for(let o of r.body.body)o.type===W.TSESTree.AST_NODE_TYPES.TSPropertySignature&&n(o)},TSTypeReference(r){if(r.typeName.type!==W.TSESTree.AST_NODE_TYPES.Identifier||r.typeName.name!=="FC"||!r.typeArguments?.params[0])return;let o=r.typeArguments.params[0];if(o.type!==W.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let l=Me(r.parent,W.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!l)return;let i=Xe(l,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 a of o.members)a.type===W.TSESTree.AST_NODE_TYPES.TSPropertySignature&&n(a)}}}});function Ge(e){return e?e.parent?.type===W.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===W.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Xe(e,t){if(Ge(e))return;let n;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&&(n=e.declarations[0].id)}else{if(!e.id)return;n=e.id}if(!n)return;let r=t.getScope(e);e.type===W.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&r.upper&&(r=r.upper);let o=r.variables.find(i=>i.identifiers.includes(n));if(!o)return;let l=o.references.filter(i=>i.identifier!==n);if(!(l.length!==1||!l[0])&&!Ge(l[0].identifier.parent.parent))return l[0].identifier}var bt={name:br,rule:ri};var $e=require("@typescript-eslint/utils");var Ue=X({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let t=new Set;function n(r){return r?r.type===$e.AST_NODE_TYPES.Identifier?t.has(r.name):r.type===$e.AST_NODE_TYPES.MemberExpression?n(r.object):!1:!1}return{ImportDeclaration(r){for(let o of r.specifiers)t.add(o.local.name)},ExportNamedDeclaration(r){if(r.source){e.report({node:r,messageId:"noReexport"});return}if(r.declaration?.type===$e.AST_NODE_TYPES.VariableDeclaration)for(let o of r.declaration.declarations)n(o.init)&&e.report({node:r,messageId:"noReexport"});r.specifiers.length>0&&e.report({node:r,messageId:"noReexport"})},ExportDefaultDeclaration(r){r.declaration.type===$e.AST_NODE_TYPES.Identifier&&t.has(r.declaration.name)&&e.report({node:r,messageId:"noReexport"})},ExportAllDeclaration(r){e.report({node:r,messageId:"noReexport"})}}}});var xr=require("@typescript-eslint/utils"),Ke=ke(require("path"));var ni=xr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ir="no-relative-imports",ii=Y({find:H(),replacement:H()}),si=Y({aliases:te(ii),rootDir:$(H()),allowNotFoundAliases:$(Ce()),_dev_simulateFileName:$(H())}),oi=ni({name:Ir,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:[si]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let n=t._dev_simulateFileName??e.filename;function r(i){return i.startsWith(".")||i.startsWith("..")}function o(i,s){let a=Ke.default.dirname(s);return Ke.default.resolve(a,i)}function l(i){let s=t.rootDir??process.cwd(),a=Ke.default.relative(s,i);if(a.startsWith("."))return null;a.startsWith("/")||(a=`/${a}`);for(let{find:p,replacement:c}of t.aliases)if(a.startsWith(c)){let u=a.replace(c,p);return{alias:p,newPath:u}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!r(s))return;let a=o(s,n),p=l(a);!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})}}}}),xt={name:Ir,rule:oi};var We=require("@typescript-eslint/utils"),Pe=ke(require("zod/v4"));var ai=Pe.object({alternativeMsgs:Pe.object({inArrayFind:Pe.string().optional(),inArrayFilter:Pe.string().optional()}).optional(),__dev_simulateFileName:Pe.string().optional()});function li(e){return e.typeAnnotation.type!==We.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}function pi(e){return/\.(typeGuards|type-guards)\.(ts|tsx)$/.test(e)}function ci(e){let t=e.parent;for(;t;){if(t.type===We.AST_NODE_TYPES.CallExpression&&t.callee.type===We.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===We.AST_NODE_TYPES.Identifier){let n=t.callee.property.name;if(n==="filter"||n==="find")return{method:n}}t=t.parent}return null}var It=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:[we(ai)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let n=t.__dev_simulateFileName??e.filename;if(pi(n))return{};function r(o){if(!li(o))return;let l=ci(o);if(t.alternativeMsgs&&l){let i=l.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let s=l.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:s,data:{message:i}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":r,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":r,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":r}}});var Fe=require("@typescript-eslint/utils");var ui="no-unnecessary-async-on-jsx-props";function fi(e){if(e.body.type!==Fe.AST_NODE_TYPES.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let n=t[0];return!n||n.type!==Fe.AST_NODE_TYPES.ExpressionStatement?!1:n.expression.type===Fe.AST_NODE_TYPES.AwaitExpression}var Ct=X({name:ui,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(n){fi(n)&&e.report({node:n,messageId:"unnecessaryAsyncInJsxProp",fix(r){let o=e.sourceCode,l=[],i=o.getFirstToken(n,a=>a.value==="async");if(i){let a=o.getTokenAfter(i);a?l.push(r.replaceTextRange([i.range[0],a.range[0]],"")):l.push(r.remove(i))}function s(a){if(a.type===Fe.AST_NODE_TYPES.AwaitExpression){let p=o.getFirstToken(a);if(p&&p.value==="await"){let c=o.getTokenAfter(p);c?l.push(r.replaceTextRange([p.range[0],c.range[0]],"")):l.push(r.remove(p))}}if(a.type===Fe.AST_NODE_TYPES.BlockStatement)for(let p of a.body)s(p);else a.type===Fe.AST_NODE_TYPES.ExpressionStatement&&s(a.expression)}return s(n.body),l}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var be=require("@typescript-eslint/utils");var wt=ke(require("typescript")),mi=be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cr="no-unnecessary-casting",di=Y({additionalCastFunctions:$(te(Y({name:H(),expectedType:Xt(["string","number"])})))}),At={name:Cr,rule:mi({name:Cr,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:[di],fixable:"code"},defaultOptions:[{}],create(e){let n=e.options[0].additionalCastFunctions||[],r=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...n],o=be.ESLintUtils.getParserServices(e,!0),l=o.program?.getTypeChecker();if(!l||!o.program)throw new Error("TypeScript services or program not available");function i(c,u){switch(c.type){case be.AST_NODE_TYPES.Literal:return u==="number"?typeof c.value=="number":typeof c.value=="string";case be.AST_NODE_TYPES.TemplateLiteral:return u==="string";case be.AST_NODE_TYPES.UnaryExpression:return u==="number"?c.operator==="+"||c.operator==="-"||c.operator==="~":!1;default:return!1}}function s(c,u){return u==="number"?!!(c.flags&wt.TypeFlags.NumberLike):!!(c.flags&wt.TypeFlags.StringLike)}function a(c,u){return d=>d.replaceText(c,e.sourceCode.getText(u))}function p(c){if(!l||c.arguments.length!==1)return;let u=c.arguments[0];if(!u||u.type===be.AST_NODE_TYPES.SpreadElement)return;let{callee:d}=c;if(d.type!==be.AST_NODE_TYPES.Identifier)return;let T=d.name,E=r.find(C=>C.name===T);if(!E)return;if(i(u,E.expectedType)||s(l.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(u)),E.expectedType)){let C,f;T==="Number"?C="unnecessaryNumberCasting":T==="String"?C="unnecessaryStringCasting":(C="unnecessaryCustomCasting",f={name:E.name,type:E.expectedType}),e.report({node:c,messageId:C,...f?{data:f}:{},fix:a(c,u)})}}return{CallExpression:p}}})};var Ve=require("@typescript-eslint/utils"),ce=ke(require("zod/v4"));var yi=ce.object({methods:ce.union([ce.array(ce.string()),ce.literal("array")])}),Rt=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(yi)]},defaultOptions:[{methods:"array"}],create(e,[t]){let n=t.methods,r=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(n)?n.includes(s):r.has(s)}function l(s){let{callee:a}=s;if(a.type===Ve.AST_NODE_TYPES.MemberExpression){let p=a.property;if(p.type===Ve.AST_NODE_TYPES.Identifier)return p.name}return null}function i(s,a){if(s.type!==Ve.AST_NODE_TYPES.Identifier||!s.typeAnnotation)return;let p=a.parent;if(p.type===Ve.AST_NODE_TYPES.CallExpression){let c=l(p);c&&o(c)&&p.arguments.indexOf(a)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(d){return d.remove(s.typeAnnotation)}})}}return{ArrowFunctionExpression(s){for(let a of s.params)i(a,s)},FunctionExpression(s){for(let a of s.params)i(a,s)}}}});var le=require("@typescript-eslint/utils");var vt=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 n=new Map;for(let i of t.init.properties)i.type===le.AST_NODE_TYPES.Property&&i.key.type===le.AST_NODE_TYPES.Identifier&&n.set(i.key.name,i);if(n.size===0||t.id.type!==le.AST_NODE_TYPES.Identifier)return;let r=gi(t,e.sourceCode);if(r.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),l=new Set;for(let i of r){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")l.add(s.property.value);else return;else{if(s.property.type!==le.AST_NODE_TYPES.Identifier)return;l.add(s.property.name)}if(s.parent.type===le.AST_NODE_TYPES.CallExpression&&o)return}for(let[i,s]of n)l.has(i)||e.report({node:s,messageId:"unusedObjectProperty",data:{name:i}})}}}});function gi(e,t){let n=t.getDeclaredVariables(e);if(n.length!==1)return[];let r=n[0];return r?r.references.filter(o=>o.identifier!==e.id):[]}var V=require("@typescript-eslint/utils");var Si=Y({selectors:te(Y({name:H(),selectorProp:$(H()),selectorArgPos:$(ge()),returnProp:$(H())}))}),Ti=V.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),wr="no-unused-selected-values",kt={name:wr,rule:Ti({name:wr,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:n=[]}=t,r=new Map(n.map(o=>[o.name,o]));return{VariableDeclarator(o){let l=null;if(o.init?.type===V.AST_NODE_TYPES.CallExpression&&(l=o.init),!l)return;let i=Ei(l);if(!i)return;let s=r.get(i);if(!s)return;let a=hi(l,s.selectorArgPos??0,s.selectorProp);if(!a)return;let p=bi(a);if(!p)return;let c=Ar(p.properties,void 0);if(!c)return;if(o.id.type===V.AST_NODE_TYPES.ObjectPattern){let T=Ar(o.id.properties,s.returnProp);if(!T)return;for(let[E,x]of c)T.has(E)||e.report({node:x,messageId:"unusedSelectedValue",data:{name:E}});return}if(o.id.type!==V.AST_NODE_TYPES.Identifier||s.returnProp)return;let u=xi(o,e.sourceCode);if(u.length===0)return;let d=new Set;for(let T of u){if(T.identifier.parent.type!==V.AST_NODE_TYPES.MemberExpression)return;let E=T.identifier.parent.property;if(E.type!==V.AST_NODE_TYPES.Identifier)return;d.add(E.name)}for(let[T,E]of c)d.has(T)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:T}})}}}})};function hi(e,t,n){let r=e.arguments[t];if(!r)return null;if(r.type===V.AST_NODE_TYPES.ArrowFunctionExpression||r.type===V.AST_NODE_TYPES.FunctionExpression)return r;if(n&&r.type===V.AST_NODE_TYPES.ObjectExpression){let o=r.properties.find(i=>i.type===V.AST_NODE_TYPES.Property&&i.key.type===V.AST_NODE_TYPES.Identifier&&i.key.name===n);if(o?.type!==V.AST_NODE_TYPES.Property)return null;let l=o.value;if(l.type===V.AST_NODE_TYPES.ArrowFunctionExpression||l.type===V.AST_NODE_TYPES.FunctionExpression)return l}return null}function Ei(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 bi(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(n=>n.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 Ar(e,t){let n=e;if(t){let o=e.find(l=>l.type===V.AST_NODE_TYPES.Property&&l.key.type===V.AST_NODE_TYPES.Identifier&&l.key.name===t);if(o?.type!==V.AST_NODE_TYPES.Property||o.value.type!==V.AST_NODE_TYPES.ObjectPattern)return null;n=o.value.properties}let r=new Map;for(let o of n){if(o.type!==V.AST_NODE_TYPES.Property||o.key.type!==V.AST_NODE_TYPES.Identifier)return null;r.set(o.key.name,o)}return r.size>0?r:null}function xi(e,t){let n=t.getDeclaredVariables(e);if(n.length!==1)return[];let r=n[0];return r?r.references.filter(o=>o.identifier!==e.id):[]}var q=require("@typescript-eslint/utils");var Ot=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(l=>l.type===q.AST_NODE_TYPES.ImportDeclaration&&l.source.value==="t-state-form"))return{};let r=null,o=!1;return{CallExpression(l){if(o)return;if(!r){let s=Ii(l);s&&(r=s);return}let i=Ci(l,e.sourceCode);if(i){o=!0;for(let s of i)r.delete(s);if(r.size!==0)for(let[s,a]of r)e.report({node:a,messageId:"unusedField",data:{name:s}})}}}}});function Ii(e){if(!(e.callee.type===q.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let n=e.arguments[0];if(!n||n.type!==q.AST_NODE_TYPES.ObjectExpression)return null;let r=Et(n.properties,l=>l.type!==q.AST_NODE_TYPES.Property||l.key.type!==q.AST_NODE_TYPES.Identifier||l.key.name!=="initialConfig"?null:l.value.type===q.AST_NODE_TYPES.ObjectExpression?l.value:l.value.type===q.AST_NODE_TYPES.ArrowFunctionExpression||l.value.type===q.AST_NODE_TYPES.FunctionExpression?wi(l.value):null);if(!r)return null;let o=new Map;for(let l of r.properties)l.type===q.AST_NODE_TYPES.Property&&l.key.type===q.AST_NODE_TYPES.Identifier&&o.set(l.key.name,l);return o}function Ci(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||!Et(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=Er(e.parent,"formFields",t),l=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;l.add(i.parent.property.name)}}return l}function wi(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(n=>n.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 Ai=U.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Rr(e){let t=[];for(let n of e.members)n.type===U.AST_NODE_TYPES.TSPropertySignature&&n.key.type===U.AST_NODE_TYPES.Identifier&&t.push([n.key.name,n]);return t}function vr(e,...t){for(let n of t)e.set(...n);return e}var Ri=Y({forceCheckOnFCPropTypesWithName:$(te(H())),alwaysCheckFunctionOptionTypes:$(Ce())}),kr="no-unused-type-props-in-args",Pt=null,vi=Ai({name:kr,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:[Ri],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:n,alwaysCheckFunctionOptionTypes:r=!0}=t;n&&!Pt&&(Pt=n.map(a=>new RegExp(a)));function o(a,p,c,u,d=!0,T=!1){let E=c.name,x=e.sourceCode.getScope(p).references.find(g=>g.identifier.name===E)?.resolved,C=a&&Pt?.some(g=>g.test(E)),f=T&&r;if(!x||!C&&x.references.filter(g=>g.isTypeReference).length>1)return;let I=x.defs[0].node,b=I.parent?.type===U.AST_NODE_TYPES.ExportNamedDeclaration;if(!(d&&b&&!f)){if(I.type===U.AST_NODE_TYPES.TSTypeAliasDeclaration){l(a,p,u,I.typeAnnotation,!0,T);return}if(I.type===U.AST_NODE_TYPES.TSInterfaceDeclaration){l(a,p,u,I.body,!0,T);return}}}function l(a,p,c,u,d,T=!1){if(u.type===U.AST_NODE_TYPES.TSInterfaceBody){for(let E of u.body)E.type===U.AST_NODE_TYPES.TSPropertySignature&&E.key.type===U.AST_NODE_TYPES.Identifier&&c.set(E.key.name,E);return}if(u.type===U.AST_NODE_TYPES.TSTypeLiteral){vr(c,...Rr(u));return}if(u.type===U.AST_NODE_TYPES.TSIntersectionType){for(let E of u.types)l(a,p,c,E,!0,T);return}d||u.type===U.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===U.AST_NODE_TYPES.Identifier&&o(a,p,u.typeName,c,!0,T)}function i(a,p,c,u=!1){for(let d of c)if(d.type===U.AST_NODE_TYPES.ObjectPattern&&d.typeAnnotation){let T=new Map;if(l(a,p,T,d.typeAnnotation.typeAnnotation,!1,u),T.size===0)continue;s(d,T)}else d.type===U.AST_NODE_TYPES.AssignmentPattern&&d.left.type===U.AST_NODE_TYPES.ObjectPattern&&i(a,p,[d.left],u)}function s(a,p){let c=[];if(a.properties.at(-1)?.type===U.AST_NODE_TYPES.RestElement)return;for(let E of a.properties)E.type===U.AST_NODE_TYPES.Property&&E.key.type===U.AST_NODE_TYPES.Identifier&&c.push(E.key.name);let d=[],T=[];for(let[E,x]of p)c.includes(E)||(T.push(E),d.push({node:x,messageId:"unusedObjectTypeProperty",data:{propertyName:E}}));for(let[E,x]of d.entries())e.report({...x,fix:E===d.length-1?C=>{let f=a.properties.at(-1),I=T.join(", ");return f?f.type===U.AST_NODE_TYPES.RestElement?null:C.insertTextAfter(f,`, ${I}`):C.insertTextBeforeRange([a.range[0]+1,a.range[1]],I)}:void 0})}return{VariableDeclaration(a){let p=a.declarations[0],c=new Map,u=p.id.type===U.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===U.AST_NODE_TYPES.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===U.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(u){if(u.type===U.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===U.AST_NODE_TYPES.Identifier)o(!0,a,u.typeName,c,!1);else if(u.type===U.AST_NODE_TYPES.TSTypeLiteral)vr(c,...Rr(u));else if(u.type===U.AST_NODE_TYPES.TSIntersectionType)for(let d of u.types)d.type===U.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===U.AST_NODE_TYPES.Identifier?o(!0,a,d.typeName,c,!1):l(!0,a,c,d,!0);if(c.size!==0&&p.init?.type===U.AST_NODE_TYPES.ArrowFunctionExpression){let d=p.init.params[0];if(!d){e.report({node:p.init,messageId:"missingComponentParam"});return}d.type===U.AST_NODE_TYPES.ObjectPattern&&s(d,c)}}},FunctionDeclaration(a){i(!1,a,a.params,r)},ArrowFunctionExpression(a){i(!1,a,a.params,r)}}}}),Ft={name:kr,rule:vi};var ue=require("@typescript-eslint/utils");var Nt=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 n(r){return r.callee.type===ue.AST_NODE_TYPES.Identifier?t.has(r.callee.name):r.callee.type===ue.AST_NODE_TYPES.MemberExpression&&r.callee.object.type===ue.AST_NODE_TYPES.Identifier&&r.callee.property.type===ue.AST_NODE_TYPES.Identifier?r.callee.property.name==="useRef":!1}return{ImportDeclaration(r){if(r.source.value==="react")for(let o of r.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(r){if(r.init&&r.init.type===ue.AST_NODE_TYPES.CallExpression&&n(r.init)&&r.id.type===ue.AST_NODE_TYPES.Identifier){let l=e.sourceCode.getScope(r).set.get(r.id.name);if(l){let i=!1;for(let s of l.references){let p=s.identifier.parent;if(p!==r&&!(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:r.id,messageId:"refNotRead",data:{name:r.id.name}})}}}}}});var De=require("@typescript-eslint/utils"),ki=De.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pr="prefer-named-functions",Or=new Map,Oi=ki({name:Pr,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 n=null;if(t.ignoreRegex){let r=Or.get(t.ignoreRegex);r?n=r:(n=new RegExp(t.ignoreRegex),Or.set(t.ignoreRegex,n))}return{VariableDeclarator(r){if(r.init&&r.init.type===De.AST_NODE_TYPES.ArrowFunctionExpression&&r.id.type===De.AST_NODE_TYPES.Identifier){let o=r.id.name;if(r.id.typeAnnotation||n&&n.test(o)||!t.disallowArrowFnWithImplicitReturns&&r.init.body.type!==De.AST_NODE_TYPES.BlockStatement)return;let l=r.parent,i=r.init.params,s=r.init.body,a=r.init;e.report({node:r.id,messageId:n?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(l,`${a.async?"async ":""}function ${o}(${i.map(c=>e.sourceCode.getText(c)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),jt={name:Pr,rule:Oi};var j=require("@typescript-eslint/utils");var Pi=Y({disallowedFunctions:te(Y({name:H(),allowUsingWithArgs:$(Ce()),hookAlternative:$(H()),message:$(H()),allowUseInside:$(te(H()))}))});function Ze(e){return/^use[A-Z]/.test(e)}function Fr(e){return/^[A-Z]/.test(e)}function Fi(e){return e.type===j.AST_NODE_TYPES.Identifier?Ze(e.name):e.type===j.AST_NODE_TYPES.MemberExpression&&e.property.type===j.AST_NODE_TYPES.Identifier?Ze(e.property.name):!1}function Nr(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 jr(e){return!!(e.parent&&e.parent.type===j.AST_NODE_TYPES.CallExpression&&Nr(e.parent.callee,"forwardRef"))}function Mr(e){return!!(e.parent&&e.parent.type===j.AST_NODE_TYPES.CallExpression&&Nr(e.parent.callee,"memo"))}function Mt(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 Ni(e){let t=e.parent,n=!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 r=Mt(t);if(r&&r.type===j.AST_NODE_TYPES.Identifier){if(Fr(r.name)||Ze(r.name))return!n;n=!0}else{if(jr(t)||Mr(t))return!n;if(t.parent.type===j.AST_NODE_TYPES.CallExpression){let o=t.parent;Fi(o.callee)||(n=!0)}else t.parent.type===j.AST_NODE_TYPES.JSXExpressionContainer||(n=!0)}}t=t.parent}return!1}function Dr(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 ji(e,t){if(!t.length)return!1;let 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 r=Mt(n);if(r&&r.type===j.AST_NODE_TYPES.Identifier&&t.includes(r.name))return!0}else if(n.type===j.AST_NODE_TYPES.CallExpression){let r=Dr(n);if(r&&t.includes(r))return!0}n=n.parent}return!1}function Mi(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===j.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function Di(e,t){let n=!1,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 o=Mt(r);if(o&&o.type===j.AST_NODE_TYPES.Identifier){if(Fr(o.name)||Ze(o.name)){n=!0;break}}else if(jr(r)||Mr(r)){n=!0;break}}r=r.parent}return n?t.length===0?Ni(e):!ji(e,t):!1}var Dt=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:[Pi],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:n}=t,r=new Map(n.map(o=>[o.name,o]));return{CallExpression(o){let l=Dr(o);if(!l)return;let i=r.get(l);if(!i||i.allowUsingWithArgs&&Mi(o))return;let s=i.allowUseInside||[];Di(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:a=>{let p=i.hookAlternative;return o.callee.type===j.AST_NODE_TYPES.Identifier?a.replaceText(o.callee,p):o.callee.type===j.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===j.AST_NODE_TYPES.Identifier?a.replaceText(o.callee.property,p):null}}]:[]})}}}});var J=require("@typescript-eslint/utils");var Li=J.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_r="prefer-single-line-if",_i=Y({maxLineLength:$(ge()),maxNonSimpleConditionLength:$(ge())}),$i=Li({name:_r,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:[_i]},defaultOptions:[{}],create(e,[t]){let n=e.sourceCode;return{IfStatement(r){if(r.consequent.type!==J.AST_NODE_TYPES.BlockStatement||r.loc.start.line===r.loc.end.line||n.getCommentsInside(r.consequent).length>0||r.alternate||r.consequent.body.length!==1)return;let l=r.consequent.body[0];if(l.type===J.AST_NODE_TYPES.ReturnStatement){if(!Ur(l))return}else if(!(l.type===J.AST_NODE_TYPES.ContinueStatement||l.type===J.AST_NODE_TYPES.BreakStatement))return;if(r.test.type===J.AST_NODE_TYPES.LogicalExpression||r.test.type===J.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let u=Lr(r.test);if(!u&&r.test.type===J.AST_NODE_TYPES.UnaryExpression&&r.test.operator==="!"){let d=r.test.argument;Lr(d)&&(u=!0)}if(u&&(i=n.getText(r.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=n.getText(r.test));let s=n.getText(l);if(i.includes(`
16
- `))return;let a=n.getTokenAfter(r);if(a&&a.type===J.AST_TOKEN_TYPES.Punctuator&&a.value==="}"){let u=n.getTokenAfter(a);if(u&&u.type===J.AST_TOKEN_TYPES.Keyword&&(u.value==="else"||u.value==="catch"))return}let p=Ui(n,r),c=`if (${i}) ${s}`;t.maxLineLength&&c.length+p.length>t.maxLineLength||e.report({node:r,messageId:"noSingleLineCurly",fix:u=>u.replaceText(r,c)})}}}});function Lr(e){return e.type===J.AST_NODE_TYPES.CallExpression||e.type===J.AST_NODE_TYPES.BinaryExpression||e.type===J.AST_NODE_TYPES.MemberExpression&&$r(e)}function $r(e){return e.object.type===J.AST_NODE_TYPES.MemberExpression?$r(e.object):e.object.type!==J.AST_NODE_TYPES.Identifier}function Ui(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Ur(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?Ur(t):!1}var Lt={name:_r,rule:$i};var oe=require("@typescript-eslint/utils");var Wi=oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Wr="react-compiler-migration",Vi=Y({disallowHooks:$(te(Y({name:H(),replacement:H()}))),disallowMethods:$(te(Y({name:H(),replacement:$(H()),requireTrueProp:$(H())})))}),zi=/eslint +react-compiler\/react-compiler: +\["error/;function Hi(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 Yi=Wi({name:Wr,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:[Vi]},defaultOptions:[{}],create(e,[t]){let n=!1;for(let r of e.sourceCode.getAllComments())if(zi.test(r.value)){n=!0;break}return n?{CallExpression(r){if(t.disallowHooks?.length){let o=null,l=null;if(r.callee.type===oe.AST_NODE_TYPES.Identifier?(o=r.callee.name,l=r.callee):r.callee.type===oe.AST_NODE_TYPES.MemberExpression&&r.callee.property.type===oe.AST_NODE_TYPES.Identifier&&(o=r.callee.property.name,l=r.callee.property),o){let i=t.disallowHooks.find(s=>s.name===o);i&&l&&e.report({node:r,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:s=>s.replaceText(l,i.replacement)}]})}}if(t.disallowMethods?.length&&Hi(r.callee)){for(let o of r.arguments)if(o.type===oe.AST_NODE_TYPES.ObjectExpression){for(let l of o.properties)if(l.type===oe.AST_NODE_TYPES.Property&&l.key.type===oe.AST_NODE_TYPES.Identifier){let i=l.key.name,s=t.disallowMethods.find(a=>a.name===i);if(s){if(s.requireTrueProp){let a=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===a&&c.value.type===oe.AST_NODE_TYPES.Literal&&c.value.value===!0){p=!0;break}if(!p){e.report({node:l,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:s.name,requireTrueProp:a}});continue}}s.replacement&&e.report({node:l,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:s.name,replacement:s.replacement},suggest:[{messageId:"replace",data:{replacement:s.replacement},fix:a=>a.replaceText(l.key,s.replacement)}]})}}}}}}:{}}}),_t={name:Wr,rule:Yi};var Qe=require("@typescript-eslint/utils"),qi=Qe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Vr="require-description",Ji=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Bi=/^eslint-disable-(next-)?line$/u,Xi=qi({name:Vr,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 n=e.sourceCode,r=new Set(t.ignore||[]);return{Program(){for(let o of n.getAllComments()){let l=Gi(o);l!=null&&(r.has(l.kind)||l.description||e.report({loc:Zi(o.loc),messageId:"missingDescription"}))}}}}}),zr={name:Vr,rule:Xi};function Gi(e){let{text:t,description:n}=Ki(e.value);if(!t)return null;let r=Ji.exec(t);if(!r)return null;let o=r[1];if(!o)return null;let l=Bi.test(o);if(e.type===Qe.TSESTree.AST_TOKEN_TYPES.Line&&!l||l&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(r.index+o.length);return{kind:o,value:i.trim(),description:n}}function Ki(e){let t=e.split(/\s-{2,}\s/u);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Zi(e){return{start:{line:e.start.line,column:-1},end:e.end}}var L=require("@typescript-eslint/utils"),Se=require("zod/v4");var Qi=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:[we(Qi)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let n=new Map,r=(i,s,a,p)=>{let c=new Set;for(let d of i.properties)d.type===L.AST_NODE_TYPES.Property&&d.key.type===L.AST_NODE_TYPES.Identifier&&c.add(d.key.name);let u=s.filter(d=>!c.has(d));if(u.length>0)if(u.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:u[0],fnName:p,customMsg:a||""}});else{let d=u.map(T=>`"${T}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:d,fnName:p,customMsg:a||""}})}},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"},l={};for(let i of t.varsToCheck)i.selector&&(l[i.selector]=s=>{if(s.type===L.AST_NODE_TYPES.VariableDeclarator&&s.id.type===L.AST_NODE_TYPES.Identifier&&n.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 a=Array.isArray(i.prop)?i.prop:[i.prop];r(s.id,a,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)}"]`;l[p]=c=>{if(c.type!==L.AST_NODE_TYPES.MemberExpression||c.parent.type!==L.AST_NODE_TYPES.CallExpression)return;let u=c.parent;if(u.parent.type!==L.AST_NODE_TYPES.VariableDeclarator)return;let d=u.parent;if(d.id.type===L.AST_NODE_TYPES.Identifier)n.set(d.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:d.id,fnName:i.fromFnCall||"unknown function"});else if(d.id.type===L.AST_NODE_TYPES.ObjectPattern){let T=Array.isArray(i.prop)?i.prop:[i.prop];r(d.id,T,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(s.includes(".")){let[a,p]=s.split("."),c=`VariableDeclarator > CallExpression > MemberExpression[object.name="${a}"][property.name="${p}"]`;l[c]=u=>{if(u.type!==L.AST_NODE_TYPES.MemberExpression||u.parent.type!==L.AST_NODE_TYPES.CallExpression)return;let d=u.parent;if(d.parent.type!==L.AST_NODE_TYPES.VariableDeclarator)return;let T=d.parent;if(T.id.type===L.AST_NODE_TYPES.Identifier)n.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 E=Array.isArray(i.prop)?i.prop:[i.prop];r(T.id,E,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let a=`VariableDeclarator > CallExpression > Identifier[name="${s}"]`;l[a]=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 u=c.parent;if(u.id.type===L.AST_NODE_TYPES.Identifier)n.set(u.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:u.id,fnName:i.fromFnCall||"unknown function"});else if(u.id.type===L.AST_NODE_TYPES.ObjectPattern){let d=Array.isArray(i.prop)?i.prop:[i.prop];r(u.id,d,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...l,"Program:exit"(){for(let[i,{props:s,errorMsg:a,node:p,fnName:c}]of n){let d=e.sourceCode.getScope(p).set.get(i);if(d){let T=new Set(s);for(let E of d.references){let x=E.identifier,C=x.parent;if(!(C.type===L.AST_NODE_TYPES.VariableDeclarator&&C.id===x)){if(C.type===L.AST_NODE_TYPES.MemberExpression&&C.object===x&&C.property.type===L.AST_NODE_TYPES.Identifier&&T.has(C.property.name)){if(T.delete(C.property.name),T.size===0)break;continue}if(C.type===L.AST_NODE_TYPES.VariableDeclarator&&C.init===x&&C.id.type===L.AST_NODE_TYPES.ObjectPattern){for(let f of C.id.properties)f.type===L.AST_NODE_TYPES.Property&&f.key.type===L.AST_NODE_TYPES.Identifier&&T.has(f.key.name)&&T.delete(f.key.name);if(T.size===0)break;continue}if(!(C.type===L.AST_NODE_TYPES.MemberExpression&&C.object===x&&C.property.type===L.AST_NODE_TYPES.Identifier&&!s.includes(C.property.name))){T.clear();break}}}if(T.size>0){let E=Array.from(T);if(E.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:E[0],fnName:c,customMsg:a||""}});else{let x=E.map(C=>`"${C}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:x,fnName:c,customMsg:a||""}})}}}}}}}});function qr(e){return/^use[A-Z0-9]/.test(e)}function et(e){return e.type==="Identifier"?qr(e.name):e.type==="MemberExpression"&&!e.computed&&et(e.property)?e.object.type==="Identifier":!1}function Jr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Br(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Xr(e){return!!(e.parent&&e.parent.callee&&Br(e.parent.callee,"forwardRef"))}function Gr(e){return!!(e.parent&&e.parent.callee&&Br(e.parent.callee,"memo"))}function Ut(e){for(;e;){let t=Zr(e);if(t&&(Jr(t)||et(t))||Xr(e)||Gr(e))return!0;e=e.parent}return!1}function Hr(e){return!1}function Wt(e){return!1}var es=/eslint +react-compiler\/react-compiler: +\["error/,Kr={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 a of e.sourceCode.getAllComments())if(es.test(a.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"?a=>t(a):a=>e.sourceCode.getText(a),n=typeof e.getScope=="function"?()=>n():a=>e.sourceCode.getScope(a),r=null,o=[],l=[],i=new WeakSet;function s(a){for(let p of a.references){let c=p.identifier.parent;if(c.type==="VariableDeclarator"&&c.init&&c.init.type==="CallExpression"&&c.init.callee&&Hr(c.init.callee))for(let u of p.resolved.references)u!==p&&i.add(u.identifier)}}return{onCodePathSegmentStart:a=>l.push(a),onCodePathSegmentEnd:()=>l.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(a,p){let c=o.pop();if(c.size===0)return;let u=new Set;function d(g,m){let{cache:S}=d,k=S.get(g.id),R=new Set(m);if(R.has(g.id)){let w=[...R],N=w.slice(w.indexOf(g.id)+1);for(let z of N)u.add(z);return BigInt("0")}if(R.add(g.id),k!==void 0)return k;if(a.thrownSegments.includes(g))k=BigInt("0");else if(g.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let w of g.prevSegments)k+=d(w,R)}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),R=new Set(m);if(R.has(g.id)){let w=Array.from(R),N=w.slice(w.indexOf(g.id)+1);for(let z of N)u.add(z);return BigInt("0")}if(R.add(g.id),k!==void 0)return k;if(a.thrownSegments.includes(g))k=BigInt("0");else if(g.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let w of g.nextSegments)k+=T(w,R)}return S.set(g.id,k),k}function E(g){let{cache:m}=E,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 R=E(k);R<S&&(S=R)}S+=1}return m.set(g.id,S),S}d.cache=new Map,T.cache=new Map,E.cache=new Map;let x=T(a.initialSegment),C=Zr(p),f=Ut(p),I=C?Jr(C)||et(C):Xr(p)||Gr(p),b=1/0;for(let g of a.finalSegments){if(!g.reachable)continue;let m=E(g);m<b&&(b=m)}for(let[g,m]of c){if(!g.reachable)continue;let S=g.nextSegments.length===0?b<=E(g):b<E(g),k=d(g)*T(g),R=u.has(g.id);for(let w of m)if(R&&!Wt(w)&&e.report({node:w,message:`React Hook "${t(w)}" 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.`}),I){if(p.async&&e.report({node:w,message:`React Hook "${t(w)}" cannot be called in an async function.`}),!R&&k!==x&&!Wt(w)){let z=`React Hook "${t(w)}" 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:w,message:z})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let N=`React Hook "${t(w)}" 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:w,message:N})}else if(C){let N=`React Hook "${t(w)}" is called in function "${t(C)}" 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:w,message:N})}else if(p.type==="Program"){let N=`React Hook "${t(w)}" 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:w,message:N})}else if(f&&!Wt(w)){if(p.parent.type==="CallExpression"&&p.parent.callee.type==="Identifier"&&p.parent.callee.name==="useCallback"){let z=p.parent;if(z.parent.type==="VariableDeclarator"&&qr(z.parent.id.name))return}let N=`React Hook "${t(w)}" 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:w,message:N})}}},CallExpression(a){if(et(a.callee)){let p=Yr(o),c=Yr(l),u=p.get(c);u||(u=[],p.set(c,u)),u.push(a.callee)}a.callee.type==="Identifier"&&(a.callee.name==="useEffect"||Hr(a.callee))&&a.arguments.length>0&&(r=a)},Identifier(a){r==null&&i.has(a)&&a.parent.type!=="CallExpression"&&e.report({node:a,message:`\`${t(a)}\` 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"(a){a===r&&(r=null)},FunctionDeclaration(a){Ut(a)&&s(n(a))},ArrowFunctionExpression(a){Ut(a)&&s(n(a))}}}};function Zr(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 Yr(e){return e[e.length-1]}var Q=require("@typescript-eslint/utils"),ae=ke(require("zod/v4"));var ts=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()}),Vt=X({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[we(ts)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:n=["HTML","indent"],functions:r=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:l}=e.options[0],i=n.map(f=>f.toLowerCase());function s(f){let I=f.split(/\r?\n/),b=I.filter(m=>m.trim()!=="");if(b.length===0)return f;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?f:I.map(m=>m.slice(g)).join(`
17
- `)}function a(f,I,b){return f.split(/\r?\n/).map(m=>m.trim()===""?m:b.repeat(I)+m).join(`
18
- `)}function p(f){if(f.type===Q.AST_NODE_TYPES.Identifier)return f.name;if(f.type===Q.AST_NODE_TYPES.MemberExpression){let I=f.object.type===Q.AST_NODE_TYPES.Identifier?f.object.name:null,b=f.property.type===Q.AST_NODE_TYPES.Identifier?f.property.name:null;return I&&b?`${I}.${b}`:b}return null}function c(f,I){if(!f)return!1;for(let b of I)if(b.includes(".")){let g=b.split(".");if(f.type===Q.AST_NODE_TYPES.MemberExpression&&f.object.type===Q.AST_NODE_TYPES.Identifier&&f.property.type===Q.AST_NODE_TYPES.Identifier&&f.object.name===g[0]&&f.property.name===g[1])return!0}else if(f.type===Q.AST_NODE_TYPES.Identifier&&f.name===b)return!0;return!1}function u(f,I){let b=f.parent;if(b.type!==Q.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let g=p(b.tag);return g?I.includes(g):!1}function d(f,I){if(!f||f.type!==Q.AST_NODE_TYPES.CallExpression)return!1;let{method:b,argumentsLength:g,optionalCall:m=!0,optionalMember:S=!0}=I;return g!==void 0&&f.arguments.length!==g||!m&&f.optional||f.callee.type!==Q.AST_NODE_TYPES.MemberExpression||!S&&f.callee.optional||f.callee.property.type!==Q.AST_NODE_TYPES.Identifier?!1:f.callee.property.name===b}function T(f,I){if(!f||f.type!==Q.AST_NODE_TYPES.CallExpression)return!1;let{name:b,argumentsLength:g,optionalCall:m=!0}=I;return g!==void 0&&f.arguments.length!==g||!m&&f.optional||f.callee.type!==Q.AST_NODE_TYPES.Identifier?!1:f.callee.name===b}function E(f){return d(f.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&f.parent.type===Q.AST_NODE_TYPES.CallExpression&&f.parent.arguments[0]===f&&T(f.parent.callee.type===Q.AST_NODE_TYPES.MemberExpression?f.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function x(f){if(i.length>0){let I=t.getTokenBefore(f,{includeComments:!0});if(I?.type===Q.AST_TOKEN_TYPES.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(E(f)||o.length>0&&u(f,o)||r.length>0&&f.parent.type===Q.AST_NODE_TYPES.CallExpression&&f.parent.arguments.includes(f)&&c(f.parent.callee,r))}function C(f){let I=`__PLACEHOLDER__${Math.random()}`,b=f.quasis.map(G=>t.getText(G).slice(1,G.tail?-1:-2)).join(I),g=b.match(/\r?\n/);if(!g)return;let m=g[0],S=t.lines[t.getLocFromIndex(f.range[0]).line-1];if(!S)return;let R=S.match(/^(\s*)\S/)?.[1]??"",w;typeof l=="string"?w=l:typeof l=="number"?w=" ".repeat(l):w=R.startsWith(" ")?" ":" ";let z=s(b).replace(new RegExp(`^${m}|${m}[ ]*$`,"g"),""),B=m+a(z,1,R+w)+m+R,re=b.includes(`\r
15
+ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let E=a.acquire(f),k=new Set,R=null;{let g=E.upper;for(;g&&(k.add(g),g.type!=="function");)g=g.upper;if(!g)return;R=g}let w=Array.isArray;function N(g){if(!w(g.defs))return!1;let C=g.defs[0];if(C==null||C.node.type!=="VariableDeclarator")return!1;let v=C.node.init;if(v==null)return!1;for(;v.type==="TSAsExpression";)v=v.expression;let F=C.node.parent;if(F==null&&(yt(R.block,C.node.id),F=C.node.parent,F==null))return!1;if(F.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 P=v.callee;if(P.type==="MemberExpression"&&P.object.name==="React"&&P.property!=null&&!P.computed&&(P=P.property),P.type!=="Identifier")return!1;let O=C.node.id,{name:M}=P;if(M==="useRef"&&O.type==="Identifier")return!0;if(_n(P)&&O.type==="Identifier"){for(let j of g.references)j!==O&&d.add(j.identifier);return!0}else if(M==="useState"||M==="useReducer"){if(O.type==="ArrayPattern"&&O.elements.length===2&&w(g.identifiers)){if(O.elements[1]===g.identifiers[0]){if(M==="useState"){let j=g.references,ae=0;for(let Te=0;Te<j.length;Te++){if(j[Te].isWrite()&&ae++,ae>1)return!1;p.set(j[Te].identifier,O.elements[0])}}return!0}else if(O.elements[0]===g.identifiers[0]){if(M==="useState"){let j=g.references;for(let ae=0;ae<j.length;ae++)u.add(j[ae].identifier)}return!1}}}else if(M==="useTransition"&&O.type==="ArrayPattern"&&O.elements.length===2&&Array.isArray(g.identifiers)&&O.elements[1]===g.identifiers[0])return!0;return!1}function V(g){if(!w(g.defs))return!1;let C=g.defs[0];if(C==null||C.node==null||C.node.id==null)return!1;let v=C.node,F=R.childScopes,P=null,O;for(O=0;O<F.length;O++){let M=F[O],j=M.block;if(v.type==="FunctionDeclaration"&&j===v||v.type==="VariableDeclarator"&&j.parent===v){P=M;break}}if(P==null)return!1;for(O=0;O<P.through.length;O++){let M=P.through[O];if(M.resolved!=null&&k.has(M.resolved.scope)&&!q(M.resolved))return!1}return!0}let q=T(N,c),ee=T(V,m),Q=new Map;function Ce(g){let C=g.from,v=!1;for(;C.block!==f;)C.type==="function"&&(v=C.block.parent!=null&&C.block.parent.type==="ReturnStatement"),C=C.upper;return v}let B=new Map,me=new Map;ce(E);function ce(g){for(let C of g.references){if(!C.resolved||!k.has(C.resolved.scope))continue;let v=yt(f,C.identifier),F=mr(v),P=Ee(F,me);if(y&&F.type==="Identifier"&&(F.parent.type==="MemberExpression"||F.parent.type==="OptionalMemberExpression")&&!F.parent.computed&&F.parent.property.type==="Identifier"&&F.parent.property.name==="current"&&Ce(C)&&Q.set(P,{reference:C,dependencyNode:F}),F.parent.type==="TSTypeQuery"||F.parent.type==="TSTypeReference")continue;let O=C.resolved.defs[0];if(O!=null&&!(O.node!=null&&O.node.init===f.parent)&&O.type!=="TypeParameter")if(B.has(P))B.get(P).references.push(C);else{let M=C.resolved,j=q(M)||ee(M);B.set(P,{isStable:j,references:[C]})}}for(let C of g.childScopes)ce(C)}Q.forEach(({reference:g,dependencyNode:C},v)=>{let F=g.resolved.references,P=!1;for(let O=0;O<F.length;O++){let{identifier:M}=F[O],{parent:j}=M;if(j!=null&&j.type==="MemberExpression"&&!j.computed&&j.property.type==="Identifier"&&j.property.name==="current"&&j.parent.type==="AssignmentExpression"&&j.parent.left===j){P=!0;break}}P||s({node:C.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 ne=new Set;function Se(g,C){ne.has(C)||(ne.add(C),s({node:g,message:`Assignments to the '${C}' variable from inside React Hook ${n(I)} 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 ${n(I)}.`}))}let Ne=new Set;if(B.forEach(({isStable:g,references:C},v)=>{g&&Ne.add(v),C.forEach(F=>{F.writeExpr&&Se(F.writeExpr,v)})}),ne.size>0)return;if(!b){let g=null;if(B.forEach(({isStable:C,references:v},F)=>{g||v.forEach(P=>{if(g)return;let O=P.identifier;if(!p.has(O))return;let j=P.from;for(;j.type!=="function";)j=j.upper;j.block===f&&(g=F)})}),g){let{suggestedDependencies:C}=mt({dependencies:B,declaredDependencies:[],stableDependencies:Ne,externalDependencies:new Set,isEffect:!0});s({node:I,message:`React Hook ${S} contains a call to '${g}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+C.join(", ")+`] as a second argument to the ${S} Hook.`,suggest:[{desc:`Add dependencies array: [${C.join(", ")}]`,fix(v){return v.insertTextAfter(f,`, [${C.join(", ")}]`)}}]})}return}let _e=[],$e=new Set;b.type!=="ArrayExpression"?s({node:b,message:`React Hook ${n(I)} 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.`}):b.elements.forEach(g=>{if(g===null)return;if(g.type==="SpreadElement"){s({node:g,message:`React Hook ${n(I)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}d.has(g)&&s({node:g,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${n(g)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${n(g)}\``,fix(P){return P.removeRange(g.range)}}]});let C;try{C=Ee(g,me)}catch(P){if(/Unsupported node type/.test(P.message)){g.type==="Literal"?B.has(g.value)?s({node:g,message:`The ${g.raw} literal is not a valid dependency because it never changes. Did you mean to include ${g.value} in the array instead?`}):s({node:g,message:`The ${g.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:g,message:`React Hook ${n(I)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw P}let v=g;for(;v.type==="MemberExpression"||v.type==="OptionalMemberExpression"||v.type==="ChainExpression";)v=v.object||v.expression.object;let F=!R.through.some(P=>P.identifier===v);_e.push({key:C,node:g}),F||$e.add(C)});let{suggestedDependencies:pn,unnecessaryDependencies:Je,missingDependencies:Ie,duplicateDependencies:Qt}=mt({dependencies:B,declaredDependencies:_e,stableDependencies:Ne,externalDependencies:$e,isEffect:y}),Ye=pn;if(Qt.size+Ie.size+Je.size===0){if(r)return;Dn({declaredDependencies:_e,declaredDependenciesNode:b,componentScope:R,scope:E}).forEach(({construction:C,isUsedOutsideOfHook:v,depType:F})=>{let P=F==="function"?"useCallback":"useMemo",O=F==="function"?"definition":"initialization",M=`wrap the ${O} of '${C.name.name}' in its own ${P}() Hook.`,j=v?`To fix this, ${M}`:`Move it inside the ${S} callback. Alternatively, ${M}`,ae=F==="conditional"||F==="logical expression"?"could make":"makes",Te=`The '${C.name.name}' ${F} ${ae} the dependencies of ${S} Hook (at line ${b.loc.start.line}) change on every render. ${j}`,er;v&&C.type==="Variable"&&F==="function"&&(er=[{desc:`Wrap the ${O} of '${C.name.name}' in its own ${P}() Hook.`,fix(tr){let[un,fn]=P==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[tr.insertTextBefore(C.node.init,un),tr.insertTextAfter(C.node.init,fn)]}}]),s({node:C.node,message:Te,suggest:er})});return}!y&&Ie.size>0&&(Ye=mt({dependencies:B,declaredDependencies:[],stableDependencies:Ne,externalDependencies:$e,isEffect:y}).suggestedDependencies);function cn(){if(_e.length===0)return!0;let g=_e.map(v=>v.key),C=g.slice().sort();return g.join(",")===C.join(",")}cn()&&Ye.sort();function ot(g){let C=g.split("."),v="";for(let F=0;F<C.length;F++){if(F!==0){let P=C.slice(0,F+1).join("."),O=me.get(P)===!0;v+=O?"?.":"."}v+=C[F]}return v}function at(g,C,v,F){return g.size===0?null:(g.size>1?"":C+" ")+v+" "+(g.size>1?"dependencies":"dependency")+": "+jn(Array.from(g).sort().map(P=>"'"+ot(P)+"'"))+`. Either ${F} ${g.size>1?"them":"it"} or remove the dependency array.`}let ue="";if(Je.size>0){let g=null;if(Array.from(Je.keys()).forEach(C=>{g===null&&C.endsWith(".current")&&(g=C)}),g!==null)ue=` Mutable values like '${g}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if($e.size>0){let C=Array.from($e)[0];E.set.has(C)||(ue=` Outer scope values like '${C}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!ue&&Ie.has("props")){let g=B.get("props");if(g==null)return;let C=g.references;if(!Array.isArray(C))return;let v=!0;for(let F=0;F<C.length;F++){let P=C[F],O=yt(R.block,P.identifier);if(!O){v=!1;break}let M=O.parent;if(M==null){v=!1;break}if(M.type!=="MemberExpression"&&M.type!=="OptionalMemberExpression"){v=!1;break}}v&&(ue=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${S} call and refer to those specific props inside ${n(I)}.`)}if(!ue&&Ie.size>0){let g=null;Ie.forEach(C=>{if(g)return;let v=R.set.get(C),F=B.get(C);if(F.references[0].resolved!==v)return;let P=v.defs[0];if(P==null||P.name==null||P.type!=="Parameter")return;let O=!1,M;for(let j=0;j<F.references.length;j++)if(M=F.references[j].identifier,M!=null&&M.parent!=null&&(M.parent.type==="CallExpression"||M.parent.type==="OptionalCallExpression")&&M.parent.callee===M){O=!0;break}O&&(g=C)}),g!==null&&(ue=` If '${g}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!ue&&Ie.size>0){let g=null;if(Ie.forEach(C=>{if(g!==null)return;let F=B.get(C).references,P,O;for(let M=0;M<F.length;M++){for(P=F[M].identifier,O=P.parent;O!=null&&O!==R.block;){if(O.type==="CallExpression"){let j=p.get(O.callee);if(j!=null){if(j.name===C)g={missingDep:C,setter:O.callee.name,form:"updater"};else if(u.has(P))g={missingDep:C,setter:O.callee.name,form:"reducer"};else{let ae=F[M].resolved;if(ae!=null){let Te=ae.defs[0];Te!=null&&Te.type==="Parameter"&&(g={missingDep:C,setter:O.callee.name,form:"inlineReducer"})}}break}}O=O.parent}if(g!==null)break}}),g!==null)switch(g.form){case"reducer":ue=` You can also replace multiple useState variables with useReducer if '${g.setter}' needs the current value of '${g.missingDep}'.`;break;case"inlineReducer":ue=` If '${g.setter}' needs the current value of '${g.missingDep}', you can also switch to useReducer instead of useState and read '${g.missingDep}' in the reducer.`;break;case"updater":ue=` You can also do a functional update '${g.setter}(${g.missingDep.slice(0,1)} => ...)' if you only need '${g.missingDep}' in the '${g.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:b,message:`React Hook ${n(I)} has `+(at(Ie,"a","missing","include")||at(Je,"an","unnecessary","exclude")||at(Qt,"a","duplicate","omit"))+ue,suggest:[{desc:`Update the dependencies array to be: [${Ye.map(ot).join(", ")}]`,fix(g){return g.replaceText(b,`[${Ye.map(ot).join(", ")}]`)}}]})}function x(f){let b=Mn(f.callee,i);if(b===-1)return;let I=f.arguments[b],S=f.callee,y=dr(S).name,E=f.arguments[b+1],k=/Effect($|[^a-z])/g.test(y);if(!I){s({node:S,message:`React Hook ${y} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(r&&!k)){if(!E&&!k){(y==="useMemo"||y==="useCallback")&&s({node:S,message:`React Hook ${y} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(I.type){case"FunctionExpression":case"ArrowFunctionExpression":h(I,E,S,y,k);return;case"Identifier":if(!E||E.elements&&E.elements.some(N=>N&&N.type==="Identifier"&&N.name===I.name))return;let R=t(f).set.get(I.name);if(R==null||R.defs==null)return;let w=R.defs[0];if(!w||!w.node||w.type!=="Variable"&&w.type!=="FunctionName")break;switch(w.node.type){case"FunctionDeclaration":h(w.node,E,S,y,k);return;case"VariableDeclarator":let N=w.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":h(N,E,S,y,k);return}break}break;default:s({node:S,message:`React Hook ${y} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:S,message:`React Hook ${y} has a missing dependency: '${I.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${I.name}]`,fix(R){return R.replaceText(E,`[${I.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let f of e.sourceCode.getAllComments())if(Nn.test(f.value))return r=!0,{CallExpression:b=>x(b,!0)}}return{CallExpression:f=>x(f)}}};function mt({dependencies:e,declaredDependencies:r,stableDependencies:n,externalDependencies:t,isEffect:o}){let l=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((h,x)=>{let f=s(l,x);f.isUsed=!0,a(l,x,b=>{b.isSubtreeUsed=!0})}),r.forEach(({key:h})=>{let x=s(l,h);x.isSatisfiedRecursively=!0}),n.forEach(h=>{let x=s(l,h);x.isSatisfiedRecursively=!0});function s(h,x){let f=x.split("."),b=h;for(let I of f){let S=b.children.get(I);S||(S=i(),b.children.set(I,S)),b=S}return b}function a(h,x,f){let b=x.split("."),I=h;for(let S of b){let y=I.children.get(S);if(!y)return;f(y),I=y}}let p=new Set,u=new Set;c(l,p,u,h=>h);function c(h,x,f,b){h.children.forEach((I,S)=>{let y=b(S);if(I.isSatisfiedRecursively){I.isSubtreeUsed&&f.add(y);return}if(I.isUsed){x.add(y);return}c(I,x,f,E=>y+"."+E)})}let m=[],d=new Set,T=new Set;return r.forEach(({key:h})=>{u.has(h)?m.indexOf(h)===-1?m.push(h):T.add(h):d.add(h)}),p.forEach(h=>{m.push(h)}),{suggestedDependencies:m,unnecessaryDependencies:d,duplicateDependencies:T,missingDependencies:p}}function Ae(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 Ae(e.consequent)!=null||Ae(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Ae(e.left)!=null||Ae(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Ae(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Ae(e.expression);case"TSAsExpression":return Ae(e.expression)}return null}function Dn({declaredDependencies:e,declaredDependenciesNode:r,componentScope:n,scope:t}){let o=e.map(({key:i})=>{let s=n.variables.find(p=>p.name===i);if(s==null)return null;let a=s.defs[0];if(a==null)return null;if(a.type==="Variable"&&a.node.type==="VariableDeclarator"&&a.node.id.type==="Identifier"&&a.node.init!=null){let p=Ae(a.node.init);if(p!=null)return[s,p]}return a.type==="FunctionName"&&a.node.type==="FunctionDeclaration"?[s,"function"]:a.type==="ClassName"&&a.node.type==="ClassDeclaration"?[s,"class"]:null}).filter(Boolean);function l(i){let s=!1;for(let a=0;a<i.references.length;a++){let p=i.references[a];if(p.writeExpr){if(s)return!0;s=!0;continue}let u=p.from;for(;u!==t&&u!=null;)u=u.upper;if(u!==t&&!yr(r,p.identifier))return!0}return!1}return o.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:l(i)}))}function mr(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)?mr(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function dt(e,r,n){r&&(e.optional?r.has(n)||r.set(n,!0):r.has(n)||r.set(n,!1))}function Ee(e,r){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let n=e.name;return r&&r.set(n,!1),n}else if(e.type==="MemberExpression"&&!e.computed){let n=Ee(e.object,r),t=Ee(e.property,null),o=`${n}.${t}`;return dt(e,r,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let n=Ee(e.object,r),t=Ee(e.property,null),o=`${n}.${t}`;return dt(e,r,o),o}else if(e.type==="ChainExpression"&&!e.computed){let n=e.expression;if(n.type==="CallExpression")throw new Error(`Unsupported node type: ${n.type}`);let t=Ee(n.object,r),o=Ee(n.property,null),l=`${t}.${o}`;return dt(n,r,l),l}else throw new Error(`Unsupported node type: ${e.type}`)}function dr(e,r){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Mn(e,r){let n=dr(e);if(n.type!=="Identifier")return-1;switch(n.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(n===e&&r&&r.additionalHooks){let t;try{t=Ee(n,null)}catch(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return r.additionalHooks.test(t)?0:-1}else return-1}}function yt(e,r){let n=[e],t=null;for(;n.length;){if(t=n.shift(),Ln(t,r))return t;if(yr(t,r))for(let[o,l]of Object.entries(t))o!=="parent"&&(ur(l)?(l.parent=t,n.push(l)):Array.isArray(l)&&l.forEach(i=>{ur(i)&&(i.parent=t,n.push(i))}))}return null}function jn(e){let r="";for(let n=0;n<e.length;n++)r+=e[n],n===0&&e.length===2?r+=" and ":n===e.length-2&&e.length>2?r+=", and ":n<e.length-1&&(r+=", ");return r}function ur(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Ln(e,r){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===r.type&&e.name===r.name&&e.range[0]===r.range[0]&&e.range[1]===r.range[1]}function yr(e,r){return e.range[0]<=r.range[0]&&e.range[1]>=r.range[1]}function _n(e){return!1}var Re=require("@typescript-eslint/utils"),re=he(require("typescript")),Sr=require("zod/v4");var $n=Re.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),gr="improved-no-unnecessary-condition",Un=Sr.z.object({}),zn=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Wn=new Set(zn),gt={name:gr,rule:$n({name:gr,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:[L(Un)]},defaultOptions:[{}],create(e){let r=Re.ESLintUtils.getParserServices(e,!0),n=r.program?.getTypeChecker();if(!n||!r.program)throw new Error("TypeScript services or program not available");function t(s){return s.type===Re.AST_NODE_TYPES.UnaryExpression&&s.operator==="typeof"}function o(s){return s.flags&re.default.TypeFlags.Any||s.flags&re.default.TypeFlags.Unknown?null:s.flags&re.default.TypeFlags.StringLike?["string"]:s.flags&re.default.TypeFlags.NumberLike?["number"]:s.flags&re.default.TypeFlags.BigIntLike?["bigint"]:s.flags&re.default.TypeFlags.BooleanLike?["boolean"]:s.flags&re.default.TypeFlags.ESSymbolLike?["symbol"]:s.flags&re.default.TypeFlags.Undefined||s.flags&re.default.TypeFlags.Void?["undefined"]:s.flags&re.default.TypeFlags.Null?["object"]:s.getCallSignatures().length>0?["function"]:s.flags&re.default.TypeFlags.Object?s.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:s.flags&re.default.TypeFlags.NonPrimitive?["object"]:s.flags&re.default.TypeFlags.Never?["never"]:null}function l(s){if(!n)return null;let a=r.esTreeNodeToTSNodeMap.get(s),p=n.getTypeAtLocation(a.expression);if(p.flags&re.default.TypeFlags.Any||p.flags&re.default.TypeFlags.Unknown)return null;let u=[];if(p.isUnion()){for(let m of p.types){let d=o(m);if(d)u.push(...d);else return null}return u}let c=o(p);return c?(u.push(...c),u):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,u=null;if(t(s.left)?(p=s.left,u=s.right.type===Re.AST_NODE_TYPES.Literal&&typeof s.right.value=="string"?s.right.value:null):t(s.right)&&(p=s.right,u=s.left.type===Re.AST_NODE_TYPES.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!u||!Vn(u,Wn))return;let c=l(p);if(!c)return;let m=s.operator==="!==",d=c.includes(u);c.length===1?d&&!m?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:De(p,e),type:u}}):!d&&m?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:De(p,e),type:Array.from(c)[0]}}):!d&&!m?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:De(p,e),actualType:Be(c),conditionType:u}}):d&&m&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:De(p,e),actualType:Be(c),conditionType:u}}):!d&&!m?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:De(p,e),actualType:Be(c),conditionType:u}}):!d&&m&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:De(p,e),type:Be(c)}})}return{BinaryExpression:i}}})};function Be(e){return Array.from(new Set(e)).join(" | ")||"never"}function De(e,r){let n=e.argument;return n.type===Re.AST_NODE_TYPES.Identifier?n.name:r.sourceCode.getText(n)}function Vn(e,r){return r.has(e)}var Ze=require("@typescript-eslint/utils"),Xe=require("zod/v4");var Hn=Ze.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Tr="no-call-with-explicit-generics",Jn=Xe.z.object({functions:Xe.z.array(Xe.z.string())}),Yn=Hn({name:Tr,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[L(Jn)]},defaultOptions:[{functions:[]}],create(e,[r]){let n=new Set(r.functions);return{CallExpression(t){let{callee:o}=t;o.type===Ze.AST_NODE_TYPES.Identifier&&n.has(o.name)&&t.typeArguments&&e.report({node:t,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),St={name:Tr,rule:Yn};var Fe=require("@typescript-eslint/utils"),qn=Fe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),hr="no-call-with-inferred-generics",Bn=qn({name:hr,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,[r]){let n=new Map(r.functions.map(t=>[t.name,t]));return{CallExpression(t){let{callee:o}=t;if(o.type!==Fe.AST_NODE_TYPES.Identifier)return;let l=n.get(o.name);if(!l)return;let{minGenerics:i=1,allowAny:s,disallowTypes:a=r.disallowTypes}=l;(t.typeArguments?.params.length||0)<(i||0)&&e.report({node:t,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(s&&!a)&&t.typeArguments?.params.some(u=>!s&&u.type===Fe.AST_NODE_TYPES.TSAnyKeyword||a&&u.type===Fe.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===Fe.AST_NODE_TYPES.Identifier&&a.includes(u.typeName.name))&&e.report({node:t,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),Tt={name:hr,rule:Bn};var br=require("@typescript-eslint/utils"),Xn=br.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),xr="no-commented-out-code",Zn=["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:"],X={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 Gn(e){if(e.includes(":")){let n=e.split(":")[0]?.trim();if(n&&/^[a-zA-Z]/.test(n)&&n.includes(" "))return!0}let r=e.trim();return r.length===0||/\.[A-Za-z_][A-Za-z0-9_]*\(/.test(r)||/[{}[\]()`=<>]/.test(r)||/:\s*(['"`[{(]|\w+\s*=>)/.test(r)||/\bif\s*\(|\belse\b|=>/.test(r)?!1:!!(r.includes(":")&&/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/.test(r))}var Kn=[") {","return;",X.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",X.stringAssignment,");",X.objectPropertyWithQuotes,X.computedPropertyAssignment,X.kebabCaseProperty,X.snakeCaseProperty,"&&","||","()",X.ternaryOperator,X.colonWithWord,X.quotedString,X.numberWithComma,X.arrayWithComma,X.objectWithComma,X.methodCall,X.arrayAccess,"?.(","??","=>",X.quotedPropertyKey],Qn=["/>","</",X.jsxSelfClosing,X.jsxElement,X.jsxOpeningTag,X.jsxClosingTag,X.htmlOpeningTag,X.htmlClosingTag],Er=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],ei=Xn({name:xr,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 r(t,o){if(t.startsWith("/"))return!1;let l=t.trimStart();if(t.startsWith("*")||l.startsWith("eslint-disable")||t.includes("@deprecated")||t.includes("@example")||t.includes("@param")||t.includes("@returns")||t.includes("@throws")||t.includes("typescript-eslint")||t.includes("@ts-")||t.includes("prettier-ignore")||X.jsdocComment.test(t))return!1;for(let i of Er)if(l.startsWith(i))return!1;if(t.includes("https://")||Gn(l))return!1;if(o==="Block"){for(let i of Qn)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of Zn)if(l.startsWith(i))return{wrongPattern:i};for(let i of Kn)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}function n(t,o){let l=t,i=l.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return l;if(o==="Block"&&l.includes("```")){let p=l.split(/```[\s\S]*?```/g);p.some(c=>/[a-zA-Z0-9]/.test(c))&&(l=p.join(""))}if(!l.includes("`"))return l;let s=l.split(/`[^`]*`/g);return s.some(p=>/[a-zA-Z0-9]/.test(p))?s.join(""):l}return{Program(){let o=e.sourceCode.getAllComments();for(let l of o){let i=n(l.value,l.type),s=r(i,l.type);s&&e.report({node:l,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:Er.join(", ")}})}}}}}),ht={name:xr,rule:ei};var Ge=require("@typescript-eslint/utils"),ti=Ge.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cr="no-default-export",ri=ti({name:Cr,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(r){e.report({node:r,messageId:"noDefaultExport"})},ExportNamedDeclaration(r){for(let n of r.specifiers)n.exported.type===Ge.TSESTree.AST_NODE_TYPES.Identifier&&n.exported.name==="default"&&e.report({node:r,messageId:"noDefaultExport"})}}}}),Et={name:Cr,rule:ri};var Ir=require("@typescript-eslint/utils"),ni=Ir.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),wr="no-leaked-text-in-jsx",ii=[",",";","[","]","(",")"],si=ni({name:wr,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(r){let n=r.value.trim();if(!n)return;let t="";ii.includes(n)?t=n:n.includes("&&")?t="&&":n.includes("||")?t="||":n.endsWith("? (")&&(t="? ("),t&&e.report({node:r,messageId:"leakedTextInJSX",data:{text:t}})}}}}),bt={name:wr,rule:si};var ve=require("@typescript-eslint/utils"),oi=ve.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Rr="no-non-camel-case-functions",ai=/^(\$?[a-z][a-zA-Z0-9]*)$/;function Ar(e){if(e.typeName.type!==ve.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:r,right:n}=e.typeName;return r.type===ve.AST_NODE_TYPES.Identifier&&r.name==="JSX"&&n.name==="Element"}var li=oi({name:Rr,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(r){if(r.id&&!ai.test(r.id.name)){let n=r.returnType?.typeAnnotation;if(n&&(n.type===ve.AST_NODE_TYPES.TSTypeReference?Ar(n):n.type===ve.AST_NODE_TYPES.TSUnionType&&n.types.some(o=>o.type===ve.AST_NODE_TYPES.TSTypeReference&&Ar(o))))return;e.report({node:r.id,messageId:"nonCamelCaseFunction",data:{functionName:r.id.name}})}}}}}),xt={name:Rr,rule:li};var z=require("@typescript-eslint/utils");var Ct=require("@typescript-eslint/utils");function Me(e,r,n=1/0){if(n!==0&&e.parent)return e.type===r?e:Me(e.parent,r,n===1/0?n:n-1)}function*It(e){yield e,e.parent&&(yield*It(e.parent))}function wt(e,r){for(let n of e){let t=r(n);if(t!=null&&t!==!1)return t}}function vr(e,r,n){let o=n.getDeclaredVariables(e).find(l=>l.name===r||l.identifiers[0]?.parent.type===Ct.AST_NODE_TYPES.Property&&l.identifiers[0]?.parent.key.type===Ct.AST_NODE_TYPES.Identifier&&l.identifiers[0]?.parent.key.name===r);return o?o.references.filter(l=>!l.init):[]}var pi=z.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),kr="no-optional-root-props",ci=pi({name:kr,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 r(t){let l=e.sourceCode.getDeclaredVariables(t)[0];if(!l||l.references.length!==1)return!1;let i=l.references[0];if(!i)return!1;for(let s of It(i.identifier)){if("returnType"in s||s.type===z.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let a=s.parent;if(!a)return!1;if(a.type===z.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&a.parent.type===z.TSESTree.AST_NODE_TYPES.TSTypeReference&&a.parent.typeName.type===z.TSESTree.AST_NODE_TYPES.Identifier&&a.parent.typeName.name==="FC"){let u=Me(a.parent.parent,z.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let c=Ke(u,e.sourceCode);return c?!(c.parent.type===z.TSESTree.AST_NODE_TYPES.CallExpression&&c.parent.callee.type===z.TSESTree.AST_NODE_TYPES.Identifier&&c.parent.callee.name==="memo"):!1}if(s.type===z.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(a.type===z.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let p=Me(a,z.TSESTree.AST_NODE_TYPES.VariableDeclaration);return p?!!Ke(p,e.sourceCode):!1}if(a.type===z.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!Ke(a,e.sourceCode)}return!1}function n(t){t.key.type!==z.TSESTree.AST_NODE_TYPES.Identifier||!t.optional||e.report({node:t.key,messageId:"optionalNotAllowed",data:{propertyName:t.key.name},suggest:[{messageId:"suggestion",fix:o=>{let l=Me(t,z.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!l)return null;let i=e.sourceCode.getText(l);return o.replaceText(l,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(t){if(t.typeAnnotation.type===z.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(Qe(t)||!r(t)))for(let o of t.typeAnnotation.members)o.type===z.TSESTree.AST_NODE_TYPES.TSPropertySignature&&n(o)},TSInterfaceDeclaration(t){if(!(Qe(t)||!r(t)))for(let o of t.body.body)o.type===z.TSESTree.AST_NODE_TYPES.TSPropertySignature&&n(o)},TSTypeReference(t){if(t.typeName.type!==z.TSESTree.AST_NODE_TYPES.Identifier||t.typeName.name!=="FC"||!t.typeArguments?.params[0])return;let o=t.typeArguments.params[0];if(o.type!==z.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let l=Me(t.parent,z.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!l)return;let i=Ke(l,e.sourceCode);if(!(!i||i.parent.type===z.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===z.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let a of o.members)a.type===z.TSESTree.AST_NODE_TYPES.TSPropertySignature&&n(a)}}}});function Qe(e){return e?e.parent?.type===z.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===z.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Ke(e,r){if(Qe(e))return;let n;if(e.type===z.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===z.TSESTree.AST_NODE_TYPES.Identifier&&(n=e.declarations[0].id)}else{if(!e.id)return;n=e.id}if(!n)return;let t=r.getScope(e);e.type===z.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&t.upper&&(t=t.upper);let o=t.variables.find(i=>i.identifiers.includes(n));if(!o)return;let l=o.references.filter(i=>i.identifier!==n);if(!(l.length!==1||!l[0])&&!Qe(l[0].identifier.parent.parent))return l[0].identifier}var At={name:kr,rule:ci};var Ue=require("@typescript-eslint/utils");var ze=H({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let r=new Set;function n(t){return t?t.type===Ue.AST_NODE_TYPES.Identifier?r.has(t.name):t.type===Ue.AST_NODE_TYPES.MemberExpression?n(t.object):!1:!1}return{ImportDeclaration(t){for(let o of t.specifiers)r.add(o.local.name)},ExportNamedDeclaration(t){if(t.source){e.report({node:t,messageId:"noReexport"});return}if(t.declaration?.type===Ue.AST_NODE_TYPES.VariableDeclaration)for(let o of t.declaration.declarations)n(o.init)&&e.report({node:t,messageId:"noReexport"});t.specifiers.length>0&&e.report({node:t,messageId:"noReexport"})},ExportDefaultDeclaration(t){t.declaration.type===Ue.AST_NODE_TYPES.Identifier&&r.has(t.declaration.name)&&e.report({node:t,messageId:"noReexport"})},ExportAllDeclaration(t){e.report({node:t,messageId:"noReexport"})}}}});var Fr=require("@typescript-eslint/utils"),et=he(require("path")),be=require("zod/v4");var ui=Fr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Or="no-relative-imports",fi=be.z.object({find:be.z.string(),replacement:be.z.string()}),mi=be.z.object({aliases:be.z.array(fi),rootDir:be.z.string().optional(),allowNotFoundAliases:be.z.boolean().optional(),_dev_simulateFileName:be.z.string().optional()}),di=ui({name:Or,meta:{type:"problem",fixable:"code",docs:{description:"Prevent relative imports and auto-fix them using configured aliases"},messages:{noRelativeImports:"Relative imports are not allowed. Use one of the valid aliases in tsconfig.json instead.",noRelativeImportsWithAlias:'Relative imports are not allowed. Use the "{{ alias }}" alias instead.'},schema:[L(mi)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[r]){let n=r._dev_simulateFileName??e.filename;function t(i){return i.startsWith(".")||i.startsWith("..")}function o(i,s){let a=et.default.dirname(s);return et.default.resolve(a,i)}function l(i){let s=r.rootDir??process.cwd(),a=et.default.relative(s,i);if(a.startsWith("."))return null;a.startsWith("/")||(a=`/${a}`);for(let{find:p,replacement:u}of r.aliases)if(a.startsWith(u)){let c=a.replace(u,p);return{alias:p,newPath:c}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!t(s))return;let a=o(s,n),p=l(a);!p&&r.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?u=>u.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),Rt={name:Or,rule:di};var Z=require("@typescript-eslint/utils"),vt=require("zod/v4");var yi=vt.z.object({customMessage:vt.z.string().optional()}),kt=H({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[L(yi)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[r]){function n(t){switch(t.type){case Z.AST_NODE_TYPES.Literal:return!0;case Z.AST_NODE_TYPES.ObjectExpression:return t.properties.every(o=>o.type===Z.AST_NODE_TYPES.Property?o.computed||o.value.type===Z.AST_NODE_TYPES.Identifier&&o.key.type===Z.AST_NODE_TYPES.Identifier&&o.key.name===o.value.name?!1:n(o.value):!1);case Z.AST_NODE_TYPES.ArrayExpression:return t.elements.every(o=>o?o.type===Z.AST_NODE_TYPES.SpreadElement?!1:n(o):!0);case Z.AST_NODE_TYPES.TemplateLiteral:return t.expressions.length===0;case Z.AST_NODE_TYPES.ConditionalExpression:case Z.AST_NODE_TYPES.LogicalExpression:case Z.AST_NODE_TYPES.BinaryExpression:case Z.AST_NODE_TYPES.UnaryExpression:case Z.AST_NODE_TYPES.CallExpression:case Z.AST_NODE_TYPES.MemberExpression:case Z.AST_NODE_TYPES.Identifier:case Z.AST_NODE_TYPES.ArrowFunctionExpression:case Z.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(t){if(t.name.type===Z.AST_NODE_TYPES.JSXIdentifier&&t.name.name==="style"&&t.value){let o=null;t.value.type===Z.AST_NODE_TYPES.JSXExpressionContainer?t.value.expression.type!==Z.AST_NODE_TYPES.JSXEmptyExpression&&(o=t.value.expression):t.value.type===Z.AST_NODE_TYPES.Literal&&(o=t.value),o&&n(o)&&e.report({node:t,messageId:"noStaticStyleProp",data:{customMessage:r.customMessage?` ${r.customMessage}`:""}})}}}}});var We=require("@typescript-eslint/utils"),Oe=he(require("zod/v4"));var gi=Oe.object({alternativeMsgs:Oe.object({inArrayFind:Oe.string().optional(),inArrayFilter:Oe.string().optional()}).optional(),__dev_simulateFileName:Oe.string().optional()});function Si(e){return e.typeAnnotation.type!==We.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}function Ti(e){return/\.(typeGuards|type-guards)\.(ts|tsx)$/.test(e)}function hi(e){let r=e.parent;for(;r;){if(r.type===We.AST_NODE_TYPES.CallExpression&&r.callee.type===We.AST_NODE_TYPES.MemberExpression&&r.callee.property.type===We.AST_NODE_TYPES.Identifier){let n=r.callee.property.name;if(n==="filter"||n==="find")return{method:n}}r=r.parent}return null}var Ft=H({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[L(gi)],hasSuggestions:!0},defaultOptions:[{}],create(e,[r]){let n=r.__dev_simulateFileName??e.filename;if(Ti(n))return{};function t(o){if(!Si(o))return;let l=hi(o);if(r.alternativeMsgs&&l){let i=l.method==="filter"?r.alternativeMsgs.inArrayFilter:r.alternativeMsgs.inArrayFind;if(i){let s=l.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:s,data:{message:i}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":t,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":t,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":t}}});var Pe=require("@typescript-eslint/utils");var Ei="no-unnecessary-async-on-jsx-props";function bi(e){if(e.body.type!==Pe.AST_NODE_TYPES.BlockStatement)return!1;let r=e.body.body;if(r.length!==1)return!1;let n=r[0];return!n||n.type!==Pe.AST_NODE_TYPES.ExpressionStatement?!1:n.expression.type===Pe.AST_NODE_TYPES.AwaitExpression}var Ot=H({name:Ei,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 r(n){bi(n)&&e.report({node:n,messageId:"unnecessaryAsyncInJsxProp",fix(t){let o=e.sourceCode,l=[],i=o.getFirstToken(n,a=>a.value==="async");if(i){let a=o.getTokenAfter(i);a?l.push(t.replaceTextRange([i.range[0],a.range[0]],"")):l.push(t.remove(i))}function s(a){if(a.type===Pe.AST_NODE_TYPES.AwaitExpression){let p=o.getFirstToken(a);if(p&&p.value==="await"){let u=o.getTokenAfter(p);u?l.push(t.replaceTextRange([p.range[0],u.range[0]],"")):l.push(t.remove(p))}}if(a.type===Pe.AST_NODE_TYPES.BlockStatement)for(let p of a.body)s(p);else a.type===Pe.AST_NODE_TYPES.ExpressionStatement&&s(a.expression)}return s(n.body),l}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":r,"JSXAttribute FunctionExpression[async=true]":r}}});var xe=require("@typescript-eslint/utils"),Pt=he(require("typescript")),je=he(require("zod/v4"));var xi=xe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pr="no-unnecessary-casting",Ci=je.default.object({additionalCastFunctions:je.default.array(je.default.object({name:je.default.string(),expectedType:je.default.enum(["string","number"])})).optional()}),Nt={name:Pr,rule:xi({name:Pr,meta:{type:"suggestion",docs:{description:"Prevents unnecessary Number and String castings"},messages:{unnecessaryNumberCasting:"Unnecessary Number() casting on a value already of number type",unnecessaryStringCasting:"Unnecessary String() casting on a value already of string type",unnecessaryCustomCasting:"Unnecessary {{name}}() casting on a value already of {{type}} type"},schema:[L(Ci)],fixable:"code"},defaultOptions:[{}],create(e){let n=e.options[0].additionalCastFunctions||[],t=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...n],o=xe.ESLintUtils.getParserServices(e,!0),l=o.program?.getTypeChecker();if(!l||!o.program)throw new Error("TypeScript services or program not available");function i(u,c){switch(u.type){case xe.AST_NODE_TYPES.Literal:return c==="number"?typeof u.value=="number":typeof u.value=="string";case xe.AST_NODE_TYPES.TemplateLiteral:return c==="string";case xe.AST_NODE_TYPES.UnaryExpression:return c==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function s(u,c){return c==="number"?!!(u.flags&Pt.TypeFlags.NumberLike):!!(u.flags&Pt.TypeFlags.StringLike)}function a(u,c){return m=>m.replaceText(u,e.sourceCode.getText(c))}function p(u){if(!l||u.arguments.length!==1)return;let c=u.arguments[0];if(!c||c.type===xe.AST_NODE_TYPES.SpreadElement)return;let{callee:m}=u;if(m.type!==xe.AST_NODE_TYPES.Identifier)return;let d=m.name,T=t.find(x=>x.name===d);if(!T)return;if(i(c,T.expectedType)||s(l.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(c)),T.expectedType)){let x,f;d==="Number"?x="unnecessaryNumberCasting":d==="String"?x="unnecessaryStringCasting":(x="unnecessaryCustomCasting",f={name:T.name,type:T.expectedType}),e.report({node:u,messageId:x,...f?{data:f}:{},fix:a(u,c)})}}return{CallExpression:p}}})};var Ve=require("@typescript-eslint/utils"),de=he(require("zod/v4"));var Ii=de.object({methods:de.union([de.array(de.string()),de.literal("array")])}),Dt=H({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[L(Ii)]},defaultOptions:[{methods:"array"}],create(e,[r]){let n=r.methods,t=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(n)?n.includes(s):t.has(s)}function l(s){let{callee:a}=s;if(a.type===Ve.AST_NODE_TYPES.MemberExpression){let p=a.property;if(p.type===Ve.AST_NODE_TYPES.Identifier)return p.name}return null}function i(s,a){if(s.type!==Ve.AST_NODE_TYPES.Identifier||!s.typeAnnotation)return;let p=a.parent;if(p.type===Ve.AST_NODE_TYPES.CallExpression){let u=l(p);u&&o(u)&&p.arguments.indexOf(a)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(m){return s.typeAnnotation?m.remove(s.typeAnnotation):null}})}}return{ArrowFunctionExpression(s){for(let a of s.params)i(a,s)},FunctionExpression(s){for(let a of s.params)i(a,s)}}}});var oe=require("@typescript-eslint/utils");var Mt=H({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(r){if(r.id.type===oe.AST_NODE_TYPES.ObjectPattern||!r.init||r.init.type!==oe.AST_NODE_TYPES.ObjectExpression||r.id.type===oe.AST_NODE_TYPES.Identifier&&r.id.typeAnnotation||r.parent.parent.type===oe.AST_NODE_TYPES.ExportNamedDeclaration)return;let n=new Map;for(let i of r.init.properties)i.type===oe.AST_NODE_TYPES.Property&&i.key.type===oe.AST_NODE_TYPES.Identifier&&n.set(i.key.name,i);if(n.size===0||r.id.type!==oe.AST_NODE_TYPES.Identifier)return;let t=wi(r,e.sourceCode);if(t.length===0)return;let o=r.init.properties.some(i=>i.type!==oe.AST_NODE_TYPES.Property?!1:i.value.type===oe.AST_NODE_TYPES.FunctionExpression),l=new Set;for(let i of t){if(i.identifier.parent.type!==oe.AST_NODE_TYPES.MemberExpression)return;let s=i.identifier.parent;if(s.object!==i.identifier)return;if(s.computed)if(s.property.type===oe.AST_NODE_TYPES.Literal&&typeof s.property.value=="string")l.add(s.property.value);else return;else{if(s.property.type!==oe.AST_NODE_TYPES.Identifier)return;l.add(s.property.name)}if(s.parent.type===oe.AST_NODE_TYPES.CallExpression&&o)return}for(let[i,s]of n)l.has(i)||e.report({node:s,messageId:"unusedObjectProperty",data:{name:i}})}}}});function wi(e,r){let n=r.getDeclaredVariables(e);if(n.length!==1)return[];let t=n[0];return t?t.references.filter(o=>o.identifier!==e.id):[]}var W=require("@typescript-eslint/utils"),ke=require("zod/v4");var Ai=ke.z.object({selectors:ke.z.array(ke.z.object({name:ke.z.string(),selectorProp:ke.z.string().optional(),selectorArgPos:ke.z.number().optional(),returnProp:ke.z.string().optional()}))}),Ri=W.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nr="no-unused-selected-values",jt={name:Nr,rule:Ri({name:Nr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[L(Ai)]},defaultOptions:[{selectors:[]}],create(e,[r]){let{selectors:n=[]}=r,t=new Map(n.map(o=>[o.name,o]));return{VariableDeclarator(o){let l=null;if(o.init?.type===W.AST_NODE_TYPES.CallExpression&&(l=o.init),!l)return;let i=ki(l);if(!i)return;let s=t.get(i);if(!s)return;let a=vi(l,s.selectorArgPos??0,s.selectorProp);if(!a)return;let p=Fi(a);if(!p)return;let u=Dr(p.properties,void 0);if(!u)return;if(o.id.type===W.AST_NODE_TYPES.ObjectPattern){let d=Dr(o.id.properties,s.returnProp);if(!d)return;for(let[T,h]of u)d.has(T)||e.report({node:h,messageId:"unusedSelectedValue",data:{name:T}});return}if(o.id.type!==W.AST_NODE_TYPES.Identifier||s.returnProp)return;let c=Oi(o,e.sourceCode);if(c.length===0)return;let m=new Set;for(let d of c){if(d.identifier.parent.type!==W.AST_NODE_TYPES.MemberExpression)return;let T=d.identifier.parent.property;if(T.type!==W.AST_NODE_TYPES.Identifier)return;m.add(T.name)}for(let[d,T]of u)m.has(d)||e.report({node:T,messageId:"unusedSelectedValue",data:{name:d}})}}}})};function vi(e,r,n){let t=e.arguments[r];if(!t)return null;if(t.type===W.AST_NODE_TYPES.ArrowFunctionExpression||t.type===W.AST_NODE_TYPES.FunctionExpression)return t;if(n&&t.type===W.AST_NODE_TYPES.ObjectExpression){let o=t.properties.find(i=>i.type===W.AST_NODE_TYPES.Property&&i.key.type===W.AST_NODE_TYPES.Identifier&&i.key.name===n);if(o?.type!==W.AST_NODE_TYPES.Property)return null;let l=o.value;if(l.type===W.AST_NODE_TYPES.ArrowFunctionExpression||l.type===W.AST_NODE_TYPES.FunctionExpression)return l}return null}function ki(e){return e.callee.type===W.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===W.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===W.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Fi(e){if(e.body.type===W.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===W.AST_NODE_TYPES.BlockStatement){let r=e.body.body.filter(n=>n.type===W.AST_NODE_TYPES.ReturnStatement);return r.length!==1||!r[0]||r[0].argument?.type!==W.AST_NODE_TYPES.ObjectExpression?null:r[0].argument}return null}function Dr(e,r){let n=e;if(r){let o=e.find(l=>l.type===W.AST_NODE_TYPES.Property&&l.key.type===W.AST_NODE_TYPES.Identifier&&l.key.name===r);if(o?.type!==W.AST_NODE_TYPES.Property||o.value.type!==W.AST_NODE_TYPES.ObjectPattern)return null;n=o.value.properties}let t=new Map;for(let o of n){if(o.type!==W.AST_NODE_TYPES.Property||o.key.type!==W.AST_NODE_TYPES.Identifier)return null;t.set(o.key.name,o)}return t.size>0?t:null}function Oi(e,r){let n=r.getDeclaredVariables(e);if(n.length!==1)return[];let t=n[0];return t?t.references.filter(o=>o.identifier!==e.id):[]}var J=require("@typescript-eslint/utils");var Lt=H({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(l=>l.type===J.AST_NODE_TYPES.ImportDeclaration&&l.source.value==="t-state-form"))return{};let t=null,o=!1;return{CallExpression(l){if(o)return;if(!t){let s=Pi(l);s&&(t=s);return}let i=Ni(l,e.sourceCode);if(i){o=!0;for(let s of i)t.delete(s);if(t.size!==0)for(let[s,a]of t)e.report({node:a,messageId:"unusedField",data:{name:s}})}}}}});function Pi(e){if(!(e.callee.type===J.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let n=e.arguments[0];if(!n||n.type!==J.AST_NODE_TYPES.ObjectExpression)return null;let t=wt(n.properties,l=>l.type!==J.AST_NODE_TYPES.Property||l.key.type!==J.AST_NODE_TYPES.Identifier||l.key.name!=="initialConfig"?null:l.value.type===J.AST_NODE_TYPES.ObjectExpression?l.value:l.value.type===J.AST_NODE_TYPES.ArrowFunctionExpression||l.value.type===J.AST_NODE_TYPES.FunctionExpression?Di(l.value):null);if(!t)return null;let o=new Map;for(let l of t.properties)l.type===J.AST_NODE_TYPES.Property&&l.key.type===J.AST_NODE_TYPES.Identifier&&o.set(l.key.name,l);return o}function Ni(e,r){if(!(e.callee.type===J.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==J.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==J.AST_NODE_TYPES.ObjectPattern||!wt(e.parent.id.properties,i=>i.type===J.AST_NODE_TYPES.Property&&i.key.type===J.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let o=vr(e.parent,"formFields",r),l=new Set;for(let{identifier:i}of o){if(i.type!==J.AST_NODE_TYPES.Identifier||i.parent.type===J.AST_NODE_TYPES.Property&&i.parent.parent.type===J.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===J.AST_NODE_TYPES.ReturnStatement||i.parent.type===J.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===J.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==J.AST_NODE_TYPES.Identifier||i.parent.property.type!==J.AST_NODE_TYPES.Identifier)return null;l.add(i.parent.property.name)}}return l}function Di(e){if(e.body.type===J.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===J.AST_NODE_TYPES.BlockStatement){let r=e.body.body.filter(n=>n.type===J.AST_NODE_TYPES.ReturnStatement);return r.length!==1||!r[0]||r[0].argument?.type!==J.AST_NODE_TYPES.ObjectExpression?null:r[0].argument}return null}var U=require("@typescript-eslint/utils"),He=require("zod/v4");var Mi=U.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Mr(e){let r=[];for(let n of e.members)n.type===U.AST_NODE_TYPES.TSPropertySignature&&n.key.type===U.AST_NODE_TYPES.Identifier&&r.push([n.key.name,n]);return r}function jr(e,...r){for(let n of r)e.set(...n);return e}var ji=He.z.object({forceCheckOnFCPropTypesWithName:He.z.array(He.z.string()).optional(),alwaysCheckFunctionOptionTypes:He.z.boolean().optional()}),Lr="no-unused-type-props-in-args",_t=null,Li=Mi({name:Lr,meta:{type:"problem",docs:{description:"Disallow unused undestructured object type properties"},messages:{unusedObjectTypeProperty:"Object type property '{{ propertyName }}' is defined but never used",missingComponentParam:"Component has declared props but no props are used"},schema:[L(ji)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[r]){let{forceCheckOnFCPropTypesWithName:n,alwaysCheckFunctionOptionTypes:t=!0}=r;n&&!_t&&(_t=n.map(a=>new RegExp(a)));function o(a,p,u,c,m=!0,d=!1){let T=u.name,h=e.sourceCode.getScope(p).references.find(S=>S.identifier.name===T)?.resolved,x=a&&_t?.some(S=>S.test(T)),f=d&&t;if(!h||!x&&h.references.filter(S=>S.isTypeReference).length>1||!h.defs[0])return;let b=h.defs[0].node,I=b.parent?.type===U.AST_NODE_TYPES.ExportNamedDeclaration;if(!(m&&I&&!f)){if(b.type===U.AST_NODE_TYPES.TSTypeAliasDeclaration){l(a,p,c,b.typeAnnotation,!0,d);return}if(b.type===U.AST_NODE_TYPES.TSInterfaceDeclaration){l(a,p,c,b.body,!0,d);return}}}function l(a,p,u,c,m,d=!1){if(c.type===U.AST_NODE_TYPES.TSInterfaceBody){for(let T of c.body)T.type===U.AST_NODE_TYPES.TSPropertySignature&&T.key.type===U.AST_NODE_TYPES.Identifier&&u.set(T.key.name,T);return}if(c.type===U.AST_NODE_TYPES.TSTypeLiteral){jr(u,...Mr(c));return}if(c.type===U.AST_NODE_TYPES.TSIntersectionType){for(let T of c.types)l(a,p,u,T,!0,d);return}m||c.type===U.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===U.AST_NODE_TYPES.Identifier&&o(a,p,c.typeName,u,!0,d)}function i(a,p,u,c=!1){for(let m of u)if(m.type===U.AST_NODE_TYPES.ObjectPattern&&m.typeAnnotation){let d=new Map;if(l(a,p,d,m.typeAnnotation.typeAnnotation,!1,c),d.size===0)continue;s(m,d)}else m.type===U.AST_NODE_TYPES.AssignmentPattern&&m.left.type===U.AST_NODE_TYPES.ObjectPattern&&i(a,p,[m.left],c)}function s(a,p){let u=[];if(a.properties.at(-1)?.type===U.AST_NODE_TYPES.RestElement)return;for(let T of a.properties)T.type===U.AST_NODE_TYPES.Property&&T.key.type===U.AST_NODE_TYPES.Identifier&&u.push(T.key.name);let m=[],d=[];for(let[T,h]of p)u.includes(T)||(d.push(T),m.push({node:h,messageId:"unusedObjectTypeProperty",data:{propertyName:T}}));for(let[T,h]of m.entries())e.report({...h,fix:T===m.length-1?x=>{let f=a.properties.at(-1),b=d.join(", ");return f?f.type===U.AST_NODE_TYPES.RestElement?null:x.insertTextAfter(f,`, ${b}`):x.insertTextBeforeRange([a.range[0]+1,a.range[1]],b)}:void 0})}return{VariableDeclaration(a){let p=a.declarations[0],u=new Map,c=p.id.type===U.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===U.AST_NODE_TYPES.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===U.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(c){if(c.type===U.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===U.AST_NODE_TYPES.Identifier)o(!0,a,c.typeName,u,!1);else if(c.type===U.AST_NODE_TYPES.TSTypeLiteral)jr(u,...Mr(c));else if(c.type===U.AST_NODE_TYPES.TSIntersectionType)for(let m of c.types)m.type===U.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===U.AST_NODE_TYPES.Identifier?o(!0,a,m.typeName,u,!1):l(!0,a,u,m,!0);if(u.size!==0&&p.init?.type===U.AST_NODE_TYPES.ArrowFunctionExpression){let m=p.init.params[0];if(!m){e.report({node:p.init,messageId:"missingComponentParam"});return}m.type===U.AST_NODE_TYPES.ObjectPattern&&s(m,u)}}},FunctionDeclaration(a){i(!1,a,a.params,t)},ArrowFunctionExpression(a){i(!1,a,a.params,t)}}}}),$t={name:Lr,rule:Li};var le=require("@typescript-eslint/utils");var Ut=H({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 r=new Set;function n(t){return t.callee.type===le.AST_NODE_TYPES.Identifier?r.has(t.callee.name):t.callee.type===le.AST_NODE_TYPES.MemberExpression&&t.callee.object.type===le.AST_NODE_TYPES.Identifier&&t.callee.property.type===le.AST_NODE_TYPES.Identifier?t.callee.property.name==="useRef":!1}return{ImportDeclaration(t){if(t.source.value==="react")for(let o of t.specifiers)o.type===le.AST_NODE_TYPES.ImportSpecifier&&o.imported.type===le.AST_NODE_TYPES.Identifier&&o.imported.name==="useRef"&&r.add(o.local.name)},VariableDeclarator(t){if(t.init&&t.init.type===le.AST_NODE_TYPES.CallExpression&&n(t.init)&&t.id.type===le.AST_NODE_TYPES.Identifier){let l=e.sourceCode.getScope(t).set.get(t.id.name);if(l){let i=!1;for(let s of l.references){let p=s.identifier.parent;if(p!==t&&!(p.type===le.AST_NODE_TYPES.JSXExpressionContainer&&p.parent.type===le.AST_NODE_TYPES.JSXAttribute&&p.parent.name.type===le.AST_NODE_TYPES.JSXIdentifier&&p.parent.name.name==="ref")){i=!0;break}}i||e.report({node:t.id,messageId:"refNotRead",data:{name:t.id.name}})}}}}}});var Le=require("@typescript-eslint/utils"),_i=Le.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),$r="prefer-named-functions",_r=new Map,$i=_i({name:$r,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,[r]){let n=null;if(r.ignoreRegex){let t=_r.get(r.ignoreRegex);t?n=t:(n=new RegExp(r.ignoreRegex),_r.set(r.ignoreRegex,n))}return{VariableDeclarator(t){if(t.init&&t.init.type===Le.AST_NODE_TYPES.ArrowFunctionExpression&&t.id.type===Le.AST_NODE_TYPES.Identifier){let o=t.id.name;if(t.id.typeAnnotation||n&&n.test(o)||!r.disallowArrowFnWithImplicitReturns&&t.init.body.type!==Le.AST_NODE_TYPES.BlockStatement)return;let l=t.parent,i=t.init.params,s=t.init.body,a=t.init;e.report({node:t.id,messageId:n?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:r.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(l,`${a.async?"async ":""}function ${o}(${i.map(u=>e.sourceCode.getText(u)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),zt={name:$r,rule:$i};var D=require("@typescript-eslint/utils"),ye=require("zod/v4");var Ui=ye.z.object({disallowedFunctions:ye.z.array(ye.z.object({name:ye.z.string(),allowUsingWithArgs:ye.z.boolean().optional(),hookAlternative:ye.z.string().optional(),message:ye.z.string().optional(),allowUseInside:ye.z.array(ye.z.string()).optional()}))});function tt(e){return/^use[A-Z]/.test(e)}function Ur(e){return/^[A-Z]/.test(e)}function zi(e){return e.type===D.AST_NODE_TYPES.Identifier?tt(e.name):e.type===D.AST_NODE_TYPES.MemberExpression&&e.property.type===D.AST_NODE_TYPES.Identifier?tt(e.property.name):!1}function zr(e,r){return e.type===D.AST_NODE_TYPES.Identifier?e.name===r:e.type===D.AST_NODE_TYPES.MemberExpression&&e.object.type===D.AST_NODE_TYPES.Identifier&&e.property.type===D.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===r:!1}function Wr(e){return!!(e.parent&&e.parent.type===D.AST_NODE_TYPES.CallExpression&&zr(e.parent.callee,"forwardRef"))}function Vr(e){return!!(e.parent&&e.parent.type===D.AST_NODE_TYPES.CallExpression&&zr(e.parent.callee,"memo"))}function Wt(e){if(e.type===D.AST_NODE_TYPES.FunctionDeclaration||e.type===D.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===D.AST_NODE_TYPES.FunctionExpression||e.type===D.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===D.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===D.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===D.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===D.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Wi(e){let r=e.parent,n=!1;for(;r;){if(r.type===D.AST_NODE_TYPES.FunctionDeclaration||r.type===D.AST_NODE_TYPES.FunctionExpression||r.type===D.AST_NODE_TYPES.ArrowFunctionExpression){let t=Wt(r);if(t&&t.type===D.AST_NODE_TYPES.Identifier){if(Ur(t.name)||tt(t.name))return!n;n=!0}else{if(Wr(r)||Vr(r))return!n;if(r.parent.type===D.AST_NODE_TYPES.CallExpression){let o=r.parent;zi(o.callee)||(n=!0)}else r.parent.type===D.AST_NODE_TYPES.JSXExpressionContainer||(n=!0)}}r=r.parent}return!1}function Hr(e){return e.callee.type===D.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===D.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===D.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Vi(e,r){if(!r.length)return!1;let n=e.parent;for(;n;){if(n.type===D.AST_NODE_TYPES.FunctionDeclaration||n.type===D.AST_NODE_TYPES.FunctionExpression||n.type===D.AST_NODE_TYPES.ArrowFunctionExpression){let t=Wt(n);if(t&&t.type===D.AST_NODE_TYPES.Identifier&&r.includes(t.name))return!0}else if(n.type===D.AST_NODE_TYPES.CallExpression){let t=Hr(n);if(t&&r.includes(t))return!0}n=n.parent}return!1}function Hi(e){return e.arguments.length>0&&!e.arguments.every(r=>r.type===D.AST_NODE_TYPES.Identifier&&r.name==="undefined")}function Ji(e,r){let n=!1,t=e.parent;for(;t;){if(t.type===D.AST_NODE_TYPES.FunctionDeclaration||t.type===D.AST_NODE_TYPES.FunctionExpression||t.type===D.AST_NODE_TYPES.ArrowFunctionExpression){let o=Wt(t);if(o&&o.type===D.AST_NODE_TYPES.Identifier){if(Ur(o.name)||tt(o.name)){n=!0;break}}else if(Wr(t)||Vr(t)){n=!0;break}}t=t.parent}return n?r.length===0?Wi(e):!Vi(e,r):!1}var Vt=H({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[L(Ui)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[r]){let{disallowedFunctions:n}=r,t=new Map(n.map(o=>[o.name,o]));return{CallExpression(o){let l=Hr(o);if(!l)return;let i=t.get(l);if(!i||i.allowUsingWithArgs&&Hi(o))return;let s=i.allowUseInside||[];Ji(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:a=>{let p=i.hookAlternative;return p?o.callee.type===D.AST_NODE_TYPES.Identifier?a.replaceText(o.callee,p):o.callee.type===D.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===D.AST_NODE_TYPES.Identifier?a.replaceText(o.callee.property,p):null:null}}]:[]})}}}});var Y=require("@typescript-eslint/utils"),rt=he(require("zod/v4"));var Yi=Y.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Yr="prefer-single-line-if",qi=rt.default.object({maxLineLength:rt.default.number().optional(),maxNonSimpleConditionLength:rt.default.number().optional()}),Bi=Yi({name:Yr,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[L(qi)]},defaultOptions:[{}],create(e,[r]){let n=e.sourceCode;return{IfStatement(t){if(t.consequent.type!==Y.AST_NODE_TYPES.BlockStatement||t.loc.start.line===t.loc.end.line||n.getCommentsInside(t.consequent).length>0||t.alternate||t.consequent.body.length!==1)return;let l=t.consequent.body[0];if(!l)return;if(l.type===Y.AST_NODE_TYPES.ReturnStatement){if(!Br(l))return}else if(!(l.type===Y.AST_NODE_TYPES.ContinueStatement||l.type===Y.AST_NODE_TYPES.BreakStatement))return;if(t.test.type===Y.AST_NODE_TYPES.LogicalExpression||t.test.type===Y.AST_NODE_TYPES.ConditionalExpression)return;let i;if(r.maxNonSimpleConditionLength){let c=Jr(t.test);if(!c&&t.test.type===Y.AST_NODE_TYPES.UnaryExpression&&t.test.operator==="!"){let m=t.test.argument;Jr(m)&&(c=!0)}if(c&&(i=n.getText(t.test),i.length>r.maxNonSimpleConditionLength))return}i||(i=n.getText(t.test));let s=n.getText(l);if(i.includes(`
16
+ `))return;let a=n.getTokenAfter(t);if(a&&a.type===Y.AST_TOKEN_TYPES.Punctuator&&a.value==="}"){let c=n.getTokenAfter(a);if(c&&c.type===Y.AST_TOKEN_TYPES.Keyword&&(c.value==="else"||c.value==="catch"))return}let p=Xi(n,t),u=`if (${i}) ${s}`;r.maxLineLength&&u.length+p.length>r.maxLineLength||e.report({node:t,messageId:"noSingleLineCurly",fix:c=>c.replaceText(t,u)})}}}});function Jr(e){return e.type===Y.AST_NODE_TYPES.CallExpression||e.type===Y.AST_NODE_TYPES.BinaryExpression||e.type===Y.AST_NODE_TYPES.MemberExpression&&qr(e)}function qr(e){return e.object.type===Y.AST_NODE_TYPES.MemberExpression?qr(e.object):e.object.type!==Y.AST_NODE_TYPES.Identifier}function Xi(e,r){return e.text.slice(r.range[0]-r.loc.start.column,r.range[0])}function Br(e){if(!e.argument)return!0;let r=e.argument;return r.type===Y.AST_NODE_TYPES.ArrayExpression&&r.elements.length===0||r.type===Y.AST_NODE_TYPES.ObjectExpression&&r.properties.length===0||r.type===Y.AST_NODE_TYPES.Literal||r.type===Y.AST_NODE_TYPES.Identifier||r.type===Y.AST_NODE_TYPES.TemplateLiteral||r.type===Y.AST_NODE_TYPES.TaggedTemplateExpression?!0:r.type===Y.AST_NODE_TYPES.CallExpression?r.arguments.length===0:r.type===Y.AST_NODE_TYPES.UnaryExpression?Br(r):!1}var Ht={name:Yr,rule:Bi};var ie=require("@typescript-eslint/utils"),fe=require("zod/v4");var Zi=ie.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Xr="react-compiler-migration",Gi=fe.z.object({disallowHooks:fe.z.array(fe.z.object({name:fe.z.string(),replacement:fe.z.string()})).optional(),disallowMethods:fe.z.array(fe.z.object({name:fe.z.string(),replacement:fe.z.string().optional(),requireTrueProp:fe.z.string().optional()})).optional()}),Ki=/eslint +react-compiler\/react-compiler: +\["error/;function Qi(e){return e.type===ie.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===ie.AST_NODE_TYPES.MemberExpression&&e.property.type===ie.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var es=Zi({name:Xr,meta:{type:"suggestion",fixable:"code",docs:{description:"Rules to help migrate to the new React compiler"},messages:{disallowedFunctionOrMethod:"{{functionOrMethod}} is not supported in react compiler. Use {{replacement}} instead.",replace:"Replace with safe alternative {{replacement}}",disallowedMethodWithMissingRequireTrueProp:"{{method}} is should have a prop named {{requireTrueProp}} set to true when used in react compiler."},hasSuggestions:!0,schema:[L(Gi)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[r]){let n=!1;for(let t of e.sourceCode.getAllComments())if(Ki.test(t.value)){n=!0;break}return n?{CallExpression(t){if(r.disallowHooks?.length){let o=null,l=null;if(t.callee.type===ie.AST_NODE_TYPES.Identifier?(o=t.callee.name,l=t.callee):t.callee.type===ie.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===ie.AST_NODE_TYPES.Identifier&&(o=t.callee.property.name,l=t.callee.property),o){let i=r.disallowHooks.find(s=>s.name===o);i&&l&&e.report({node:t,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:s=>s.replaceText(l,i.replacement)}]})}}if(r.disallowMethods?.length&&Qi(t.callee)){for(let o of t.arguments)if(o.type===ie.AST_NODE_TYPES.ObjectExpression){for(let l of o.properties)if(l.type===ie.AST_NODE_TYPES.Property&&l.key.type===ie.AST_NODE_TYPES.Identifier){let i=l.key.name,s=r.disallowMethods.find(a=>a.name===i);if(s){if(s.requireTrueProp){let a=s.requireTrueProp,p=!1;for(let u of o.properties)if(u.type===ie.AST_NODE_TYPES.Property&&u.key.type===ie.AST_NODE_TYPES.Identifier&&u.key.name===a&&u.value.type===ie.AST_NODE_TYPES.Literal&&u.value.value===!0){p=!0;break}if(!p){e.report({node:l,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:s.name,requireTrueProp:a}});continue}}s.replacement&&e.report({node:l,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:s.name,replacement:s.replacement},suggest:[{messageId:"replace",data:{replacement:s.replacement},fix:a=>s.replacement?a.replaceText(l.key,s.replacement):null}]})}}}}}}:{}}}),Jt={name:Xr,rule:es};var nt=require("@typescript-eslint/utils"),ts=nt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Zr="require-description",rs=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,ns=/^eslint-disable-(next-)?line$/u,is=ts({name:Zr,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,[r]){let n=e.sourceCode,t=new Set(r.ignore||[]);return{Program(){for(let o of n.getAllComments()){let l=ss(o);l!=null&&(t.has(l.kind)||l.description||e.report({loc:as(o.loc),messageId:"missingDescription"}))}}}}}),Gr={name:Zr,rule:is};function ss(e){let{text:r,description:n}=os(e.value);if(!r)return null;let t=rs.exec(r);if(!t)return null;let o=t[1];if(!o)return null;let l=ns.test(o);if(e.type===nt.TSESTree.AST_TOKEN_TYPES.Line&&!l||l&&e.loc.start.line!==e.loc.end.line)return null;let i=r.slice(t.index+o.length);return{kind:o,value:i.trim(),description:n}}function os(e){let r=e.split(/\s-{2,}\s/u);return{text:r[0]?.trim(),description:r.length>1?r[1]?.trim()??null:null}}function as(e){return{start:{line:e.start.line,column:-1},end:e.end}}var _=require("@typescript-eslint/utils"),ge=require("zod/v4");var ls=ge.z.object({varsToCheck:ge.z.array(ge.z.object({selector:ge.z.string().optional(),fromFnCall:ge.z.string().optional(),prop:ge.z.string().or(ge.z.array(ge.z.string())),errorMsg:ge.z.string().optional()}))}),Yt=H({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[L(ls)]},defaultOptions:[{varsToCheck:[]}],create(e,[r]){let n=new Map,t=(i,s,a,p)=>{let u=new Set;for(let m of i.properties)m.type===_.AST_NODE_TYPES.Property&&m.key.type===_.AST_NODE_TYPES.Identifier&&u.add(m.key.name);let c=s.filter(m=>!u.has(m));if(c.length>0)if(c.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:c[0],fnName:p,customMsg:a||""}});else{let m=c.map(d=>`"${d}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:m,fnName:p,customMsg:a||""}})}},o=i=>{if(i.init?.type===_.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===_.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===_.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===_.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===_.AST_NODE_TYPES.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"},l={};for(let i of r.varsToCheck)i.selector&&(l[i.selector]=s=>{if(s.type===_.AST_NODE_TYPES.VariableDeclarator&&s.id.type===_.AST_NODE_TYPES.Identifier&&n.set(s.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:s.id,fnName:o(s)}),s.type===_.AST_NODE_TYPES.VariableDeclarator&&s.id.type===_.AST_NODE_TYPES.ObjectPattern){let a=Array.isArray(i.prop)?i.prop:[i.prop];t(s.id,a,i.errorMsg,o(s))}});for(let i of r.varsToCheck)if(i.fromFnCall){let s=i.fromFnCall;if(s.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${s.slice(2)}"]`;l[p]=u=>{if(u.type!==_.AST_NODE_TYPES.MemberExpression||u.parent.type!==_.AST_NODE_TYPES.CallExpression)return;let c=u.parent;if(c.parent.type!==_.AST_NODE_TYPES.VariableDeclarator)return;let m=c.parent;if(m.id.type===_.AST_NODE_TYPES.Identifier)n.set(m.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:m.id,fnName:i.fromFnCall||"unknown function"});else if(m.id.type===_.AST_NODE_TYPES.ObjectPattern){let d=Array.isArray(i.prop)?i.prop:[i.prop];t(m.id,d,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(s.includes(".")){let[a,p]=s.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${a}"][property.name="${p}"]`;l[u]=c=>{if(c.type!==_.AST_NODE_TYPES.MemberExpression||c.parent.type!==_.AST_NODE_TYPES.CallExpression)return;let m=c.parent;if(m.parent.type!==_.AST_NODE_TYPES.VariableDeclarator)return;let d=m.parent;if(d.id.type===_.AST_NODE_TYPES.Identifier)n.set(d.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:d.id,fnName:i.fromFnCall||"unknown function"});else if(d.id.type===_.AST_NODE_TYPES.ObjectPattern){let T=Array.isArray(i.prop)?i.prop:[i.prop];t(d.id,T,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let a=`VariableDeclarator > CallExpression > Identifier[name="${s}"]`;l[a]=p=>{if(p.type!==_.AST_NODE_TYPES.Identifier||p.parent.type!==_.AST_NODE_TYPES.CallExpression)return;let u=p.parent;if(u.parent.type!==_.AST_NODE_TYPES.VariableDeclarator)return;let c=u.parent;if(c.id.type===_.AST_NODE_TYPES.Identifier)n.set(c.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:c.id,fnName:i.fromFnCall||"unknown function"});else if(c.id.type===_.AST_NODE_TYPES.ObjectPattern){let m=Array.isArray(i.prop)?i.prop:[i.prop];t(c.id,m,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...l,"Program:exit"(){for(let[i,{props:s,errorMsg:a,node:p,fnName:u}]of n){let m=e.sourceCode.getScope(p).set.get(i);if(m){let d=new Set(s);for(let T of m.references){let h=T.identifier,x=h.parent;if(!(x.type===_.AST_NODE_TYPES.VariableDeclarator&&x.id===h)){if(x.type===_.AST_NODE_TYPES.MemberExpression&&x.object===h&&x.property.type===_.AST_NODE_TYPES.Identifier&&d.has(x.property.name)){if(d.delete(x.property.name),d.size===0)break;continue}if(x.type===_.AST_NODE_TYPES.VariableDeclarator&&x.init===h&&x.id.type===_.AST_NODE_TYPES.ObjectPattern){for(let f of x.id.properties)f.type===_.AST_NODE_TYPES.Property&&f.key.type===_.AST_NODE_TYPES.Identifier&&d.has(f.key.name)&&d.delete(f.key.name);if(d.size===0)break;continue}if(!(x.type===_.AST_NODE_TYPES.MemberExpression&&x.object===h&&x.property.type===_.AST_NODE_TYPES.Identifier&&!s.includes(x.property.name))){d.clear();break}}}if(d.size>0){let T=Array.from(d);if(T.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:T[0],fnName:u,customMsg:a||""}});else{let h=T.map(x=>`"${x}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:h,fnName:u,customMsg:a||""}})}}}}}}}});function en(e){return/^use[A-Z0-9]/.test(e)}function it(e){return e.type==="Identifier"?en(e.name):e.type==="MemberExpression"&&!e.computed&&it(e.property)?e.object.type==="Identifier":!1}function tn(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function rn(e,r){return e.name===r||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===r}function nn(e){return!!(e.parent&&e.parent.callee&&rn(e.parent.callee,"forwardRef"))}function sn(e){return!!(e.parent&&e.parent.callee&&rn(e.parent.callee,"memo"))}function qt(e){for(;e;){let r=an(e);if(r&&(tn(r)||it(r))||nn(e)||sn(e))return!0;e=e.parent}return!1}function Kr(e){return!1}function Bt(e){return!1}var ps=/eslint +react-compiler\/react-compiler: +\["error/,on={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 a of e.sourceCode.getAllComments())if(ps.test(a.value))return{CallExpression(p){let u=null;p.callee.name==="useMemo"?u="useMemo":p.callee.name==="useCallback"&&(u="useCallback"),u&&e.report({node:p,message:`"${u}" is not necessary when using React Compiler.`})}}}let r=typeof e.getSource=="function"?a=>r(a):a=>e.sourceCode.getText(a),n=typeof e.getScope=="function"?()=>n():a=>e.sourceCode.getScope(a),t=null,o=[],l=[],i=new WeakSet;function s(a){for(let p of a.references){let u=p.identifier.parent;if(u.type==="VariableDeclarator"&&u.init&&u.init.type==="CallExpression"&&u.init.callee&&Kr(u.init.callee))for(let c of p.resolved.references)c!==p&&i.add(c.identifier)}}return{onCodePathSegmentStart:a=>l.push(a),onCodePathSegmentEnd:()=>l.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(a,p){let u=o.pop();if(u.size===0)return;let c=new Set;function m(S,y){let{cache:E}=m,k=E.get(S.id),R=new Set(y);if(R.has(S.id)){let w=[...R],N=w.slice(w.indexOf(S.id)+1);for(let V of N)c.add(V);return BigInt("0")}if(R.add(S.id),k!==void 0)return k;if(a.thrownSegments.includes(S))k=BigInt("0");else if(S.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let w of S.prevSegments)k+=m(w,R)}return S.reachable&&k===BigInt("0")?E.delete(S.id):E.set(S.id,k),k}function d(S,y){let{cache:E}=d,k=E.get(S.id),R=new Set(y);if(R.has(S.id)){let w=Array.from(R),N=w.slice(w.indexOf(S.id)+1);for(let V of N)c.add(V);return BigInt("0")}if(R.add(S.id),k!==void 0)return k;if(a.thrownSegments.includes(S))k=BigInt("0");else if(S.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let w of S.nextSegments)k+=d(w,R)}return E.set(S.id,k),k}function T(S){let{cache:y}=T,E=y.get(S.id);if(E===null)return 1/0;if(E!==void 0)return E;if(y.set(S.id,null),S.prevSegments.length===0)E=1;else{E=1/0;for(let k of S.prevSegments){let R=T(k);R<E&&(E=R)}E+=1}return y.set(S.id,E),E}m.cache=new Map,d.cache=new Map,T.cache=new Map;let h=d(a.initialSegment),x=an(p),f=qt(p),b=x?tn(x)||it(x):nn(p)||sn(p),I=1/0;for(let S of a.finalSegments){if(!S.reachable)continue;let y=T(S);y<I&&(I=y)}for(let[S,y]of u){if(!S.reachable)continue;let E=S.nextSegments.length===0?I<=T(S):I<T(S),k=m(S)*d(S),R=c.has(S.id);for(let w of y)if(R&&!Bt(w)&&e.report({node:w,message:`React Hook "${r(w)}" 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.`}),b){if(p.async&&e.report({node:w,message:`React Hook "${r(w)}" cannot be called in an async function.`}),!R&&k!==h&&!Bt(w)){let V=`React Hook "${r(w)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(E?" Did you accidentally call a React Hook after an early return?":"");e.report({node:w,message:V})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let N=`React Hook "${r(w)}" 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:w,message:N})}else if(x){let N=`React Hook "${r(w)}" is called in function "${r(x)}" 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:w,message:N})}else if(p.type==="Program"){let N=`React Hook "${r(w)}" 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:w,message:N})}else if(f&&!Bt(w)){if(p.parent.type==="CallExpression"&&p.parent.callee.type==="Identifier"&&p.parent.callee.name==="useCallback"){let V=p.parent;if(V.parent.type==="VariableDeclarator"&&en(V.parent.id.name))return}let N=`React Hook "${r(w)}" 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:w,message:N})}}},CallExpression(a){if(it(a.callee)){let p=Qr(o),u=Qr(l),c=p.get(u);c||(c=[],p.set(u,c)),c.push(a.callee)}a.callee.type==="Identifier"&&(a.callee.name==="useEffect"||Kr(a.callee))&&a.arguments.length>0&&(t=a)},Identifier(a){t==null&&i.has(a)&&a.parent.type!=="CallExpression"&&e.report({node:a,message:`\`${r(a)}\` 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"(a){a===t&&(t=null)},FunctionDeclaration(a){qt(a)&&s(n(a))},ArrowFunctionExpression(a){qt(a)&&s(n(a))}}}};function an(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 Qr(e){return e[e.length-1]}var K=require("@typescript-eslint/utils"),se=he(require("zod/v4"));var cs=se.object({indent:se.union([se.string().regex(/^\s+$/),se.number().int().min(1)]).optional(),tags:se.array(se.string()).optional(),functions:se.array(se.string()).optional(),comments:se.array(se.string()).optional()}),Xt=H({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[L(cs)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let r=e.sourceCode,{comments:n=["HTML","indent"],functions:t=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:l}=e.options[0],i=n.map(f=>f.toLowerCase());function s(f){let b=f.split(/\r?\n/),I=b.filter(y=>y.trim()!=="");if(I.length===0)return f;let S=Number.POSITIVE_INFINITY;for(let y of I){let E=y.match(/^(\s*)/);E&&(S=Math.min(S,E[1]?.length??0))}return!isFinite(S)||S===0?f:b.map(y=>y.slice(S)).join(`
17
+ `)}function a(f,b,I){return f.split(/\r?\n/).map(y=>y.trim()===""?y:I.repeat(b)+y).join(`
18
+ `)}function p(f){if(f.type===K.AST_NODE_TYPES.Identifier)return f.name;if(f.type===K.AST_NODE_TYPES.MemberExpression){let b=f.object.type===K.AST_NODE_TYPES.Identifier?f.object.name:null,I=f.property.type===K.AST_NODE_TYPES.Identifier?f.property.name:null;return b&&I?`${b}.${I}`:I}return null}function u(f,b){if(!f)return!1;for(let I of b)if(I.includes(".")){let S=I.split(".");if(f.type===K.AST_NODE_TYPES.MemberExpression&&f.object.type===K.AST_NODE_TYPES.Identifier&&f.property.type===K.AST_NODE_TYPES.Identifier&&f.object.name===S[0]&&f.property.name===S[1])return!0}else if(f.type===K.AST_NODE_TYPES.Identifier&&f.name===I)return!0;return!1}function c(f,b){let I=f.parent;if(I.type!==K.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let S=p(I.tag);return S?b.includes(S):!1}function m(f,b){if(!f||f.type!==K.AST_NODE_TYPES.CallExpression)return!1;let{method:I,argumentsLength:S,optionalCall:y=!0,optionalMember:E=!0}=b;return S!==void 0&&f.arguments.length!==S||!y&&f.optional||f.callee.type!==K.AST_NODE_TYPES.MemberExpression||!E&&f.callee.optional||f.callee.property.type!==K.AST_NODE_TYPES.Identifier?!1:f.callee.property.name===I}function d(f,b){if(!f||f.type!==K.AST_NODE_TYPES.CallExpression)return!1;let{name:I,argumentsLength:S,optionalCall:y=!0}=b;return S!==void 0&&f.arguments.length!==S||!y&&f.optional||f.callee.type!==K.AST_NODE_TYPES.Identifier?!1:f.callee.name===I}function T(f){return m(f.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&f.parent.type===K.AST_NODE_TYPES.CallExpression&&f.parent.arguments[0]===f&&d(f.parent.callee.type===K.AST_NODE_TYPES.MemberExpression?f.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function h(f){if(i.length>0){let b=r.getTokenBefore(f,{includeComments:!0});if(b?.type===K.AST_TOKEN_TYPES.Block&&i.includes(b.value.trim().toLowerCase()))return!0}return!!(T(f)||o.length>0&&c(f,o)||t.length>0&&f.parent.type===K.AST_NODE_TYPES.CallExpression&&f.parent.arguments.includes(f)&&u(f.parent.callee,t))}function x(f){let b=`__PLACEHOLDER__${Math.random()}`,I=f.quasis.map(B=>r.getText(B).slice(1,B.tail?-1:-2)).join(b),S=I.match(/\r?\n/);if(!S)return;let y=S[0],E=r.lines[r.getLocFromIndex(f.range[0]).line-1];if(!E)return;let R=E.match(/^(\s*)\S/)?.[1]??"",w;typeof l=="string"?w=l:typeof l=="number"?w=" ".repeat(l):w=R.startsWith(" ")?" ":" ";let V=s(I).replace(new RegExp(`^${y}|${y}[ ]*$`,"g"),""),q=y+a(V,1,R+w)+y+R,ee=I.includes(`\r
19
19
  `)?`\r
20
20
  `:`
21
- `,ee=b.split(/\r?\n/),xe=ee.map((G,ye)=>ye!==ee.length-1&&G===w+R?"":G).join(re);if(B!==xe)return{node:f,messageId:"improperlyIndented",fix:G=>B.split(I).map((ye,fe)=>{let se=f.quasis[fe];return se?G.replaceTextRange([se.range[0]+1,se.range[1]-(se.tail?1:2)],ye):[]}).flat()}}return{TemplateLiteral(f){if(!x(f))return;let I=C(f);if(I)return e.report(I)}}}});var zt=require("@typescript-eslint/utils");function rs(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===zt.AST_NODE_TYPES.NewExpression&&t.callee.type===zt.AST_NODE_TYPES.Identifier&&t.callee.name==="RegExp"}var Ht=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(n){rs(n)||ns(n)||e.report({node:n,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var Qr={[Ft.name]:Ft.rule,[dt.name]:dt.rule,[mt.name]:mt.rule,"rules-of-hooks":Kr,"exhaustive-deps":sr,"require-description":zr.rule,[yt.name]:yt.rule,[St.name]:St.rule,[jt.name]:jt.rule,[st.name]:st.rule,[ft.name]:ft.rule,[xt.name]:xt.rule,[Ue.name]:Ue.rule,[Lt.name]:Lt.rule,[bt.name]:bt.rule,[gt.name]:gt.rule,[at.name]:at.rule,[_t.name]:_t.rule,[it.name]:it.rule,[ut.name]:ut.rule,[At.name]:At.rule,[Rt.name]:Rt.rule,[kt.name]:kt.rule,[Ot.name]:Ot.rule,[vt.name]:vt.rule,[Dt.name]:Dt.rule,[Ct.name]:Ct.rule,[It.name]:It.rule,[Ht.name]:Ht.rule,[Nt.name]:Nt.rule,[$t.name]:$t.rule,[Vt.name]:Vt.rule,[Ue.name]:Ue.rule};var is={rules:Qr};0&&(module.exports={extendedLintPlugin});
21
+ `,Q=I.split(/\r?\n/),Ce=Q.map((B,me)=>me!==Q.length-1&&B===w+R?"":B).join(ee);if(q!==Ce)return{node:f,messageId:"improperlyIndented",fix:B=>q.split(b).map((me,ce)=>{let ne=f.quasis[ce];return ne?B.replaceTextRange([ne.range[0]+1,ne.range[1]-(ne.tail?1:2)],me):[]}).flat()}}return{TemplateLiteral(f){if(!h(f))return;let b=x(f);if(b)return e.report(b)}}}});var Zt=require("@typescript-eslint/utils");function us(e){if(!("regex"in e))return!1;let r=e.regex.flags;return r.includes("g")||r.includes("y")}function fs(e){let r=e.parent;return r?.type===Zt.AST_NODE_TYPES.NewExpression&&r.callee.type===Zt.AST_NODE_TYPES.Identifier&&r.callee.name==="RegExp"}var Gt=H({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 r(n){us(n)||fs(n)||e.report({node:n,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":r}}});var pe=require("@typescript-eslint/utils"),st=require("zod/v4");var ms=st.z.object({checkOnly:st.z.array(st.z.enum(["function-args","FC"])).optional()}),Kt=H({name:"use-types-directly-above-usage",meta:{type:"suggestion",docs:{description:"Require type definitions to be placed directly above their first usage for better readability"},fixable:"code",schema:[L(ms)],messages:{moveTypeAboveUsage:"Type definition should be placed directly above its first usage."}},defaultOptions:[{}],create(e,[r]){let n=e.sourceCode,t=new Map,o=[];function l(c,m){if(!t.has(c))return;let d=t.get(c);if(!d||d.statement===m)return;let T=o.indexOf(d.statement),h=o.indexOf(m);T===-1||h===-1||(T>h||T!==h-1)&&e.report({node:d.node,messageId:"moveTypeAboveUsage",fix:s(d.statement,m)})}function i(c){for(let m of o)if(c.range[0]>=m.range[0]&&c.range[1]<=m.range[1])return m;return null}function s(c,m){return function*(d){let T=n.getText(c),h=n.getCommentsBefore(c),x=T;h.length>0&&(x=`${h.map(E=>n.getText(E)).join(`
22
+ `)}
23
+ ${T}`);let f=c.range[0],b=c.range[1];h.length>0&&h[0]&&(f=h[0].range[0]),n.text[b]===`
24
+ `&&(b+=1),yield d.removeRange([f,b]);let S=n.getText(m);yield d.replaceText(m,`${x}
25
+
26
+ ${S}`)}}function a(c){let m=c.parent;for(;m;){if(m.type===pe.AST_NODE_TYPES.FunctionDeclaration||m.type===pe.AST_NODE_TYPES.FunctionExpression||m.type===pe.AST_NODE_TYPES.ArrowFunctionExpression){let d=m.params;for(let T of d)if(c.range[0]>=T.range[0]&&c.range[1]<=T.range[1])return!0;break}m=m.parent}return!1}function p(c){let m=c.parent;for(;m;){if(m.type===pe.AST_NODE_TYPES.TSTypeParameterInstantiation){let d=m.parent;if(d.type===pe.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===pe.AST_NODE_TYPES.Identifier&&(d.typeName.name==="FC"||d.typeName.name==="React.FC")||d.type===pe.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===pe.AST_NODE_TYPES.TSQualifiedName&&d.typeName.right.name==="FC")return!0}m=m.parent}return!1}let u=[];return{Program(c){o.push(...c.body)},TSTypeAliasDeclaration(c){if(o.some(d=>d.type===pe.AST_NODE_TYPES.ExportNamedDeclaration&&d.declaration===c?!0:d===c)){let d=i(c);d&&t.set(c.id.name,{node:c,name:c.id.name,statement:d})}},TSInterfaceDeclaration(c){if(o.some(d=>d.type===pe.AST_NODE_TYPES.ExportNamedDeclaration&&d.declaration===c?!0:d===c)){let d=i(c);d&&t.set(c.id.name,{node:c,name:c.id.name,statement:d})}},TSTypeReference(c){c.typeName.type===pe.AST_NODE_TYPES.Identifier&&u.push({typeName:c.typeName.name,node:c,inFunctionArgs:a(c),inFCProps:p(c)})},"Program:exit"(){let c=new Map,m=u.filter(h=>{let{typeName:x}=h;if(!r.checkOnly||r.checkOnly.length===0)return!0;if(u.filter(b=>b.typeName===x).length>1)return!1;for(let b of r.checkOnly)if(b==="function-args"&&h.inFunctionArgs||b==="FC"&&h.inFCProps)return!0;return!1});for(let h of m){let{typeName:x,node:f}=h;if(t.has(x)){let b=i(f),I=t.get(x);if(b&&I&&b!==I.statement){c.has(x)||c.set(x,[]);let S=c.get(x);if(!S)return;S.includes(b)||S.push(b)}}}let d=[];for(let[h,x]of c)if(x.length>0){let f=x[0];if(!f)continue;for(let b of x)b.range[0]<f.range[0]&&(f=b);d.push({typeName:h,firstUsage:f})}let T=d.sort((h,x)=>h.firstUsage.range[0]-x.firstUsage.range[0]);if(T.length>0){let h=T[0];h&&l(h.typeName,h.firstUsage)}}}}});var ln={[$t.name]:$t.rule,[ht.name]:ht.rule,[Tt.name]:Tt.rule,"rules-of-hooks":on,"exhaustive-deps":fr,"require-description":Gr.rule,[Et.name]:Et.rule,[xt.name]:xt.rule,[zt.name]:zt.rule,[ct.name]:ct.rule,[St.name]:St.rule,[Rt.name]:Rt.rule,[ze.name]:ze.rule,[Ht.name]:Ht.rule,[At.name]:At.rule,[bt.name]:bt.rule,[kt.name]:kt.rule,[ft.name]:ft.rule,[Jt.name]:Jt.rule,[pt.name]:pt.rule,[gt.name]:gt.rule,[Nt.name]:Nt.rule,[Dt.name]:Dt.rule,[jt.name]:jt.rule,[Lt.name]:Lt.rule,[Mt.name]:Mt.rule,[Vt.name]:Vt.rule,[Ot.name]:Ot.rule,[Ft.name]:Ft.rule,[Gt.name]:Gt.rule,[Ut.name]:Ut.rule,[Yt.name]:Yt.rule,[Xt.name]:Xt.rule,[Kt.name]:Kt.rule,[ze.name]:ze.rule};var ds={rules:ln};0&&(module.exports={extendedLintPlugin});
@@ -1,7 +1,7 @@
1
- import{AST_NODE_TYPES as ee,ESLintUtils as Zr}from"@typescript-eslint/utils";var Ge=Symbol.for("optional");function _(e){return{...e,[Ge]:!0}}function Wt(e,t){return{enum:e,...t}}function Ie(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 n={...t,type:"object",properties:e};if(e&&(n.additionalProperties||=!1,!n.required)){let r,a=[];for(r in e)e[r][Ge]?e[r][Ge]=void 0:a.push(r);a.length>0&&(n.required=a)}return n}var Qr=Zr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),zt="react-compiler-extra",en=z({runOnlyWithEnableCompilerDirective:_(Ie())}),tn=/eslint +react-compiler\/react-compiler: +\["error/;function rn(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 nn=/\bthis[.[]/;function Vt(e){return nn.test(e)}var sn=Qr({name:zt,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:[en]},defaultOptions:[{}],create(e,[t]){let n=!1;if(t.runOnlyWithEnableCompilerDirective){for(let l of e.sourceCode.getAllComments())if(tn.test(l.value)){n=!0;break}if(!n)return{}}function r(l){for(let i of l.properties)if(i.type===ee.Property&&i.method&&i.value.type===ee.FunctionExpression){let s=e.sourceCode,o=s.getText(i.key),p=i.value,c=s.getText(p.body);if(Vt(c))e.report({node:i,messageId:"thisKeywordInMethod"});else{let u=p.params.map(T=>s.getText(T)).join(", "),d="";p.generator?d=`${o}: function* (${u}) ${c}`:d=`${o}: (${u}) => ${c}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:T=>T.replaceText(i,d)})}}}function a(l){for(let i of l.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);Vt(p)&&e.report({node:s,messageId:"thisKeywordInMethod"})}}}return{CallExpression(l){if(rn(l.callee))for(let i of l.arguments){if(i.type===ee.ObjectExpression&&(r(i),a(i)),i.type===ee.ArrowFunctionExpression&&(i.body.type===ee.ObjectExpression&&(r(i.body),a(i.body)),i.body.type===ee.BlockStatement))for(let s of i.body.body)s.type===ee.ReturnStatement&&s.argument?.type===ee.ObjectExpression&&(r(s.argument),a(s.argument));if(i.type===ee.FunctionExpression)for(let s of i.body.body)s.type===ee.ReturnStatement&&s.argument?.type===ee.ObjectExpression&&(r(s.argument),a(s.argument))}}}}}),Ke={name:zt,rule:sn};import{AST_NODE_TYPES as ne}from"@typescript-eslint/utils";import{z as A}from"zod/v4";import{ESLintUtils as on}from"@typescript-eslint/utils";import*as Ht from"zod/v4";function B(e){let n=on.RuleCreator(r=>`https://github.com/lucasols/extended-lint#${r}`)(e);return{name:e.name,rule:n}}function Ce(e){return Ht.toJSONSchema(e)}var an=A.object({disallow:A.array(A.object({selector:A.string(),message:A.string(),replace:A.optional(A.union([A.string(),A.object({regex:A.string(),with:A.string()})])),replaceType:A.optional(A.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:A.optional(A.array(A.object({fn:A.string(),withArgs:A.optional(A.array(A.object({atIndex:A.number(),value:A.union([A.string(),A.number(),A.boolean()])}))),message:A.string(),replaceWith:A.optional(A.string()),ignoreRegex:A.optional(A.string())}))),__dev_simulateFileName:A.optional(A.string()),mustMatchSyntax:A.optional(A.array(A.object({includeRegex:A.string(),mustCallFn:A.optional(A.array(A.object({anyCall:A.array(A.object({fn:A.string(),withArgs:A.array(A.object({atIndex:A.number(),literal:A.union([A.string(),A.number(),A.boolean()])}))})),message:A.optional(A.string())}))),mustMatchSelector:A.optional(A.array(A.object({selector:A.string(),message:A.string()}))),mustHaveExport:A.optional(A.array(A.object({name:A.string(),type:A.enum(["function","variable","any"]).default("any"),message:A.string()})))})))}),Ze=B({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[Ce(an)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let n={},{mustMatchSyntax:r,__dev_simulateFileName:a,disallow:l,disallowFnCalls:i}=t,s=a??e.filename,o=[],p=new Map,c=new Set,u=new Map,d=new Set,T=new Map;function E(m){for(let S of m.specifiers)S.type===ne.ImportSpecifier&&S.imported.type===ne.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===ne.FunctionDeclaration&&m.declaration.id){let S=m.declaration.id.name;for(let k of Array.from(d)){let[R,w]=k.split(":");R===S&&(w==="function"||w==="any")&&d.delete(k)}}else if(m.declaration.type===ne.VariableDeclaration){for(let S of m.declaration.declarations)if(S.id.type===ne.Identifier){let k=S.id.name;for(let R of Array.from(d)){let[w,N]=R.split(":");w===k&&(N==="variable"||N==="any")&&d.delete(R)}}}}for(let S of m.specifiers)if(S.exported.type===ne.Identifier){let k=S.exported.name;for(let R of Array.from(d)){let[w,N]=R.split(":");w===k&&N==="any"&&d.delete(R)}}}function C(m){m.id.type===ne.Identifier&&m.init?.type===ne.Identifier&&T.set(m.id.name,m.init.name)}function f(m){return T.get(m)??m}function I(m,S){return f(m)===S||m===S}for(let{includeRegex:m,mustCallFn:S,mustMatchSelector:k,mustHaveExport:R}of r??[]){let w=ln(s,new RegExp(m));if(!w)continue;let N=W=>{let J=W;for(let{name:te,value:Z}of w)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),o.push(Z=>{let{callee:be}=Z;if(be.type===ne.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!==ne.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:Re=>Re.replaceText(ie,typeof Se=="string"?`'${Se}'`:String(Se))})}break}}})}for(let{selector:W,message:J}of k??[])u.set(W,N(J)),p.set(N(W),()=>{u.delete(W)});for(let{name:W,type:J,message:te}of R??[]){let Z=N(W),be=N(te);d.add(`${Z}:${J}:${be}`)}}for(let{fn:m,withArgs:S,message:k,replaceWith:R,ignoreRegex:w}of i??[])w&&new RegExp(w).test(s)||o.push(N=>{let{callee:W}=N;if(W.type!==ne.Identifier||!I(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!==ne.Literal||Z.value!==te.value)return}let J=te=>R?te.replaceText(N,R):null;e.report({node:N,messageId:"default",data:{message:k},suggest:R?[{messageId:"default",data:{message:`Replace with "${R}"`},fix:J}]:void 0})});function b(m,S){let k=n[m];k?n[m]=R=>{k(R),S(R)}:n[m]=S}for(let{selector:m,message:S,replace:k,replaceType:R="suggestion"}of l??[]){if(m==="CallExpression"){o.push(w=>{g(k,w,S,R)});continue}n[m]=w=>{g(k,w,S,R)}}if(p.size>0)for(let[m,S]of p)b(m,S);return o.length>0&&(n.CallExpression=m=>{if(m.type===ne.CallExpression)for(let S of o)S(m)}),n.ImportDeclaration=m=>{m.type===ne.ImportDeclaration&&E(m)},n.ExportNamedDeclaration=m=>{m.type===ne.ExportNamedDeclaration&&x(m)},n.VariableDeclarator=m=>{m.type===ne.VariableDeclarator&&C(m)},n["Program:exit"]=m=>{for(let S of c)e.report({node:m,messageId:"default",data:{message:S}});for(let[,S]of u)e.report({node:m,messageId:"default",data:{message:S}});for(let S of d){let[k,R,w]=S.split(":");e.report({node:m,messageId:"default",data:{message:`Missing required export "${k}" of type ${R}: ${w}`}})}},n;function g(m,S,k,R){let w=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&&R==="autofix"?w:void 0,suggest:m&&R==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof m=="string"?m:m.with}"`},fix:w}]:void 0})}}});function ln(e,t){let n=[],r=t.exec(e);if(!r)return null;let[a,...l]=r;n.push({name:"$0_lowercase",value:a.toLowerCase()}),n.push({name:"$0_capitalize",value:Yt(a)}),n.push({name:"$0_uncapitalize",value:qt(a)}),n.push({name:"$0",value:a});for(let i=0;i<l.length;i++){let s=`$${i+1}`,o=l[i];n.push({name:`${s}_lowercase`,value:o.toLowerCase()}),n.push({name:`${s}_capitalize`,value:Yt(o)}),n.push({name:`${s}_uncapitalize`,value:qt(o)}),n.push({name:s,value:o})}return n}function Yt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function qt(e){return e.charAt(0).toLowerCase()+e.slice(1)}import{AST_NODE_TYPES as U,AST_TOKEN_TYPES as Jt,ESLintUtils as pn}from"@typescript-eslint/utils";var cn=pn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Xt="collapse-simple-objs-in-one-line",un=z({maxLineLength:_(ge()),maxProperties:_(ge()),nestedObjMaxLineLength:_(ge()),nestedObjMaxProperties:_(ge()),ignoreTypesWithSuffix:_(Q(V()))}),fn=cn({name:Xt,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:[un]},defaultOptions:[{}],create(e,[t]){let n=e.sourceCode,r=t.ignoreTypesWithSuffix??[],a=t.maxProperties??2,l=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function s(p){if(p.type===U.ObjectExpression){let c=p.parent.type===U.Property,u=c?i:a,d=p.properties.length;if(d>u)return!1;if(d===1){let E=p.properties[0];return E.type===U.Property&&E.value.type===U.ObjectExpression||E.type===U.Property&&E.value.type===U.ArrayExpression&&!E.value.elements.every(C=>C&&Qe(C))?!1:{text:n.getText(E),isNested:c,propsSize:d}}let T=[];for(let E of p.properties){if(E.type===U.Property&&!Qe(E.value))return!1;T.push(n.getText(E))}return{text:T.join(", "),isNested:c,propsSize:d}}else{let c=p.parent.parent?.type===U.TSPropertySignature,u=c?i:a,d=p.members.length;if(d>u)return!1;if(r.length>0&&p.parent.type===U.TSTypeAliasDeclaration){let E=p.parent.id.name;if(r.some(x=>E.endsWith(x)))return!1}if(d===1){let E=p.members[0];return E.type===U.TSPropertySignature&&E.typeAnnotation?.typeAnnotation.type===U.TSTypeLiteral?!1:{text:n.getText(E),isNested:c,propsSize:1}}if(p.parent.type===U.TSIntersectionType||p.parent.type===U.TSUnionType&&p.parent.types[0]!==p)return!1;let T=[];for(let E of p.members){if(E.type!==U.TSPropertySignature)return!1;let x=E.typeAnnotation?.typeAnnotation;if(!x||x.type===U.TSTypeLiteral||!Bt(x))return!1;if(x.type===U.TSTypeReference&&x.typeArguments){if(x.typeArguments.params.length>1)return!1;let f=x.typeArguments.params[0];if(!Bt(f))return!1}let C=n.getText(E).trim();(C.endsWith(";")||C.endsWith(","))&&(C=C.slice(0,-1)),T.push(C)}return{text:T.join("; "),isNested:c,propsSize:d}}}function o(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==U.JSXExpressionContainer){let x=0,C=!1,f=n.getTokenAfter(p,{filter:b=>b.type!==Jt.Punctuator||C?!0:b.value===","?(x++,!1):b.value===";"?(x++,C=!0,!1):b.value===")"||b.value==="}"?(x++,!1):!0});if(x>4)return;let I=f?.type===Jt.Template&&f.value.startsWith(`}
2
- `);if(f?.loc.start.line===p.loc.end.line&&!I)return}let c=s(p);if(!c)return;let u=c.text;if(u.includes(`
3
- `)||n.getCommentsInside(p).length>0)return;u.endsWith(";")&&(u=u.slice(0,-1));let d=`{ ${u} }`,T=dn(n,p),E=c.isNested&&c.propsSize>2?l:t.maxLineLength;E&&d.length+T.length+mn(p,n)>E||e.report({node:p,messageId:"singleLineProp",fix:x=>x.replaceText(p,d)})}return{TSTypeLiteral:o,ObjectExpression:o}}});function Bt(e){return e.type===U.TSLiteralType||e.type===U.TSTypeReference||e.type===U.TSNumberKeyword||e.type===U.TSStringKeyword||e.type===U.TSBooleanKeyword||e.type===U.TSNullKeyword||e.type===U.TSUndefinedKeyword}function Qe(e,t){return!!(e.type===U.Literal||e.type===U.Identifier||e.type===U.TemplateLiteral||e.type===U.TaggedTemplateExpression||!t&&e.type===U.ArrayExpression&&e.elements.every(n=>n&&Qe(n,!0)))}function mn(e,t){let n=t.getLastToken(e);if(!n)return 0;let r=t.text.indexOf(`
4
- `,n.range[1]);return(r!==-1?r:t.text.length)-n.range[1]}function dn(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var et={name:Xt,rule:fn};var yn=/eslint +react-compiler\/react-compiler: +\["error/,Kt={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,n=typeof e.getSource=="function"?f=>n(f):f=>e.sourceCode.getText(f),r=typeof e.getScope=="function"?()=>r():f=>e.sourceCode.getScope(f),a=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,l=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:a,enableDangerousAutofixThisMayCauseInfiniteLoops:l};function s(f){l&&Array.isArray(f.suggest)&&f.suggest.length>0&&(f.fix=f.suggest[0].fix),e.report(f)}let o=e.getSourceCode().scopeManager,p=new WeakMap,c=new WeakSet,u=new WeakMap,d=new WeakMap,T=new WeakSet;function E(f,I){return function(b){if(I.has(b))return I.get(b);let g=f(b);return I.set(b,g),g}}function x(f,I,b,g,m){m&&f.async&&s({node:f,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
1
+ import{AST_NODE_TYPES as K,ESLintUtils as an}from"@typescript-eslint/utils";import{z as Bt}from"zod/v4";import{ESLintUtils as on}from"@typescript-eslint/utils";import*as qt from"zod/v4";function W(e){let n=on.RuleCreator(t=>`https://github.com/lucasols/extended-lint#${t}`)(e);return{name:e.name,rule:n}}function L(e){return qt.toJSONSchema(e)}var ln=an.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Zt="react-compiler-extra",pn=Bt.object({runOnlyWithEnableCompilerDirective:Bt.boolean().optional()}),cn=/eslint +react-compiler\/react-compiler: +\["error/;function un(e){return e.type===K.Identifier?e.name.startsWith("use"):e.type===K.MemberExpression&&e.property.type===K.Identifier?e.property.name.startsWith("use"):!1}var fn=/\bthis[.[]/;function Xt(e){return fn.test(e)}var mn=ln({name:Zt,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:[L(pn)]},defaultOptions:[{}],create(e,[r]){let n=!1;if(r.runOnlyWithEnableCompilerDirective){for(let l of e.sourceCode.getAllComments())if(cn.test(l.value)){n=!0;break}if(!n)return{}}function t(l){for(let i of l.properties)if(i.type===K.Property&&i.method&&i.value.type===K.FunctionExpression){let s=e.sourceCode,a=s.getText(i.key),p=i.value,u=s.getText(p.body);if(Xt(u))e.report({node:i,messageId:"thisKeywordInMethod"});else{let c=p.params.map(d=>s.getText(d)).join(", "),m="";p.generator?m=`${a}: function* (${c}) ${u}`:m=`${a}: (${c}) => ${u}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:d=>d.replaceText(i,m)})}}}function o(l){for(let i of l.properties)if(i.type===K.Property&&i.value.type===K.ObjectExpression){for(let s of i.value.properties)if(s.type===K.Property&&s.method&&s.value.type===K.FunctionExpression){let p=e.sourceCode.getText(s.value.body);Xt(p)&&e.report({node:s,messageId:"thisKeywordInMethod"})}}}return{CallExpression(l){if(un(l.callee))for(let i of l.arguments){if(i.type===K.ObjectExpression&&(t(i),o(i)),i.type===K.ArrowFunctionExpression&&(i.body.type===K.ObjectExpression&&(t(i.body),o(i.body)),i.body.type===K.BlockStatement))for(let s of i.body.body)s.type===K.ReturnStatement&&s.argument?.type===K.ObjectExpression&&(t(s.argument),o(s.argument));if(i.type===K.FunctionExpression)for(let s of i.body.body)s.type===K.ReturnStatement&&s.argument?.type===K.ObjectExpression&&(t(s.argument),o(s.argument))}}}}}),Ke={name:Zt,rule:mn};import{AST_NODE_TYPES as te}from"@typescript-eslint/utils";import{z as A}from"zod/v4";var dn=A.object({disallow:A.array(A.object({selector:A.string(),message:A.string(),replace:A.optional(A.union([A.string(),A.object({regex:A.string(),with:A.string()})])),replaceType:A.optional(A.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:A.optional(A.array(A.object({fn:A.string(),withArgs:A.optional(A.array(A.object({atIndex:A.number(),value:A.union([A.string(),A.number(),A.boolean()])}))),message:A.string(),replaceWith:A.optional(A.string()),ignoreRegex:A.optional(A.string())}))),__dev_simulateFileName:A.optional(A.string()),mustMatchSyntax:A.optional(A.array(A.object({includeRegex:A.string(),mustCallFn:A.optional(A.array(A.object({anyCall:A.array(A.object({fn:A.string(),withArgs:A.array(A.object({atIndex:A.number(),literal:A.union([A.string(),A.number(),A.boolean()])}))})),message:A.optional(A.string())}))),mustMatchSelector:A.optional(A.array(A.object({selector:A.string(),message:A.string()}))),mustHaveExport:A.optional(A.array(A.object({name:A.string(),type:A.enum(["function","variable","any"]).default("any"),message:A.string()})))})))}),Qe=W({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[L(dn)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[r]){let n={},{mustMatchSyntax:t,__dev_simulateFileName:o,disallow:l,disallowFnCalls:i}=r,s=o??e.filename,a=[],p=new Map,u=new Set,c=new Map,m=new Set,d=new Map;function T(y){for(let E of y.specifiers)E.type===te.ImportSpecifier&&E.imported.type===te.Identifier&&E.imported.name!==E.local.name&&d.set(E.local.name,E.imported.name)}function h(y){if(y.declaration){if(y.declaration.type===te.FunctionDeclaration&&y.declaration.id){let E=y.declaration.id.name;for(let k of Array.from(m)){let[R,w]=k.split(":");R===E&&(w==="function"||w==="any")&&m.delete(k)}}else if(y.declaration.type===te.VariableDeclaration){for(let E of y.declaration.declarations)if(E.id.type===te.Identifier){let k=E.id.name;for(let R of Array.from(m)){let[w,N]=R.split(":");w===k&&(N==="variable"||N==="any")&&m.delete(R)}}}}for(let E of y.specifiers)if(E.exported.type===te.Identifier){let k=E.exported.name;for(let R of Array.from(m)){let[w,N]=R.split(":");w===k&&N==="any"&&m.delete(R)}}}function x(y){y.id.type===te.Identifier&&y.init?.type===te.Identifier&&d.set(y.id.name,y.init.name)}function f(y){return d.get(y)??y}function b(y,E){return f(y)===E||y===E}for(let{includeRegex:y,mustCallFn:E,mustMatchSelector:k,mustHaveExport:R}of t??[]){let w=yn(s,new RegExp(y));if(!w)continue;let N=z=>{let Y=z;for(let{name:Q,value:G}of w)Y=Y.replaceAll(Q,G);return Y};for(let{anyCall:z,message:Y}of E??[]){let Q=`Expected file to call the function: ${z.map(({fn:G})=>G).join(" or ")}`;u.add(Q),a.push(G=>{let{callee:Ee}=G;if(Ee.type===te.Identifier){for(let{fn:q,withArgs:fe}of z)if(Ee.name===q){u.delete(Q);for(let le of fe){let re=G.arguments[le.atIndex],ye=typeof le.literal=="string"?N(le.literal):le.literal;if(!re){e.report({node:G,messageId:"default",data:{message:`Missing argument with value "${ye}" at index ${le.atIndex}${Y?`: ${N(Y)}`:""}`}});continue}if(re.type!==te.Literal){e.report({node:re,messageId:"default",data:{message:`Argument at position ${le.atIndex} should the literal "${ye}"${Y?`: ${N(Y)}`:""}`}});continue}re.value!==ye&&e.report({node:re,messageId:"default",data:{message:`Argument should have the value "${ye}"${Y?`: ${N(Y)}`:""}`},fix:Re=>Re.replaceText(re,typeof ye=="string"?`'${ye}'`:String(ye))})}break}}})}for(let{selector:z,message:Y}of k??[])c.set(z,N(Y)),p.set(N(z),()=>{c.delete(z)});for(let{name:z,type:Y,message:Q}of R??[]){let G=N(z),Ee=N(Q);m.add(`${G}:${Y}:${Ee}`)}}for(let{fn:y,withArgs:E,message:k,replaceWith:R,ignoreRegex:w}of i??[])w&&new RegExp(w).test(s)||a.push(N=>{let{callee:z}=N;if(z.type!==te.Identifier||!b(z.name,y))return;if(E)for(let Q of E){let G=N.arguments[Q.atIndex];if(!G){e.report({node:N,messageId:"default",data:{message:`Missing argument with value "${Q.value}" at index ${Q.atIndex}: ${k}`}});return}if(G.type!==te.Literal||G.value!==Q.value)return}let Y=Q=>R?Q.replaceText(N,R):null;e.report({node:N,messageId:"default",data:{message:k},suggest:R?[{messageId:"default",data:{message:`Replace with "${R}"`},fix:Y}]:void 0})});function I(y,E){let k=n[y];k?n[y]=R=>{k(R),E(R)}:n[y]=E}for(let{selector:y,message:E,replace:k,replaceType:R="suggestion"}of l??[]){if(y==="CallExpression"){a.push(w=>{S(k,w,E,R)});continue}n[y]=w=>{S(k,w,E,R)}}if(p.size>0)for(let[y,E]of p)I(y,E);return a.length>0&&(n.CallExpression=y=>{if(y.type===te.CallExpression)for(let E of a)E(y)}),n.ImportDeclaration=y=>{y.type===te.ImportDeclaration&&T(y)},n.ExportNamedDeclaration=y=>{y.type===te.ExportNamedDeclaration&&h(y)},n.VariableDeclarator=y=>{y.type===te.VariableDeclarator&&x(y)},n["Program:exit"]=y=>{for(let E of u)e.report({node:y,messageId:"default",data:{message:E}});for(let[,E]of c)e.report({node:y,messageId:"default",data:{message:E}});for(let E of m){let[k,R,w]=E.split(":");e.report({node:y,messageId:"default",data:{message:`Missing required export "${k}" of type ${R}: ${w}`}})}},n;function S(y,E,k,R){let w=N=>{if(!y)return null;if(typeof y=="string")return N.replaceText(E,y);{let z=new RegExp(y.regex),Y=e.sourceCode.getText(E);return N.replaceText(E,Y.replace(z,y.with))}};e.report({node:E,messageId:"default",data:{message:k},fix:y&&R==="autofix"?w:void 0,suggest:y&&R==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof y=="string"?y:y.with}"`},fix:w}]:void 0})}}});function yn(e,r){let n=[],t=r.exec(e);if(!t)return null;let[o,...l]=t;n.push({name:"$0_lowercase",value:o.toLowerCase()}),n.push({name:"$0_capitalize",value:Gt(o)}),n.push({name:"$0_uncapitalize",value:Kt(o)}),n.push({name:"$0",value:o});for(let i=0;i<l.length;i++){let s=`$${i+1}`,a=l[i];a!==void 0&&(n.push({name:`${s}_lowercase`,value:a.toLowerCase()}),n.push({name:`${s}_capitalize`,value:Gt(a)}),n.push({name:`${s}_uncapitalize`,value:Kt(a)}),n.push({name:s,value:a}))}return n}function Gt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Kt(e){return e.charAt(0).toLowerCase()+e.slice(1)}import{AST_NODE_TYPES as U,AST_TOKEN_TYPES as Qt,ESLintUtils as gn}from"@typescript-eslint/utils";import{z as Ie}from"zod/v4";var Sn=gn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),tr="collapse-simple-objs-in-one-line",Tn=Ie.object({maxLineLength:Ie.number().optional(),maxProperties:Ie.number().optional(),nestedObjMaxLineLength:Ie.number().optional(),nestedObjMaxProperties:Ie.number().optional(),ignoreTypesWithSuffix:Ie.array(Ie.string()).optional()}),hn=Sn({name:tr,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[L(Tn)]},defaultOptions:[{}],create(e,[r]){let n=e.sourceCode,t=r.ignoreTypesWithSuffix??[],o=r.maxProperties??2,l=r.nestedObjMaxLineLength??r.maxLineLength,i=r.nestedObjMaxProperties??3;function s(p){if(p.type===U.ObjectExpression){let u=p.parent.type===U.Property,c=u?i:o,m=p.properties.length;if(m>c)return!1;if(m===1){let T=p.properties[0];return!T||T.type===U.Property&&T.value.type===U.ObjectExpression||T.type===U.Property&&T.value.type===U.ArrayExpression&&!T.value.elements.every(x=>x&&et(x))?!1:{text:n.getText(T),isNested:u,propsSize:m}}let d=[];for(let T of p.properties){if(T.type===U.Property&&!et(T.value))return!1;d.push(n.getText(T))}return{text:d.join(", "),isNested:u,propsSize:m}}else{let u=p.parent.parent?.type===U.TSPropertySignature,c=u?i:o,m=p.members.length;if(m>c)return!1;if(t.length>0&&p.parent.type===U.TSTypeAliasDeclaration){let T=p.parent.id.name;if(t.some(h=>T.endsWith(h)))return!1}if(m===1){let T=p.members[0];return!T||T.type===U.TSPropertySignature&&T.typeAnnotation?.typeAnnotation.type===U.TSTypeLiteral?!1:{text:n.getText(T),isNested:u,propsSize:1}}if(p.parent.type===U.TSIntersectionType||p.parent.type===U.TSUnionType&&p.parent.types[0]!==p)return!1;let d=[];for(let T of p.members){if(T.type!==U.TSPropertySignature)return!1;let h=T.typeAnnotation?.typeAnnotation;if(!h||h.type===U.TSTypeLiteral||!er(h))return!1;if(h.type===U.TSTypeReference&&h.typeArguments){if(h.typeArguments.params.length>1)return!1;let f=h.typeArguments.params[0];if(!f||!er(f))return!1}let x=n.getText(T).trim();(x.endsWith(";")||x.endsWith(","))&&(x=x.slice(0,-1)),d.push(x)}return{text:d.join("; "),isNested:u,propsSize:m}}}function a(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==U.JSXExpressionContainer){let h=0,x=!1,f=n.getTokenAfter(p,{filter:I=>I.type!==Qt.Punctuator||x?!0:I.value===","?(h++,!1):I.value===";"?(h++,x=!0,!1):I.value===")"||I.value==="}"?(h++,!1):!0});if(h>4)return;let b=f?.type===Qt.Template&&f.value.startsWith(`}
2
+ `);if(f?.loc.start.line===p.loc.end.line&&!b)return}let u=s(p);if(!u)return;let c=u.text;if(c.includes(`
3
+ `)||n.getCommentsInside(p).length>0)return;c.endsWith(";")&&(c=c.slice(0,-1));let m=`{ ${c} }`,d=bn(n,p),T=u.isNested&&u.propsSize>2?l:r.maxLineLength;T&&m.length+d.length+En(p,n)>T||e.report({node:p,messageId:"singleLineProp",fix:h=>h.replaceText(p,m)})}return{TSTypeLiteral:a,ObjectExpression:a}}});function er(e){return e.type===U.TSLiteralType||e.type===U.TSTypeReference||e.type===U.TSNumberKeyword||e.type===U.TSStringKeyword||e.type===U.TSBooleanKeyword||e.type===U.TSNullKeyword||e.type===U.TSUndefinedKeyword}function et(e,r){return!!(e.type===U.Literal||e.type===U.Identifier||e.type===U.TemplateLiteral||e.type===U.TaggedTemplateExpression||!r&&e.type===U.ArrayExpression&&e.elements.every(n=>n&&et(n,!0)))}function En(e,r){let n=r.getLastToken(e);if(!n)return 0;let t=r.text.indexOf(`
4
+ `,n.range[1]);return(t!==-1?t:r.text.length)-n.range[1]}function bn(e,r){return e.text.slice(r.range[0]-r.loc.start.column,r.range[0])}var tt={name:tr,rule:hn};var xn=/eslint +react-compiler\/react-compiler: +\["error/,nr={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 r=!1,n=typeof e.getSource=="function"?f=>n(f):f=>e.sourceCode.getText(f),t=typeof e.getScope=="function"?()=>t():f=>e.sourceCode.getScope(f),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,l=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:l};function s(f){l&&Array.isArray(f.suggest)&&f.suggest.length>0&&(f.fix=f.suggest[0].fix),e.report(f)}let a=e.getSourceCode().scopeManager,p=new WeakMap,u=new WeakSet,c=new WeakMap,m=new WeakMap,d=new WeakSet;function T(f,b){return function(I){if(b.has(I))return b.get(I);let S=f(I);return b.set(I,S),S}}function h(f,b,I,S,y){y&&f.async&&s({node:f,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
5
5
 
6
6
  useEffect(() => {
7
7
  async function fetchData() {
@@ -12,10 +12,15 @@ 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=o.acquire(f),k=new Set,R=null;{let y=S.upper;for(;y&&(k.add(y),y.type!=="function");)y=y.upper;if(!y)return;R=y}let w=Array.isArray;function N(y){if(!w(y.defs))return!1;let h=y.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(R.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(En(F)&&P.type==="Identifier"){for(let D of y.references)D!==P&&T.add(D.identifier);return!0}else if(j==="useState"||j==="useReducer"){if(P.type==="ArrayPattern"&&P.elements.length===2&&w(y.identifiers)){if(P.elements[1]===y.identifiers[0]){if(j==="useState"){let D=y.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]===y.identifiers[0]){if(j==="useState"){let D=y.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(y.identifiers)&&P.elements[1]===y.identifiers[0])return!0;return!1}function W(y){if(!w(y.defs))return!1;let h=y.defs[0];if(h==null||h.node==null||h.node.id==null)return!1;let v=h.node,O=R.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=E(N,u),te=E(W,d),Z=new Map;function be(y){let h=y.from,v=!1;for(;h.block!==f;)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(y){for(let h of y.references){if(!h.resolved||!k.has(h.resolved.scope))continue;let v=nt(f,h.identifier),O=Zt(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===f.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 y.childScopes)ue(h)}Z.forEach(({reference:y,dependencyNode:h},v)=>{let O=y.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(y,h){ie.has(h)||(ie.add(h),s({node:y,message:`Assignments to the '${h}' variable from inside React Hook ${n(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 ${n(b)}.`}))}let Re=new Set;if(X.forEach(({isStable:y,references:h},v)=>{y&&Re.add(v),h.forEach(O=>{O.writeExpr&&Se(O.writeExpr,v)})}),ie.size>0)return;if(!I){let y=null;if(X.forEach(({isStable:h,references:v},O)=>{y||v.forEach(F=>{if(y)return;let P=F.identifier;if(!p.has(P))return;let D=F.from;for(;D.type!=="function";)D=D.upper;D.block===f&&(y=O)})}),y){let{suggestedDependencies:h}=tt({dependencies:X,declaredDependencies:[],stableDependencies:Re,externalDependencies:new Set,isEffect:!0});s({node:b,message:`React Hook ${g} contains a call to '${y}'. 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(f,`, [${h.join(", ")}]`)}}]})}return}let Pe=[],Fe=new Set;I.type!=="ArrayExpression"?s({node:I,message:`React Hook ${n(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.`}):I.elements.forEach(y=>{if(y===null)return;if(y.type==="SpreadElement"){s({node:y,message:`React Hook ${n(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(y)&&s({node:y,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${n(y)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${n(y)}\``,fix(F){return F.removeRange(y.range)}}]});let h;try{h=he(y,ye)}catch(F){if(/Unsupported node type/.test(F.message)){y.type==="Literal"?X.has(y.value)?s({node:y,message:`The ${y.raw} literal is not a valid dependency because it never changes. Did you mean to include ${y.value} in the array instead?`}):s({node:y,message:`The ${y.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:y,message:`React Hook ${n(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=y;for(;v.type==="MemberExpression"||v.type==="OptionalMemberExpression"||v.type==="ChainExpression";)v=v.object||v.expression.object;let O=!R.through.some(F=>F.identifier===v);Pe.push({key:h,node:y}),O||Fe.add(h)});let{suggestedDependencies:Br,unnecessaryDependencies:De,missingDependencies:xe,duplicateDependencies:_t}=tt({dependencies:X,declaredDependencies:Pe,stableDependencies:Re,externalDependencies:Fe,isEffect:m}),Le=Br;if(_t.size+xe.size+De.size===0){if(t)return;gn({declaredDependencies:Pe,declaredDependenciesNode:I,componentScope:R,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 ${I.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(Ut){let[Gr,Kr]=F==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Ut.insertTextBefore(h.node.init,Gr),Ut.insertTextAfter(h.node.init,Kr)]}}]),s({node:h.node,message:Te,suggest:$t})});return}!m&&xe.size>0&&(Le=tt({dependencies:X,declaredDependencies:[],stableDependencies:Re,externalDependencies:Fe,isEffect:m}).suggestedDependencies);function Xr(){if(Pe.length===0)return!0;let y=Pe.map(v=>v.key),h=y.slice().sort();return y.join(",")===h.join(",")}Xr()&&Le.sort();function Be(y){let h=y.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 Xe(y,h,v,O){return y.size===0?null:(y.size>1?"":h+" ")+v+" "+(y.size>1?"dependencies":"dependency")+": "+Tn(Array.from(y).sort().map(F=>"'"+Be(F)+"'"))+`. Either ${O} ${y.size>1?"them":"it"} or remove the dependency array.`}let fe="";if(De.size>0){let y=null;if(Array.from(De.keys()).forEach(h=>{y===null&&h.endsWith(".current")&&(y=h)}),y!==null)fe=` Mutable values like '${y}' 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 y=X.get("props");if(y==null)return;let h=y.references;if(!Array.isArray(h))return;let v=!0;for(let O=0;O<h.length;O++){let F=h[O],P=nt(R.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 ${n(b)}.`)}if(!fe&&xe.size>0){let y=null;xe.forEach(h=>{if(y)return;let v=R.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&&(y=h)}),y!==null&&(fe=` If '${y}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!fe&&xe.size>0){let y=null;if(xe.forEach(h=>{if(y!==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!==R.block;){if(P.type==="CallExpression"){let D=p.get(P.callee);if(D!=null){if(D.name===h)y={missingDep:h,setter:P.callee.name,form:"updater"};else if(c.has(F))y={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"&&(y={missingDep:h,setter:P.callee.name,form:"inlineReducer"})}}break}}P=P.parent}if(y!==null)break}}),y!==null)switch(y.form){case"reducer":fe=` You can also replace multiple useState variables with useReducer if '${y.setter}' needs the current value of '${y.missingDep}'.`;break;case"inlineReducer":fe=` If '${y.setter}' needs the current value of '${y.missingDep}', you can also switch to useReducer instead of useState and read '${y.missingDep}' in the reducer.`;break;case"updater":fe=` You can also do a functional update '${y.setter}(${y.missingDep.slice(0,1)} => ...)' if you only need '${y.missingDep}' in the '${y.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:I,message:`React Hook ${n(b)} has `+(Xe(xe,"a","missing","include")||Xe(De,"an","unnecessary","exclude")||Xe(_t,"a","duplicate","omit"))+fe,suggest:[{desc:`Update the dependencies array to be: [${Le.map(Be).join(", ")}]`,fix(y){return y.replaceText(I,`[${Le.map(Be).join(", ")}]`)}}]})}function C(f){let I=Sn(f.callee,i);if(I===-1)return;let b=f.arguments[I],g=f.callee,m=Qt(g).name,S=f.arguments[I+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 R=r(f).set.get(b.name);if(R==null||R.defs==null)return;let w=R.defs[0];if(!w||!w.node||w.type!=="Variable"&&w.type!=="FunctionName")break;switch(w.node.type){case"FunctionDeclaration":x(w.node,S,g,m,k);return;case"VariableDeclarator":let N=w.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(R){return R.replaceText(S,`[${b.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let f of e.sourceCode.getAllComments())if(yn.test(f.value))return t=!0,{CallExpression:I=>C(I,!0)}}return{CallExpression:f=>C(f)}}};function tt({dependencies:e,declaredDependencies:t,stableDependencies:n,externalDependencies:r,isEffect:a}){let l=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((x,C)=>{let f=s(l,C);f.isUsed=!0,o(l,C,I=>{I.isSubtreeUsed=!0})}),t.forEach(({key:x})=>{let C=s(l,x);C.isSatisfiedRecursively=!0}),n.forEach(x=>{let C=s(l,x);C.isSatisfiedRecursively=!0});function s(x,C){let f=C.split("."),I=x;for(let b of f){let g=I.children.get(b);g||(g=i(),I.children.set(b,g)),I=g}return I}function o(x,C,f){let I=C.split("."),b=x;for(let g of I){let m=b.children.get(g);if(!m)return;f(m),b=m}}let p=new Set,c=new Set;u(l,p,c,x=>x);function u(x,C,f,I){x.children.forEach((b,g)=>{let m=I(g);if(b.isSatisfiedRecursively){b.isSubtreeUsed&&f.add(m);return}if(b.isUsed){C.add(m);return}u(b,C,f,S=>m+"."+S)})}let d=[],T=new Set,E=new Set;return t.forEach(({key:x})=>{c.has(x)?d.indexOf(x)===-1?d.push(x):E.add(x):T.add(x)}),p.forEach(x=>{d.push(x)}),{suggestedDependencies:d,unnecessaryDependencies:T,duplicateDependencies:E,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 gn({declaredDependencies:e,declaredDependenciesNode:t,componentScope:n,scope:r}){let a=e.map(({key:i})=>{let s=n.variables.find(p=>p.name===i);if(s==null)return null;let o=s.defs[0];if(o==null)return null;if(o.type==="Variable"&&o.node.type==="VariableDeclarator"&&o.node.id.type==="Identifier"&&o.node.init!=null){let p=we(o.node.init);if(p!=null)return[s,p]}return o.type==="FunctionName"&&o.node.type==="FunctionDeclaration"?[s,"function"]:o.type==="ClassName"&&o.node.type==="ClassDeclaration"?[s,"class"]:null}).filter(Boolean);function l(i){let s=!1;for(let o=0;o<i.references.length;o++){let p=i.references[o];if(p.writeExpr){if(s)return!0;s=!0;continue}let c=p.from;for(;c!==r&&c!=null;)c=c.upper;if(c!==r&&!er(t,p.identifier))return!0}return!1}return a.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:l(i)}))}function Zt(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)?Zt(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function rt(e,t,n){t&&(e.optional?t.has(n)||t.set(n,!0):t.has(n)||t.set(n,!1))}function he(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let n=e.name;return t&&t.set(n,!1),n}else if(e.type==="MemberExpression"&&!e.computed){let n=he(e.object,t),r=he(e.property,null),a=`${n}.${r}`;return rt(e,t,a),a}else if(e.type==="OptionalMemberExpression"&&!e.computed){let n=he(e.object,t),r=he(e.property,null),a=`${n}.${r}`;return rt(e,t,a),a}else if(e.type==="ChainExpression"&&!e.computed){let n=e.expression;if(n.type==="CallExpression")throw new Error(`Unsupported node type: ${n.type}`);let r=he(n.object,t),a=he(n.property,null),l=`${r}.${a}`;return rt(n,t,l),l}else throw new Error(`Unsupported node type: ${e.type}`)}function Qt(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Sn(e,t){let n=Qt(e);if(n.type!=="Identifier")return-1;switch(n.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(n===e&&t&&t.additionalHooks){let r;try{r=he(n,null)}catch(a){if(/Unsupported node type/.test(a.message))return 0;throw a}return t.additionalHooks.test(r)?0:-1}else return-1}}function nt(e,t){let n=[e],r=null;for(;n.length;){if(r=n.shift(),hn(r,t))return r;if(er(r,t))for(let[a,l]of Object.entries(r))a!=="parent"&&(Gt(l)?(l.parent=r,n.push(l)):Array.isArray(l)&&l.forEach(i=>{Gt(i)&&(i.parent=r,n.push(i))}))}return null}function Tn(e){let t="";for(let n=0;n<e.length;n++)t+=e[n],n===0&&e.length===2?t+=" and ":n===e.length-2&&e.length>2?t+=", and ":n<e.length-1&&(t+=", ");return t}function Gt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function hn(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 er(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function En(e){return!1}import{AST_NODE_TYPES as $e,ESLintUtils as rr}from"@typescript-eslint/utils";import se from"typescript";var bn=rr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),tr="improved-no-unnecessary-condition",xn=z({}),In=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Cn=new Set(In),it={name:tr,rule:bn({name:tr,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:[xn]},defaultOptions:[{}],create(e){let t=rr.getParserServices(e,!0),n=t.program?.getTypeChecker();if(!n||!t.program)throw new Error("TypeScript services or program not available");function r(s){return s.type===$e.UnaryExpression&&s.operator==="typeof"}function a(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 l(s){if(!n)return null;let o=t.esTreeNodeToTSNodeMap.get(s),p=n.getTypeAtLocation(o.expression);if(p.flags&se.TypeFlags.Any||p.flags&se.TypeFlags.Unknown)return null;let c=[];if(p.isUnion()){for(let d of p.types){let T=a(d);if(T)c.push(...T);else return null}return c}let u=a(p);return u?(c.push(...u),c):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,c=null;if(r(s.left)?(p=s.left,c=s.right.type===$e.Literal&&typeof s.right.value=="string"?s.right.value:null):r(s.right)&&(p=s.right,c=s.left.type===$e.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!c||!wn(c,Cn))return;let u=l(p);if(!u)return;let d=s.operator==="!==",T=u.includes(c);u.length===1?T&&!d?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:c}}):!T&&d?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:Array.from(u)[0]}}):!T&&!d?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:_e(u),conditionType:c}}):T&&d&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:_e(u),conditionType:c}}):!T&&!d?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:_e(u),conditionType:c}}):!T&&d&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:_e(u)}})}return{BinaryExpression:i}}})};function _e(e){return Array.from(new Set(e)).join(" | ")||"never"}function ve(e,t){let n=e.argument;return n.type===$e.Identifier?n.name:t.sourceCode.getText(n)}function wn(e,t){return t.has(e)}import{AST_NODE_TYPES as An,ESLintUtils as Rn}from"@typescript-eslint/utils";var vn=Rn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nr="no-call-with-explicit-generics",kn=z({functions:Q(V())}),On=vn({name:nr,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:[kn]},defaultOptions:[{functions:[]}],create(e,[t]){let n=new Set(t.functions);return{CallExpression(r){let{callee:a}=r;a.type===An.Identifier&&n.has(a.name)&&r.typeArguments&&e.report({node:r,messageId:"noExplicitGenerics",data:{functionName:a.name}})}}}}),st={name:nr,rule:On};import{AST_NODE_TYPES as Ue,ESLintUtils as Pn}from"@typescript-eslint/utils";var Fn=Pn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ir="no-call-with-inferred-generics",Nn=Fn({name:ir,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 n=new Map(t.functions.map(r=>[r.name,r]));return{CallExpression(r){let{callee:a}=r;if(a.type!==Ue.Identifier)return;let l=n.get(a.name);if(!l)return;let{minGenerics:i=1,allowAny:s,disallowTypes:o=t.disallowTypes}=l;(r.typeArguments?.params.length||0)<(i||0)&&e.report({node:r,messageId:"missingGenericDeclaration",data:{functionName:a.name,minGenerics:i||0}}),!(s&&!o)&&r.typeArguments?.params.some(c=>!s&&c.type===Ue.TSAnyKeyword||o&&c.type===Ue.TSTypeReference&&c.typeName.type===Ue.Identifier&&o.includes(c.typeName.name))&&e.report({node:r,messageId:"anyUsedInGenerics",data:{functionName:a.name}})}}}}),ot={name:ir,rule:Nn};import{ESLintUtils as jn}from"@typescript-eslint/utils";var Mn=jn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),or="no-commented-out-code",Dn=["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 Ln(e){if(e.includes(":")){let n=e.split(":")[0]?.trim();if(n&&/^[a-zA-Z]/.test(n)&&n.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 _n=[") {","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],$n=["/>","</",G.jsxSelfClosing,G.jsxElement,G.jsxOpeningTag,G.jsxClosingTag,G.htmlOpeningTag,G.htmlClosingTag],sr=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Un=Mn({name:or,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(r,a){if(r.startsWith("/"))return!1;let l=r.trimStart();if(r.startsWith("*")||l.startsWith("eslint-disable")||r.includes("@deprecated")||r.includes("@example")||r.includes("@param")||r.includes("@returns")||r.includes("@throws")||r.includes("typescript-eslint")||r.includes("@ts-")||r.includes("prettier-ignore")||G.jsdocComment.test(r))return!1;for(let i of sr)if(l.startsWith(i))return!1;if(r.includes("https://")||Ln(l))return!1;if(a==="Block"){for(let i of $n)if(typeof i=="string"){if(r.includes(i))return{wrongPattern:i}}else if(i.test(r))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of Dn)if(l.startsWith(i))return{wrongPattern:i};for(let i of _n)if(typeof i=="string"){if(r.includes(i))return{wrongPattern:i}}else if(i.test(r))return{wrongPattern:`regex(${i.toString()})`};return!1}function n(r,a){let l=r,i=l.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return l;if(a==="Block"&&l.includes("```")){let p=l.split(/```[\s\S]*?```/g);p.some(u=>/[a-zA-Z0-9]/.test(u))&&(l=p.join(""))}if(!l.includes("`"))return l;let s=l.split(/`[^`]*`/g);return s.some(p=>/[a-zA-Z0-9]/.test(p))?s.join(""):l}return{Program(){let a=e.sourceCode.getAllComments();for(let l of a){let i=n(l.value,l.type),s=t(i,l.type);s&&e.report({node:l,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:sr.join(", ")}})}}}}}),at={name:or,rule:Un};import{ESLintUtils as Wn,TSESTree as Vn}from"@typescript-eslint/utils";var zn=Wn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ar="no-default-export",Hn=zn({name:ar,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 n of t.specifiers)n.exported.type===Vn.AST_NODE_TYPES.Identifier&&n.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),lt={name:ar,rule:Hn};import{ESLintUtils as Yn}from"@typescript-eslint/utils";var qn=Yn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),lr="no-leaked-text-in-jsx",Jn=[",",";","[","]","(",")"],Bn=qn({name:lr,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 n=t.value.trim();if(!n)return;let r="";Jn.includes(n)?r=n:n.includes("&&")?r="&&":n.includes("||")?r="||":n.endsWith("? (")&&(r="? ("),r&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:r}})}}}}),pt={name:lr,rule:Bn};import{AST_NODE_TYPES as Ne,ESLintUtils as Xn}from"@typescript-eslint/utils";var Gn=Xn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cr="no-non-camel-case-functions",Kn=/^(\$?[a-z][a-zA-Z0-9]*)$/;function pr(e){if(e.typeName.type!==Ne.TSQualifiedName)return!1;let{left:t,right:n}=e.typeName;return t.type===Ne.Identifier&&t.name==="JSX"&&n.name==="Element"}var Zn=Gn({name:cr,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&&!Kn.test(t.id.name)){let n=t.returnType?.typeAnnotation;if(n&&(n.type===Ne.TSTypeReference?pr(n):n.type===Ne.TSUnionType&&n.types.some(a=>a.type===Ne.TSTypeReference&&pr(a))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),ct={name:cr,rule:Zn};import{ESLintUtils as Qn,TSESTree as H}from"@typescript-eslint/utils";import{AST_NODE_TYPES as ur}from"@typescript-eslint/utils";function ke(e,t,n=1/0){if(n!==0&&e.parent)return e.type===t?e:ke(e.parent,t,n===1/0?n:n-1)}function*ut(e){yield e,e.parent&&(yield*ut(e.parent))}function ft(e,t){for(let n of e){let r=t(n);if(r!=null&&r!==!1)return r}}function fr(e,t,n){let a=n.getDeclaredVariables(e).find(l=>l.name===t||l.identifiers[0]?.parent.type===ur.Property&&l.identifiers[0]?.parent.key.type===ur.Identifier&&l.identifiers[0]?.parent.key.name===t);return a?a.references.filter(l=>!l.init):[]}var ei=Qn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mr="no-optional-root-props",ti=ei({name:mr,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(r){let l=e.sourceCode.getDeclaredVariables(r)[0];if(!l||l.references.length!==1)return!1;let i=l.references[0];if(!i)return!1;for(let s of ut(i.identifier)){if("returnType"in s||s.type===H.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let o=s.parent;if(!o)return!1;if(o.type===H.AST_NODE_TYPES.TSTypeParameterInstantiation&&o.parent.type===H.AST_NODE_TYPES.TSTypeReference&&o.parent.typeName.type===H.AST_NODE_TYPES.Identifier&&o.parent.typeName.name==="FC"){let c=ke(o.parent.parent,H.AST_NODE_TYPES.VariableDeclaration,4);if(!c)return!1;let u=We(c,e.sourceCode);return u?!(u.parent.type===H.AST_NODE_TYPES.CallExpression&&u.parent.callee.type===H.AST_NODE_TYPES.Identifier&&u.parent.callee.name==="memo"):!1}if(s.type===H.AST_NODE_TYPES.AssignmentPattern)return!1;if(o.type===H.AST_NODE_TYPES.ArrowFunctionExpression){let p=ke(o,H.AST_NODE_TYPES.VariableDeclaration);return p?!!We(p,e.sourceCode):!1}if(o.type===H.AST_NODE_TYPES.FunctionDeclaration)return!!We(o,e.sourceCode)}return!1}function n(r){r.key.type!==H.AST_NODE_TYPES.Identifier||!r.optional||e.report({node:r.key,messageId:"optionalNotAllowed",data:{propertyName:r.key.name},suggest:[{messageId:"suggestion",fix:a=>{let l=ke(r,H.AST_NODE_TYPES.TSPropertySignature);if(!l)return null;let i=e.sourceCode.getText(l);return a.replaceText(l,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(r){if(r.typeAnnotation.type===H.AST_NODE_TYPES.TSTypeLiteral&&!(Ve(r)||!t(r)))for(let a of r.typeAnnotation.members)a.type===H.AST_NODE_TYPES.TSPropertySignature&&n(a)},TSInterfaceDeclaration(r){if(!(Ve(r)||!t(r)))for(let a of r.body.body)a.type===H.AST_NODE_TYPES.TSPropertySignature&&n(a)},TSTypeReference(r){if(r.typeName.type!==H.AST_NODE_TYPES.Identifier||r.typeName.name!=="FC"||!r.typeArguments?.params[0])return;let a=r.typeArguments.params[0];if(a.type!==H.AST_NODE_TYPES.TSTypeLiteral)return;let l=ke(r.parent,H.AST_NODE_TYPES.VariableDeclaration,4);if(!l)return;let i=We(l,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 o of a.members)o.type===H.AST_NODE_TYPES.TSPropertySignature&&n(o)}}}});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 n;if(e.type===H.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===H.AST_NODE_TYPES.Identifier&&(n=e.declarations[0].id)}else{if(!e.id)return;n=e.id}if(!n)return;let r=t.getScope(e);e.type===H.AST_NODE_TYPES.FunctionDeclaration&&r.upper&&(r=r.upper);let a=r.variables.find(i=>i.identifiers.includes(n));if(!a)return;let l=a.references.filter(i=>i.identifier!==n);if(!(l.length!==1||!l[0])&&!Ve(l[0].identifier.parent.parent))return l[0].identifier}var mt={name:mr,rule:ti};import{AST_NODE_TYPES as ze}from"@typescript-eslint/utils";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){let t=new Set;function n(r){return r?r.type===ze.Identifier?t.has(r.name):r.type===ze.MemberExpression?n(r.object):!1:!1}return{ImportDeclaration(r){for(let a of r.specifiers)t.add(a.local.name)},ExportNamedDeclaration(r){if(r.source){e.report({node:r,messageId:"noReexport"});return}if(r.declaration?.type===ze.VariableDeclaration)for(let a of r.declaration.declarations)n(a.init)&&e.report({node:r,messageId:"noReexport"});r.specifiers.length>0&&e.report({node:r,messageId:"noReexport"})},ExportDefaultDeclaration(r){r.declaration.type===ze.Identifier&&t.has(r.declaration.name)&&e.report({node:r,messageId:"noReexport"})},ExportAllDeclaration(r){e.report({node:r,messageId:"noReexport"})}}}});import{ESLintUtils as ri}from"@typescript-eslint/utils";import dt from"node:path";var ni=ri.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),dr="no-relative-imports",ii=z({find:V(),replacement:V()}),si=z({aliases:Q(ii),rootDir:_(V()),allowNotFoundAliases:_(Ie()),_dev_simulateFileName:_(V())}),oi=ni({name:dr,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:[si]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let n=t._dev_simulateFileName??e.filename;function r(i){return i.startsWith(".")||i.startsWith("..")}function a(i,s){let o=dt.dirname(s);return dt.resolve(o,i)}function l(i){let s=t.rootDir??process.cwd(),o=dt.relative(s,i);if(o.startsWith("."))return null;o.startsWith("/")||(o=`/${o}`);for(let{find:p,replacement:c}of t.aliases)if(o.startsWith(c)){let u=o.replace(c,p);return{alias:p,newPath:u}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!r(s))return;let o=a(s,n),p=l(o);!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})}}}}),yt={name:dr,rule:oi};import{AST_NODE_TYPES as He}from"@typescript-eslint/utils";import*as Ae from"zod/v4";var ai=Ae.object({alternativeMsgs:Ae.object({inArrayFind:Ae.string().optional(),inArrayFilter:Ae.string().optional()}).optional(),__dev_simulateFileName:Ae.string().optional()});function li(e){return e.typeAnnotation.type!==He.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}function pi(e){return/\.(typeGuards|type-guards)\.(ts|tsx)$/.test(e)}function ci(e){let t=e.parent;for(;t;){if(t.type===He.CallExpression&&t.callee.type===He.MemberExpression&&t.callee.property.type===He.Identifier){let n=t.callee.property.name;if(n==="filter"||n==="find")return{method:n}}t=t.parent}return null}var gt=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:[Ce(ai)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let n=t.__dev_simulateFileName??e.filename;if(pi(n))return{};function r(a){if(!li(a))return;let l=ci(a);if(t.alternativeMsgs&&l){let i=l.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let s=l.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:a,messageId:s,data:{message:i}});return}}e.report({node:a,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":r,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":r,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":r}}});import{AST_NODE_TYPES as Oe}from"@typescript-eslint/utils";var ui="no-unnecessary-async-on-jsx-props";function fi(e){if(e.body.type!==Oe.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let n=t[0];return!n||n.type!==Oe.ExpressionStatement?!1:n.expression.type===Oe.AwaitExpression}var St=B({name:ui,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(n){fi(n)&&e.report({node:n,messageId:"unnecessaryAsyncInJsxProp",fix(r){let a=e.sourceCode,l=[],i=a.getFirstToken(n,o=>o.value==="async");if(i){let o=a.getTokenAfter(i);o?l.push(r.replaceTextRange([i.range[0],o.range[0]],"")):l.push(r.remove(i))}function s(o){if(o.type===Oe.AwaitExpression){let p=a.getFirstToken(o);if(p&&p.value==="await"){let c=a.getTokenAfter(p);c?l.push(r.replaceTextRange([p.range[0],c.range[0]],"")):l.push(r.remove(p))}}if(o.type===Oe.BlockStatement)for(let p of o.body)s(p);else o.type===Oe.ExpressionStatement&&s(o.expression)}return s(n.body),l}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});import{AST_NODE_TYPES as Me,ESLintUtils as gr}from"@typescript-eslint/utils";import*as Tt from"typescript";var mi=gr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yr="no-unnecessary-casting",di=z({additionalCastFunctions:_(Q(z({name:V(),expectedType:Wt(["string","number"])})))}),ht={name:yr,rule:mi({name:yr,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:[di],fixable:"code"},defaultOptions:[{}],create(e){let n=e.options[0].additionalCastFunctions||[],r=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...n],a=gr.getParserServices(e,!0),l=a.program?.getTypeChecker();if(!l||!a.program)throw new Error("TypeScript services or program not available");function i(c,u){switch(c.type){case Me.Literal:return u==="number"?typeof c.value=="number":typeof c.value=="string";case Me.TemplateLiteral:return u==="string";case Me.UnaryExpression:return u==="number"?c.operator==="+"||c.operator==="-"||c.operator==="~":!1;default:return!1}}function s(c,u){return u==="number"?!!(c.flags&Tt.TypeFlags.NumberLike):!!(c.flags&Tt.TypeFlags.StringLike)}function o(c,u){return d=>d.replaceText(c,e.sourceCode.getText(u))}function p(c){if(!l||c.arguments.length!==1)return;let u=c.arguments[0];if(!u||u.type===Me.SpreadElement)return;let{callee:d}=c;if(d.type!==Me.Identifier)return;let T=d.name,E=r.find(C=>C.name===T);if(!E)return;if(i(u,E.expectedType)||s(l.getTypeAtLocation(a.esTreeNodeToTSNodeMap.get(u)),E.expectedType)){let C,f;T==="Number"?C="unnecessaryNumberCasting":T==="String"?C="unnecessaryStringCasting":(C="unnecessaryCustomCasting",f={name:E.name,type:E.expectedType}),e.report({node:c,messageId:C,...f?{data:f}:{},fix:o(c,u)})}}return{CallExpression:p}}})};import{AST_NODE_TYPES as Ye}from"@typescript-eslint/utils";import*as pe from"zod/v4";var yi=pe.object({methods:pe.union([pe.array(pe.string()),pe.literal("array")])}),Et=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(yi)]},defaultOptions:[{methods:"array"}],create(e,[t]){let n=t.methods,r=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function a(s){return Array.isArray(n)?n.includes(s):r.has(s)}function l(s){let{callee:o}=s;if(o.type===Ye.MemberExpression){let p=o.property;if(p.type===Ye.Identifier)return p.name}return null}function i(s,o){if(s.type!==Ye.Identifier||!s.typeAnnotation)return;let p=o.parent;if(p.type===Ye.CallExpression){let c=l(p);c&&a(c)&&p.arguments.indexOf(o)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(d){return d.remove(s.typeAnnotation)}})}}return{ArrowFunctionExpression(s){for(let o of s.params)i(o,s)},FunctionExpression(s){for(let o of s.params)i(o,s)}}}});import{AST_NODE_TYPES as ae}from"@typescript-eslint/utils";var bt=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 n=new Map;for(let i of t.init.properties)i.type===ae.Property&&i.key.type===ae.Identifier&&n.set(i.key.name,i);if(n.size===0||t.id.type!==ae.Identifier)return;let r=gi(t,e.sourceCode);if(r.length===0)return;let a=t.init.properties.some(i=>i.type!==ae.Property?!1:i.value.type===ae.FunctionExpression),l=new Set;for(let i of r){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")l.add(s.property.value);else return;else{if(s.property.type!==ae.Identifier)return;l.add(s.property.name)}if(s.parent.type===ae.CallExpression&&a)return}for(let[i,s]of n)l.has(i)||e.report({node:s,messageId:"unusedObjectProperty",data:{name:i}})}}}});function gi(e,t){let n=t.getDeclaredVariables(e);if(n.length!==1)return[];let r=n[0];return r?r.references.filter(a=>a.identifier!==e.id):[]}import{AST_NODE_TYPES as q,ESLintUtils as Si}from"@typescript-eslint/utils";var Ti=z({selectors:Q(z({name:V(),selectorProp:_(V()),selectorArgPos:_(ge()),returnProp:_(V())}))}),hi=Si.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sr="no-unused-selected-values",xt={name:Sr,rule:hi({name:Sr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[Ti]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:n=[]}=t,r=new Map(n.map(a=>[a.name,a]));return{VariableDeclarator(a){let l=null;if(a.init?.type===q.CallExpression&&(l=a.init),!l)return;let i=bi(l);if(!i)return;let s=r.get(i);if(!s)return;let o=Ei(l,s.selectorArgPos??0,s.selectorProp);if(!o)return;let p=xi(o);if(!p)return;let c=Tr(p.properties,void 0);if(!c)return;if(a.id.type===q.ObjectPattern){let T=Tr(a.id.properties,s.returnProp);if(!T)return;for(let[E,x]of c)T.has(E)||e.report({node:x,messageId:"unusedSelectedValue",data:{name:E}});return}if(a.id.type!==q.Identifier||s.returnProp)return;let u=Ii(a,e.sourceCode);if(u.length===0)return;let d=new Set;for(let T of u){if(T.identifier.parent.type!==q.MemberExpression)return;let E=T.identifier.parent.property;if(E.type!==q.Identifier)return;d.add(E.name)}for(let[T,E]of c)d.has(T)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:T}})}}}})};function Ei(e,t,n){let r=e.arguments[t];if(!r)return null;if(r.type===q.ArrowFunctionExpression||r.type===q.FunctionExpression)return r;if(n&&r.type===q.ObjectExpression){let a=r.properties.find(i=>i.type===q.Property&&i.key.type===q.Identifier&&i.key.name===n);if(a?.type!==q.Property)return null;let l=a.value;if(l.type===q.ArrowFunctionExpression||l.type===q.FunctionExpression)return l}return null}function bi(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 xi(e){if(e.body.type===q.ObjectExpression)return e.body;if(e.body.type===q.BlockStatement){let t=e.body.body.filter(n=>n.type===q.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==q.ObjectExpression?null:t[0].argument}return null}function Tr(e,t){let n=e;if(t){let a=e.find(l=>l.type===q.Property&&l.key.type===q.Identifier&&l.key.name===t);if(a?.type!==q.Property||a.value.type!==q.ObjectPattern)return null;n=a.value.properties}let r=new Map;for(let a of n){if(a.type!==q.Property||a.key.type!==q.Identifier)return null;r.set(a.key.name,a)}return r.size>0?r:null}function Ii(e,t){let n=t.getDeclaredVariables(e);if(n.length!==1)return[];let r=n[0];return r?r.references.filter(a=>a.identifier!==e.id):[]}import{AST_NODE_TYPES as Y}from"@typescript-eslint/utils";var It=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(l=>l.type===Y.ImportDeclaration&&l.source.value==="t-state-form"))return{};let r=null,a=!1;return{CallExpression(l){if(a)return;if(!r){let s=Ci(l);s&&(r=s);return}let i=wi(l,e.sourceCode);if(i){a=!0;for(let s of i)r.delete(s);if(r.size!==0)for(let[s,o]of r)e.report({node:o,messageId:"unusedField",data:{name:s}})}}}}});function Ci(e){if(!(e.callee.type===Y.Identifier&&e.callee.name==="useForm"))return null;let n=e.arguments[0];if(!n||n.type!==Y.ObjectExpression)return null;let r=ft(n.properties,l=>l.type!==Y.Property||l.key.type!==Y.Identifier||l.key.name!=="initialConfig"?null:l.value.type===Y.ObjectExpression?l.value:l.value.type===Y.ArrowFunctionExpression||l.value.type===Y.FunctionExpression?Ai(l.value):null);if(!r)return null;let a=new Map;for(let l of r.properties)l.type===Y.Property&&l.key.type===Y.Identifier&&a.set(l.key.name,l);return a}function wi(e,t){if(!(e.callee.type===Y.Identifier&&e.callee.name==="useFormState")||e.parent.type!==Y.VariableDeclarator||e.parent.id.type!==Y.ObjectPattern||!ft(e.parent.id.properties,i=>i.type===Y.Property&&i.key.type===Y.Identifier&&i.key.name==="formFields"&&i))return null;let a=fr(e.parent,"formFields",t),l=new Set;for(let{identifier:i}of a){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;l.add(i.parent.property.name)}}return l}function Ai(e){if(e.body.type===Y.ObjectExpression)return e.body;if(e.body.type===Y.BlockStatement){let t=e.body.body.filter(n=>n.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 $,ESLintUtils as Ri}from"@typescript-eslint/utils";var vi=Ri.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function hr(e){let t=[];for(let n of e.members)n.type===$.TSPropertySignature&&n.key.type===$.Identifier&&t.push([n.key.name,n]);return t}function Er(e,...t){for(let n of t)e.set(...n);return e}var ki=z({forceCheckOnFCPropTypesWithName:_(Q(V())),alwaysCheckFunctionOptionTypes:_(Ie())}),br="no-unused-type-props-in-args",Ct=null,Oi=vi({name:br,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:[ki],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:n,alwaysCheckFunctionOptionTypes:r=!0}=t;n&&!Ct&&(Ct=n.map(o=>new RegExp(o)));function a(o,p,c,u,d=!0,T=!1){let E=c.name,x=e.sourceCode.getScope(p).references.find(g=>g.identifier.name===E)?.resolved,C=o&&Ct?.some(g=>g.test(E)),f=T&&r;if(!x||!C&&x.references.filter(g=>g.isTypeReference).length>1)return;let I=x.defs[0].node,b=I.parent?.type===$.ExportNamedDeclaration;if(!(d&&b&&!f)){if(I.type===$.TSTypeAliasDeclaration){l(o,p,u,I.typeAnnotation,!0,T);return}if(I.type===$.TSInterfaceDeclaration){l(o,p,u,I.body,!0,T);return}}}function l(o,p,c,u,d,T=!1){if(u.type===$.TSInterfaceBody){for(let E of u.body)E.type===$.TSPropertySignature&&E.key.type===$.Identifier&&c.set(E.key.name,E);return}if(u.type===$.TSTypeLiteral){Er(c,...hr(u));return}if(u.type===$.TSIntersectionType){for(let E of u.types)l(o,p,c,E,!0,T);return}d||u.type===$.TSTypeReference&&u.typeName.type===$.Identifier&&a(o,p,u.typeName,c,!0,T)}function i(o,p,c,u=!1){for(let d of c)if(d.type===$.ObjectPattern&&d.typeAnnotation){let T=new Map;if(l(o,p,T,d.typeAnnotation.typeAnnotation,!1,u),T.size===0)continue;s(d,T)}else d.type===$.AssignmentPattern&&d.left.type===$.ObjectPattern&&i(o,p,[d.left],u)}function s(o,p){let c=[];if(o.properties.at(-1)?.type===$.RestElement)return;for(let E of o.properties)E.type===$.Property&&E.key.type===$.Identifier&&c.push(E.key.name);let d=[],T=[];for(let[E,x]of p)c.includes(E)||(T.push(E),d.push({node:x,messageId:"unusedObjectTypeProperty",data:{propertyName:E}}));for(let[E,x]of d.entries())e.report({...x,fix:E===d.length-1?C=>{let f=o.properties.at(-1),I=T.join(", ");return f?f.type===$.RestElement?null:C.insertTextAfter(f,`, ${I}`):C.insertTextBeforeRange([o.range[0]+1,o.range[1]],I)}:void 0})}return{VariableDeclaration(o){let p=o.declarations[0],c=new Map,u=p.id.type===$.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===$.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===$.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(u){if(u.type===$.TSTypeReference&&u.typeName.type===$.Identifier)a(!0,o,u.typeName,c,!1);else if(u.type===$.TSTypeLiteral)Er(c,...hr(u));else if(u.type===$.TSIntersectionType)for(let d of u.types)d.type===$.TSTypeReference&&d.typeName.type===$.Identifier?a(!0,o,d.typeName,c,!1):l(!0,o,c,d,!0);if(c.size!==0&&p.init?.type===$.ArrowFunctionExpression){let d=p.init.params[0];if(!d){e.report({node:p.init,messageId:"missingComponentParam"});return}d.type===$.ObjectPattern&&s(d,c)}}},FunctionDeclaration(o){i(!1,o,o.params,r)},ArrowFunctionExpression(o){i(!1,o,o.params,r)}}}}),wt={name:br,rule:Oi};import{AST_NODE_TYPES as de}from"@typescript-eslint/utils";var At=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 n(r){return r.callee.type===de.Identifier?t.has(r.callee.name):r.callee.type===de.MemberExpression&&r.callee.object.type===de.Identifier&&r.callee.property.type===de.Identifier?r.callee.property.name==="useRef":!1}return{ImportDeclaration(r){if(r.source.value==="react")for(let a of r.specifiers)a.type===de.ImportSpecifier&&a.imported.type===de.Identifier&&a.imported.name==="useRef"&&t.add(a.local.name)},VariableDeclarator(r){if(r.init&&r.init.type===de.CallExpression&&n(r.init)&&r.id.type===de.Identifier){let l=e.sourceCode.getScope(r).set.get(r.id.name);if(l){let i=!1;for(let s of l.references){let p=s.identifier.parent;if(p!==r&&!(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:r.id,messageId:"refNotRead",data:{name:r.id.name}})}}}}}});import{AST_NODE_TYPES as Rt,ESLintUtils as Pi}from"@typescript-eslint/utils";var Fi=Pi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ir="prefer-named-functions",xr=new Map,Ni=Fi({name:Ir,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 n=null;if(t.ignoreRegex){let r=xr.get(t.ignoreRegex);r?n=r:(n=new RegExp(t.ignoreRegex),xr.set(t.ignoreRegex,n))}return{VariableDeclarator(r){if(r.init&&r.init.type===Rt.ArrowFunctionExpression&&r.id.type===Rt.Identifier){let a=r.id.name;if(r.id.typeAnnotation||n&&n.test(a)||!t.disallowArrowFnWithImplicitReturns&&r.init.body.type!==Rt.BlockStatement)return;let l=r.parent,i=r.init.params,s=r.init.body,o=r.init;e.report({node:r.id,messageId:n?"withIgnoreRegex":"default",data:{functionName:a,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(l,`${o.async?"async ":""}function ${a}(${i.map(c=>e.sourceCode.getText(c)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),vt={name:Ir,rule:Ni};import{AST_NODE_TYPES as M}from"@typescript-eslint/utils";var ji=z({disallowedFunctions:Q(z({name:V(),allowUsingWithArgs:_(Ie()),hookAlternative:_(V()),message:_(V()),allowUseInside:_(Q(V()))}))});function qe(e){return/^use[A-Z]/.test(e)}function Cr(e){return/^[A-Z]/.test(e)}function Mi(e){return e.type===M.Identifier?qe(e.name):e.type===M.MemberExpression&&e.property.type===M.Identifier?qe(e.property.name):!1}function wr(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 Ar(e){return!!(e.parent&&e.parent.type===M.CallExpression&&wr(e.parent.callee,"forwardRef"))}function Rr(e){return!!(e.parent&&e.parent.type===M.CallExpression&&wr(e.parent.callee,"memo"))}function kt(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 Di(e){let t=e.parent,n=!1;for(;t;){if(t.type===M.FunctionDeclaration||t.type===M.FunctionExpression||t.type===M.ArrowFunctionExpression){let r=kt(t);if(r&&r.type===M.Identifier){if(Cr(r.name)||qe(r.name))return!n;n=!0}else{if(Ar(t)||Rr(t))return!n;if(t.parent.type===M.CallExpression){let a=t.parent;Mi(a.callee)||(n=!0)}else t.parent.type===M.JSXExpressionContainer||(n=!0)}}t=t.parent}return!1}function vr(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 Li(e,t){if(!t.length)return!1;let n=e.parent;for(;n;){if(n.type===M.FunctionDeclaration||n.type===M.FunctionExpression||n.type===M.ArrowFunctionExpression){let r=kt(n);if(r&&r.type===M.Identifier&&t.includes(r.name))return!0}else if(n.type===M.CallExpression){let r=vr(n);if(r&&t.includes(r))return!0}n=n.parent}return!1}function _i(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===M.Identifier&&t.name==="undefined")}function $i(e,t){let n=!1,r=e.parent;for(;r;){if(r.type===M.FunctionDeclaration||r.type===M.FunctionExpression||r.type===M.ArrowFunctionExpression){let a=kt(r);if(a&&a.type===M.Identifier){if(Cr(a.name)||qe(a.name)){n=!0;break}}else if(Ar(r)||Rr(r)){n=!0;break}}r=r.parent}return n?t.length===0?Di(e):!Li(e,t):!1}var Ot=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:[ji],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:n}=t,r=new Map(n.map(a=>[a.name,a]));return{CallExpression(a){let l=vr(a);if(!l)return;let i=r.get(l);if(!i||i.allowUsingWithArgs&&_i(a))return;let s=i.allowUseInside||[];$i(a,s)&&e.report({node:a,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:o=>{let p=i.hookAlternative;return a.callee.type===M.Identifier?o.replaceText(a.callee,p):a.callee.type===M.MemberExpression&&a.callee.property.type===M.Identifier?o.replaceText(a.callee.property,p):null}}]:[]})}}}});import{AST_NODE_TYPES as K,AST_TOKEN_TYPES as kr,ESLintUtils as Ui}from"@typescript-eslint/utils";var Wi=Ui.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pr="prefer-single-line-if",Vi=z({maxLineLength:_(ge()),maxNonSimpleConditionLength:_(ge())}),zi=Wi({name:Pr,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[Vi]},defaultOptions:[{}],create(e,[t]){let n=e.sourceCode;return{IfStatement(r){if(r.consequent.type!==K.BlockStatement||r.loc.start.line===r.loc.end.line||n.getCommentsInside(r.consequent).length>0||r.alternate||r.consequent.body.length!==1)return;let l=r.consequent.body[0];if(l.type===K.ReturnStatement){if(!Nr(l))return}else if(!(l.type===K.ContinueStatement||l.type===K.BreakStatement))return;if(r.test.type===K.LogicalExpression||r.test.type===K.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let u=Or(r.test);if(!u&&r.test.type===K.UnaryExpression&&r.test.operator==="!"){let d=r.test.argument;Or(d)&&(u=!0)}if(u&&(i=n.getText(r.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=n.getText(r.test));let s=n.getText(l);if(i.includes(`
16
- `))return;let o=n.getTokenAfter(r);if(o&&o.type===kr.Punctuator&&o.value==="}"){let u=n.getTokenAfter(o);if(u&&u.type===kr.Keyword&&(u.value==="else"||u.value==="catch"))return}let p=Hi(n,r),c=`if (${i}) ${s}`;t.maxLineLength&&c.length+p.length>t.maxLineLength||e.report({node:r,messageId:"noSingleLineCurly",fix:u=>u.replaceText(r,c)})}}}});function Or(e){return e.type===K.CallExpression||e.type===K.BinaryExpression||e.type===K.MemberExpression&&Fr(e)}function Fr(e){return e.object.type===K.MemberExpression?Fr(e.object):e.object.type!==K.Identifier}function Hi(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Nr(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?Nr(t):!1}var Pt={name:Pr,rule:zi};import{AST_NODE_TYPES as ce,ESLintUtils as Yi}from"@typescript-eslint/utils";var qi=Yi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),jr="react-compiler-migration",Ji=z({disallowHooks:_(Q(z({name:V(),replacement:V()}))),disallowMethods:_(Q(z({name:V(),replacement:_(V()),requireTrueProp:_(V())})))}),Bi=/eslint +react-compiler\/react-compiler: +\["error/;function Xi(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 Gi=qi({name:jr,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:[Ji]},defaultOptions:[{}],create(e,[t]){let n=!1;for(let r of e.sourceCode.getAllComments())if(Bi.test(r.value)){n=!0;break}return n?{CallExpression(r){if(t.disallowHooks?.length){let a=null,l=null;if(r.callee.type===ce.Identifier?(a=r.callee.name,l=r.callee):r.callee.type===ce.MemberExpression&&r.callee.property.type===ce.Identifier&&(a=r.callee.property.name,l=r.callee.property),a){let i=t.disallowHooks.find(s=>s.name===a);i&&l&&e.report({node:r,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:s=>s.replaceText(l,i.replacement)}]})}}if(t.disallowMethods?.length&&Xi(r.callee)){for(let a of r.arguments)if(a.type===ce.ObjectExpression){for(let l of a.properties)if(l.type===ce.Property&&l.key.type===ce.Identifier){let i=l.key.name,s=t.disallowMethods.find(o=>o.name===i);if(s){if(s.requireTrueProp){let o=s.requireTrueProp,p=!1;for(let c of a.properties)if(c.type===ce.Property&&c.key.type===ce.Identifier&&c.key.name===o&&c.value.type===ce.Literal&&c.value.value===!0){p=!0;break}if(!p){e.report({node:l,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:s.name,requireTrueProp:o}});continue}}s.replacement&&e.report({node:l,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:s.name,replacement:s.replacement},suggest:[{messageId:"replace",data:{replacement:s.replacement},fix:o=>o.replaceText(l.key,s.replacement)}]})}}}}}}:{}}}),Ft={name:jr,rule:Gi};import{ESLintUtils as Ki,TSESTree as Zi}from"@typescript-eslint/utils";var Qi=Ki.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mr="require-description",es=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,ts=/^eslint-disable-(next-)?line$/u,rs=Qi({name:Mr,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let n=e.sourceCode,r=new Set(t.ignore||[]);return{Program(){for(let a of n.getAllComments()){let l=ns(a);l!=null&&(r.has(l.kind)||l.description||e.report({loc:ss(a.loc),messageId:"missingDescription"}))}}}}}),Dr={name:Mr,rule:rs};function ns(e){let{text:t,description:n}=is(e.value);if(!t)return null;let r=es.exec(t);if(!r)return null;let a=r[1];if(!a)return null;let l=ts.test(a);if(e.type===Zi.AST_TOKEN_TYPES.Line&&!l||l&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(r.index+a.length);return{kind:a,value:i.trim(),description:n}}function is(e){let t=e.split(/\s-{2,}\s/u);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function ss(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 os=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()}))}),Nt=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:[Ce(os)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let n=new Map,r=(i,s,o,p)=>{let c=new Set;for(let d of i.properties)d.type===L.Property&&d.key.type===L.Identifier&&c.add(d.key.name);let u=s.filter(d=>!c.has(d));if(u.length>0)if(u.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:u[0],fnName:p,customMsg:o||""}});else{let d=u.map(T=>`"${T}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:d,fnName:p,customMsg:o||""}})}},a=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"},l={};for(let i of t.varsToCheck)i.selector&&(l[i.selector]=s=>{if(s.type===L.VariableDeclarator&&s.id.type===L.Identifier&&n.set(s.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:s.id,fnName:a(s)}),s.type===L.VariableDeclarator&&s.id.type===L.ObjectPattern){let o=Array.isArray(i.prop)?i.prop:[i.prop];r(s.id,o,i.errorMsg,a(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)}"]`;l[p]=c=>{if(c.type!==L.MemberExpression||c.parent.type!==L.CallExpression)return;let u=c.parent;if(u.parent.type!==L.VariableDeclarator)return;let d=u.parent;if(d.id.type===L.Identifier)n.set(d.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:d.id,fnName:i.fromFnCall||"unknown function"});else if(d.id.type===L.ObjectPattern){let T=Array.isArray(i.prop)?i.prop:[i.prop];r(d.id,T,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(s.includes(".")){let[o,p]=s.split("."),c=`VariableDeclarator > CallExpression > MemberExpression[object.name="${o}"][property.name="${p}"]`;l[c]=u=>{if(u.type!==L.MemberExpression||u.parent.type!==L.CallExpression)return;let d=u.parent;if(d.parent.type!==L.VariableDeclarator)return;let T=d.parent;if(T.id.type===L.Identifier)n.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 E=Array.isArray(i.prop)?i.prop:[i.prop];r(T.id,E,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let o=`VariableDeclarator > CallExpression > Identifier[name="${s}"]`;l[o]=p=>{if(p.type!==L.Identifier||p.parent.type!==L.CallExpression)return;let c=p.parent;if(c.parent.type!==L.VariableDeclarator)return;let u=c.parent;if(u.id.type===L.Identifier)n.set(u.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:u.id,fnName:i.fromFnCall||"unknown function"});else if(u.id.type===L.ObjectPattern){let d=Array.isArray(i.prop)?i.prop:[i.prop];r(u.id,d,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...l,"Program:exit"(){for(let[i,{props:s,errorMsg:o,node:p,fnName:c}]of n){let d=e.sourceCode.getScope(p).set.get(i);if(d){let T=new Set(s);for(let E of d.references){let x=E.identifier,C=x.parent;if(!(C.type===L.VariableDeclarator&&C.id===x)){if(C.type===L.MemberExpression&&C.object===x&&C.property.type===L.Identifier&&T.has(C.property.name)){if(T.delete(C.property.name),T.size===0)break;continue}if(C.type===L.VariableDeclarator&&C.init===x&&C.id.type===L.ObjectPattern){for(let f of C.id.properties)f.type===L.Property&&f.key.type===L.Identifier&&T.has(f.key.name)&&T.delete(f.key.name);if(T.size===0)break;continue}if(!(C.type===L.MemberExpression&&C.object===x&&C.property.type===L.Identifier&&!s.includes(C.property.name))){T.clear();break}}}if(T.size>0){let E=Array.from(T);if(E.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:E[0],fnName:c,customMsg:o||""}});else{let x=E.map(C=>`"${C}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:x,fnName:c,customMsg:o||""}})}}}}}}}});function $r(e){return/^use[A-Z0-9]/.test(e)}function Je(e){return e.type==="Identifier"?$r(e.name):e.type==="MemberExpression"&&!e.computed&&Je(e.property)?e.object.type==="Identifier":!1}function Ur(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Wr(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Vr(e){return!!(e.parent&&e.parent.callee&&Wr(e.parent.callee,"forwardRef"))}function zr(e){return!!(e.parent&&e.parent.callee&&Wr(e.parent.callee,"memo"))}function jt(e){for(;e;){let t=Yr(e);if(t&&(Ur(t)||Je(t))||Vr(e)||zr(e))return!0;e=e.parent}return!1}function Lr(e){return!1}function Mt(e){return!1}var as=/eslint +react-compiler\/react-compiler: +\["error/,Hr={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let o of e.sourceCode.getAllComments())if(as.test(o.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"?o=>t(o):o=>e.sourceCode.getText(o),n=typeof e.getScope=="function"?()=>n():o=>e.sourceCode.getScope(o),r=null,a=[],l=[],i=new WeakSet;function s(o){for(let p of o.references){let c=p.identifier.parent;if(c.type==="VariableDeclarator"&&c.init&&c.init.type==="CallExpression"&&c.init.callee&&Lr(c.init.callee))for(let u of p.resolved.references)u!==p&&i.add(u.identifier)}}return{onCodePathSegmentStart:o=>l.push(o),onCodePathSegmentEnd:()=>l.pop(),onCodePathStart:()=>a.push(new Map),onCodePathEnd(o,p){let c=a.pop();if(c.size===0)return;let u=new Set;function d(g,m){let{cache:S}=d,k=S.get(g.id),R=new Set(m);if(R.has(g.id)){let w=[...R],N=w.slice(w.indexOf(g.id)+1);for(let W of N)u.add(W);return BigInt("0")}if(R.add(g.id),k!==void 0)return k;if(o.thrownSegments.includes(g))k=BigInt("0");else if(g.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let w of g.prevSegments)k+=d(w,R)}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),R=new Set(m);if(R.has(g.id)){let w=Array.from(R),N=w.slice(w.indexOf(g.id)+1);for(let W of N)u.add(W);return BigInt("0")}if(R.add(g.id),k!==void 0)return k;if(o.thrownSegments.includes(g))k=BigInt("0");else if(g.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let w of g.nextSegments)k+=T(w,R)}return S.set(g.id,k),k}function E(g){let{cache:m}=E,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 R=E(k);R<S&&(S=R)}S+=1}return m.set(g.id,S),S}d.cache=new Map,T.cache=new Map,E.cache=new Map;let x=T(o.initialSegment),C=Yr(p),f=jt(p),I=C?Ur(C)||Je(C):Vr(p)||zr(p),b=1/0;for(let g of o.finalSegments){if(!g.reachable)continue;let m=E(g);m<b&&(b=m)}for(let[g,m]of c){if(!g.reachable)continue;let S=g.nextSegments.length===0?b<=E(g):b<E(g),k=d(g)*T(g),R=u.has(g.id);for(let w of m)if(R&&!Mt(w)&&e.report({node:w,message:`React Hook "${t(w)}" 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.`}),I){if(p.async&&e.report({node:w,message:`React Hook "${t(w)}" cannot be called in an async function.`}),!R&&k!==x&&!Mt(w)){let W=`React Hook "${t(w)}" 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:w,message:W})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let N=`React Hook "${t(w)}" 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:w,message:N})}else if(C){let N=`React Hook "${t(w)}" is called in function "${t(C)}" 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:w,message:N})}else if(p.type==="Program"){let N=`React Hook "${t(w)}" 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:w,message:N})}else if(f&&!Mt(w)){if(p.parent.type==="CallExpression"&&p.parent.callee.type==="Identifier"&&p.parent.callee.name==="useCallback"){let W=p.parent;if(W.parent.type==="VariableDeclarator"&&$r(W.parent.id.name))return}let N=`React Hook "${t(w)}" 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:w,message:N})}}},CallExpression(o){if(Je(o.callee)){let p=_r(a),c=_r(l),u=p.get(c);u||(u=[],p.set(c,u)),u.push(o.callee)}o.callee.type==="Identifier"&&(o.callee.name==="useEffect"||Lr(o.callee))&&o.arguments.length>0&&(r=o)},Identifier(o){r==null&&i.has(o)&&o.parent.type!=="CallExpression"&&e.report({node:o,message:`\`${t(o)}\` 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"(o){o===r&&(r=null)},FunctionDeclaration(o){jt(o)&&s(n(o))},ArrowFunctionExpression(o){jt(o)&&s(n(o))}}}};function Yr(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 _r(e){return e[e.length-1]}import{AST_NODE_TYPES as re,AST_TOKEN_TYPES as ls}from"@typescript-eslint/utils";import*as oe from"zod/v4";var ps=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()}),Dt=B({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[Ce(ps)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:n=["HTML","indent"],functions:r=["dedent","stripIndent"],tags:a=["outdent","dedent","gql","sql","html","styled"],indent:l}=e.options[0],i=n.map(f=>f.toLowerCase());function s(f){let I=f.split(/\r?\n/),b=I.filter(m=>m.trim()!=="");if(b.length===0)return f;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?f:I.map(m=>m.slice(g)).join(`
17
- `)}function o(f,I,b){return f.split(/\r?\n/).map(m=>m.trim()===""?m:b.repeat(I)+m).join(`
18
- `)}function p(f){if(f.type===re.Identifier)return f.name;if(f.type===re.MemberExpression){let I=f.object.type===re.Identifier?f.object.name:null,b=f.property.type===re.Identifier?f.property.name:null;return I&&b?`${I}.${b}`:b}return null}function c(f,I){if(!f)return!1;for(let b of I)if(b.includes(".")){let g=b.split(".");if(f.type===re.MemberExpression&&f.object.type===re.Identifier&&f.property.type===re.Identifier&&f.object.name===g[0]&&f.property.name===g[1])return!0}else if(f.type===re.Identifier&&f.name===b)return!0;return!1}function u(f,I){let b=f.parent;if(b.type!==re.TaggedTemplateExpression)return!1;let g=p(b.tag);return g?I.includes(g):!1}function d(f,I){if(!f||f.type!==re.CallExpression)return!1;let{method:b,argumentsLength:g,optionalCall:m=!0,optionalMember:S=!0}=I;return g!==void 0&&f.arguments.length!==g||!m&&f.optional||f.callee.type!==re.MemberExpression||!S&&f.callee.optional||f.callee.property.type!==re.Identifier?!1:f.callee.property.name===b}function T(f,I){if(!f||f.type!==re.CallExpression)return!1;let{name:b,argumentsLength:g,optionalCall:m=!0}=I;return g!==void 0&&f.arguments.length!==g||!m&&f.optional||f.callee.type!==re.Identifier?!1:f.callee.name===b}function E(f){return d(f.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&f.parent.type===re.CallExpression&&f.parent.arguments[0]===f&&T(f.parent.callee.type===re.MemberExpression?f.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function x(f){if(i.length>0){let I=t.getTokenBefore(f,{includeComments:!0});if(I?.type===ls.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(E(f)||a.length>0&&u(f,a)||r.length>0&&f.parent.type===re.CallExpression&&f.parent.arguments.includes(f)&&c(f.parent.callee,r))}function C(f){let I=`__PLACEHOLDER__${Math.random()}`,b=f.quasis.map(X=>t.getText(X).slice(1,X.tail?-1:-2)).join(I),g=b.match(/\r?\n/);if(!g)return;let m=g[0],S=t.lines[t.getLocFromIndex(f.range[0]).line-1];if(!S)return;let R=S.match(/^(\s*)\S/)?.[1]??"",w;typeof l=="string"?w=l:typeof l=="number"?w=" ".repeat(l):w=R.startsWith(" ")?" ":" ";let W=s(b).replace(new RegExp(`^${m}|${m}[ ]*$`,"g"),""),J=m+o(W,1,R+w)+m+R,te=b.includes(`\r
15
+ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let E=a.acquire(f),k=new Set,R=null;{let g=E.upper;for(;g&&(k.add(g),g.type!=="function");)g=g.upper;if(!g)return;R=g}let w=Array.isArray;function N(g){if(!w(g.defs))return!1;let C=g.defs[0];if(C==null||C.node.type!=="VariableDeclarator")return!1;let v=C.node.init;if(v==null)return!1;for(;v.type==="TSAsExpression";)v=v.expression;let F=C.node.parent;if(F==null&&(it(R.block,C.node.id),F=C.node.parent,F==null))return!1;if(F.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 P=v.callee;if(P.type==="MemberExpression"&&P.object.name==="React"&&P.property!=null&&!P.computed&&(P=P.property),P.type!=="Identifier")return!1;let O=C.node.id,{name:D}=P;if(D==="useRef"&&O.type==="Identifier")return!0;if(Rn(P)&&O.type==="Identifier"){for(let j of g.references)j!==O&&d.add(j.identifier);return!0}else if(D==="useState"||D==="useReducer"){if(O.type==="ArrayPattern"&&O.elements.length===2&&w(g.identifiers)){if(O.elements[1]===g.identifiers[0]){if(D==="useState"){let j=g.references,oe=0;for(let ge=0;ge<j.length;ge++){if(j[ge].isWrite()&&oe++,oe>1)return!1;p.set(j[ge].identifier,O.elements[0])}}return!0}else if(O.elements[0]===g.identifiers[0]){if(D==="useState"){let j=g.references;for(let oe=0;oe<j.length;oe++)u.add(j[oe].identifier)}return!1}}}else if(D==="useTransition"&&O.type==="ArrayPattern"&&O.elements.length===2&&Array.isArray(g.identifiers)&&O.elements[1]===g.identifiers[0])return!0;return!1}function z(g){if(!w(g.defs))return!1;let C=g.defs[0];if(C==null||C.node==null||C.node.id==null)return!1;let v=C.node,F=R.childScopes,P=null,O;for(O=0;O<F.length;O++){let D=F[O],j=D.block;if(v.type==="FunctionDeclaration"&&j===v||v.type==="VariableDeclarator"&&j.parent===v){P=D;break}}if(P==null)return!1;for(O=0;O<P.through.length;O++){let D=P.through[O];if(D.resolved!=null&&k.has(D.resolved.scope)&&!Y(D.resolved))return!1}return!0}let Y=T(N,c),Q=T(z,m),G=new Map;function Ee(g){let C=g.from,v=!1;for(;C.block!==f;)C.type==="function"&&(v=C.block.parent!=null&&C.block.parent.type==="ReturnStatement"),C=C.upper;return v}let q=new Map,fe=new Map;le(E);function le(g){for(let C of g.references){if(!C.resolved||!k.has(C.resolved.scope))continue;let v=it(f,C.identifier),F=ir(v),P=Se(F,fe);if(y&&F.type==="Identifier"&&(F.parent.type==="MemberExpression"||F.parent.type==="OptionalMemberExpression")&&!F.parent.computed&&F.parent.property.type==="Identifier"&&F.parent.property.name==="current"&&Ee(C)&&G.set(P,{reference:C,dependencyNode:F}),F.parent.type==="TSTypeQuery"||F.parent.type==="TSTypeReference")continue;let O=C.resolved.defs[0];if(O!=null&&!(O.node!=null&&O.node.init===f.parent)&&O.type!=="TypeParameter")if(q.has(P))q.get(P).references.push(C);else{let D=C.resolved,j=Y(D)||Q(D);q.set(P,{isStable:j,references:[C]})}}for(let C of g.childScopes)le(C)}G.forEach(({reference:g,dependencyNode:C},v)=>{let F=g.resolved.references,P=!1;for(let O=0;O<F.length;O++){let{identifier:D}=F[O],{parent:j}=D;if(j!=null&&j.type==="MemberExpression"&&!j.computed&&j.property.type==="Identifier"&&j.property.name==="current"&&j.parent.type==="AssignmentExpression"&&j.parent.left===j){P=!0;break}}P||s({node:C.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 re=new Set;function ye(g,C){re.has(C)||(re.add(C),s({node:g,message:`Assignments to the '${C}' variable from inside React Hook ${n(I)} 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 ${n(I)}.`}))}let Re=new Set;if(q.forEach(({isStable:g,references:C},v)=>{g&&Re.add(v),C.forEach(F=>{F.writeExpr&&ye(F.writeExpr,v)})}),re.size>0)return;if(!b){let g=null;if(q.forEach(({isStable:C,references:v},F)=>{g||v.forEach(P=>{if(g)return;let O=P.identifier;if(!p.has(O))return;let j=P.from;for(;j.type!=="function";)j=j.upper;j.block===f&&(g=F)})}),g){let{suggestedDependencies:C}=rt({dependencies:q,declaredDependencies:[],stableDependencies:Re,externalDependencies:new Set,isEffect:!0});s({node:I,message:`React Hook ${S} contains a call to '${g}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+C.join(", ")+`] as a second argument to the ${S} Hook.`,suggest:[{desc:`Add dependencies array: [${C.join(", ")}]`,fix(v){return v.insertTextAfter(f,`, [${C.join(", ")}]`)}}]})}return}let Oe=[],Pe=new Set;b.type!=="ArrayExpression"?s({node:b,message:`React Hook ${n(I)} 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.`}):b.elements.forEach(g=>{if(g===null)return;if(g.type==="SpreadElement"){s({node:g,message:`React Hook ${n(I)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}d.has(g)&&s({node:g,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${n(g)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${n(g)}\``,fix(P){return P.removeRange(g.range)}}]});let C;try{C=Se(g,fe)}catch(P){if(/Unsupported node type/.test(P.message)){g.type==="Literal"?q.has(g.value)?s({node:g,message:`The ${g.raw} literal is not a valid dependency because it never changes. Did you mean to include ${g.value} in the array instead?`}):s({node:g,message:`The ${g.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:g,message:`React Hook ${n(I)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw P}let v=g;for(;v.type==="MemberExpression"||v.type==="OptionalMemberExpression"||v.type==="ChainExpression";)v=v.object||v.expression.object;let F=!R.through.some(P=>P.identifier===v);Oe.push({key:C,node:g}),F||Pe.add(C)});let{suggestedDependencies:tn,unnecessaryDependencies:Le,missingDependencies:be,duplicateDependencies:Ht}=rt({dependencies:q,declaredDependencies:Oe,stableDependencies:Re,externalDependencies:Pe,isEffect:y}),_e=tn;if(Ht.size+be.size+Le.size===0){if(r)return;Cn({declaredDependencies:Oe,declaredDependenciesNode:b,componentScope:R,scope:E}).forEach(({construction:C,isUsedOutsideOfHook:v,depType:F})=>{let P=F==="function"?"useCallback":"useMemo",O=F==="function"?"definition":"initialization",D=`wrap the ${O} of '${C.name.name}' in its own ${P}() Hook.`,j=v?`To fix this, ${D}`:`Move it inside the ${S} callback. Alternatively, ${D}`,oe=F==="conditional"||F==="logical expression"?"could make":"makes",ge=`The '${C.name.name}' ${F} ${oe} the dependencies of ${S} Hook (at line ${b.loc.start.line}) change on every render. ${j}`,Jt;v&&C.type==="Variable"&&F==="function"&&(Jt=[{desc:`Wrap the ${O} of '${C.name.name}' in its own ${P}() Hook.`,fix(Yt){let[nn,sn]=P==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Yt.insertTextBefore(C.node.init,nn),Yt.insertTextAfter(C.node.init,sn)]}}]),s({node:C.node,message:ge,suggest:Jt})});return}!y&&be.size>0&&(_e=rt({dependencies:q,declaredDependencies:[],stableDependencies:Re,externalDependencies:Pe,isEffect:y}).suggestedDependencies);function rn(){if(Oe.length===0)return!0;let g=Oe.map(v=>v.key),C=g.slice().sort();return g.join(",")===C.join(",")}rn()&&_e.sort();function Ze(g){let C=g.split("."),v="";for(let F=0;F<C.length;F++){if(F!==0){let P=C.slice(0,F+1).join("."),O=fe.get(P)===!0;v+=O?"?.":"."}v+=C[F]}return v}function Ge(g,C,v,F){return g.size===0?null:(g.size>1?"":C+" ")+v+" "+(g.size>1?"dependencies":"dependency")+": "+wn(Array.from(g).sort().map(P=>"'"+Ze(P)+"'"))+`. Either ${F} ${g.size>1?"them":"it"} or remove the dependency array.`}let pe="";if(Le.size>0){let g=null;if(Array.from(Le.keys()).forEach(C=>{g===null&&C.endsWith(".current")&&(g=C)}),g!==null)pe=` Mutable values like '${g}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Pe.size>0){let C=Array.from(Pe)[0];E.set.has(C)||(pe=` Outer scope values like '${C}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!pe&&be.has("props")){let g=q.get("props");if(g==null)return;let C=g.references;if(!Array.isArray(C))return;let v=!0;for(let F=0;F<C.length;F++){let P=C[F],O=it(R.block,P.identifier);if(!O){v=!1;break}let D=O.parent;if(D==null){v=!1;break}if(D.type!=="MemberExpression"&&D.type!=="OptionalMemberExpression"){v=!1;break}}v&&(pe=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${S} call and refer to those specific props inside ${n(I)}.`)}if(!pe&&be.size>0){let g=null;be.forEach(C=>{if(g)return;let v=R.set.get(C),F=q.get(C);if(F.references[0].resolved!==v)return;let P=v.defs[0];if(P==null||P.name==null||P.type!=="Parameter")return;let O=!1,D;for(let j=0;j<F.references.length;j++)if(D=F.references[j].identifier,D!=null&&D.parent!=null&&(D.parent.type==="CallExpression"||D.parent.type==="OptionalCallExpression")&&D.parent.callee===D){O=!0;break}O&&(g=C)}),g!==null&&(pe=` If '${g}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!pe&&be.size>0){let g=null;if(be.forEach(C=>{if(g!==null)return;let F=q.get(C).references,P,O;for(let D=0;D<F.length;D++){for(P=F[D].identifier,O=P.parent;O!=null&&O!==R.block;){if(O.type==="CallExpression"){let j=p.get(O.callee);if(j!=null){if(j.name===C)g={missingDep:C,setter:O.callee.name,form:"updater"};else if(u.has(P))g={missingDep:C,setter:O.callee.name,form:"reducer"};else{let oe=F[D].resolved;if(oe!=null){let ge=oe.defs[0];ge!=null&&ge.type==="Parameter"&&(g={missingDep:C,setter:O.callee.name,form:"inlineReducer"})}}break}}O=O.parent}if(g!==null)break}}),g!==null)switch(g.form){case"reducer":pe=` You can also replace multiple useState variables with useReducer if '${g.setter}' needs the current value of '${g.missingDep}'.`;break;case"inlineReducer":pe=` If '${g.setter}' needs the current value of '${g.missingDep}', you can also switch to useReducer instead of useState and read '${g.missingDep}' in the reducer.`;break;case"updater":pe=` You can also do a functional update '${g.setter}(${g.missingDep.slice(0,1)} => ...)' if you only need '${g.missingDep}' in the '${g.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:b,message:`React Hook ${n(I)} has `+(Ge(be,"a","missing","include")||Ge(Le,"an","unnecessary","exclude")||Ge(Ht,"a","duplicate","omit"))+pe,suggest:[{desc:`Update the dependencies array to be: [${_e.map(Ze).join(", ")}]`,fix(g){return g.replaceText(b,`[${_e.map(Ze).join(", ")}]`)}}]})}function x(f){let b=In(f.callee,i);if(b===-1)return;let I=f.arguments[b],S=f.callee,y=sr(S).name,E=f.arguments[b+1],k=/Effect($|[^a-z])/g.test(y);if(!I){s({node:S,message:`React Hook ${y} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(r&&!k)){if(!E&&!k){(y==="useMemo"||y==="useCallback")&&s({node:S,message:`React Hook ${y} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(I.type){case"FunctionExpression":case"ArrowFunctionExpression":h(I,E,S,y,k);return;case"Identifier":if(!E||E.elements&&E.elements.some(N=>N&&N.type==="Identifier"&&N.name===I.name))return;let R=t(f).set.get(I.name);if(R==null||R.defs==null)return;let w=R.defs[0];if(!w||!w.node||w.type!=="Variable"&&w.type!=="FunctionName")break;switch(w.node.type){case"FunctionDeclaration":h(w.node,E,S,y,k);return;case"VariableDeclarator":let N=w.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":h(N,E,S,y,k);return}break}break;default:s({node:S,message:`React Hook ${y} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:S,message:`React Hook ${y} has a missing dependency: '${I.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${I.name}]`,fix(R){return R.replaceText(E,`[${I.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let f of e.sourceCode.getAllComments())if(xn.test(f.value))return r=!0,{CallExpression:b=>x(b,!0)}}return{CallExpression:f=>x(f)}}};function rt({dependencies:e,declaredDependencies:r,stableDependencies:n,externalDependencies:t,isEffect:o}){let l=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((h,x)=>{let f=s(l,x);f.isUsed=!0,a(l,x,b=>{b.isSubtreeUsed=!0})}),r.forEach(({key:h})=>{let x=s(l,h);x.isSatisfiedRecursively=!0}),n.forEach(h=>{let x=s(l,h);x.isSatisfiedRecursively=!0});function s(h,x){let f=x.split("."),b=h;for(let I of f){let S=b.children.get(I);S||(S=i(),b.children.set(I,S)),b=S}return b}function a(h,x,f){let b=x.split("."),I=h;for(let S of b){let y=I.children.get(S);if(!y)return;f(y),I=y}}let p=new Set,u=new Set;c(l,p,u,h=>h);function c(h,x,f,b){h.children.forEach((I,S)=>{let y=b(S);if(I.isSatisfiedRecursively){I.isSubtreeUsed&&f.add(y);return}if(I.isUsed){x.add(y);return}c(I,x,f,E=>y+"."+E)})}let m=[],d=new Set,T=new Set;return r.forEach(({key:h})=>{u.has(h)?m.indexOf(h)===-1?m.push(h):T.add(h):d.add(h)}),p.forEach(h=>{m.push(h)}),{suggestedDependencies:m,unnecessaryDependencies:d,duplicateDependencies:T,missingDependencies:p}}function xe(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 xe(e.consequent)!=null||xe(e.alternate)!=null?"conditional":null;case"LogicalExpression":return xe(e.left)!=null||xe(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return xe(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return xe(e.expression);case"TSAsExpression":return xe(e.expression)}return null}function Cn({declaredDependencies:e,declaredDependenciesNode:r,componentScope:n,scope:t}){let o=e.map(({key:i})=>{let s=n.variables.find(p=>p.name===i);if(s==null)return null;let a=s.defs[0];if(a==null)return null;if(a.type==="Variable"&&a.node.type==="VariableDeclarator"&&a.node.id.type==="Identifier"&&a.node.init!=null){let p=xe(a.node.init);if(p!=null)return[s,p]}return a.type==="FunctionName"&&a.node.type==="FunctionDeclaration"?[s,"function"]:a.type==="ClassName"&&a.node.type==="ClassDeclaration"?[s,"class"]:null}).filter(Boolean);function l(i){let s=!1;for(let a=0;a<i.references.length;a++){let p=i.references[a];if(p.writeExpr){if(s)return!0;s=!0;continue}let u=p.from;for(;u!==t&&u!=null;)u=u.upper;if(u!==t&&!or(r,p.identifier))return!0}return!1}return o.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:l(i)}))}function ir(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)?ir(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function nt(e,r,n){r&&(e.optional?r.has(n)||r.set(n,!0):r.has(n)||r.set(n,!1))}function Se(e,r){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let n=e.name;return r&&r.set(n,!1),n}else if(e.type==="MemberExpression"&&!e.computed){let n=Se(e.object,r),t=Se(e.property,null),o=`${n}.${t}`;return nt(e,r,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let n=Se(e.object,r),t=Se(e.property,null),o=`${n}.${t}`;return nt(e,r,o),o}else if(e.type==="ChainExpression"&&!e.computed){let n=e.expression;if(n.type==="CallExpression")throw new Error(`Unsupported node type: ${n.type}`);let t=Se(n.object,r),o=Se(n.property,null),l=`${t}.${o}`;return nt(n,r,l),l}else throw new Error(`Unsupported node type: ${e.type}`)}function sr(e,r){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function In(e,r){let n=sr(e);if(n.type!=="Identifier")return-1;switch(n.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(n===e&&r&&r.additionalHooks){let t;try{t=Se(n,null)}catch(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return r.additionalHooks.test(t)?0:-1}else return-1}}function it(e,r){let n=[e],t=null;for(;n.length;){if(t=n.shift(),An(t,r))return t;if(or(t,r))for(let[o,l]of Object.entries(t))o!=="parent"&&(rr(l)?(l.parent=t,n.push(l)):Array.isArray(l)&&l.forEach(i=>{rr(i)&&(i.parent=t,n.push(i))}))}return null}function wn(e){let r="";for(let n=0;n<e.length;n++)r+=e[n],n===0&&e.length===2?r+=" and ":n===e.length-2&&e.length>2?r+=", and ":n<e.length-1&&(r+=", ");return r}function rr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function An(e,r){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===r.type&&e.name===r.name&&e.range[0]===r.range[0]&&e.range[1]===r.range[1]}function or(e,r){return e.range[0]<=r.range[0]&&e.range[1]>=r.range[1]}function Rn(e){return!1}import{AST_NODE_TYPES as Ue,ESLintUtils as lr}from"@typescript-eslint/utils";import ne from"typescript";import{z as vn}from"zod/v4";var kn=lr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ar="improved-no-unnecessary-condition",Fn=vn.object({}),On=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Pn=new Set(On),st={name:ar,rule:kn({name:ar,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:[L(Fn)]},defaultOptions:[{}],create(e){let r=lr.getParserServices(e,!0),n=r.program?.getTypeChecker();if(!n||!r.program)throw new Error("TypeScript services or program not available");function t(s){return s.type===Ue.UnaryExpression&&s.operator==="typeof"}function o(s){return s.flags&ne.TypeFlags.Any||s.flags&ne.TypeFlags.Unknown?null:s.flags&ne.TypeFlags.StringLike?["string"]:s.flags&ne.TypeFlags.NumberLike?["number"]:s.flags&ne.TypeFlags.BigIntLike?["bigint"]:s.flags&ne.TypeFlags.BooleanLike?["boolean"]:s.flags&ne.TypeFlags.ESSymbolLike?["symbol"]:s.flags&ne.TypeFlags.Undefined||s.flags&ne.TypeFlags.Void?["undefined"]:s.flags&ne.TypeFlags.Null?["object"]:s.getCallSignatures().length>0?["function"]:s.flags&ne.TypeFlags.Object?s.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:s.flags&ne.TypeFlags.NonPrimitive?["object"]:s.flags&ne.TypeFlags.Never?["never"]:null}function l(s){if(!n)return null;let a=r.esTreeNodeToTSNodeMap.get(s),p=n.getTypeAtLocation(a.expression);if(p.flags&ne.TypeFlags.Any||p.flags&ne.TypeFlags.Unknown)return null;let u=[];if(p.isUnion()){for(let m of p.types){let d=o(m);if(d)u.push(...d);else return null}return u}let c=o(p);return c?(u.push(...c),u):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,u=null;if(t(s.left)?(p=s.left,u=s.right.type===Ue.Literal&&typeof s.right.value=="string"?s.right.value:null):t(s.right)&&(p=s.right,u=s.left.type===Ue.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!u||!Nn(u,Pn))return;let c=l(p);if(!c)return;let m=s.operator==="!==",d=c.includes(u);c.length===1?d&&!m?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:u}}):!d&&m?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:Array.from(c)[0]}}):!d&&!m?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:$e(c),conditionType:u}}):d&&m&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:$e(c),conditionType:u}}):!d&&!m?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:$e(c),conditionType:u}}):!d&&m&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:$e(c)}})}return{BinaryExpression:i}}})};function $e(e){return Array.from(new Set(e)).join(" | ")||"never"}function ve(e,r){let n=e.argument;return n.type===Ue.Identifier?n.name:r.sourceCode.getText(n)}function Nn(e,r){return r.has(e)}import{AST_NODE_TYPES as Dn,ESLintUtils as Mn}from"@typescript-eslint/utils";import{z as ot}from"zod/v4";var jn=Mn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pr="no-call-with-explicit-generics",Ln=ot.object({functions:ot.array(ot.string())}),_n=jn({name:pr,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[L(Ln)]},defaultOptions:[{functions:[]}],create(e,[r]){let n=new Set(r.functions);return{CallExpression(t){let{callee:o}=t;o.type===Dn.Identifier&&n.has(o.name)&&t.typeArguments&&e.report({node:t,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),at={name:pr,rule:_n};import{AST_NODE_TYPES as ze,ESLintUtils as $n}from"@typescript-eslint/utils";var Un=$n.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cr="no-call-with-inferred-generics",zn=Un({name:cr,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},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,[r]){let n=new Map(r.functions.map(t=>[t.name,t]));return{CallExpression(t){let{callee:o}=t;if(o.type!==ze.Identifier)return;let l=n.get(o.name);if(!l)return;let{minGenerics:i=1,allowAny:s,disallowTypes:a=r.disallowTypes}=l;(t.typeArguments?.params.length||0)<(i||0)&&e.report({node:t,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(s&&!a)&&t.typeArguments?.params.some(u=>!s&&u.type===ze.TSAnyKeyword||a&&u.type===ze.TSTypeReference&&u.typeName.type===ze.Identifier&&a.includes(u.typeName.name))&&e.report({node:t,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),lt={name:cr,rule:zn};import{ESLintUtils as Wn}from"@typescript-eslint/utils";var Vn=Wn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),fr="no-commented-out-code",Hn=["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:"],B={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 Jn(e){if(e.includes(":")){let n=e.split(":")[0]?.trim();if(n&&/^[a-zA-Z]/.test(n)&&n.includes(" "))return!0}let r=e.trim();return r.length===0||/\.[A-Za-z_][A-Za-z0-9_]*\(/.test(r)||/[{}[\]()`=<>]/.test(r)||/:\s*(['"`[{(]|\w+\s*=>)/.test(r)||/\bif\s*\(|\belse\b|=>/.test(r)?!1:!!(r.includes(":")&&/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/.test(r))}var Yn=[") {","return;",B.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",B.stringAssignment,");",B.objectPropertyWithQuotes,B.computedPropertyAssignment,B.kebabCaseProperty,B.snakeCaseProperty,"&&","||","()",B.ternaryOperator,B.colonWithWord,B.quotedString,B.numberWithComma,B.arrayWithComma,B.objectWithComma,B.methodCall,B.arrayAccess,"?.(","??","=>",B.quotedPropertyKey],qn=["/>","</",B.jsxSelfClosing,B.jsxElement,B.jsxOpeningTag,B.jsxClosingTag,B.htmlOpeningTag,B.htmlClosingTag],ur=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Bn=Vn({name:fr,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function r(t,o){if(t.startsWith("/"))return!1;let l=t.trimStart();if(t.startsWith("*")||l.startsWith("eslint-disable")||t.includes("@deprecated")||t.includes("@example")||t.includes("@param")||t.includes("@returns")||t.includes("@throws")||t.includes("typescript-eslint")||t.includes("@ts-")||t.includes("prettier-ignore")||B.jsdocComment.test(t))return!1;for(let i of ur)if(l.startsWith(i))return!1;if(t.includes("https://")||Jn(l))return!1;if(o==="Block"){for(let i of qn)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of Hn)if(l.startsWith(i))return{wrongPattern:i};for(let i of Yn)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}function n(t,o){let l=t,i=l.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return l;if(o==="Block"&&l.includes("```")){let p=l.split(/```[\s\S]*?```/g);p.some(c=>/[a-zA-Z0-9]/.test(c))&&(l=p.join(""))}if(!l.includes("`"))return l;let s=l.split(/`[^`]*`/g);return s.some(p=>/[a-zA-Z0-9]/.test(p))?s.join(""):l}return{Program(){let o=e.sourceCode.getAllComments();for(let l of o){let i=n(l.value,l.type),s=r(i,l.type);s&&e.report({node:l,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:ur.join(", ")}})}}}}}),pt={name:fr,rule:Bn};import{ESLintUtils as Xn,TSESTree as Zn}from"@typescript-eslint/utils";var Gn=Xn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mr="no-default-export",Kn=Gn({name:mr,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(r){e.report({node:r,messageId:"noDefaultExport"})},ExportNamedDeclaration(r){for(let n of r.specifiers)n.exported.type===Zn.AST_NODE_TYPES.Identifier&&n.exported.name==="default"&&e.report({node:r,messageId:"noDefaultExport"})}}}}),ct={name:mr,rule:Kn};import{ESLintUtils as Qn}from"@typescript-eslint/utils";var ei=Qn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),dr="no-leaked-text-in-jsx",ti=[",",";","[","]","(",")"],ri=ei({name:dr,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(r){let n=r.value.trim();if(!n)return;let t="";ti.includes(n)?t=n:n.includes("&&")?t="&&":n.includes("||")?t="||":n.endsWith("? (")&&(t="? ("),t&&e.report({node:r,messageId:"leakedTextInJSX",data:{text:t}})}}}}),ut={name:dr,rule:ri};import{AST_NODE_TYPES as Ne,ESLintUtils as ni}from"@typescript-eslint/utils";var ii=ni.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),gr="no-non-camel-case-functions",si=/^(\$?[a-z][a-zA-Z0-9]*)$/;function yr(e){if(e.typeName.type!==Ne.TSQualifiedName)return!1;let{left:r,right:n}=e.typeName;return r.type===Ne.Identifier&&r.name==="JSX"&&n.name==="Element"}var oi=ii({name:gr,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(r){if(r.id&&!si.test(r.id.name)){let n=r.returnType?.typeAnnotation;if(n&&(n.type===Ne.TSTypeReference?yr(n):n.type===Ne.TSUnionType&&n.types.some(o=>o.type===Ne.TSTypeReference&&yr(o))))return;e.report({node:r.id,messageId:"nonCamelCaseFunction",data:{functionName:r.id.name}})}}}}}),ft={name:gr,rule:oi};import{ESLintUtils as ai,TSESTree as V}from"@typescript-eslint/utils";import{AST_NODE_TYPES as Sr}from"@typescript-eslint/utils";function ke(e,r,n=1/0){if(n!==0&&e.parent)return e.type===r?e:ke(e.parent,r,n===1/0?n:n-1)}function*mt(e){yield e,e.parent&&(yield*mt(e.parent))}function dt(e,r){for(let n of e){let t=r(n);if(t!=null&&t!==!1)return t}}function Tr(e,r,n){let o=n.getDeclaredVariables(e).find(l=>l.name===r||l.identifiers[0]?.parent.type===Sr.Property&&l.identifiers[0]?.parent.key.type===Sr.Identifier&&l.identifiers[0]?.parent.key.name===r);return o?o.references.filter(l=>!l.init):[]}var li=ai.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),hr="no-optional-root-props",pi=li({name:hr,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 r(t){let l=e.sourceCode.getDeclaredVariables(t)[0];if(!l||l.references.length!==1)return!1;let i=l.references[0];if(!i)return!1;for(let s of mt(i.identifier)){if("returnType"in s||s.type===V.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let a=s.parent;if(!a)return!1;if(a.type===V.AST_NODE_TYPES.TSTypeParameterInstantiation&&a.parent.type===V.AST_NODE_TYPES.TSTypeReference&&a.parent.typeName.type===V.AST_NODE_TYPES.Identifier&&a.parent.typeName.name==="FC"){let u=ke(a.parent.parent,V.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let c=We(u,e.sourceCode);return c?!(c.parent.type===V.AST_NODE_TYPES.CallExpression&&c.parent.callee.type===V.AST_NODE_TYPES.Identifier&&c.parent.callee.name==="memo"):!1}if(s.type===V.AST_NODE_TYPES.AssignmentPattern)return!1;if(a.type===V.AST_NODE_TYPES.ArrowFunctionExpression){let p=ke(a,V.AST_NODE_TYPES.VariableDeclaration);return p?!!We(p,e.sourceCode):!1}if(a.type===V.AST_NODE_TYPES.FunctionDeclaration)return!!We(a,e.sourceCode)}return!1}function n(t){t.key.type!==V.AST_NODE_TYPES.Identifier||!t.optional||e.report({node:t.key,messageId:"optionalNotAllowed",data:{propertyName:t.key.name},suggest:[{messageId:"suggestion",fix:o=>{let l=ke(t,V.AST_NODE_TYPES.TSPropertySignature);if(!l)return null;let i=e.sourceCode.getText(l);return o.replaceText(l,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(t){if(t.typeAnnotation.type===V.AST_NODE_TYPES.TSTypeLiteral&&!(Ve(t)||!r(t)))for(let o of t.typeAnnotation.members)o.type===V.AST_NODE_TYPES.TSPropertySignature&&n(o)},TSInterfaceDeclaration(t){if(!(Ve(t)||!r(t)))for(let o of t.body.body)o.type===V.AST_NODE_TYPES.TSPropertySignature&&n(o)},TSTypeReference(t){if(t.typeName.type!==V.AST_NODE_TYPES.Identifier||t.typeName.name!=="FC"||!t.typeArguments?.params[0])return;let o=t.typeArguments.params[0];if(o.type!==V.AST_NODE_TYPES.TSTypeLiteral)return;let l=ke(t.parent,V.AST_NODE_TYPES.VariableDeclaration,4);if(!l)return;let i=We(l,e.sourceCode);if(!(!i||i.parent.type===V.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===V.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let a of o.members)a.type===V.AST_NODE_TYPES.TSPropertySignature&&n(a)}}}});function Ve(e){return e?e.parent?.type===V.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===V.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function We(e,r){if(Ve(e))return;let n;if(e.type===V.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===V.AST_NODE_TYPES.Identifier&&(n=e.declarations[0].id)}else{if(!e.id)return;n=e.id}if(!n)return;let t=r.getScope(e);e.type===V.AST_NODE_TYPES.FunctionDeclaration&&t.upper&&(t=t.upper);let o=t.variables.find(i=>i.identifiers.includes(n));if(!o)return;let l=o.references.filter(i=>i.identifier!==n);if(!(l.length!==1||!l[0])&&!Ve(l[0].identifier.parent.parent))return l[0].identifier}var yt={name:hr,rule:pi};import{AST_NODE_TYPES as He}from"@typescript-eslint/utils";var De=W({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let r=new Set;function n(t){return t?t.type===He.Identifier?r.has(t.name):t.type===He.MemberExpression?n(t.object):!1:!1}return{ImportDeclaration(t){for(let o of t.specifiers)r.add(o.local.name)},ExportNamedDeclaration(t){if(t.source){e.report({node:t,messageId:"noReexport"});return}if(t.declaration?.type===He.VariableDeclaration)for(let o of t.declaration.declarations)n(o.init)&&e.report({node:t,messageId:"noReexport"});t.specifiers.length>0&&e.report({node:t,messageId:"noReexport"})},ExportDefaultDeclaration(t){t.declaration.type===He.Identifier&&r.has(t.declaration.name)&&e.report({node:t,messageId:"noReexport"})},ExportAllDeclaration(t){e.report({node:t,messageId:"noReexport"})}}}});import{ESLintUtils as ci}from"@typescript-eslint/utils";import gt from"node:path";import{z as Ce}from"zod/v4";var ui=ci.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Er="no-relative-imports",fi=Ce.object({find:Ce.string(),replacement:Ce.string()}),mi=Ce.object({aliases:Ce.array(fi),rootDir:Ce.string().optional(),allowNotFoundAliases:Ce.boolean().optional(),_dev_simulateFileName:Ce.string().optional()}),di=ui({name:Er,meta:{type:"problem",fixable:"code",docs:{description:"Prevent relative imports and auto-fix them using configured aliases"},messages:{noRelativeImports:"Relative imports are not allowed. Use one of the valid aliases in tsconfig.json instead.",noRelativeImportsWithAlias:'Relative imports are not allowed. Use the "{{ alias }}" alias instead.'},schema:[L(mi)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[r]){let n=r._dev_simulateFileName??e.filename;function t(i){return i.startsWith(".")||i.startsWith("..")}function o(i,s){let a=gt.dirname(s);return gt.resolve(a,i)}function l(i){let s=r.rootDir??process.cwd(),a=gt.relative(s,i);if(a.startsWith("."))return null;a.startsWith("/")||(a=`/${a}`);for(let{find:p,replacement:u}of r.aliases)if(a.startsWith(u)){let c=a.replace(u,p);return{alias:p,newPath:c}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!t(s))return;let a=o(s,n),p=l(a);!p&&r.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?u=>u.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),St={name:Er,rule:di};import{AST_NODE_TYPES as X}from"@typescript-eslint/utils";import{z as br}from"zod/v4";var yi=br.object({customMessage:br.string().optional()}),Tt=W({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[L(yi)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[r]){function n(t){switch(t.type){case X.Literal:return!0;case X.ObjectExpression:return t.properties.every(o=>o.type===X.Property?o.computed||o.value.type===X.Identifier&&o.key.type===X.Identifier&&o.key.name===o.value.name?!1:n(o.value):!1);case X.ArrayExpression:return t.elements.every(o=>o?o.type===X.SpreadElement?!1:n(o):!0);case X.TemplateLiteral:return t.expressions.length===0;case X.ConditionalExpression:case X.LogicalExpression:case X.BinaryExpression:case X.UnaryExpression:case X.CallExpression:case X.MemberExpression:case X.Identifier:case X.ArrowFunctionExpression:case X.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(t){if(t.name.type===X.JSXIdentifier&&t.name.name==="style"&&t.value){let o=null;t.value.type===X.JSXExpressionContainer?t.value.expression.type!==X.JSXEmptyExpression&&(o=t.value.expression):t.value.type===X.Literal&&(o=t.value),o&&n(o)&&e.report({node:t,messageId:"noStaticStyleProp",data:{customMessage:r.customMessage?` ${r.customMessage}`:""}})}}}}});import{AST_NODE_TYPES as Je}from"@typescript-eslint/utils";import*as we from"zod/v4";var gi=we.object({alternativeMsgs:we.object({inArrayFind:we.string().optional(),inArrayFilter:we.string().optional()}).optional(),__dev_simulateFileName:we.string().optional()});function Si(e){return e.typeAnnotation.type!==Je.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}function Ti(e){return/\.(typeGuards|type-guards)\.(ts|tsx)$/.test(e)}function hi(e){let r=e.parent;for(;r;){if(r.type===Je.CallExpression&&r.callee.type===Je.MemberExpression&&r.callee.property.type===Je.Identifier){let n=r.callee.property.name;if(n==="filter"||n==="find")return{method:n}}r=r.parent}return null}var ht=W({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[L(gi)],hasSuggestions:!0},defaultOptions:[{}],create(e,[r]){let n=r.__dev_simulateFileName??e.filename;if(Ti(n))return{};function t(o){if(!Si(o))return;let l=hi(o);if(r.alternativeMsgs&&l){let i=l.method==="filter"?r.alternativeMsgs.inArrayFilter:r.alternativeMsgs.inArrayFind;if(i){let s=l.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:s,data:{message:i}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":t,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":t,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":t}}});import{AST_NODE_TYPES as Fe}from"@typescript-eslint/utils";var Ei="no-unnecessary-async-on-jsx-props";function bi(e){if(e.body.type!==Fe.BlockStatement)return!1;let r=e.body.body;if(r.length!==1)return!1;let n=r[0];return!n||n.type!==Fe.ExpressionStatement?!1:n.expression.type===Fe.AwaitExpression}var Et=W({name:Ei,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 r(n){bi(n)&&e.report({node:n,messageId:"unnecessaryAsyncInJsxProp",fix(t){let o=e.sourceCode,l=[],i=o.getFirstToken(n,a=>a.value==="async");if(i){let a=o.getTokenAfter(i);a?l.push(t.replaceTextRange([i.range[0],a.range[0]],"")):l.push(t.remove(i))}function s(a){if(a.type===Fe.AwaitExpression){let p=o.getFirstToken(a);if(p&&p.value==="await"){let u=o.getTokenAfter(p);u?l.push(t.replaceTextRange([p.range[0],u.range[0]],"")):l.push(t.remove(p))}}if(a.type===Fe.BlockStatement)for(let p of a.body)s(p);else a.type===Fe.ExpressionStatement&&s(a.expression)}return s(n.body),l}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":r,"JSXAttribute FunctionExpression[async=true]":r}}});import{AST_NODE_TYPES as Me,ESLintUtils as Cr}from"@typescript-eslint/utils";import*as bt from"typescript";import je from"zod/v4";var xi=Cr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),xr="no-unnecessary-casting",Ci=je.object({additionalCastFunctions:je.array(je.object({name:je.string(),expectedType:je.enum(["string","number"])})).optional()}),xt={name:xr,rule:xi({name:xr,meta:{type:"suggestion",docs:{description:"Prevents unnecessary Number and String castings"},messages:{unnecessaryNumberCasting:"Unnecessary Number() casting on a value already of number type",unnecessaryStringCasting:"Unnecessary String() casting on a value already of string type",unnecessaryCustomCasting:"Unnecessary {{name}}() casting on a value already of {{type}} type"},schema:[L(Ci)],fixable:"code"},defaultOptions:[{}],create(e){let n=e.options[0].additionalCastFunctions||[],t=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...n],o=Cr.getParserServices(e,!0),l=o.program?.getTypeChecker();if(!l||!o.program)throw new Error("TypeScript services or program not available");function i(u,c){switch(u.type){case Me.Literal:return c==="number"?typeof u.value=="number":typeof u.value=="string";case Me.TemplateLiteral:return c==="string";case Me.UnaryExpression:return c==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function s(u,c){return c==="number"?!!(u.flags&bt.TypeFlags.NumberLike):!!(u.flags&bt.TypeFlags.StringLike)}function a(u,c){return m=>m.replaceText(u,e.sourceCode.getText(c))}function p(u){if(!l||u.arguments.length!==1)return;let c=u.arguments[0];if(!c||c.type===Me.SpreadElement)return;let{callee:m}=u;if(m.type!==Me.Identifier)return;let d=m.name,T=t.find(x=>x.name===d);if(!T)return;if(i(c,T.expectedType)||s(l.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(c)),T.expectedType)){let x,f;d==="Number"?x="unnecessaryNumberCasting":d==="String"?x="unnecessaryStringCasting":(x="unnecessaryCustomCasting",f={name:T.name,type:T.expectedType}),e.report({node:u,messageId:x,...f?{data:f}:{},fix:a(u,c)})}}return{CallExpression:p}}})};import{AST_NODE_TYPES as Ye}from"@typescript-eslint/utils";import*as me from"zod/v4";var Ii=me.object({methods:me.union([me.array(me.string()),me.literal("array")])}),Ct=W({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[L(Ii)]},defaultOptions:[{methods:"array"}],create(e,[r]){let n=r.methods,t=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(n)?n.includes(s):t.has(s)}function l(s){let{callee:a}=s;if(a.type===Ye.MemberExpression){let p=a.property;if(p.type===Ye.Identifier)return p.name}return null}function i(s,a){if(s.type!==Ye.Identifier||!s.typeAnnotation)return;let p=a.parent;if(p.type===Ye.CallExpression){let u=l(p);u&&o(u)&&p.arguments.indexOf(a)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(m){return s.typeAnnotation?m.remove(s.typeAnnotation):null}})}}return{ArrowFunctionExpression(s){for(let a of s.params)i(a,s)},FunctionExpression(s){for(let a of s.params)i(a,s)}}}});import{AST_NODE_TYPES as se}from"@typescript-eslint/utils";var It=W({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(r){if(r.id.type===se.ObjectPattern||!r.init||r.init.type!==se.ObjectExpression||r.id.type===se.Identifier&&r.id.typeAnnotation||r.parent.parent.type===se.ExportNamedDeclaration)return;let n=new Map;for(let i of r.init.properties)i.type===se.Property&&i.key.type===se.Identifier&&n.set(i.key.name,i);if(n.size===0||r.id.type!==se.Identifier)return;let t=wi(r,e.sourceCode);if(t.length===0)return;let o=r.init.properties.some(i=>i.type!==se.Property?!1:i.value.type===se.FunctionExpression),l=new Set;for(let i of t){if(i.identifier.parent.type!==se.MemberExpression)return;let s=i.identifier.parent;if(s.object!==i.identifier)return;if(s.computed)if(s.property.type===se.Literal&&typeof s.property.value=="string")l.add(s.property.value);else return;else{if(s.property.type!==se.Identifier)return;l.add(s.property.name)}if(s.parent.type===se.CallExpression&&o)return}for(let[i,s]of n)l.has(i)||e.report({node:s,messageId:"unusedObjectProperty",data:{name:i}})}}}});function wi(e,r){let n=r.getDeclaredVariables(e);if(n.length!==1)return[];let t=n[0];return t?t.references.filter(o=>o.identifier!==e.id):[]}import{AST_NODE_TYPES as J,ESLintUtils as Ai}from"@typescript-eslint/utils";import{z as Ae}from"zod/v4";var Ri=Ae.object({selectors:Ae.array(Ae.object({name:Ae.string(),selectorProp:Ae.string().optional(),selectorArgPos:Ae.number().optional(),returnProp:Ae.string().optional()}))}),vi=Ai.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ir="no-unused-selected-values",wt={name:Ir,rule:vi({name:Ir,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[L(Ri)]},defaultOptions:[{selectors:[]}],create(e,[r]){let{selectors:n=[]}=r,t=new Map(n.map(o=>[o.name,o]));return{VariableDeclarator(o){let l=null;if(o.init?.type===J.CallExpression&&(l=o.init),!l)return;let i=Fi(l);if(!i)return;let s=t.get(i);if(!s)return;let a=ki(l,s.selectorArgPos??0,s.selectorProp);if(!a)return;let p=Oi(a);if(!p)return;let u=wr(p.properties,void 0);if(!u)return;if(o.id.type===J.ObjectPattern){let d=wr(o.id.properties,s.returnProp);if(!d)return;for(let[T,h]of u)d.has(T)||e.report({node:h,messageId:"unusedSelectedValue",data:{name:T}});return}if(o.id.type!==J.Identifier||s.returnProp)return;let c=Pi(o,e.sourceCode);if(c.length===0)return;let m=new Set;for(let d of c){if(d.identifier.parent.type!==J.MemberExpression)return;let T=d.identifier.parent.property;if(T.type!==J.Identifier)return;m.add(T.name)}for(let[d,T]of u)m.has(d)||e.report({node:T,messageId:"unusedSelectedValue",data:{name:d}})}}}})};function ki(e,r,n){let t=e.arguments[r];if(!t)return null;if(t.type===J.ArrowFunctionExpression||t.type===J.FunctionExpression)return t;if(n&&t.type===J.ObjectExpression){let o=t.properties.find(i=>i.type===J.Property&&i.key.type===J.Identifier&&i.key.name===n);if(o?.type!==J.Property)return null;let l=o.value;if(l.type===J.ArrowFunctionExpression||l.type===J.FunctionExpression)return l}return null}function Fi(e){return e.callee.type===J.Identifier?e.callee.name:e.callee.type===J.MemberExpression&&e.callee.property.type===J.Identifier?e.callee.property.name:null}function Oi(e){if(e.body.type===J.ObjectExpression)return e.body;if(e.body.type===J.BlockStatement){let r=e.body.body.filter(n=>n.type===J.ReturnStatement);return r.length!==1||!r[0]||r[0].argument?.type!==J.ObjectExpression?null:r[0].argument}return null}function wr(e,r){let n=e;if(r){let o=e.find(l=>l.type===J.Property&&l.key.type===J.Identifier&&l.key.name===r);if(o?.type!==J.Property||o.value.type!==J.ObjectPattern)return null;n=o.value.properties}let t=new Map;for(let o of n){if(o.type!==J.Property||o.key.type!==J.Identifier)return null;t.set(o.key.name,o)}return t.size>0?t:null}function Pi(e,r){let n=r.getDeclaredVariables(e);if(n.length!==1)return[];let t=n[0];return t?t.references.filter(o=>o.identifier!==e.id):[]}import{AST_NODE_TYPES as H}from"@typescript-eslint/utils";var At=W({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(l=>l.type===H.ImportDeclaration&&l.source.value==="t-state-form"))return{};let t=null,o=!1;return{CallExpression(l){if(o)return;if(!t){let s=Ni(l);s&&(t=s);return}let i=Di(l,e.sourceCode);if(i){o=!0;for(let s of i)t.delete(s);if(t.size!==0)for(let[s,a]of t)e.report({node:a,messageId:"unusedField",data:{name:s}})}}}}});function Ni(e){if(!(e.callee.type===H.Identifier&&e.callee.name==="useForm"))return null;let n=e.arguments[0];if(!n||n.type!==H.ObjectExpression)return null;let t=dt(n.properties,l=>l.type!==H.Property||l.key.type!==H.Identifier||l.key.name!=="initialConfig"?null:l.value.type===H.ObjectExpression?l.value:l.value.type===H.ArrowFunctionExpression||l.value.type===H.FunctionExpression?Mi(l.value):null);if(!t)return null;let o=new Map;for(let l of t.properties)l.type===H.Property&&l.key.type===H.Identifier&&o.set(l.key.name,l);return o}function Di(e,r){if(!(e.callee.type===H.Identifier&&e.callee.name==="useFormState")||e.parent.type!==H.VariableDeclarator||e.parent.id.type!==H.ObjectPattern||!dt(e.parent.id.properties,i=>i.type===H.Property&&i.key.type===H.Identifier&&i.key.name==="formFields"&&i))return null;let o=Tr(e.parent,"formFields",r),l=new Set;for(let{identifier:i}of o){if(i.type!==H.Identifier||i.parent.type===H.Property&&i.parent.parent.type===H.ObjectExpression&&i.parent.parent.parent.type===H.ReturnStatement||i.parent.type===H.ReturnStatement)return null;if(i.parent.type===H.MemberExpression){if(i.parent.object.type!==H.Identifier||i.parent.property.type!==H.Identifier)return null;l.add(i.parent.property.name)}}return l}function Mi(e){if(e.body.type===H.ObjectExpression)return e.body;if(e.body.type===H.BlockStatement){let r=e.body.body.filter(n=>n.type===H.ReturnStatement);return r.length!==1||!r[0]||r[0].argument?.type!==H.ObjectExpression?null:r[0].argument}return null}import{AST_NODE_TYPES as $,ESLintUtils as ji}from"@typescript-eslint/utils";import{z as qe}from"zod/v4";var Li=ji.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Ar(e){let r=[];for(let n of e.members)n.type===$.TSPropertySignature&&n.key.type===$.Identifier&&r.push([n.key.name,n]);return r}function Rr(e,...r){for(let n of r)e.set(...n);return e}var _i=qe.object({forceCheckOnFCPropTypesWithName:qe.array(qe.string()).optional(),alwaysCheckFunctionOptionTypes:qe.boolean().optional()}),vr="no-unused-type-props-in-args",Rt=null,$i=Li({name:vr,meta:{type:"problem",docs:{description:"Disallow unused undestructured object type properties"},messages:{unusedObjectTypeProperty:"Object type property '{{ propertyName }}' is defined but never used",missingComponentParam:"Component has declared props but no props are used"},schema:[L(_i)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[r]){let{forceCheckOnFCPropTypesWithName:n,alwaysCheckFunctionOptionTypes:t=!0}=r;n&&!Rt&&(Rt=n.map(a=>new RegExp(a)));function o(a,p,u,c,m=!0,d=!1){let T=u.name,h=e.sourceCode.getScope(p).references.find(S=>S.identifier.name===T)?.resolved,x=a&&Rt?.some(S=>S.test(T)),f=d&&t;if(!h||!x&&h.references.filter(S=>S.isTypeReference).length>1||!h.defs[0])return;let b=h.defs[0].node,I=b.parent?.type===$.ExportNamedDeclaration;if(!(m&&I&&!f)){if(b.type===$.TSTypeAliasDeclaration){l(a,p,c,b.typeAnnotation,!0,d);return}if(b.type===$.TSInterfaceDeclaration){l(a,p,c,b.body,!0,d);return}}}function l(a,p,u,c,m,d=!1){if(c.type===$.TSInterfaceBody){for(let T of c.body)T.type===$.TSPropertySignature&&T.key.type===$.Identifier&&u.set(T.key.name,T);return}if(c.type===$.TSTypeLiteral){Rr(u,...Ar(c));return}if(c.type===$.TSIntersectionType){for(let T of c.types)l(a,p,u,T,!0,d);return}m||c.type===$.TSTypeReference&&c.typeName.type===$.Identifier&&o(a,p,c.typeName,u,!0,d)}function i(a,p,u,c=!1){for(let m of u)if(m.type===$.ObjectPattern&&m.typeAnnotation){let d=new Map;if(l(a,p,d,m.typeAnnotation.typeAnnotation,!1,c),d.size===0)continue;s(m,d)}else m.type===$.AssignmentPattern&&m.left.type===$.ObjectPattern&&i(a,p,[m.left],c)}function s(a,p){let u=[];if(a.properties.at(-1)?.type===$.RestElement)return;for(let T of a.properties)T.type===$.Property&&T.key.type===$.Identifier&&u.push(T.key.name);let m=[],d=[];for(let[T,h]of p)u.includes(T)||(d.push(T),m.push({node:h,messageId:"unusedObjectTypeProperty",data:{propertyName:T}}));for(let[T,h]of m.entries())e.report({...h,fix:T===m.length-1?x=>{let f=a.properties.at(-1),b=d.join(", ");return f?f.type===$.RestElement?null:x.insertTextAfter(f,`, ${b}`):x.insertTextBeforeRange([a.range[0]+1,a.range[1]],b)}:void 0})}return{VariableDeclaration(a){let p=a.declarations[0],u=new Map,c=p.id.type===$.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===$.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===$.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(c){if(c.type===$.TSTypeReference&&c.typeName.type===$.Identifier)o(!0,a,c.typeName,u,!1);else if(c.type===$.TSTypeLiteral)Rr(u,...Ar(c));else if(c.type===$.TSIntersectionType)for(let m of c.types)m.type===$.TSTypeReference&&m.typeName.type===$.Identifier?o(!0,a,m.typeName,u,!1):l(!0,a,u,m,!0);if(u.size!==0&&p.init?.type===$.ArrowFunctionExpression){let m=p.init.params[0];if(!m){e.report({node:p.init,messageId:"missingComponentParam"});return}m.type===$.ObjectPattern&&s(m,u)}}},FunctionDeclaration(a){i(!1,a,a.params,t)},ArrowFunctionExpression(a){i(!1,a,a.params,t)}}}}),vt={name:vr,rule:$i};import{AST_NODE_TYPES as ce}from"@typescript-eslint/utils";var kt=W({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let r=new Set;function n(t){return t.callee.type===ce.Identifier?r.has(t.callee.name):t.callee.type===ce.MemberExpression&&t.callee.object.type===ce.Identifier&&t.callee.property.type===ce.Identifier?t.callee.property.name==="useRef":!1}return{ImportDeclaration(t){if(t.source.value==="react")for(let o of t.specifiers)o.type===ce.ImportSpecifier&&o.imported.type===ce.Identifier&&o.imported.name==="useRef"&&r.add(o.local.name)},VariableDeclarator(t){if(t.init&&t.init.type===ce.CallExpression&&n(t.init)&&t.id.type===ce.Identifier){let l=e.sourceCode.getScope(t).set.get(t.id.name);if(l){let i=!1;for(let s of l.references){let p=s.identifier.parent;if(p!==t&&!(p.type===ce.JSXExpressionContainer&&p.parent.type===ce.JSXAttribute&&p.parent.name.type===ce.JSXIdentifier&&p.parent.name.name==="ref")){i=!0;break}}i||e.report({node:t.id,messageId:"refNotRead",data:{name:t.id.name}})}}}}}});import{AST_NODE_TYPES as Ft,ESLintUtils as Ui}from"@typescript-eslint/utils";var zi=Ui.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Fr="prefer-named-functions",kr=new Map,Wi=zi({name:Fr,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,[r]){let n=null;if(r.ignoreRegex){let t=kr.get(r.ignoreRegex);t?n=t:(n=new RegExp(r.ignoreRegex),kr.set(r.ignoreRegex,n))}return{VariableDeclarator(t){if(t.init&&t.init.type===Ft.ArrowFunctionExpression&&t.id.type===Ft.Identifier){let o=t.id.name;if(t.id.typeAnnotation||n&&n.test(o)||!r.disallowArrowFnWithImplicitReturns&&t.init.body.type!==Ft.BlockStatement)return;let l=t.parent,i=t.init.params,s=t.init.body,a=t.init;e.report({node:t.id,messageId:n?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:r.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(l,`${a.async?"async ":""}function ${o}(${i.map(u=>e.sourceCode.getText(u)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),Ot={name:Fr,rule:Wi};import{AST_NODE_TYPES as M}from"@typescript-eslint/utils";import{z as Te}from"zod/v4";var Vi=Te.object({disallowedFunctions:Te.array(Te.object({name:Te.string(),allowUsingWithArgs:Te.boolean().optional(),hookAlternative:Te.string().optional(),message:Te.string().optional(),allowUseInside:Te.array(Te.string()).optional()}))});function Be(e){return/^use[A-Z]/.test(e)}function Or(e){return/^[A-Z]/.test(e)}function Hi(e){return e.type===M.Identifier?Be(e.name):e.type===M.MemberExpression&&e.property.type===M.Identifier?Be(e.property.name):!1}function Pr(e,r){return e.type===M.Identifier?e.name===r:e.type===M.MemberExpression&&e.object.type===M.Identifier&&e.property.type===M.Identifier?e.object.name==="React"&&e.property.name===r:!1}function Nr(e){return!!(e.parent&&e.parent.type===M.CallExpression&&Pr(e.parent.callee,"forwardRef"))}function Dr(e){return!!(e.parent&&e.parent.type===M.CallExpression&&Pr(e.parent.callee,"memo"))}function Pt(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 Ji(e){let r=e.parent,n=!1;for(;r;){if(r.type===M.FunctionDeclaration||r.type===M.FunctionExpression||r.type===M.ArrowFunctionExpression){let t=Pt(r);if(t&&t.type===M.Identifier){if(Or(t.name)||Be(t.name))return!n;n=!0}else{if(Nr(r)||Dr(r))return!n;if(r.parent.type===M.CallExpression){let o=r.parent;Hi(o.callee)||(n=!0)}else r.parent.type===M.JSXExpressionContainer||(n=!0)}}r=r.parent}return!1}function Mr(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 Yi(e,r){if(!r.length)return!1;let n=e.parent;for(;n;){if(n.type===M.FunctionDeclaration||n.type===M.FunctionExpression||n.type===M.ArrowFunctionExpression){let t=Pt(n);if(t&&t.type===M.Identifier&&r.includes(t.name))return!0}else if(n.type===M.CallExpression){let t=Mr(n);if(t&&r.includes(t))return!0}n=n.parent}return!1}function qi(e){return e.arguments.length>0&&!e.arguments.every(r=>r.type===M.Identifier&&r.name==="undefined")}function Bi(e,r){let n=!1,t=e.parent;for(;t;){if(t.type===M.FunctionDeclaration||t.type===M.FunctionExpression||t.type===M.ArrowFunctionExpression){let o=Pt(t);if(o&&o.type===M.Identifier){if(Or(o.name)||Be(o.name)){n=!0;break}}else if(Nr(t)||Dr(t)){n=!0;break}}t=t.parent}return n?r.length===0?Ji(e):!Yi(e,r):!1}var Nt=W({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[L(Vi)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[r]){let{disallowedFunctions:n}=r,t=new Map(n.map(o=>[o.name,o]));return{CallExpression(o){let l=Mr(o);if(!l)return;let i=t.get(l);if(!i||i.allowUsingWithArgs&&qi(o))return;let s=i.allowUseInside||[];Bi(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:a=>{let p=i.hookAlternative;return p?o.callee.type===M.Identifier?a.replaceText(o.callee,p):o.callee.type===M.MemberExpression&&o.callee.property.type===M.Identifier?a.replaceText(o.callee.property,p):null:null}}]:[]})}}}});import{AST_NODE_TYPES as Z,AST_TOKEN_TYPES as jr,ESLintUtils as Xi}from"@typescript-eslint/utils";import Dt from"zod/v4";var Zi=Xi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_r="prefer-single-line-if",Gi=Dt.object({maxLineLength:Dt.number().optional(),maxNonSimpleConditionLength:Dt.number().optional()}),Ki=Zi({name:_r,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[L(Gi)]},defaultOptions:[{}],create(e,[r]){let n=e.sourceCode;return{IfStatement(t){if(t.consequent.type!==Z.BlockStatement||t.loc.start.line===t.loc.end.line||n.getCommentsInside(t.consequent).length>0||t.alternate||t.consequent.body.length!==1)return;let l=t.consequent.body[0];if(!l)return;if(l.type===Z.ReturnStatement){if(!Ur(l))return}else if(!(l.type===Z.ContinueStatement||l.type===Z.BreakStatement))return;if(t.test.type===Z.LogicalExpression||t.test.type===Z.ConditionalExpression)return;let i;if(r.maxNonSimpleConditionLength){let c=Lr(t.test);if(!c&&t.test.type===Z.UnaryExpression&&t.test.operator==="!"){let m=t.test.argument;Lr(m)&&(c=!0)}if(c&&(i=n.getText(t.test),i.length>r.maxNonSimpleConditionLength))return}i||(i=n.getText(t.test));let s=n.getText(l);if(i.includes(`
16
+ `))return;let a=n.getTokenAfter(t);if(a&&a.type===jr.Punctuator&&a.value==="}"){let c=n.getTokenAfter(a);if(c&&c.type===jr.Keyword&&(c.value==="else"||c.value==="catch"))return}let p=Qi(n,t),u=`if (${i}) ${s}`;r.maxLineLength&&u.length+p.length>r.maxLineLength||e.report({node:t,messageId:"noSingleLineCurly",fix:c=>c.replaceText(t,u)})}}}});function Lr(e){return e.type===Z.CallExpression||e.type===Z.BinaryExpression||e.type===Z.MemberExpression&&$r(e)}function $r(e){return e.object.type===Z.MemberExpression?$r(e.object):e.object.type!==Z.Identifier}function Qi(e,r){return e.text.slice(r.range[0]-r.loc.start.column,r.range[0])}function Ur(e){if(!e.argument)return!0;let r=e.argument;return r.type===Z.ArrayExpression&&r.elements.length===0||r.type===Z.ObjectExpression&&r.properties.length===0||r.type===Z.Literal||r.type===Z.Identifier||r.type===Z.TemplateLiteral||r.type===Z.TaggedTemplateExpression?!0:r.type===Z.CallExpression?r.arguments.length===0:r.type===Z.UnaryExpression?Ur(r):!1}var Mt={name:_r,rule:Ki};import{AST_NODE_TYPES as ae,ESLintUtils as es}from"@typescript-eslint/utils";import{z as de}from"zod/v4";var ts=es.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),zr="react-compiler-migration",rs=de.object({disallowHooks:de.array(de.object({name:de.string(),replacement:de.string()})).optional(),disallowMethods:de.array(de.object({name:de.string(),replacement:de.string().optional(),requireTrueProp:de.string().optional()})).optional()}),ns=/eslint +react-compiler\/react-compiler: +\["error/;function is(e){return e.type===ae.Identifier?e.name.startsWith("use"):e.type===ae.MemberExpression&&e.property.type===ae.Identifier?e.property.name.startsWith("use"):!1}var ss=ts({name:zr,meta:{type:"suggestion",fixable:"code",docs:{description:"Rules to help migrate to the new React compiler"},messages:{disallowedFunctionOrMethod:"{{functionOrMethod}} is not supported in react compiler. Use {{replacement}} instead.",replace:"Replace with safe alternative {{replacement}}",disallowedMethodWithMissingRequireTrueProp:"{{method}} is should have a prop named {{requireTrueProp}} set to true when used in react compiler."},hasSuggestions:!0,schema:[L(rs)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[r]){let n=!1;for(let t of e.sourceCode.getAllComments())if(ns.test(t.value)){n=!0;break}return n?{CallExpression(t){if(r.disallowHooks?.length){let o=null,l=null;if(t.callee.type===ae.Identifier?(o=t.callee.name,l=t.callee):t.callee.type===ae.MemberExpression&&t.callee.property.type===ae.Identifier&&(o=t.callee.property.name,l=t.callee.property),o){let i=r.disallowHooks.find(s=>s.name===o);i&&l&&e.report({node:t,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:s=>s.replaceText(l,i.replacement)}]})}}if(r.disallowMethods?.length&&is(t.callee)){for(let o of t.arguments)if(o.type===ae.ObjectExpression){for(let l of o.properties)if(l.type===ae.Property&&l.key.type===ae.Identifier){let i=l.key.name,s=r.disallowMethods.find(a=>a.name===i);if(s){if(s.requireTrueProp){let a=s.requireTrueProp,p=!1;for(let u of o.properties)if(u.type===ae.Property&&u.key.type===ae.Identifier&&u.key.name===a&&u.value.type===ae.Literal&&u.value.value===!0){p=!0;break}if(!p){e.report({node:l,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:s.name,requireTrueProp:a}});continue}}s.replacement&&e.report({node:l,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:s.name,replacement:s.replacement},suggest:[{messageId:"replace",data:{replacement:s.replacement},fix:a=>s.replacement?a.replaceText(l.key,s.replacement):null}]})}}}}}}:{}}}),jt={name:zr,rule:ss};import{ESLintUtils as os,TSESTree as as}from"@typescript-eslint/utils";var ls=os.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Wr="require-description",ps=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,cs=/^eslint-disable-(next-)?line$/u,us=ls({name:Wr,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,[r]){let n=e.sourceCode,t=new Set(r.ignore||[]);return{Program(){for(let o of n.getAllComments()){let l=fs(o);l!=null&&(t.has(l.kind)||l.description||e.report({loc:ds(o.loc),messageId:"missingDescription"}))}}}}}),Vr={name:Wr,rule:us};function fs(e){let{text:r,description:n}=ms(e.value);if(!r)return null;let t=ps.exec(r);if(!t)return null;let o=t[1];if(!o)return null;let l=cs.test(o);if(e.type===as.AST_TOKEN_TYPES.Line&&!l||l&&e.loc.start.line!==e.loc.end.line)return null;let i=r.slice(t.index+o.length);return{kind:o,value:i.trim(),description:n}}function ms(e){let r=e.split(/\s-{2,}\s/u);return{text:r[0]?.trim(),description:r.length>1?r[1]?.trim()??null:null}}function ds(e){return{start:{line:e.start.line,column:-1},end:e.end}}import{AST_NODE_TYPES as _}from"@typescript-eslint/utils";import{z as he}from"zod/v4";var ys=he.object({varsToCheck:he.array(he.object({selector:he.string().optional(),fromFnCall:he.string().optional(),prop:he.string().or(he.array(he.string())),errorMsg:he.string().optional()}))}),Lt=W({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[L(ys)]},defaultOptions:[{varsToCheck:[]}],create(e,[r]){let n=new Map,t=(i,s,a,p)=>{let u=new Set;for(let m of i.properties)m.type===_.Property&&m.key.type===_.Identifier&&u.add(m.key.name);let c=s.filter(m=>!u.has(m));if(c.length>0)if(c.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:c[0],fnName:p,customMsg:a||""}});else{let m=c.map(d=>`"${d}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:m,fnName:p,customMsg:a||""}})}},o=i=>{if(i.init?.type===_.CallExpression){if(i.init.callee.type===_.Identifier)return i.init.callee.name;if(i.init.callee.type===_.MemberExpression&&i.init.callee.property.type===_.Identifier)return i.init.callee.object.type===_.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"},l={};for(let i of r.varsToCheck)i.selector&&(l[i.selector]=s=>{if(s.type===_.VariableDeclarator&&s.id.type===_.Identifier&&n.set(s.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:s.id,fnName:o(s)}),s.type===_.VariableDeclarator&&s.id.type===_.ObjectPattern){let a=Array.isArray(i.prop)?i.prop:[i.prop];t(s.id,a,i.errorMsg,o(s))}});for(let i of r.varsToCheck)if(i.fromFnCall){let s=i.fromFnCall;if(s.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${s.slice(2)}"]`;l[p]=u=>{if(u.type!==_.MemberExpression||u.parent.type!==_.CallExpression)return;let c=u.parent;if(c.parent.type!==_.VariableDeclarator)return;let m=c.parent;if(m.id.type===_.Identifier)n.set(m.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:m.id,fnName:i.fromFnCall||"unknown function"});else if(m.id.type===_.ObjectPattern){let d=Array.isArray(i.prop)?i.prop:[i.prop];t(m.id,d,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(s.includes(".")){let[a,p]=s.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${a}"][property.name="${p}"]`;l[u]=c=>{if(c.type!==_.MemberExpression||c.parent.type!==_.CallExpression)return;let m=c.parent;if(m.parent.type!==_.VariableDeclarator)return;let d=m.parent;if(d.id.type===_.Identifier)n.set(d.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:d.id,fnName:i.fromFnCall||"unknown function"});else if(d.id.type===_.ObjectPattern){let T=Array.isArray(i.prop)?i.prop:[i.prop];t(d.id,T,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let a=`VariableDeclarator > CallExpression > Identifier[name="${s}"]`;l[a]=p=>{if(p.type!==_.Identifier||p.parent.type!==_.CallExpression)return;let u=p.parent;if(u.parent.type!==_.VariableDeclarator)return;let c=u.parent;if(c.id.type===_.Identifier)n.set(c.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:c.id,fnName:i.fromFnCall||"unknown function"});else if(c.id.type===_.ObjectPattern){let m=Array.isArray(i.prop)?i.prop:[i.prop];t(c.id,m,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...l,"Program:exit"(){for(let[i,{props:s,errorMsg:a,node:p,fnName:u}]of n){let m=e.sourceCode.getScope(p).set.get(i);if(m){let d=new Set(s);for(let T of m.references){let h=T.identifier,x=h.parent;if(!(x.type===_.VariableDeclarator&&x.id===h)){if(x.type===_.MemberExpression&&x.object===h&&x.property.type===_.Identifier&&d.has(x.property.name)){if(d.delete(x.property.name),d.size===0)break;continue}if(x.type===_.VariableDeclarator&&x.init===h&&x.id.type===_.ObjectPattern){for(let f of x.id.properties)f.type===_.Property&&f.key.type===_.Identifier&&d.has(f.key.name)&&d.delete(f.key.name);if(d.size===0)break;continue}if(!(x.type===_.MemberExpression&&x.object===h&&x.property.type===_.Identifier&&!s.includes(x.property.name))){d.clear();break}}}if(d.size>0){let T=Array.from(d);if(T.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:T[0],fnName:u,customMsg:a||""}});else{let h=T.map(x=>`"${x}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:h,fnName:u,customMsg:a||""}})}}}}}}}});function Yr(e){return/^use[A-Z0-9]/.test(e)}function Xe(e){return e.type==="Identifier"?Yr(e.name):e.type==="MemberExpression"&&!e.computed&&Xe(e.property)?e.object.type==="Identifier":!1}function qr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Br(e,r){return e.name===r||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===r}function Xr(e){return!!(e.parent&&e.parent.callee&&Br(e.parent.callee,"forwardRef"))}function Zr(e){return!!(e.parent&&e.parent.callee&&Br(e.parent.callee,"memo"))}function _t(e){for(;e;){let r=Kr(e);if(r&&(qr(r)||Xe(r))||Xr(e)||Zr(e))return!0;e=e.parent}return!1}function Hr(e){return!1}function $t(e){return!1}var gs=/eslint +react-compiler\/react-compiler: +\["error/,Gr={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 a of e.sourceCode.getAllComments())if(gs.test(a.value))return{CallExpression(p){let u=null;p.callee.name==="useMemo"?u="useMemo":p.callee.name==="useCallback"&&(u="useCallback"),u&&e.report({node:p,message:`"${u}" is not necessary when using React Compiler.`})}}}let r=typeof e.getSource=="function"?a=>r(a):a=>e.sourceCode.getText(a),n=typeof e.getScope=="function"?()=>n():a=>e.sourceCode.getScope(a),t=null,o=[],l=[],i=new WeakSet;function s(a){for(let p of a.references){let u=p.identifier.parent;if(u.type==="VariableDeclarator"&&u.init&&u.init.type==="CallExpression"&&u.init.callee&&Hr(u.init.callee))for(let c of p.resolved.references)c!==p&&i.add(c.identifier)}}return{onCodePathSegmentStart:a=>l.push(a),onCodePathSegmentEnd:()=>l.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(a,p){let u=o.pop();if(u.size===0)return;let c=new Set;function m(S,y){let{cache:E}=m,k=E.get(S.id),R=new Set(y);if(R.has(S.id)){let w=[...R],N=w.slice(w.indexOf(S.id)+1);for(let z of N)c.add(z);return BigInt("0")}if(R.add(S.id),k!==void 0)return k;if(a.thrownSegments.includes(S))k=BigInt("0");else if(S.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let w of S.prevSegments)k+=m(w,R)}return S.reachable&&k===BigInt("0")?E.delete(S.id):E.set(S.id,k),k}function d(S,y){let{cache:E}=d,k=E.get(S.id),R=new Set(y);if(R.has(S.id)){let w=Array.from(R),N=w.slice(w.indexOf(S.id)+1);for(let z of N)c.add(z);return BigInt("0")}if(R.add(S.id),k!==void 0)return k;if(a.thrownSegments.includes(S))k=BigInt("0");else if(S.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let w of S.nextSegments)k+=d(w,R)}return E.set(S.id,k),k}function T(S){let{cache:y}=T,E=y.get(S.id);if(E===null)return 1/0;if(E!==void 0)return E;if(y.set(S.id,null),S.prevSegments.length===0)E=1;else{E=1/0;for(let k of S.prevSegments){let R=T(k);R<E&&(E=R)}E+=1}return y.set(S.id,E),E}m.cache=new Map,d.cache=new Map,T.cache=new Map;let h=d(a.initialSegment),x=Kr(p),f=_t(p),b=x?qr(x)||Xe(x):Xr(p)||Zr(p),I=1/0;for(let S of a.finalSegments){if(!S.reachable)continue;let y=T(S);y<I&&(I=y)}for(let[S,y]of u){if(!S.reachable)continue;let E=S.nextSegments.length===0?I<=T(S):I<T(S),k=m(S)*d(S),R=c.has(S.id);for(let w of y)if(R&&!$t(w)&&e.report({node:w,message:`React Hook "${r(w)}" 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.`}),b){if(p.async&&e.report({node:w,message:`React Hook "${r(w)}" cannot be called in an async function.`}),!R&&k!==h&&!$t(w)){let z=`React Hook "${r(w)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(E?" Did you accidentally call a React Hook after an early return?":"");e.report({node:w,message:z})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let N=`React Hook "${r(w)}" 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:w,message:N})}else if(x){let N=`React Hook "${r(w)}" is called in function "${r(x)}" 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:w,message:N})}else if(p.type==="Program"){let N=`React Hook "${r(w)}" 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:w,message:N})}else if(f&&!$t(w)){if(p.parent.type==="CallExpression"&&p.parent.callee.type==="Identifier"&&p.parent.callee.name==="useCallback"){let z=p.parent;if(z.parent.type==="VariableDeclarator"&&Yr(z.parent.id.name))return}let N=`React Hook "${r(w)}" 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:w,message:N})}}},CallExpression(a){if(Xe(a.callee)){let p=Jr(o),u=Jr(l),c=p.get(u);c||(c=[],p.set(u,c)),c.push(a.callee)}a.callee.type==="Identifier"&&(a.callee.name==="useEffect"||Hr(a.callee))&&a.arguments.length>0&&(t=a)},Identifier(a){t==null&&i.has(a)&&a.parent.type!=="CallExpression"&&e.report({node:a,message:`\`${r(a)}\` 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"(a){a===t&&(t=null)},FunctionDeclaration(a){_t(a)&&s(n(a))},ArrowFunctionExpression(a){_t(a)&&s(n(a))}}}};function Kr(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 Jr(e){return e[e.length-1]}import{AST_NODE_TYPES as ee,AST_TOKEN_TYPES as Ss}from"@typescript-eslint/utils";import*as ie from"zod/v4";var Ts=ie.object({indent:ie.union([ie.string().regex(/^\s+$/),ie.number().int().min(1)]).optional(),tags:ie.array(ie.string()).optional(),functions:ie.array(ie.string()).optional(),comments:ie.array(ie.string()).optional()}),Ut=W({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[L(Ts)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let r=e.sourceCode,{comments:n=["HTML","indent"],functions:t=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:l}=e.options[0],i=n.map(f=>f.toLowerCase());function s(f){let b=f.split(/\r?\n/),I=b.filter(y=>y.trim()!=="");if(I.length===0)return f;let S=Number.POSITIVE_INFINITY;for(let y of I){let E=y.match(/^(\s*)/);E&&(S=Math.min(S,E[1]?.length??0))}return!isFinite(S)||S===0?f:b.map(y=>y.slice(S)).join(`
17
+ `)}function a(f,b,I){return f.split(/\r?\n/).map(y=>y.trim()===""?y:I.repeat(b)+y).join(`
18
+ `)}function p(f){if(f.type===ee.Identifier)return f.name;if(f.type===ee.MemberExpression){let b=f.object.type===ee.Identifier?f.object.name:null,I=f.property.type===ee.Identifier?f.property.name:null;return b&&I?`${b}.${I}`:I}return null}function u(f,b){if(!f)return!1;for(let I of b)if(I.includes(".")){let S=I.split(".");if(f.type===ee.MemberExpression&&f.object.type===ee.Identifier&&f.property.type===ee.Identifier&&f.object.name===S[0]&&f.property.name===S[1])return!0}else if(f.type===ee.Identifier&&f.name===I)return!0;return!1}function c(f,b){let I=f.parent;if(I.type!==ee.TaggedTemplateExpression)return!1;let S=p(I.tag);return S?b.includes(S):!1}function m(f,b){if(!f||f.type!==ee.CallExpression)return!1;let{method:I,argumentsLength:S,optionalCall:y=!0,optionalMember:E=!0}=b;return S!==void 0&&f.arguments.length!==S||!y&&f.optional||f.callee.type!==ee.MemberExpression||!E&&f.callee.optional||f.callee.property.type!==ee.Identifier?!1:f.callee.property.name===I}function d(f,b){if(!f||f.type!==ee.CallExpression)return!1;let{name:I,argumentsLength:S,optionalCall:y=!0}=b;return S!==void 0&&f.arguments.length!==S||!y&&f.optional||f.callee.type!==ee.Identifier?!1:f.callee.name===I}function T(f){return m(f.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&f.parent.type===ee.CallExpression&&f.parent.arguments[0]===f&&d(f.parent.callee.type===ee.MemberExpression?f.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function h(f){if(i.length>0){let b=r.getTokenBefore(f,{includeComments:!0});if(b?.type===Ss.Block&&i.includes(b.value.trim().toLowerCase()))return!0}return!!(T(f)||o.length>0&&c(f,o)||t.length>0&&f.parent.type===ee.CallExpression&&f.parent.arguments.includes(f)&&u(f.parent.callee,t))}function x(f){let b=`__PLACEHOLDER__${Math.random()}`,I=f.quasis.map(q=>r.getText(q).slice(1,q.tail?-1:-2)).join(b),S=I.match(/\r?\n/);if(!S)return;let y=S[0],E=r.lines[r.getLocFromIndex(f.range[0]).line-1];if(!E)return;let R=E.match(/^(\s*)\S/)?.[1]??"",w;typeof l=="string"?w=l:typeof l=="number"?w=" ".repeat(l):w=R.startsWith(" ")?" ":" ";let z=s(I).replace(new RegExp(`^${y}|${y}[ ]*$`,"g"),""),Y=y+a(z,1,R+w)+y+R,Q=I.includes(`\r
19
19
  `)?`\r
20
20
  `:`
21
- `,Z=b.split(/\r?\n/),be=Z.map((X,ye)=>ye!==Z.length-1&&X===w+R?"":X).join(te);if(J!==be)return{node:f,messageId:"improperlyIndented",fix:X=>J.split(I).map((ye,ue)=>{let ie=f.quasis[ue];return ie?X.replaceTextRange([ie.range[0]+1,ie.range[1]-(ie.tail?1:2)],ye):[]}).flat()}}return{TemplateLiteral(f){if(!x(f))return;let I=C(f);if(I)return e.report(I)}}}});import{AST_NODE_TYPES as qr}from"@typescript-eslint/utils";function cs(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function us(e){let t=e.parent;return t?.type===qr.NewExpression&&t.callee.type===qr.Identifier&&t.callee.name==="RegExp"}var Lt=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(n){cs(n)||us(n)||e.report({node:n,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var Jr={[wt.name]:wt.rule,[at.name]:at.rule,[ot.name]:ot.rule,"rules-of-hooks":Hr,"exhaustive-deps":Kt,"require-description":Dr.rule,[lt.name]:lt.rule,[ct.name]:ct.rule,[vt.name]:vt.rule,[Ze.name]:Ze.rule,[st.name]:st.rule,[yt.name]:yt.rule,[je.name]:je.rule,[Pt.name]:Pt.rule,[mt.name]:mt.rule,[pt.name]:pt.rule,[et.name]:et.rule,[Ft.name]:Ft.rule,[Ke.name]:Ke.rule,[it.name]:it.rule,[ht.name]:ht.rule,[Et.name]:Et.rule,[xt.name]:xt.rule,[It.name]:It.rule,[bt.name]:bt.rule,[Ot.name]:Ot.rule,[St.name]:St.rule,[gt.name]:gt.rule,[Lt.name]:Lt.rule,[At.name]:At.rule,[Nt.name]:Nt.rule,[Dt.name]:Dt.rule,[je.name]:je.rule};var il={rules:Jr};export{il as extendedLintPlugin};
21
+ `,G=I.split(/\r?\n/),Ee=G.map((q,fe)=>fe!==G.length-1&&q===w+R?"":q).join(Q);if(Y!==Ee)return{node:f,messageId:"improperlyIndented",fix:q=>Y.split(b).map((fe,le)=>{let re=f.quasis[le];return re?q.replaceTextRange([re.range[0]+1,re.range[1]-(re.tail?1:2)],fe):[]}).flat()}}return{TemplateLiteral(f){if(!h(f))return;let b=x(f);if(b)return e.report(b)}}}});import{AST_NODE_TYPES as Qr}from"@typescript-eslint/utils";function hs(e){if(!("regex"in e))return!1;let r=e.regex.flags;return r.includes("g")||r.includes("y")}function Es(e){let r=e.parent;return r?.type===Qr.NewExpression&&r.callee.type===Qr.Identifier&&r.callee.name==="RegExp"}var zt=W({name:"use-top-level-regex",meta:{type:"suggestion",docs:{description:"Require regex literals to be declared at the top level to avoid performance issues"},messages:{regexShouldBeTopLevel:"Move this regex literal to the top level to avoid creating new RegExp objects on each function call."},schema:[],hasSuggestions:!1},defaultOptions:[],create(e){function r(n){hs(n)||Es(n)||e.report({node:n,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":r}}});import{AST_NODE_TYPES as ue}from"@typescript-eslint/utils";import{z as Wt}from"zod/v4";var bs=Wt.object({checkOnly:Wt.array(Wt.enum(["function-args","FC"])).optional()}),Vt=W({name:"use-types-directly-above-usage",meta:{type:"suggestion",docs:{description:"Require type definitions to be placed directly above their first usage for better readability"},fixable:"code",schema:[L(bs)],messages:{moveTypeAboveUsage:"Type definition should be placed directly above its first usage."}},defaultOptions:[{}],create(e,[r]){let n=e.sourceCode,t=new Map,o=[];function l(c,m){if(!t.has(c))return;let d=t.get(c);if(!d||d.statement===m)return;let T=o.indexOf(d.statement),h=o.indexOf(m);T===-1||h===-1||(T>h||T!==h-1)&&e.report({node:d.node,messageId:"moveTypeAboveUsage",fix:s(d.statement,m)})}function i(c){for(let m of o)if(c.range[0]>=m.range[0]&&c.range[1]<=m.range[1])return m;return null}function s(c,m){return function*(d){let T=n.getText(c),h=n.getCommentsBefore(c),x=T;h.length>0&&(x=`${h.map(E=>n.getText(E)).join(`
22
+ `)}
23
+ ${T}`);let f=c.range[0],b=c.range[1];h.length>0&&h[0]&&(f=h[0].range[0]),n.text[b]===`
24
+ `&&(b+=1),yield d.removeRange([f,b]);let S=n.getText(m);yield d.replaceText(m,`${x}
25
+
26
+ ${S}`)}}function a(c){let m=c.parent;for(;m;){if(m.type===ue.FunctionDeclaration||m.type===ue.FunctionExpression||m.type===ue.ArrowFunctionExpression){let d=m.params;for(let T of d)if(c.range[0]>=T.range[0]&&c.range[1]<=T.range[1])return!0;break}m=m.parent}return!1}function p(c){let m=c.parent;for(;m;){if(m.type===ue.TSTypeParameterInstantiation){let d=m.parent;if(d.type===ue.TSTypeReference&&d.typeName.type===ue.Identifier&&(d.typeName.name==="FC"||d.typeName.name==="React.FC")||d.type===ue.TSTypeReference&&d.typeName.type===ue.TSQualifiedName&&d.typeName.right.name==="FC")return!0}m=m.parent}return!1}let u=[];return{Program(c){o.push(...c.body)},TSTypeAliasDeclaration(c){if(o.some(d=>d.type===ue.ExportNamedDeclaration&&d.declaration===c?!0:d===c)){let d=i(c);d&&t.set(c.id.name,{node:c,name:c.id.name,statement:d})}},TSInterfaceDeclaration(c){if(o.some(d=>d.type===ue.ExportNamedDeclaration&&d.declaration===c?!0:d===c)){let d=i(c);d&&t.set(c.id.name,{node:c,name:c.id.name,statement:d})}},TSTypeReference(c){c.typeName.type===ue.Identifier&&u.push({typeName:c.typeName.name,node:c,inFunctionArgs:a(c),inFCProps:p(c)})},"Program:exit"(){let c=new Map,m=u.filter(h=>{let{typeName:x}=h;if(!r.checkOnly||r.checkOnly.length===0)return!0;if(u.filter(b=>b.typeName===x).length>1)return!1;for(let b of r.checkOnly)if(b==="function-args"&&h.inFunctionArgs||b==="FC"&&h.inFCProps)return!0;return!1});for(let h of m){let{typeName:x,node:f}=h;if(t.has(x)){let b=i(f),I=t.get(x);if(b&&I&&b!==I.statement){c.has(x)||c.set(x,[]);let S=c.get(x);if(!S)return;S.includes(b)||S.push(b)}}}let d=[];for(let[h,x]of c)if(x.length>0){let f=x[0];if(!f)continue;for(let b of x)b.range[0]<f.range[0]&&(f=b);d.push({typeName:h,firstUsage:f})}let T=d.sort((h,x)=>h.firstUsage.range[0]-x.firstUsage.range[0]);if(T.length>0){let h=T[0];h&&l(h.typeName,h.firstUsage)}}}}});var en={[vt.name]:vt.rule,[pt.name]:pt.rule,[lt.name]:lt.rule,"rules-of-hooks":Gr,"exhaustive-deps":nr,"require-description":Vr.rule,[ct.name]:ct.rule,[ft.name]:ft.rule,[Ot.name]:Ot.rule,[Qe.name]:Qe.rule,[at.name]:at.rule,[St.name]:St.rule,[De.name]:De.rule,[Mt.name]:Mt.rule,[yt.name]:yt.rule,[ut.name]:ut.rule,[Tt.name]:Tt.rule,[tt.name]:tt.rule,[jt.name]:jt.rule,[Ke.name]:Ke.rule,[st.name]:st.rule,[xt.name]:xt.rule,[Ct.name]:Ct.rule,[wt.name]:wt.rule,[At.name]:At.rule,[It.name]:It.rule,[Nt.name]:Nt.rule,[Et.name]:Et.rule,[ht.name]:ht.rule,[zt.name]:zt.rule,[kt.name]:kt.rule,[Lt.name]:Lt.rule,[Ut.name]:Ut.rule,[Vt.name]:Vt.rule,[De.name]:De.rule};var ql={rules:en};export{ql as extendedLintPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ls-stack/extended-lint",
3
- "version": "0.58.0",
3
+ "version": "0.59.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"