@ls-stack/extended-lint 0.60.0 → 0.60.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
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 Z=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=Z.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===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 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===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(sr(c))e.report({node:i,messageId:"thisKeywordInMethod"});else{let m=p.params.map(g=>s.getText(g)).join(", "),u="";p.generator?u=`${a}: function* (${m}) ${c}`:u=`${a}: (${m}) => ${c}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:g=>g.replaceText(i,u)})}}}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);sr(p)&&e.report({node:s,messageId:"thisKeywordInMethod"})}}}return{CallExpression(l){if(Cn(l.callee))for(let i of l.arguments){if(i.type===Z.AST_NODE_TYPES.ObjectExpression&&(t(i),o(i)),i.type===Z.AST_NODE_TYPES.ArrowFunctionExpression&&(i.body.type===Z.AST_NODE_TYPES.ObjectExpression&&(t(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&&(t(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&&(t(s.argument),o(s.argument))}}}}}),pt={name:or,rule:wn};var te=require("@typescript-eslint/utils"),R=require("zod/v4");var An=R.z.object({disallow:R.z.array(R.z.object({selector:R.z.string(),message:R.z.string(),replace:R.z.optional(R.z.union([R.z.string(),R.z.object({regex:R.z.string(),with:R.z.string()})])),replaceType:R.z.optional(R.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:R.z.optional(R.z.array(R.z.object({fn:R.z.string(),withArgs:R.z.optional(R.z.array(R.z.object({atIndex:R.z.number(),value:R.z.union([R.z.string(),R.z.number(),R.z.boolean()])}))),message:R.z.string(),replaceWith:R.z.optional(R.z.string()),ignoreRegex:R.z.optional(R.z.string())}))),__dev_simulateFileName:R.z.optional(R.z.string()),mustMatchSyntax:R.z.optional(R.z.array(R.z.object({includeRegex:R.z.string(),mustCallFn:R.z.optional(R.z.array(R.z.object({anyCall:R.z.array(R.z.object({fn:R.z.string(),withArgs:R.z.array(R.z.object({atIndex:R.z.number(),literal:R.z.union([R.z.string(),R.z.number(),R.z.boolean()])}))})),message:R.z.optional(R.z.string())}))),mustMatchSelector:R.z.optional(R.z.array(R.z.object({selector:R.z.string(),message:R.z.string()}))),mustHaveExport:R.z.optional(R.z.array(R.z.object({name:R.z.string(),type:R.z.enum(["function","variable","any"]).default("any"),message:R.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,c=new Set,m=new Map,u=new Set,g=new Map;function d(y){for(let b of y.specifiers)b.type===te.AST_NODE_TYPES.ImportSpecifier&&b.imported.type===te.AST_NODE_TYPES.Identifier&&b.imported.name!==b.local.name&&g.set(b.local.name,b.imported.name)}function C(y){if(y.declaration){if(y.declaration.type===te.AST_NODE_TYPES.FunctionDeclaration&&y.declaration.id){let b=y.declaration.id.name;for(let v of Array.from(u)){let[w,A]=v.split(":");w===b&&(A==="function"||A==="any")&&u.delete(v)}}else if(y.declaration.type===te.AST_NODE_TYPES.VariableDeclaration){for(let b of y.declaration.declarations)if(b.id.type===te.AST_NODE_TYPES.Identifier){let v=b.id.name;for(let w of Array.from(u)){let[A,N]=w.split(":");A===v&&(N==="variable"||N==="any")&&u.delete(w)}}}}for(let b of y.specifiers)if(b.exported.type===te.AST_NODE_TYPES.Identifier){let v=b.exported.name;for(let w of Array.from(u)){let[A,N]=w.split(":");A===v&&N==="any"&&u.delete(w)}}}function h(y){y.id.type===te.AST_NODE_TYPES.Identifier&&y.init?.type===te.AST_NODE_TYPES.Identifier&&g.set(y.id.name,y.init.name)}function f(y){return g.get(y)??y}function I(y,b){return f(y)===b||y===b}for(let{includeRegex:y,mustCallFn:b,mustMatchSelector:v,mustHaveExport:w}of t??[]){let A=Rn(s,new RegExp(y));if(!A)continue;let N=V=>{let q=V;for(let{name:ee,value:Q}of A)q=q.replaceAll(ee,Q);return q};for(let{anyCall:V,message:q}of b??[]){let ee=`Expected file to call the function: ${V.map(({fn:Q})=>Q).join(" or ")}`;c.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){c.delete(ee);for(let ce of me){let ie=Q.arguments[ce.atIndex],Se=typeof ce.literal=="string"?N(ce.literal):ce.literal;if(!ie){e.report({node:Q,messageId:"default",data:{message:`Missing argument with value "${Se}" at index ${ce.atIndex}${q?`: ${N(q)}`:""}`}});continue}if(ie.type!==te.AST_NODE_TYPES.Literal){e.report({node:ie,messageId:"default",data:{message:`Argument at position ${ce.atIndex} should the literal "${Se}"${q?`: ${N(q)}`:""}`}});continue}ie.value!==Se&&e.report({node:ie,messageId:"default",data:{message:`Argument should have the value "${Se}"${q?`: ${N(q)}`:""}`},fix:Ne=>Ne.replaceText(ie,typeof Se=="string"?`'${Se}'`:String(Se))})}break}}})}for(let{selector:V,message:q}of v??[])m.set(V,N(q)),p.set(N(V),()=>{m.delete(V)});for(let{name:V,type:q,message:ee}of w??[]){let Q=N(V),Ce=N(ee);u.add(`${Q}:${q}:${Ce}`)}}for(let{fn:y,withArgs:b,message:v,replaceWith:w,ignoreRegex:A}of i??[])A&&new RegExp(A).test(s)||a.push(N=>{let{callee:V}=N;if(V.type!==te.AST_NODE_TYPES.Identifier||!I(V.name,y))return;if(b)for(let ee of b){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}: ${v}`}});return}if(Q.type!==te.AST_NODE_TYPES.Literal||Q.value!==ee.value)return}let q=ee=>w?ee.replaceText(N,w):null;e.report({node:N,messageId:"default",data:{message:v},suggest:w?[{messageId:"default",data:{message:`Replace with "${w}"`},fix:q}]:void 0})});function E(y,b){let v=n[y];v?n[y]=w=>{v(w),b(w)}:n[y]=b}for(let{selector:y,message:b,replace:v,replaceType:w="suggestion"}of l??[]){if(y==="CallExpression"){a.push(A=>{S(v,A,b,w)});continue}n[y]=A=>{S(v,A,b,w)}}if(p.size>0)for(let[y,b]of p)E(y,b);return a.length>0&&(n.CallExpression=y=>{if(y.type===te.AST_NODE_TYPES.CallExpression)for(let b of a)b(y)}),n.ImportDeclaration=y=>{y.type===te.AST_NODE_TYPES.ImportDeclaration&&d(y)},n.ExportNamedDeclaration=y=>{y.type===te.AST_NODE_TYPES.ExportNamedDeclaration&&C(y)},n.VariableDeclarator=y=>{y.type===te.AST_NODE_TYPES.VariableDeclarator&&h(y)},n["Program:exit"]=y=>{for(let b of c)e.report({node:y,messageId:"default",data:{message:b}});for(let[,b]of m)e.report({node:y,messageId:"default",data:{message:b}});for(let b of u){let[v,w,A]=b.split(":");e.report({node:y,messageId:"default",data:{message:`Missing required export "${v}" of type ${w}: ${A}`}})}},n;function S(y,b,v,w){let A=N=>{if(!y)return null;if(typeof y=="string")return N.replaceText(b,y);{let V=new RegExp(y.regex),q=e.sourceCode.getText(b);return N.replaceText(b,q.replace(V,y.with))}};e.report({node:b,messageId:"default",data:{message:v},fix:y&&w==="autofix"?A:void 0,suggest:y&&w==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof y=="string"?y:y.with}"`},fix:A}]: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 c=p.parent.type===$.AST_NODE_TYPES.Property,m=c?i:o,u=p.properties.length;if(u>m)return!1;if(u===1){let d=p.properties[0];return!d||d.type===$.AST_NODE_TYPES.Property&&d.value.type===$.AST_NODE_TYPES.ObjectExpression||d.type===$.AST_NODE_TYPES.Property&&d.value.type===$.AST_NODE_TYPES.ArrayExpression&&!d.value.elements.every(h=>h&&ut(h))?!1:{text:n.getText(d),isNested:c,propsSize:u}}let g=[];for(let d of p.properties){if(d.type===$.AST_NODE_TYPES.Property&&!ut(d.value))return!1;g.push(n.getText(d))}return{text:g.join(", "),isNested:c,propsSize:u}}else{let c=p.parent.parent?.type===$.AST_NODE_TYPES.TSPropertySignature,m=c?i:o,u=p.members.length;if(u>m)return!1;if(t.length>0&&p.parent.type===$.AST_NODE_TYPES.TSTypeAliasDeclaration){let d=p.parent.id.name;if(t.some(C=>d.endsWith(C)))return!1}if(u===1){let d=p.members[0];return!d||d.type===$.AST_NODE_TYPES.TSPropertySignature&&d.typeAnnotation?.typeAnnotation.type===$.AST_NODE_TYPES.TSTypeLiteral?!1:{text:n.getText(d),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 g=[];for(let d of p.members){if(d.type!==$.AST_NODE_TYPES.TSPropertySignature)return!1;let C=d.typeAnnotation?.typeAnnotation;if(!C||C.type===$.AST_NODE_TYPES.TSTypeLiteral||!pr(C))return!1;if(C.type===$.AST_NODE_TYPES.TSTypeReference&&C.typeArguments){if(C.typeArguments.params.length>1)return!1;let f=C.typeArguments.params[0];if(!f||!pr(f))return!1}let h=n.getText(d).trim();(h.endsWith(";")||h.endsWith(","))&&(h=h.slice(0,-1)),g.push(h)}return{text:g.join("; "),isNested:c,propsSize:u}}}function a(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==$.AST_NODE_TYPES.JSXExpressionContainer){let C=0,h=!1,f=n.getTokenAfter(p,{filter:E=>E.type!==$.AST_TOKEN_TYPES.Punctuator||h?!0:E.value===","?(C++,!1):E.value===";"?(C++,h=!0,!1):E.value===")"||E.value==="}"?(C++,!1):!0});if(C>4)return;let I=f?.type===$.AST_TOKEN_TYPES.Template&&f.value.startsWith(`}
1
+ "use strict";var mn=Object.create;var Be=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)Be(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&&Be(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?Be(n,"default",{value:e,enumerable:!0}):n,e)),hn=e=>rr(Be({},"__esModule",{value:!0}),e);var ys={};Tn(ys,{extendedLintPlugin:()=>ds});module.exports=hn(ys);var Z=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=Z.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===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 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===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(sr(c))e.report({node:i,messageId:"thisKeywordInMethod"});else{let m=p.params.map(g=>s.getText(g)).join(", "),u="";p.generator?u=`${a}: function* (${m}) ${c}`:u=`${a}: (${m}) => ${c}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:g=>g.replaceText(i,u)})}}}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);sr(p)&&e.report({node:s,messageId:"thisKeywordInMethod"})}}}return{CallExpression(l){if(Cn(l.callee))for(let i of l.arguments){if(i.type===Z.AST_NODE_TYPES.ObjectExpression&&(t(i),o(i)),i.type===Z.AST_NODE_TYPES.ArrowFunctionExpression&&(i.body.type===Z.AST_NODE_TYPES.ObjectExpression&&(t(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&&(t(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&&(t(s.argument),o(s.argument))}}}}}),pt={name:or,rule:wn};var te=require("@typescript-eslint/utils"),R=require("zod/v4");var An=R.z.object({disallow:R.z.array(R.z.object({selector:R.z.string(),message:R.z.string(),replace:R.z.optional(R.z.union([R.z.string(),R.z.object({regex:R.z.string(),with:R.z.string()})])),replaceType:R.z.optional(R.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:R.z.optional(R.z.array(R.z.object({fn:R.z.string(),withArgs:R.z.optional(R.z.array(R.z.object({atIndex:R.z.number(),value:R.z.union([R.z.string(),R.z.number(),R.z.boolean()])}))),message:R.z.string(),replaceWith:R.z.optional(R.z.string()),ignoreRegex:R.z.optional(R.z.string())}))),__dev_simulateFileName:R.z.optional(R.z.string()),mustMatchSyntax:R.z.optional(R.z.array(R.z.object({includeRegex:R.z.string(),mustCallFn:R.z.optional(R.z.array(R.z.object({anyCall:R.z.array(R.z.object({fn:R.z.string(),withArgs:R.z.array(R.z.object({atIndex:R.z.number(),literal:R.z.union([R.z.string(),R.z.number(),R.z.boolean()])}))})),message:R.z.optional(R.z.string())}))),mustMatchSelector:R.z.optional(R.z.array(R.z.object({selector:R.z.string(),message:R.z.string()}))),mustHaveExport:R.z.optional(R.z.array(R.z.object({name:R.z.string(),type:R.z.enum(["function","variable","any"]).default("any"),message:R.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,c=new Set,m=new Map,u=new Set,g=new Map;function y(d){for(let b of d.specifiers)b.type===te.AST_NODE_TYPES.ImportSpecifier&&b.imported.type===te.AST_NODE_TYPES.Identifier&&b.imported.name!==b.local.name&&g.set(b.local.name,b.imported.name)}function C(d){if(d.declaration){if(d.declaration.type===te.AST_NODE_TYPES.FunctionDeclaration&&d.declaration.id){let b=d.declaration.id.name;for(let v of Array.from(u)){let[w,A]=v.split(":");w===b&&(A==="function"||A==="any")&&u.delete(v)}}else if(d.declaration.type===te.AST_NODE_TYPES.VariableDeclaration){for(let b of d.declaration.declarations)if(b.id.type===te.AST_NODE_TYPES.Identifier){let v=b.id.name;for(let w of Array.from(u)){let[A,N]=w.split(":");A===v&&(N==="variable"||N==="any")&&u.delete(w)}}}}for(let b of d.specifiers)if(b.exported.type===te.AST_NODE_TYPES.Identifier){let v=b.exported.name;for(let w of Array.from(u)){let[A,N]=w.split(":");A===v&&N==="any"&&u.delete(w)}}}function h(d){d.id.type===te.AST_NODE_TYPES.Identifier&&d.init?.type===te.AST_NODE_TYPES.Identifier&&g.set(d.id.name,d.init.name)}function f(d){return g.get(d)??d}function I(d,b){return f(d)===b||d===b}for(let{includeRegex:d,mustCallFn:b,mustMatchSelector:v,mustHaveExport:w}of t??[]){let A=Rn(s,new RegExp(d));if(!A)continue;let N=V=>{let q=V;for(let{name:ee,value:Q}of A)q=q.replaceAll(ee,Q);return q};for(let{anyCall:V,message:q}of b??[]){let ee=`Expected file to call the function: ${V.map(({fn:Q})=>Q).join(" or ")}`;c.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){c.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 v??[])m.set(V,N(q)),p.set(N(V),()=>{m.delete(V)});for(let{name:V,type:q,message:ee}of w??[]){let Q=N(V),Ce=N(ee);u.add(`${Q}:${q}:${Ce}`)}}for(let{fn:d,withArgs:b,message:v,replaceWith:w,ignoreRegex:A}of i??[])A&&new RegExp(A).test(s)||a.push(N=>{let{callee:V}=N;if(V.type!==te.AST_NODE_TYPES.Identifier||!I(V.name,d))return;if(b)for(let ee of b){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}: ${v}`}});return}if(Q.type!==te.AST_NODE_TYPES.Literal||Q.value!==ee.value)return}let q=ee=>w?ee.replaceText(N,w):null;e.report({node:N,messageId:"default",data:{message:v},suggest:w?[{messageId:"default",data:{message:`Replace with "${w}"`},fix:q}]:void 0})});function E(d,b){let v=n[d];v?n[d]=w=>{v(w),b(w)}:n[d]=b}for(let{selector:d,message:b,replace:v,replaceType:w="suggestion"}of l??[]){if(d==="CallExpression"){a.push(A=>{S(v,A,b,w)});continue}n[d]=A=>{S(v,A,b,w)}}if(p.size>0)for(let[d,b]of p)E(d,b);return a.length>0&&(n.CallExpression=d=>{if(d.type===te.AST_NODE_TYPES.CallExpression)for(let b of a)b(d)}),n.ImportDeclaration=d=>{d.type===te.AST_NODE_TYPES.ImportDeclaration&&y(d)},n.ExportNamedDeclaration=d=>{d.type===te.AST_NODE_TYPES.ExportNamedDeclaration&&C(d)},n.VariableDeclarator=d=>{d.type===te.AST_NODE_TYPES.VariableDeclarator&&h(d)},n["Program:exit"]=d=>{for(let b of c)e.report({node:d,messageId:"default",data:{message:b}});for(let[,b]of m)e.report({node:d,messageId:"default",data:{message:b}});for(let b of u){let[v,w,A]=b.split(":");e.report({node:d,messageId:"default",data:{message:`Missing required export "${v}" of type ${w}: ${A}`}})}},n;function S(d,b,v,w){let A=N=>{if(!d)return null;if(typeof d=="string")return N.replaceText(b,d);{let V=new RegExp(d.regex),q=e.sourceCode.getText(b);return N.replaceText(b,q.replace(V,d.with))}};e.report({node:b,messageId:"default",data:{message:v},fix:d&&w==="autofix"?A:void 0,suggest:d&&w==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof d=="string"?d:d.with}"`},fix:A}]: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 c=p.parent.type===$.AST_NODE_TYPES.Property,m=c?i:o,u=p.properties.length;if(u>m)return!1;if(u===1){let y=p.properties[0];return!y||y.type===$.AST_NODE_TYPES.Property&&y.value.type===$.AST_NODE_TYPES.ObjectExpression||y.type===$.AST_NODE_TYPES.Property&&y.value.type===$.AST_NODE_TYPES.ArrayExpression&&!y.value.elements.every(h=>h&&ut(h))?!1:{text:n.getText(y),isNested:c,propsSize:u}}let g=[];for(let y of p.properties){if(y.type===$.AST_NODE_TYPES.Property&&!ut(y.value))return!1;g.push(n.getText(y))}return{text:g.join(", "),isNested:c,propsSize:u}}else{let c=p.parent.parent?.type===$.AST_NODE_TYPES.TSPropertySignature,m=c?i:o,u=p.members.length;if(u>m)return!1;if(t.length>0&&p.parent.type===$.AST_NODE_TYPES.TSTypeAliasDeclaration){let y=p.parent.id.name;if(t.some(C=>y.endsWith(C)))return!1}if(u===1){let y=p.members[0];return!y||y.type===$.AST_NODE_TYPES.TSPropertySignature&&y.typeAnnotation?.typeAnnotation.type===$.AST_NODE_TYPES.TSTypeLiteral?!1:{text:n.getText(y),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 g=[];for(let y of p.members){if(y.type!==$.AST_NODE_TYPES.TSPropertySignature)return!1;let C=y.typeAnnotation?.typeAnnotation;if(!C||C.type===$.AST_NODE_TYPES.TSTypeLiteral||!pr(C))return!1;if(C.type===$.AST_NODE_TYPES.TSTypeReference&&C.typeArguments){if(C.typeArguments.params.length>1)return!1;let f=C.typeArguments.params[0];if(!f||!pr(f))return!1}let h=n.getText(y).trim();(h.endsWith(";")||h.endsWith(","))&&(h=h.slice(0,-1)),g.push(h)}return{text:g.join("; "),isNested:c,propsSize:u}}}function a(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==$.AST_NODE_TYPES.JSXExpressionContainer){let C=0,h=!1,f=n.getTokenAfter(p,{filter:E=>E.type!==$.AST_TOKEN_TYPES.Punctuator||h?!0:E.value===","?(C++,!1):E.value===";"?(C++,h=!0,!1):E.value===")"||E.value==="}"?(C++,!1):!0});if(C>4)return;let I=f?.type===$.AST_TOKEN_TYPES.Template&&f.value.startsWith(`}
2
2
  `);if(f?.loc.start.line===p.loc.end.line&&!I)return}let c=s(p);if(!c)return;let m=c.text;if(m.includes(`
3
- `)||n.getCommentsInside(p).length>0)return;m.endsWith(";")&&(m=m.slice(0,-1));let u=`{ ${m} }`,g=Pn(n,p),d=c.isNested&&c.propsSize>2?l:r.maxLineLength;d&&u.length+g.length+On(p,n)>d||e.report({node:p,messageId:"singleLineProp",fix:C=>C.replaceText(p,u)})}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,c=new WeakSet,m=new WeakMap,u=new WeakMap,g=new WeakSet;function d(f,I){return function(E){if(I.has(E))return I.get(E);let S=f(E);return I.set(E,S),S}}function C(f,I,E,S,y){y&&f.async&&s({node:f,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
3
+ `)||n.getCommentsInside(p).length>0)return;m.endsWith(";")&&(m=m.slice(0,-1));let u=`{ ${m} }`,g=Pn(n,p),y=c.isNested&&c.propsSize>2?l:r.maxLineLength;y&&u.length+g.length+On(p,n)>y||e.report({node:p,messageId:"singleLineProp",fix:C=>C.replaceText(p,u)})}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,c=new WeakSet,m=new WeakMap,u=new WeakMap,g=new WeakSet;function y(f,I){return function(E){if(I.has(E))return I.get(E);let S=f(E);return I.set(E,S),S}}function C(f,I,E,S,d){d&&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,16 +12,16 @@ 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 b=a.acquire(f),v=new Set,w=null;{let T=b.upper;for(;T&&(v.add(T),T.type!=="function");)T=T.upper;if(!T)return;w=T}let A=Array.isArray;function N(T){if(!A(T.defs))return!1;let x=T.defs[0];if(x==null||x.node.type!=="VariableDeclarator")return!1;let k=x.node.init;if(k==null)return!1;for(;k.type==="TSAsExpression";)k=k.expression;let F=x.node.parent;if(F==null&&(yt(w.block,x.node.id),F=x.node.parent,F==null))return!1;if(F.kind==="const"&&k.type==="Literal"&&(typeof k.value=="string"||typeof k.value=="number"||k.value===null))return!0;if(k.type!=="CallExpression")return!1;let P=k.callee;if(P.type==="MemberExpression"&&P.object.name==="React"&&P.property!=null&&!P.computed&&(P=P.property),P.type!=="Identifier")return!1;let O=x.node.id,{name:M}=P;if(M==="useRef"&&O.type==="Identifier")return!0;if(_n(P)&&O.type==="Identifier"){for(let j of T.references)j!==O&&g.add(j.identifier);return!0}else if(M==="useState"||M==="useReducer"){if(O.type==="ArrayPattern"&&O.elements.length===2&&A(T.identifiers)){if(O.elements[1]===T.identifiers[0]){if(M==="useState"){let j=T.references,le=0;for(let Te=0;Te<j.length;Te++){if(j[Te].isWrite()&&le++,le>1)return!1;p.set(j[Te].identifier,O.elements[0])}}return!0}else if(O.elements[0]===T.identifiers[0]){if(M==="useState"){let j=T.references;for(let le=0;le<j.length;le++)c.add(j[le].identifier)}return!1}}}else if(M==="useTransition"&&O.type==="ArrayPattern"&&O.elements.length===2&&Array.isArray(T.identifiers)&&O.elements[1]===T.identifiers[0])return!0;return!1}function V(T){if(!A(T.defs))return!1;let x=T.defs[0];if(x==null||x.node==null||x.node.id==null)return!1;let k=x.node,F=w.childScopes,P=null,O;for(O=0;O<F.length;O++){let M=F[O],j=M.block;if(k.type==="FunctionDeclaration"&&j===k||k.type==="VariableDeclarator"&&j.parent===k){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&&v.has(M.resolved.scope)&&!q(M.resolved))return!1}return!0}let q=d(N,m),ee=d(V,u),Q=new Map;function Ce(T){let x=T.from,k=!1;for(;x.block!==f;)x.type==="function"&&(k=x.block.parent!=null&&x.block.parent.type==="ReturnStatement"),x=x.upper;return k}let B=new Map,me=new Map;ce(b);function ce(T){for(let x of T.references){if(!x.resolved||!v.has(x.resolved.scope))continue;let k=yt(f,x.identifier),F=mr(k),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(x)&&Q.set(P,{reference:x,dependencyNode:F}),F.parent.type==="TSTypeQuery"||F.parent.type==="TSTypeReference")continue;let O=x.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(x);else{let M=x.resolved,j=q(M)||ee(M);B.set(P,{isStable:j,references:[x]})}}for(let x of T.childScopes)ce(x)}Q.forEach(({reference:T,dependencyNode:x},k)=>{let F=T.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:x.parent.property,message:`The ref value '${k}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${k}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ie=new Set;function Se(T,x){ie.has(x)||(ie.add(x),s({node:T,message:`Assignments to the '${x}' variable from inside React Hook ${n(E)} 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(E)}.`}))}let Ne=new Set;if(B.forEach(({isStable:T,references:x},k)=>{T&&Ne.add(k),x.forEach(F=>{F.writeExpr&&Se(F.writeExpr,k)})}),ie.size>0)return;if(!I){let T=null;if(B.forEach(({isStable:x,references:k},F)=>{T||k.forEach(P=>{if(T)return;let O=P.identifier;if(!p.has(O))return;let j=P.from;for(;j.type!=="function";)j=j.upper;j.block===f&&(T=F)})}),T){let{suggestedDependencies:x}=mt({dependencies:B,declaredDependencies:[],stableDependencies:Ne,externalDependencies:new Set,isEffect:!0});s({node:E,message:`React Hook ${S} contains a call to '${T}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+x.join(", ")+`] as a second argument to the ${S} Hook.`,suggest:[{desc:`Add dependencies array: [${x.join(", ")}]`,fix(k){return k.insertTextAfter(f,`, [${x.join(", ")}]`)}}]})}return}let _e=[],$e=new Set;I.type!=="ArrayExpression"?s({node:I,message:`React Hook ${n(E)} 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(T=>{if(T===null)return;if(T.type==="SpreadElement"){s({node:T,message:`React Hook ${n(E)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}g.has(T)&&s({node:T,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${n(T)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${n(T)}\``,fix(P){return P.removeRange(T.range)}}]});let x;try{x=Ee(T,me)}catch(P){if(/Unsupported node type/.test(P.message)){T.type==="Literal"?B.has(T.value)?s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. Did you mean to include ${T.value} in the array instead?`}):s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:T,message:`React Hook ${n(E)} 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 k=T;for(;k.type==="MemberExpression"||k.type==="OptionalMemberExpression"||k.type==="ChainExpression";)k=k.object||k.expression.object;let F=!w.through.some(P=>P.identifier===k);_e.push({key:x,node:T}),F||$e.add(x)});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:I,componentScope:w,scope:b}).forEach(({construction:x,isUsedOutsideOfHook:k,depType:F})=>{let P=F==="function"?"useCallback":"useMemo",O=F==="function"?"definition":"initialization",M=`wrap the ${O} of '${x.name.name}' in its own ${P}() Hook.`,j=k?`To fix this, ${M}`:`Move it inside the ${S} callback. Alternatively, ${M}`,le=F==="conditional"||F==="logical expression"?"could make":"makes",Te=`The '${x.name.name}' ${F} ${le} the dependencies of ${S} Hook (at line ${I.loc.start.line}) change on every render. ${j}`,er;k&&x.type==="Variable"&&F==="function"&&(er=[{desc:`Wrap the ${O} of '${x.name.name}' in its own ${P}() Hook.`,fix(tr){let[un,fn]=P==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[tr.insertTextBefore(x.node.init,un),tr.insertTextAfter(x.node.init,fn)]}}]),s({node:x.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 T=_e.map(k=>k.key),x=T.slice().sort();return T.join(",")===x.join(",")}cn()&&Ye.sort();function ot(T){let x=T.split("."),k="";for(let F=0;F<x.length;F++){if(F!==0){let P=x.slice(0,F+1).join("."),O=me.get(P)===!0;k+=O?"?.":"."}k+=x[F]}return k}function at(T,x,k,F){return T.size===0?null:(T.size>1?"":x+" ")+k+" "+(T.size>1?"dependencies":"dependency")+": "+jn(Array.from(T).sort().map(P=>"'"+ot(P)+"'"))+`. Either ${F} ${T.size>1?"them":"it"} or remove the dependency array.`}let ue="";if(Je.size>0){let T=null;if(Array.from(Je.keys()).forEach(x=>{T===null&&x.endsWith(".current")&&(T=x)}),T!==null)ue=` Mutable values like '${T}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if($e.size>0){let x=Array.from($e)[0];b.set.has(x)||(ue=` Outer scope values like '${x}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!ue&&Ie.has("props")){let T=B.get("props");if(T==null)return;let x=T.references;if(!Array.isArray(x))return;let k=!0;for(let F=0;F<x.length;F++){let P=x[F],O=yt(w.block,P.identifier);if(!O){k=!1;break}let M=O.parent;if(M==null){k=!1;break}if(M.type!=="MemberExpression"&&M.type!=="OptionalMemberExpression"){k=!1;break}}k&&(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(E)}.`)}if(!ue&&Ie.size>0){let T=null;Ie.forEach(x=>{if(T)return;let k=w.set.get(x),F=B.get(x);if(F.references[0].resolved!==k)return;let P=k.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&&(T=x)}),T!==null&&(ue=` If '${T}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!ue&&Ie.size>0){let T=null;if(Ie.forEach(x=>{if(T!==null)return;let F=B.get(x).references,P,O;for(let M=0;M<F.length;M++){for(P=F[M].identifier,O=P.parent;O!=null&&O!==w.block;){if(O.type==="CallExpression"){let j=p.get(O.callee);if(j!=null){if(j.name===x)T={missingDep:x,setter:O.callee.name,form:"updater"};else if(c.has(P))T={missingDep:x,setter:O.callee.name,form:"reducer"};else{let le=F[M].resolved;if(le!=null){let Te=le.defs[0];Te!=null&&Te.type==="Parameter"&&(T={missingDep:x,setter:O.callee.name,form:"inlineReducer"})}}break}}O=O.parent}if(T!==null)break}}),T!==null)switch(T.form){case"reducer":ue=` You can also replace multiple useState variables with useReducer if '${T.setter}' needs the current value of '${T.missingDep}'.`;break;case"inlineReducer":ue=` If '${T.setter}' needs the current value of '${T.missingDep}', you can also switch to useReducer instead of useState and read '${T.missingDep}' in the reducer.`;break;case"updater":ue=` You can also do a functional update '${T.setter}(${T.missingDep.slice(0,1)} => ...)' if you only need '${T.missingDep}' in the '${T.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:I,message:`React Hook ${n(E)} 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(T){return T.replaceText(I,`[${Ye.map(ot).join(", ")}]`)}}]})}function h(f){let I=Mn(f.callee,i);if(I===-1)return;let E=f.arguments[I],S=f.callee,y=dr(S).name,b=f.arguments[I+1],v=/Effect($|[^a-z])/g.test(y);if(!E){s({node:S,message:`React Hook ${y} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(r&&!v)){if(!b&&!v){(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(E.type){case"FunctionExpression":case"ArrowFunctionExpression":C(E,b,S,y,v);return;case"Identifier":if(!b||b.elements&&b.elements.some(N=>N&&N.type==="Identifier"&&N.name===E.name))return;let w=t(f).set.get(E.name);if(w==null||w.defs==null)return;let A=w.defs[0];if(!A||!A.node||A.type!=="Variable"&&A.type!=="FunctionName")break;switch(A.node.type){case"FunctionDeclaration":C(A.node,b,S,y,v);return;case"VariableDeclarator":let N=A.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":C(N,b,S,y,v);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: '${E.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${E.name}]`,fix(w){return w.replaceText(b,`[${E.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let f of e.sourceCode.getAllComments())if(Nn.test(f.value))return r=!0,{CallExpression:I=>h(I,!0)}}return{CallExpression:f=>h(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((C,h)=>{let f=s(l,h);f.isUsed=!0,a(l,h,I=>{I.isSubtreeUsed=!0})}),r.forEach(({key:C})=>{let h=s(l,C);h.isSatisfiedRecursively=!0}),n.forEach(C=>{let h=s(l,C);h.isSatisfiedRecursively=!0});function s(C,h){let f=h.split("."),I=C;for(let E of f){let S=I.children.get(E);S||(S=i(),I.children.set(E,S)),I=S}return I}function a(C,h,f){let I=h.split("."),E=C;for(let S of I){let y=E.children.get(S);if(!y)return;f(y),E=y}}let p=new Set,c=new Set;m(l,p,c,C=>C);function m(C,h,f,I){C.children.forEach((E,S)=>{let y=I(S);if(E.isSatisfiedRecursively){E.isSubtreeUsed&&f.add(y);return}if(E.isUsed){h.add(y);return}m(E,h,f,b=>y+"."+b)})}let u=[],g=new Set,d=new Set;return r.forEach(({key:C})=>{c.has(C)?u.indexOf(C)===-1?u.push(C):d.add(C):g.add(C)}),p.forEach(C=>{u.push(C)}),{suggestedDependencies:u,unnecessaryDependencies:g,duplicateDependencies:d,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 c=p.from;for(;c!==t&&c!=null;)c=c.upper;if(c!==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"),ne=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&ne.default.TypeFlags.Any||s.flags&ne.default.TypeFlags.Unknown?null:s.flags&ne.default.TypeFlags.StringLike?["string"]:s.flags&ne.default.TypeFlags.NumberLike?["number"]:s.flags&ne.default.TypeFlags.BigIntLike?["bigint"]:s.flags&ne.default.TypeFlags.BooleanLike?["boolean"]:s.flags&ne.default.TypeFlags.ESSymbolLike?["symbol"]:s.flags&ne.default.TypeFlags.Undefined||s.flags&ne.default.TypeFlags.Void?["undefined"]:s.flags&ne.default.TypeFlags.Null?["object"]:s.getCallSignatures().length>0?["function"]:s.flags&ne.default.TypeFlags.Object?s.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:s.flags&ne.default.TypeFlags.NonPrimitive?["object"]:s.flags&ne.default.TypeFlags.Never?["never"]:null}function l(s){if(!n)return null;let a=r.esTreeNodeToTSNodeMap.get(s),p=n.getTypeAtLocation(a.expression);if(p.flags&ne.default.TypeFlags.Any||p.flags&ne.default.TypeFlags.Unknown)return null;let c=[];if(p.isUnion()){for(let u of p.types){let g=o(u);if(g)c.push(...g);else return null}return c}let m=o(p);return m?(c.push(...m),c):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,c=null;if(t(s.left)?(p=s.left,c=s.right.type===Re.AST_NODE_TYPES.Literal&&typeof s.right.value=="string"?s.right.value:null):t(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||!Vn(c,Wn))return;let m=l(p);if(!m)return;let u=s.operator==="!==",g=m.includes(c);m.length===1?g&&!u?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:De(p,e),type:c}}):!g&&u?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:De(p,e),type:Array.from(m)[0]}}):!g&&!u?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:De(p,e),actualType:Be(m),conditionType:c}}):g&&u&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:De(p,e),actualType:Be(m),conditionType:c}}):!g&&!u?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:De(p,e),actualType:Be(m),conditionType:c}}):!g&&u&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:De(p,e),type:Be(m)}})}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 Ge=require("@typescript-eslint/utils"),Xe=require("zod/v4");var Hn=Ge.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===Ge.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(c=>!s&&c.type===Fe.AST_NODE_TYPES.TSAnyKeyword||a&&c.type===Fe.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===Fe.AST_NODE_TYPES.Identifier&&a.includes(c.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",Gn=["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 Zn(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://")||Zn(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 Gn)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(m=>/[a-zA-Z0-9]/.test(m))&&(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 Ze=require("@typescript-eslint/utils"),ti=Ze.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===Ze.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 c=Me(a.parent.parent,z.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!c)return!1;let m=Ke(c,e.sourceCode);return m?!(m.parent.type===z.TSESTree.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===z.TSESTree.AST_NODE_TYPES.Identifier&&m.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:c}of r.aliases)if(a.startsWith(c)){let m=a.replace(c,p);return{alias:p,newPath:m}}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?c=>c.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),Rt={name:Or,rule:di};var G=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 G.AST_NODE_TYPES.Literal:return!0;case G.AST_NODE_TYPES.ObjectExpression:return t.properties.every(o=>o.type===G.AST_NODE_TYPES.Property?o.computed||o.value.type===G.AST_NODE_TYPES.Identifier&&o.key.type===G.AST_NODE_TYPES.Identifier&&o.key.name===o.value.name?!1:n(o.value):!1);case G.AST_NODE_TYPES.ArrayExpression:return t.elements.every(o=>o?o.type===G.AST_NODE_TYPES.SpreadElement?!1:n(o):!0);case G.AST_NODE_TYPES.TemplateLiteral:return t.expressions.length===0;case G.AST_NODE_TYPES.ConditionalExpression:case G.AST_NODE_TYPES.LogicalExpression:case G.AST_NODE_TYPES.BinaryExpression:case G.AST_NODE_TYPES.UnaryExpression:case G.AST_NODE_TYPES.CallExpression:case G.AST_NODE_TYPES.MemberExpression:case G.AST_NODE_TYPES.Identifier:case G.AST_NODE_TYPES.ArrowFunctionExpression:case G.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(t){if(t.name.type===G.AST_NODE_TYPES.JSXIdentifier&&t.name.name==="style"&&t.value){let o=null;t.value.type===G.AST_NODE_TYPES.JSXExpressionContainer?t.value.expression.type!==G.AST_NODE_TYPES.JSXEmptyExpression&&(o=t.value.expression):t.value.type===G.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 c=o.getTokenAfter(p);c?l.push(t.replaceTextRange([p.range[0],c.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(c,m){switch(c.type){case xe.AST_NODE_TYPES.Literal:return m==="number"?typeof c.value=="number":typeof c.value=="string";case xe.AST_NODE_TYPES.TemplateLiteral:return m==="string";case xe.AST_NODE_TYPES.UnaryExpression:return m==="number"?c.operator==="+"||c.operator==="-"||c.operator==="~":!1;default:return!1}}function s(c,m){return m==="number"?!!(c.flags&Pt.TypeFlags.NumberLike):!!(c.flags&Pt.TypeFlags.StringLike)}function a(c,m){return u=>u.replaceText(c,e.sourceCode.getText(m))}function p(c){if(!l||c.arguments.length!==1)return;let m=c.arguments[0];if(!m||m.type===xe.AST_NODE_TYPES.SpreadElement)return;let{callee:u}=c;if(u.type!==xe.AST_NODE_TYPES.Identifier)return;let g=u.name,d=t.find(h=>h.name===g);if(!d)return;if(i(m,d.expectedType)||s(l.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(m)),d.expectedType)){let h,f;g==="Number"?h="unnecessaryNumberCasting":g==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",f={name:d.name,type:d.expectedType}),e.report({node:c,messageId:h,...f?{data:f}:{},fix:a(c,m)})}}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 c=l(p);c&&o(c)&&p.arguments.indexOf(a)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(u){return s.typeAnnotation?u.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 ae=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===ae.AST_NODE_TYPES.ObjectPattern||!r.init||r.init.type!==ae.AST_NODE_TYPES.ObjectExpression||r.id.type===ae.AST_NODE_TYPES.Identifier&&r.id.typeAnnotation||r.parent.parent.type===ae.AST_NODE_TYPES.ExportNamedDeclaration)return;let n=new Map;for(let i of r.init.properties)i.type===ae.AST_NODE_TYPES.Property&&i.key.type===ae.AST_NODE_TYPES.Identifier&&n.set(i.key.name,i);if(n.size===0||r.id.type!==ae.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!==ae.AST_NODE_TYPES.Property?!1:i.value.type===ae.AST_NODE_TYPES.FunctionExpression),l=new Set;for(let i of t){if(i.identifier.parent.type!==ae.AST_NODE_TYPES.MemberExpression)return;let s=i.identifier.parent;if(s.object!==i.identifier)return;if(s.computed)if(s.property.type===ae.AST_NODE_TYPES.Literal&&typeof s.property.value=="string")l.add(s.property.value);else return;else{if(s.property.type!==ae.AST_NODE_TYPES.Identifier)return;l.add(s.property.name)}if(s.parent.type===ae.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 c=Dr(p.properties,void 0);if(!c)return;if(o.id.type===W.AST_NODE_TYPES.ObjectPattern){let g=Dr(o.id.properties,s.returnProp);if(!g)return;for(let[d,C]of c)g.has(d)||e.report({node:C,messageId:"unusedSelectedValue",data:{name:d}});return}if(o.id.type!==W.AST_NODE_TYPES.Identifier||s.returnProp)return;let m=Oi(o,e.sourceCode);if(m.length===0)return;let u=new Set;for(let g of m){if(g.identifier.parent.type!==W.AST_NODE_TYPES.MemberExpression)return;let d=g.identifier.parent.property;if(d.type!==W.AST_NODE_TYPES.Identifier)return;u.add(d.name)}for(let[g,d]of c)u.has(g)||e.report({node:d,messageId:"unusedSelectedValue",data:{name:g}})}}}})};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,c,m,u=!0,g=!1){let d=c.name,C=e.sourceCode.getScope(p).references.find(S=>S.identifier.name===d)?.resolved,h=a&&_t?.some(S=>S.test(d)),f=g&&t;if(!C||!h&&C.references.filter(S=>S.isTypeReference).length>1||!C.defs[0])return;let I=C.defs[0].node,E=I.parent?.type===U.AST_NODE_TYPES.ExportNamedDeclaration;if(!(u&&E&&!f)){if(I.type===U.AST_NODE_TYPES.TSTypeAliasDeclaration){l(a,p,m,I.typeAnnotation,!0,g);return}if(I.type===U.AST_NODE_TYPES.TSInterfaceDeclaration){l(a,p,m,I.body,!0,g);return}}}function l(a,p,c,m,u,g=!1){if(m.type===U.AST_NODE_TYPES.TSInterfaceBody){for(let d of m.body)d.type===U.AST_NODE_TYPES.TSPropertySignature&&d.key.type===U.AST_NODE_TYPES.Identifier&&c.set(d.key.name,d);return}if(m.type===U.AST_NODE_TYPES.TSTypeLiteral){jr(c,...Mr(m));return}if(m.type===U.AST_NODE_TYPES.TSIntersectionType){for(let d of m.types)l(a,p,c,d,!0,g);return}u||m.type===U.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===U.AST_NODE_TYPES.Identifier&&o(a,p,m.typeName,c,!0,g)}function i(a,p,c,m=!1){for(let u of c)if(u.type===U.AST_NODE_TYPES.ObjectPattern&&u.typeAnnotation){let g=new Map;if(l(a,p,g,u.typeAnnotation.typeAnnotation,!1,m),g.size===0)continue;s(u,g)}else u.type===U.AST_NODE_TYPES.AssignmentPattern&&u.left.type===U.AST_NODE_TYPES.ObjectPattern&&i(a,p,[u.left],m)}function s(a,p){let c=[];if(a.properties.at(-1)?.type===U.AST_NODE_TYPES.RestElement)return;for(let d of a.properties)d.type===U.AST_NODE_TYPES.Property&&d.key.type===U.AST_NODE_TYPES.Identifier&&c.push(d.key.name);let u=[],g=[];for(let[d,C]of p)c.includes(d)||(g.push(d),u.push({node:C,messageId:"unusedObjectTypeProperty",data:{propertyName:d}}));for(let[d,C]of u.entries())e.report({...C,fix:d===u.length-1?h=>{let f=a.properties.at(-1),I=g.join(", ");return f?f.type===U.AST_NODE_TYPES.RestElement?null:h.insertTextAfter(f,`, ${I}`):h.insertTextBeforeRange([a.range[0]+1,a.range[1]],I)}:void 0})}return{VariableDeclaration(a){let p=a.declarations[0],c=new Map,m=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(m){if(m.type===U.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===U.AST_NODE_TYPES.Identifier)o(!0,a,m.typeName,c,!1);else if(m.type===U.AST_NODE_TYPES.TSTypeLiteral)jr(c,...Mr(m));else if(m.type===U.AST_NODE_TYPES.TSIntersectionType)for(let u of m.types)u.type===U.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===U.AST_NODE_TYPES.Identifier?o(!0,a,u.typeName,c,!1):l(!0,a,c,u,!0);if(c.size!==0&&p.init?.type===U.AST_NODE_TYPES.ArrowFunctionExpression){let u=p.init.params[0];if(!u){e.report({node:p.init,messageId:"missingComponentParam"});return}u.type===U.AST_NODE_TYPES.ObjectPattern&&s(u,c)}}},FunctionDeclaration(a){i(!1,a,a.params,t)},ArrowFunctionExpression(a){i(!1,a,a.params,t)}}}}),$t={name:Lr,rule:Li};var pe=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===pe.AST_NODE_TYPES.Identifier?r.has(t.callee.name):t.callee.type===pe.AST_NODE_TYPES.MemberExpression&&t.callee.object.type===pe.AST_NODE_TYPES.Identifier&&t.callee.property.type===pe.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===pe.AST_NODE_TYPES.ImportSpecifier&&o.imported.type===pe.AST_NODE_TYPES.Identifier&&o.imported.name==="useRef"&&r.add(o.local.name)},VariableDeclarator(t){if(t.init&&t.init.type===pe.AST_NODE_TYPES.CallExpression&&n(t.init)&&t.id.type===pe.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===pe.AST_NODE_TYPES.JSXExpressionContainer&&p.parent.type===pe.AST_NODE_TYPES.JSXAttribute&&p.parent.name.type===pe.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(c=>e.sourceCode.getText(c)).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 m=Jr(t.test);if(!m&&t.test.type===Y.AST_NODE_TYPES.UnaryExpression&&t.test.operator==="!"){let u=t.test.argument;Jr(u)&&(m=!0)}if(m&&(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 m=n.getTokenAfter(a);if(m&&m.type===Y.AST_TOKEN_TYPES.Keyword&&(m.value==="else"||m.value==="catch"))return}let p=Xi(n,t),c=`if (${i}) ${s}`;r.maxLineLength&&c.length+p.length>r.maxLineLength||e.report({node:t,messageId:"noSingleLineCurly",fix:m=>m.replaceText(t,c)})}}}});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 se=require("@typescript-eslint/utils"),fe=require("zod/v4");var Gi=se.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Xr="react-compiler-migration",Zi=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===se.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===se.AST_NODE_TYPES.MemberExpression&&e.property.type===se.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var es=Gi({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(Zi)]},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===se.AST_NODE_TYPES.Identifier?(o=t.callee.name,l=t.callee):t.callee.type===se.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===se.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===se.AST_NODE_TYPES.ObjectExpression){for(let l of o.properties)if(l.type===se.AST_NODE_TYPES.Property&&l.key.type===se.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 c of o.properties)if(c.type===se.AST_NODE_TYPES.Property&&c.key.type===se.AST_NODE_TYPES.Identifier&&c.key.name===a&&c.value.type===se.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=>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}`),Gr="require-description",rs=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,ns=/^eslint-disable-(next-)?line$/u,is=ts({name:Gr,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"}))}}}}}),Zr={name:Gr,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 c=new Set;for(let u of i.properties)u.type===_.AST_NODE_TYPES.Property&&u.key.type===_.AST_NODE_TYPES.Identifier&&c.add(u.key.name);let m=s.filter(u=>!c.has(u));if(m.length>0)if(m.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:m[0],fnName:p,customMsg:a||""}});else{let u=m.map(g=>`"${g}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:u,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]=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 u=m.parent;if(u.id.type===_.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===_.AST_NODE_TYPES.ObjectPattern){let g=Array.isArray(i.prop)?i.prop:[i.prop];t(u.id,g,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]=m=>{if(m.type!==_.AST_NODE_TYPES.MemberExpression||m.parent.type!==_.AST_NODE_TYPES.CallExpression)return;let u=m.parent;if(u.parent.type!==_.AST_NODE_TYPES.VariableDeclarator)return;let g=u.parent;if(g.id.type===_.AST_NODE_TYPES.Identifier)n.set(g.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:g.id,fnName:i.fromFnCall||"unknown function"});else if(g.id.type===_.AST_NODE_TYPES.ObjectPattern){let d=Array.isArray(i.prop)?i.prop:[i.prop];t(g.id,d,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 c=p.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 u=Array.isArray(i.prop)?i.prop:[i.prop];t(m.id,u,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...l,"Program:exit"(){for(let[i,{props:s,errorMsg:a,node:p,fnName:c}]of n){let u=e.sourceCode.getScope(p).set.get(i);if(u){let g=new Set(s);for(let d of u.references){let C=d.identifier,h=C.parent;if(!(h.type===_.AST_NODE_TYPES.VariableDeclarator&&h.id===C)){if(h.type===_.AST_NODE_TYPES.MemberExpression&&h.object===C&&h.property.type===_.AST_NODE_TYPES.Identifier&&g.has(h.property.name)){if(g.delete(h.property.name),g.size===0)break;continue}if(h.type===_.AST_NODE_TYPES.VariableDeclarator&&h.init===C&&h.id.type===_.AST_NODE_TYPES.ObjectPattern){for(let f of h.id.properties)f.type===_.AST_NODE_TYPES.Property&&f.key.type===_.AST_NODE_TYPES.Identifier&&g.has(f.key.name)&&g.delete(f.key.name);if(g.size===0)break;continue}if(!(h.type===_.AST_NODE_TYPES.MemberExpression&&h.object===C&&h.property.type===_.AST_NODE_TYPES.Identifier&&!s.includes(h.property.name))){g.clear();break}}}if(g.size>0){let d=Array.from(g);if(d.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:d[0],fnName:c,customMsg:a||""}});else{let C=d.map(h=>`"${h}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:C,fnName:c,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 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 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 c=p.identifier.parent;if(c.type==="VariableDeclarator"&&c.init&&c.init.type==="CallExpression"&&c.init.callee&&Kr(c.init.callee))for(let m of p.resolved.references)m!==p&&i.add(m.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 m=new Set;function u(S,y){let{cache:b}=u,v=b.get(S.id),w=new Set(y);if(w.has(S.id)){let A=[...w],N=A.slice(A.indexOf(S.id)+1);for(let V of N)m.add(V);return BigInt("0")}if(w.add(S.id),v!==void 0)return v;if(a.thrownSegments.includes(S))v=BigInt("0");else if(S.prevSegments.length===0)v=BigInt("1");else{v=BigInt("0");for(let A of S.prevSegments)v+=u(A,w)}return S.reachable&&v===BigInt("0")?b.delete(S.id):b.set(S.id,v),v}function g(S,y){let{cache:b}=g,v=b.get(S.id),w=new Set(y);if(w.has(S.id)){let A=Array.from(w),N=A.slice(A.indexOf(S.id)+1);for(let V of N)m.add(V);return BigInt("0")}if(w.add(S.id),v!==void 0)return v;if(a.thrownSegments.includes(S))v=BigInt("0");else if(S.nextSegments.length===0)v=BigInt("1");else{v=BigInt("0");for(let A of S.nextSegments)v+=g(A,w)}return b.set(S.id,v),v}function d(S){let{cache:y}=d,b=y.get(S.id);if(b===null)return 1/0;if(b!==void 0)return b;if(y.set(S.id,null),S.prevSegments.length===0)b=1;else{b=1/0;for(let v of S.prevSegments){let w=d(v);w<b&&(b=w)}b+=1}return y.set(S.id,b),b}u.cache=new Map,g.cache=new Map,d.cache=new Map;let C=g(a.initialSegment),h=an(p),f=qt(p),I=h?tn(h)||it(h):nn(p)||sn(p),E=1/0;for(let S of a.finalSegments){if(!S.reachable)continue;let y=d(S);y<E&&(E=y)}for(let[S,y]of c){if(!S.reachable)continue;let b=S.nextSegments.length===0?E<=d(S):E<d(S),v=u(S)*g(S),w=m.has(S.id);for(let A of y)if(w&&!Bt(A)&&e.report({node:A,message:`React Hook "${r(A)}" 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:A,message:`React Hook "${r(A)}" cannot be called in an async function.`}),!w&&v!==C&&!Bt(A)){let V=`React Hook "${r(A)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(b?" Did you accidentally call a React Hook after an early return?":"");e.report({node:A,message:V})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let N=`React Hook "${r(A)}" 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:A,message:N})}else if(h){let N=`React Hook "${r(A)}" is called in function "${r(h)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:A,message:N})}else if(p.type==="Program"){let N=`React Hook "${r(A)}" 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:A,message:N})}else if(f&&!Bt(A)){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(A)}" 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:A,message:N})}}},CallExpression(a){if(it(a.callee)){let p=Qr(o),c=Qr(l),m=p.get(c);m||(m=[],p.set(c,m)),m.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"),oe=he(require("zod/v4"));var cs=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()}),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 I=f.split(/\r?\n/),E=I.filter(y=>y.trim()!=="");if(E.length===0)return f;let S=Number.POSITIVE_INFINITY;for(let y of E){let b=y.match(/^(\s*)/);b&&(S=Math.min(S,b[1]?.length??0))}return!isFinite(S)||S===0?f:I.map(y=>y.slice(S)).join(`
17
- `)}function a(f,I,E){return f.split(/\r?\n/).map(y=>y.trim()===""?y:E.repeat(I)+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 I=f.object.type===K.AST_NODE_TYPES.Identifier?f.object.name:null,E=f.property.type===K.AST_NODE_TYPES.Identifier?f.property.name:null;return I&&E?`${I}.${E}`:E}return null}function c(f,I){if(!f)return!1;for(let E of I)if(E.includes(".")){let S=E.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===E)return!0;return!1}function m(f,I){let E=f.parent;if(E.type!==K.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let S=p(E.tag);return S?I.includes(S):!1}function u(f,I){if(!f||f.type!==K.AST_NODE_TYPES.CallExpression)return!1;let{method:E,argumentsLength:S,optionalCall:y=!0,optionalMember:b=!0}=I;return S!==void 0&&f.arguments.length!==S||!y&&f.optional||f.callee.type!==K.AST_NODE_TYPES.MemberExpression||!b&&f.callee.optional||f.callee.property.type!==K.AST_NODE_TYPES.Identifier?!1:f.callee.property.name===E}function g(f,I){if(!f||f.type!==K.AST_NODE_TYPES.CallExpression)return!1;let{name:E,argumentsLength:S,optionalCall:y=!0}=I;return S!==void 0&&f.arguments.length!==S||!y&&f.optional||f.callee.type!==K.AST_NODE_TYPES.Identifier?!1:f.callee.name===E}function d(f){return u(f.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&f.parent.type===K.AST_NODE_TYPES.CallExpression&&f.parent.arguments[0]===f&&g(f.parent.callee.type===K.AST_NODE_TYPES.MemberExpression?f.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function C(f){if(i.length>0){let I=r.getTokenBefore(f,{includeComments:!0});if(I?.type===K.AST_TOKEN_TYPES.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(d(f)||o.length>0&&m(f,o)||t.length>0&&f.parent.type===K.AST_NODE_TYPES.CallExpression&&f.parent.arguments.includes(f)&&c(f.parent.callee,t))}function h(f){let I=`__PLACEHOLDER__${Math.random()}`,E=f.quasis.map(B=>r.getText(B).slice(1,B.tail?-1:-2)).join(I),S=E.match(/\r?\n/);if(!S)return;let y=S[0],b=r.lines[r.getLocFromIndex(f.range[0]).line-1];if(!b)return;let w=b.match(/^(\s*)\S/)?.[1]??"",A;typeof l=="string"?A=l:typeof l=="number"?A=" ".repeat(l):A=w.startsWith(" ")?" ":" ";let V=s(E).replace(new RegExp(`^${y}|${y}[ ]*$`,"g"),""),q=y+a(V,1,w+A)+y+w,ee=E.includes(`\r
15
+ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let b=a.acquire(f),v=new Set,w=null;{let T=b.upper;for(;T&&(v.add(T),T.type!=="function");)T=T.upper;if(!T)return;w=T}let A=Array.isArray;function N(T){if(!A(T.defs))return!1;let x=T.defs[0];if(x==null||x.node.type!=="VariableDeclarator")return!1;let k=x.node.init;if(k==null)return!1;for(;k.type==="TSAsExpression";)k=k.expression;let F=x.node.parent;if(F==null&&(yt(w.block,x.node.id),F=x.node.parent,F==null))return!1;if(F.kind==="const"&&k.type==="Literal"&&(typeof k.value=="string"||typeof k.value=="number"||k.value===null))return!0;if(k.type!=="CallExpression")return!1;let P=k.callee;if(P.type==="MemberExpression"&&P.object.name==="React"&&P.property!=null&&!P.computed&&(P=P.property),P.type!=="Identifier")return!1;let O=x.node.id,{name:M}=P;if(M==="useRef"&&O.type==="Identifier")return!0;if(_n(P)&&O.type==="Identifier"){for(let j of T.references)j!==O&&g.add(j.identifier);return!0}else if(M==="useState"||M==="useReducer"){if(O.type==="ArrayPattern"&&O.elements.length===2&&A(T.identifiers)){if(O.elements[1]===T.identifiers[0]){if(M==="useState"){let j=T.references,le=0;for(let Te=0;Te<j.length;Te++){if(j[Te].isWrite()&&le++,le>1)return!1;p.set(j[Te].identifier,O.elements[0])}}return!0}else if(O.elements[0]===T.identifiers[0]){if(M==="useState"){let j=T.references;for(let le=0;le<j.length;le++)c.add(j[le].identifier)}return!1}}}else if(M==="useTransition"&&O.type==="ArrayPattern"&&O.elements.length===2&&Array.isArray(T.identifiers)&&O.elements[1]===T.identifiers[0])return!0;return!1}function V(T){if(!A(T.defs))return!1;let x=T.defs[0];if(x==null||x.node==null||x.node.id==null)return!1;let k=x.node,F=w.childScopes,P=null,O;for(O=0;O<F.length;O++){let M=F[O],j=M.block;if(k.type==="FunctionDeclaration"&&j===k||k.type==="VariableDeclarator"&&j.parent===k){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&&v.has(M.resolved.scope)&&!q(M.resolved))return!1}return!0}let q=y(N,m),ee=y(V,u),Q=new Map;function Ce(T){let x=T.from,k=!1;for(;x.block!==f;)x.type==="function"&&(k=x.block.parent!=null&&x.block.parent.type==="ReturnStatement"),x=x.upper;return k}let B=new Map,me=new Map;ce(b);function ce(T){for(let x of T.references){if(!x.resolved||!v.has(x.resolved.scope))continue;let k=yt(f,x.identifier),F=mr(k),P=Ee(F,me);if(d&&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(x)&&Q.set(P,{reference:x,dependencyNode:F}),F.parent.type==="TSTypeQuery"||F.parent.type==="TSTypeReference")continue;let O=x.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(x);else{let M=x.resolved,j=q(M)||ee(M);B.set(P,{isStable:j,references:[x]})}}for(let x of T.childScopes)ce(x)}Q.forEach(({reference:T,dependencyNode:x},k)=>{let F=T.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:x.parent.property,message:`The ref value '${k}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${k}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ne=new Set;function Se(T,x){ne.has(x)||(ne.add(x),s({node:T,message:`Assignments to the '${x}' variable from inside React Hook ${n(E)} 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(E)}.`}))}let Ne=new Set;if(B.forEach(({isStable:T,references:x},k)=>{T&&Ne.add(k),x.forEach(F=>{F.writeExpr&&Se(F.writeExpr,k)})}),ne.size>0)return;if(!I){let T=null;if(B.forEach(({isStable:x,references:k},F)=>{T||k.forEach(P=>{if(T)return;let O=P.identifier;if(!p.has(O))return;let j=P.from;for(;j.type!=="function";)j=j.upper;j.block===f&&(T=F)})}),T){let{suggestedDependencies:x}=mt({dependencies:B,declaredDependencies:[],stableDependencies:Ne,externalDependencies:new Set,isEffect:!0});s({node:E,message:`React Hook ${S} contains a call to '${T}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+x.join(", ")+`] as a second argument to the ${S} Hook.`,suggest:[{desc:`Add dependencies array: [${x.join(", ")}]`,fix(k){return k.insertTextAfter(f,`, [${x.join(", ")}]`)}}]})}return}let $e=[],Ue=new Set;I.type!=="ArrayExpression"?s({node:I,message:`React Hook ${n(E)} 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(T=>{if(T===null)return;if(T.type==="SpreadElement"){s({node:T,message:`React Hook ${n(E)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}g.has(T)&&s({node:T,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${n(T)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${n(T)}\``,fix(P){return P.removeRange(T.range)}}]});let x;try{x=Ee(T,me)}catch(P){if(/Unsupported node type/.test(P.message)){T.type==="Literal"?B.has(T.value)?s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. Did you mean to include ${T.value} in the array instead?`}):s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:T,message:`React Hook ${n(E)} 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 k=T;for(;k.type==="MemberExpression"||k.type==="OptionalMemberExpression"||k.type==="ChainExpression";)k=k.object||k.expression.object;let F=!w.through.some(P=>P.identifier===k);$e.push({key:x,node:T}),F||Ue.add(x)});let{suggestedDependencies:pn,unnecessaryDependencies:Ye,missingDependencies:Ie,duplicateDependencies:Qt}=mt({dependencies:B,declaredDependencies:$e,stableDependencies:Ne,externalDependencies:Ue,isEffect:d}),qe=pn;if(Qt.size+Ie.size+Ye.size===0){if(r)return;Dn({declaredDependencies:$e,declaredDependenciesNode:I,componentScope:w,scope:b}).forEach(({construction:x,isUsedOutsideOfHook:k,depType:F})=>{let P=F==="function"?"useCallback":"useMemo",O=F==="function"?"definition":"initialization",M=`wrap the ${O} of '${x.name.name}' in its own ${P}() Hook.`,j=k?`To fix this, ${M}`:`Move it inside the ${S} callback. Alternatively, ${M}`,le=F==="conditional"||F==="logical expression"?"could make":"makes",Te=`The '${x.name.name}' ${F} ${le} the dependencies of ${S} Hook (at line ${I.loc.start.line}) change on every render. ${j}`,er;k&&x.type==="Variable"&&F==="function"&&(er=[{desc:`Wrap the ${O} of '${x.name.name}' in its own ${P}() Hook.`,fix(tr){let[un,fn]=P==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[tr.insertTextBefore(x.node.init,un),tr.insertTextAfter(x.node.init,fn)]}}]),s({node:x.node,message:Te,suggest:er})});return}!d&&Ie.size>0&&(qe=mt({dependencies:B,declaredDependencies:[],stableDependencies:Ne,externalDependencies:Ue,isEffect:d}).suggestedDependencies);function cn(){if($e.length===0)return!0;let T=$e.map(k=>k.key),x=T.slice().sort();return T.join(",")===x.join(",")}cn()&&qe.sort();function ot(T){let x=T.split("."),k="";for(let F=0;F<x.length;F++){if(F!==0){let P=x.slice(0,F+1).join("."),O=me.get(P)===!0;k+=O?"?.":"."}k+=x[F]}return k}function at(T,x,k,F){return T.size===0?null:(T.size>1?"":x+" ")+k+" "+(T.size>1?"dependencies":"dependency")+": "+jn(Array.from(T).sort().map(P=>"'"+ot(P)+"'"))+`. Either ${F} ${T.size>1?"them":"it"} or remove the dependency array.`}let ue="";if(Ye.size>0){let T=null;if(Array.from(Ye.keys()).forEach(x=>{T===null&&x.endsWith(".current")&&(T=x)}),T!==null)ue=` Mutable values like '${T}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Ue.size>0){let x=Array.from(Ue)[0];b.set.has(x)||(ue=` Outer scope values like '${x}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!ue&&Ie.has("props")){let T=B.get("props");if(T==null)return;let x=T.references;if(!Array.isArray(x))return;let k=!0;for(let F=0;F<x.length;F++){let P=x[F],O=yt(w.block,P.identifier);if(!O){k=!1;break}let M=O.parent;if(M==null){k=!1;break}if(M.type!=="MemberExpression"&&M.type!=="OptionalMemberExpression"){k=!1;break}}k&&(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(E)}.`)}if(!ue&&Ie.size>0){let T=null;Ie.forEach(x=>{if(T)return;let k=w.set.get(x),F=B.get(x);if(F.references[0].resolved!==k)return;let P=k.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&&(T=x)}),T!==null&&(ue=` If '${T}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!ue&&Ie.size>0){let T=null;if(Ie.forEach(x=>{if(T!==null)return;let F=B.get(x).references,P,O;for(let M=0;M<F.length;M++){for(P=F[M].identifier,O=P.parent;O!=null&&O!==w.block;){if(O.type==="CallExpression"){let j=p.get(O.callee);if(j!=null){if(j.name===x)T={missingDep:x,setter:O.callee.name,form:"updater"};else if(c.has(P))T={missingDep:x,setter:O.callee.name,form:"reducer"};else{let le=F[M].resolved;if(le!=null){let Te=le.defs[0];Te!=null&&Te.type==="Parameter"&&(T={missingDep:x,setter:O.callee.name,form:"inlineReducer"})}}break}}O=O.parent}if(T!==null)break}}),T!==null)switch(T.form){case"reducer":ue=` You can also replace multiple useState variables with useReducer if '${T.setter}' needs the current value of '${T.missingDep}'.`;break;case"inlineReducer":ue=` If '${T.setter}' needs the current value of '${T.missingDep}', you can also switch to useReducer instead of useState and read '${T.missingDep}' in the reducer.`;break;case"updater":ue=` You can also do a functional update '${T.setter}(${T.missingDep.slice(0,1)} => ...)' if you only need '${T.missingDep}' in the '${T.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:I,message:`React Hook ${n(E)} has `+(at(Ie,"a","missing","include")||at(Ye,"an","unnecessary","exclude")||at(Qt,"a","duplicate","omit"))+ue,suggest:[{desc:`Update the dependencies array to be: [${qe.map(ot).join(", ")}]`,fix(T){return T.replaceText(I,`[${qe.map(ot).join(", ")}]`)}}]})}function h(f){let I=Mn(f.callee,i);if(I===-1)return;let E=f.arguments[I],S=f.callee,d=dr(S).name,b=f.arguments[I+1],v=/Effect($|[^a-z])/g.test(d);if(!E){s({node:S,message:`React Hook ${d} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(r&&!v)){if(!b&&!v){(d==="useMemo"||d==="useCallback")&&s({node:S,message:`React Hook ${d} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(E.type){case"FunctionExpression":case"ArrowFunctionExpression":C(E,b,S,d,v);return;case"Identifier":if(!b||b.elements&&b.elements.some(N=>N&&N.type==="Identifier"&&N.name===E.name))return;let w=t(f).set.get(E.name);if(w==null||w.defs==null)return;let A=w.defs[0];if(!A||!A.node||A.type!=="Variable"&&A.type!=="FunctionName")break;switch(A.node.type){case"FunctionDeclaration":C(A.node,b,S,d,v);return;case"VariableDeclarator":let N=A.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":C(N,b,S,d,v);return}break}break;default:s({node:S,message:`React Hook ${d} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:S,message:`React Hook ${d} has a missing dependency: '${E.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${E.name}]`,fix(w){return w.replaceText(b,`[${E.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let f of e.sourceCode.getAllComments())if(Nn.test(f.value))return r=!0,{CallExpression:I=>h(I,!0)}}return{CallExpression:f=>h(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((C,h)=>{let f=s(l,h);f.isUsed=!0,a(l,h,I=>{I.isSubtreeUsed=!0})}),r.forEach(({key:C})=>{let h=s(l,C);h.isSatisfiedRecursively=!0}),n.forEach(C=>{let h=s(l,C);h.isSatisfiedRecursively=!0});function s(C,h){let f=h.split("."),I=C;for(let E of f){let S=I.children.get(E);S||(S=i(),I.children.set(E,S)),I=S}return I}function a(C,h,f){let I=h.split("."),E=C;for(let S of I){let d=E.children.get(S);if(!d)return;f(d),E=d}}let p=new Set,c=new Set;m(l,p,c,C=>C);function m(C,h,f,I){C.children.forEach((E,S)=>{let d=I(S);if(E.isSatisfiedRecursively){E.isSubtreeUsed&&f.add(d);return}if(E.isUsed){h.add(d);return}m(E,h,f,b=>d+"."+b)})}let u=[],g=new Set,y=new Set;return r.forEach(({key:C})=>{c.has(C)?u.indexOf(C)===-1?u.push(C):y.add(C):g.add(C)}),p.forEach(C=>{u.push(C)}),{suggestedDependencies:u,unnecessaryDependencies:g,duplicateDependencies:y,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 c=p.from;for(;c!==t&&c!=null;)c=c.upper;if(c!==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 c=[];if(p.isUnion()){for(let u of p.types){let g=o(u);if(g)c.push(...g);else return null}return c}let m=o(p);return m?(c.push(...m),c):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,c=null;if(t(s.left)?(p=s.left,c=s.right.type===Re.AST_NODE_TYPES.Literal&&typeof s.right.value=="string"?s.right.value:null):t(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||!Vn(c,Wn))return;let m=l(p);if(!m)return;let u=s.operator==="!==",g=m.includes(c);m.length===1?g&&!u?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:De(p,e),type:c}}):!g&&u?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:De(p,e),type:Array.from(m)[0]}}):!g&&!u?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:De(p,e),actualType:Xe(m),conditionType:c}}):g&&u&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:De(p,e),actualType:Xe(m),conditionType:c}}):!g&&!u?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:De(p,e),actualType:Xe(m),conditionType:c}}):!g&&u&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:De(p,e),type:Xe(m)}})}return{BinaryExpression:i}}})};function Xe(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"),Ge=require("zod/v4");var Hn=Ze.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Tr="no-call-with-explicit-generics",Jn=Ge.z.object({functions:Ge.z.array(Ge.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(c=>!s&&c.type===Fe.AST_NODE_TYPES.TSAnyKeyword||a&&c.type===Fe.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===Fe.AST_NODE_TYPES.Identifier&&a.includes(c.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",Gn=["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 Zn(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://")||Zn(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 Gn)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(m=>/[a-zA-Z0-9]/.test(m))&&(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 Ke=require("@typescript-eslint/utils"),ti=Ke.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===Ke.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 c=Me(a.parent.parent,z.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!c)return!1;let m=Qe(c,e.sourceCode);return m?!(m.parent.type===z.TSESTree.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===z.TSESTree.AST_NODE_TYPES.Identifier&&m.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?!!Qe(p,e.sourceCode):!1}if(a.type===z.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!Qe(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&&!(et(t)||!r(t)))for(let o of t.typeAnnotation.members)o.type===z.TSESTree.AST_NODE_TYPES.TSPropertySignature&&n(o)},TSInterfaceDeclaration(t){if(!(et(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=Qe(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 et(e){return e?e.parent?.type===z.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===z.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Qe(e,r){if(et(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])&&!et(l[0].identifier.parent.parent))return l[0].identifier}var At={name:kr,rule:ci};var ze=require("@typescript-eslint/utils");var We=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===ze.AST_NODE_TYPES.Identifier?r.has(t.name):t.type===ze.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===ze.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===ze.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"),tt=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=tt.default.dirname(s);return tt.default.resolve(a,i)}function l(i){let s=r.rootDir??process.cwd(),a=tt.default.relative(s,i);if(a.startsWith("."))return null;a.startsWith("/")||(a=`/${a}`);for(let{find:p,replacement:c}of r.aliases)if(a.startsWith(c)){let m=a.replace(c,p);return{alias:p,newPath:m}}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?c=>c.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),Rt={name:Or,rule:di};var G=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 G.AST_NODE_TYPES.Literal:return!0;case G.AST_NODE_TYPES.ObjectExpression:return t.properties.every(o=>o.type===G.AST_NODE_TYPES.Property?o.computed||o.value.type===G.AST_NODE_TYPES.Identifier&&o.key.type===G.AST_NODE_TYPES.Identifier&&o.key.name===o.value.name?!1:n(o.value):!1);case G.AST_NODE_TYPES.ArrayExpression:return t.elements.every(o=>o?o.type===G.AST_NODE_TYPES.SpreadElement?!1:n(o):!0);case G.AST_NODE_TYPES.TemplateLiteral:return t.expressions.length===0;case G.AST_NODE_TYPES.ConditionalExpression:case G.AST_NODE_TYPES.LogicalExpression:case G.AST_NODE_TYPES.BinaryExpression:case G.AST_NODE_TYPES.UnaryExpression:case G.AST_NODE_TYPES.CallExpression:case G.AST_NODE_TYPES.MemberExpression:case G.AST_NODE_TYPES.Identifier:case G.AST_NODE_TYPES.ArrowFunctionExpression:case G.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(t){if(t.name.type===G.AST_NODE_TYPES.JSXIdentifier&&t.name.name==="style"&&t.value){let o=null;t.value.type===G.AST_NODE_TYPES.JSXExpressionContainer?t.value.expression.type!==G.AST_NODE_TYPES.JSXEmptyExpression&&(o=t.value.expression):t.value.type===G.AST_NODE_TYPES.Literal&&(o=t.value),o&&n(o)&&e.report({node:t,messageId:"noStaticStyleProp",data:{customMessage:r.customMessage?` ${r.customMessage}`:""}})}}}}});var Ve=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!==Ve.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===Ve.AST_NODE_TYPES.CallExpression&&r.callee.type===Ve.AST_NODE_TYPES.MemberExpression&&r.callee.property.type===Ve.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 c=o.getTokenAfter(p);c?l.push(t.replaceTextRange([p.range[0],c.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(c,m){switch(c.type){case xe.AST_NODE_TYPES.Literal:return m==="number"?typeof c.value=="number":typeof c.value=="string";case xe.AST_NODE_TYPES.TemplateLiteral:return m==="string";case xe.AST_NODE_TYPES.UnaryExpression:return m==="number"?c.operator==="+"||c.operator==="-"||c.operator==="~":!1;default:return!1}}function s(c,m){return m==="number"?!!(c.flags&Pt.TypeFlags.NumberLike):!!(c.flags&Pt.TypeFlags.StringLike)}function a(c,m){return u=>u.replaceText(c,e.sourceCode.getText(m))}function p(c){if(!l||c.arguments.length!==1)return;let m=c.arguments[0];if(!m||m.type===xe.AST_NODE_TYPES.SpreadElement)return;let{callee:u}=c;if(u.type!==xe.AST_NODE_TYPES.Identifier)return;let g=u.name,y=t.find(h=>h.name===g);if(!y)return;if(i(m,y.expectedType)||s(l.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(m)),y.expectedType)){let h,f;g==="Number"?h="unnecessaryNumberCasting":g==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",f={name:y.name,type:y.expectedType}),e.report({node:c,messageId:h,...f?{data:f}:{},fix:a(c,m)})}}return{CallExpression:p}}})};var He=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===He.AST_NODE_TYPES.MemberExpression){let p=a.property;if(p.type===He.AST_NODE_TYPES.Identifier)return p.name}return null}function i(s,a){if(s.type!==He.AST_NODE_TYPES.Identifier||!s.typeAnnotation)return;let p=a.parent;if(p.type===He.AST_NODE_TYPES.CallExpression){let c=l(p);c&&o(c)&&p.arguments.indexOf(a)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(u){return s.typeAnnotation?u.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 ae=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===ae.AST_NODE_TYPES.ObjectPattern||!r.init||r.init.type!==ae.AST_NODE_TYPES.ObjectExpression||r.id.type===ae.AST_NODE_TYPES.Identifier&&r.id.typeAnnotation||r.parent.parent.type===ae.AST_NODE_TYPES.ExportNamedDeclaration)return;let n=new Map;for(let i of r.init.properties)i.type===ae.AST_NODE_TYPES.Property&&i.key.type===ae.AST_NODE_TYPES.Identifier&&n.set(i.key.name,i);if(n.size===0||r.id.type!==ae.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!==ae.AST_NODE_TYPES.Property?!1:i.value.type===ae.AST_NODE_TYPES.FunctionExpression),l=new Set;for(let i of t){if(i.identifier.parent.type!==ae.AST_NODE_TYPES.MemberExpression)return;let s=i.identifier.parent;if(s.object!==i.identifier)return;if(s.computed)if(s.property.type===ae.AST_NODE_TYPES.Literal&&typeof s.property.value=="string")l.add(s.property.value);else return;else{if(s.property.type!==ae.AST_NODE_TYPES.Identifier)return;l.add(s.property.name)}if(s.parent.type===ae.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 c=Dr(p.properties,void 0);if(!c)return;if(o.id.type===W.AST_NODE_TYPES.ObjectPattern){let g=Dr(o.id.properties,s.returnProp);if(!g)return;for(let[y,C]of c)g.has(y)||e.report({node:C,messageId:"unusedSelectedValue",data:{name:y}});return}if(o.id.type!==W.AST_NODE_TYPES.Identifier||s.returnProp)return;let m=Oi(o,e.sourceCode);if(m.length===0)return;let u=new Set;for(let g of m){if(g.identifier.parent.type!==W.AST_NODE_TYPES.MemberExpression)return;let y=g.identifier.parent.property;if(y.type!==W.AST_NODE_TYPES.Identifier)return;u.add(y.name)}for(let[g,y]of c)u.has(g)||e.report({node:y,messageId:"unusedSelectedValue",data:{name:g}})}}}})};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"),Je=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=Je.z.object({forceCheckOnFCPropTypesWithName:Je.z.array(Je.z.string()).optional(),alwaysCheckFunctionOptionTypes:Je.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,c,m,u=!0,g=!1){let y=c.name,C=e.sourceCode.getScope(p).references.find(S=>S.identifier.name===y)?.resolved,h=a&&_t?.some(S=>S.test(y)),f=g&&t;if(!C||!h&&C.references.filter(S=>S.isTypeReference).length>1||!C.defs[0])return;let I=C.defs[0].node,E=I.parent?.type===U.AST_NODE_TYPES.ExportNamedDeclaration;if(!(u&&E&&!f)){if(I.type===U.AST_NODE_TYPES.TSTypeAliasDeclaration){l(a,p,m,I.typeAnnotation,!0,g);return}if(I.type===U.AST_NODE_TYPES.TSInterfaceDeclaration){l(a,p,m,I.body,!0,g);return}}}function l(a,p,c,m,u,g=!1){if(m.type===U.AST_NODE_TYPES.TSInterfaceBody){for(let y of m.body)y.type===U.AST_NODE_TYPES.TSPropertySignature&&y.key.type===U.AST_NODE_TYPES.Identifier&&c.set(y.key.name,y);return}if(m.type===U.AST_NODE_TYPES.TSTypeLiteral){jr(c,...Mr(m));return}if(m.type===U.AST_NODE_TYPES.TSIntersectionType){for(let y of m.types)l(a,p,c,y,!0,g);return}u||m.type===U.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===U.AST_NODE_TYPES.Identifier&&o(a,p,m.typeName,c,!0,g)}function i(a,p,c,m=!1){for(let u of c)if(u.type===U.AST_NODE_TYPES.ObjectPattern&&u.typeAnnotation){let g=new Map;if(l(a,p,g,u.typeAnnotation.typeAnnotation,!1,m),g.size===0)continue;s(u,g)}else u.type===U.AST_NODE_TYPES.AssignmentPattern&&u.left.type===U.AST_NODE_TYPES.ObjectPattern&&i(a,p,[u.left],m)}function s(a,p){let c=[];if(a.properties.at(-1)?.type===U.AST_NODE_TYPES.RestElement)return;for(let y of a.properties)y.type===U.AST_NODE_TYPES.Property&&y.key.type===U.AST_NODE_TYPES.Identifier&&c.push(y.key.name);let u=[],g=[];for(let[y,C]of p)c.includes(y)||(g.push(y),u.push({node:C,messageId:"unusedObjectTypeProperty",data:{propertyName:y}}));for(let[y,C]of u.entries())e.report({...C,fix:y===u.length-1?h=>{let f=a.properties.at(-1),I=g.join(", ");return f?f.type===U.AST_NODE_TYPES.RestElement?null:h.insertTextAfter(f,`, ${I}`):h.insertTextBeforeRange([a.range[0]+1,a.range[1]],I)}:void 0})}return{VariableDeclaration(a){let p=a.declarations[0],c=new Map,m=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(m){if(m.type===U.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===U.AST_NODE_TYPES.Identifier)o(!0,a,m.typeName,c,!1);else if(m.type===U.AST_NODE_TYPES.TSTypeLiteral)jr(c,...Mr(m));else if(m.type===U.AST_NODE_TYPES.TSIntersectionType)for(let u of m.types)u.type===U.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===U.AST_NODE_TYPES.Identifier?o(!0,a,u.typeName,c,!1):l(!0,a,c,u,!0);if(c.size!==0&&p.init?.type===U.AST_NODE_TYPES.ArrowFunctionExpression){let u=p.init.params[0];if(!u){e.report({node:p.init,messageId:"missingComponentParam"});return}u.type===U.AST_NODE_TYPES.ObjectPattern&&s(u,c)}}},FunctionDeclaration(a){i(!1,a,a.params,t)},ArrowFunctionExpression(a){i(!1,a,a.params,t)}}}}),$t={name:Lr,rule:Li};var pe=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===pe.AST_NODE_TYPES.Identifier?r.has(t.callee.name):t.callee.type===pe.AST_NODE_TYPES.MemberExpression&&t.callee.object.type===pe.AST_NODE_TYPES.Identifier&&t.callee.property.type===pe.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===pe.AST_NODE_TYPES.ImportSpecifier&&o.imported.type===pe.AST_NODE_TYPES.Identifier&&o.imported.name==="useRef"&&r.add(o.local.name)},VariableDeclarator(t){if(t.init&&t.init.type===pe.AST_NODE_TYPES.CallExpression&&n(t.init)&&t.id.type===pe.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===pe.AST_NODE_TYPES.JSXExpressionContainer&&p.parent.type===pe.AST_NODE_TYPES.JSXAttribute&&p.parent.name.type===pe.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(c=>e.sourceCode.getText(c)).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 rt(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?rt(e.name):e.type===D.AST_NODE_TYPES.MemberExpression&&e.property.type===D.AST_NODE_TYPES.Identifier?rt(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)||rt(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)||rt(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"),nt=he(require("zod/v4"));var Yi=Y.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Yr="prefer-single-line-if",qi=nt.default.object({maxLineLength:nt.default.number().optional(),maxNonSimpleConditionLength:nt.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 m=Jr(t.test);if(!m&&t.test.type===Y.AST_NODE_TYPES.UnaryExpression&&t.test.operator==="!"){let u=t.test.argument;Jr(u)&&(m=!0)}if(m&&(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 m=n.getTokenAfter(a);if(m&&m.type===Y.AST_TOKEN_TYPES.Keyword&&(m.value==="else"||m.value==="catch"))return}let p=Xi(n,t),c=`if (${i}) ${s}`;r.maxLineLength&&c.length+p.length>r.maxLineLength||e.report({node:t,messageId:"noSingleLineCurly",fix:m=>m.replaceText(t,c)})}}}});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 Gi=ie.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Xr="react-compiler-migration",Zi=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=Gi({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(Zi)]},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 c of o.properties)if(c.type===ie.AST_NODE_TYPES.Property&&c.key.type===ie.AST_NODE_TYPES.Identifier&&c.key.name===a&&c.value.type===ie.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=>s.replacement?a.replaceText(l.key,s.replacement):null}]})}}}}}}:{}}}),Jt={name:Xr,rule:es};var it=require("@typescript-eslint/utils"),ts=it.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Gr="require-description",rs=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,ns=/^eslint-disable-(next-)?line$/u,is=ts({name:Gr,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"}))}}}}}),Zr={name:Gr,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===it.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 c=new Set;for(let u of i.properties)u.type===_.AST_NODE_TYPES.Property&&u.key.type===_.AST_NODE_TYPES.Identifier&&c.add(u.key.name);let m=s.filter(u=>!c.has(u));if(m.length>0)if(m.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:m[0],fnName:p,customMsg:a||""}});else{let u=m.map(g=>`"${g}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:u,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]=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 u=m.parent;if(u.id.type===_.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===_.AST_NODE_TYPES.ObjectPattern){let g=Array.isArray(i.prop)?i.prop:[i.prop];t(u.id,g,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]=m=>{if(m.type!==_.AST_NODE_TYPES.MemberExpression||m.parent.type!==_.AST_NODE_TYPES.CallExpression)return;let u=m.parent;if(u.parent.type!==_.AST_NODE_TYPES.VariableDeclarator)return;let g=u.parent;if(g.id.type===_.AST_NODE_TYPES.Identifier)n.set(g.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:g.id,fnName:i.fromFnCall||"unknown function"});else if(g.id.type===_.AST_NODE_TYPES.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];t(g.id,y,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 c=p.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 u=Array.isArray(i.prop)?i.prop:[i.prop];t(m.id,u,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...l,"Program:exit"(){for(let[i,{props:s,errorMsg:a,node:p,fnName:c}]of n){let u=e.sourceCode.getScope(p).set.get(i);if(u){let g=new Set(s);for(let y of u.references){let C=y.identifier,h=C.parent;if(!(h.type===_.AST_NODE_TYPES.VariableDeclarator&&h.id===C)){if(h.type===_.AST_NODE_TYPES.MemberExpression&&h.object===C&&h.property.type===_.AST_NODE_TYPES.Identifier&&g.has(h.property.name)){if(g.delete(h.property.name),g.size===0)break;continue}if(h.type===_.AST_NODE_TYPES.VariableDeclarator&&h.init===C&&h.id.type===_.AST_NODE_TYPES.ObjectPattern){for(let f of h.id.properties)f.type===_.AST_NODE_TYPES.Property&&f.key.type===_.AST_NODE_TYPES.Identifier&&g.has(f.key.name)&&g.delete(f.key.name);if(g.size===0)break;continue}if(!(h.type===_.AST_NODE_TYPES.MemberExpression&&h.object===C&&h.property.type===_.AST_NODE_TYPES.Identifier&&!s.includes(h.property.name))){g.clear();break}}}if(g.size>0){let y=Array.from(g);if(y.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:y[0],fnName:c,customMsg:a||""}});else{let C=y.map(h=>`"${h}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:C,fnName:c,customMsg:a||""}})}}}}}}}});function en(e){return/^use[A-Z0-9]/.test(e)}function st(e){return e.type==="Identifier"?en(e.name):e.type==="MemberExpression"&&!e.computed&&st(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)||st(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 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 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 c=p.identifier.parent;if(c.type==="VariableDeclarator"&&c.init&&c.init.type==="CallExpression"&&c.init.callee&&Kr(c.init.callee))for(let m of p.resolved.references)m!==p&&i.add(m.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 m=new Set;function u(S,d){let{cache:b}=u,v=b.get(S.id),w=new Set(d);if(w.has(S.id)){let A=[...w],N=A.slice(A.indexOf(S.id)+1);for(let V of N)m.add(V);return BigInt("0")}if(w.add(S.id),v!==void 0)return v;if(a.thrownSegments.includes(S))v=BigInt("0");else if(S.prevSegments.length===0)v=BigInt("1");else{v=BigInt("0");for(let A of S.prevSegments)v+=u(A,w)}return S.reachable&&v===BigInt("0")?b.delete(S.id):b.set(S.id,v),v}function g(S,d){let{cache:b}=g,v=b.get(S.id),w=new Set(d);if(w.has(S.id)){let A=Array.from(w),N=A.slice(A.indexOf(S.id)+1);for(let V of N)m.add(V);return BigInt("0")}if(w.add(S.id),v!==void 0)return v;if(a.thrownSegments.includes(S))v=BigInt("0");else if(S.nextSegments.length===0)v=BigInt("1");else{v=BigInt("0");for(let A of S.nextSegments)v+=g(A,w)}return b.set(S.id,v),v}function y(S){let{cache:d}=y,b=d.get(S.id);if(b===null)return 1/0;if(b!==void 0)return b;if(d.set(S.id,null),S.prevSegments.length===0)b=1;else{b=1/0;for(let v of S.prevSegments){let w=y(v);w<b&&(b=w)}b+=1}return d.set(S.id,b),b}u.cache=new Map,g.cache=new Map,y.cache=new Map;let C=g(a.initialSegment),h=an(p),f=qt(p),I=h?tn(h)||st(h):nn(p)||sn(p),E=1/0;for(let S of a.finalSegments){if(!S.reachable)continue;let d=y(S);d<E&&(E=d)}for(let[S,d]of c){if(!S.reachable)continue;let b=S.nextSegments.length===0?E<=y(S):E<y(S),v=u(S)*g(S),w=m.has(S.id);for(let A of d)if(w&&!Bt(A)&&e.report({node:A,message:`React Hook "${r(A)}" 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:A,message:`React Hook "${r(A)}" cannot be called in an async function.`}),!w&&v!==C&&!Bt(A)){let V=`React Hook "${r(A)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(b?" Did you accidentally call a React Hook after an early return?":"");e.report({node:A,message:V})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let N=`React Hook "${r(A)}" 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:A,message:N})}else if(h){let N=`React Hook "${r(A)}" is called in function "${r(h)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:A,message:N})}else if(p.type==="Program"){let N=`React Hook "${r(A)}" 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:A,message:N})}else if(f&&!Bt(A)){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(A)}" 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:A,message:N})}}},CallExpression(a){if(st(a.callee)){let p=Qr(o),c=Qr(l),m=p.get(c);m||(m=[],p.set(c,m)),m.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 I=f.split(/\r?\n/),E=I.filter(d=>d.trim()!=="");if(E.length===0)return f;let S=Number.POSITIVE_INFINITY;for(let d of E){let b=d.match(/^(\s*)/);b&&(S=Math.min(S,b[1]?.length??0))}return!isFinite(S)||S===0?f:I.map(d=>d.slice(S)).join(`
17
+ `)}function a(f,I,E){return f.split(/\r?\n/).map(d=>d.trim()===""?d:E.repeat(I)+d).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 I=f.object.type===K.AST_NODE_TYPES.Identifier?f.object.name:null,E=f.property.type===K.AST_NODE_TYPES.Identifier?f.property.name:null;return I&&E?`${I}.${E}`:E}return null}function c(f,I){if(!f)return!1;for(let E of I)if(E.includes(".")){let S=E.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===E)return!0;return!1}function m(f,I){let E=f.parent;if(E.type!==K.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let S=p(E.tag);return S?I.includes(S):!1}function u(f,I){if(!f||f.type!==K.AST_NODE_TYPES.CallExpression)return!1;let{method:E,argumentsLength:S,optionalCall:d=!0,optionalMember:b=!0}=I;return S!==void 0&&f.arguments.length!==S||!d&&f.optional||f.callee.type!==K.AST_NODE_TYPES.MemberExpression||!b&&f.callee.optional||f.callee.property.type!==K.AST_NODE_TYPES.Identifier?!1:f.callee.property.name===E}function g(f,I){if(!f||f.type!==K.AST_NODE_TYPES.CallExpression)return!1;let{name:E,argumentsLength:S,optionalCall:d=!0}=I;return S!==void 0&&f.arguments.length!==S||!d&&f.optional||f.callee.type!==K.AST_NODE_TYPES.Identifier?!1:f.callee.name===E}function y(f){return u(f.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&f.parent.type===K.AST_NODE_TYPES.CallExpression&&f.parent.arguments[0]===f&&g(f.parent.callee.type===K.AST_NODE_TYPES.MemberExpression?f.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function C(f){if(i.length>0){let I=r.getTokenBefore(f,{includeComments:!0});if(I?.type===K.AST_TOKEN_TYPES.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(y(f)||o.length>0&&m(f,o)||t.length>0&&f.parent.type===K.AST_NODE_TYPES.CallExpression&&f.parent.arguments.includes(f)&&c(f.parent.callee,t))}function h(f){let I=`__PLACEHOLDER__${Math.random()}`,E=f.quasis.map(B=>r.getText(B).slice(1,B.tail?-1:-2)).join(I),S=E.match(/\r?\n/);if(!S)return;let d=S[0],b=r.lines[r.getLocFromIndex(f.range[0]).line-1];if(!b)return;let w=b.match(/^(\s*)\S/)?.[1]??"",A;typeof l=="string"?A=l:typeof l=="number"?A=" ".repeat(l):A=w.startsWith(" ")?" ":" ";let V=s(E).replace(new RegExp(`^${d}|${d}[ ]*$`,"g"),""),q=d+a(V,1,w+A)+d+w,ee=E.includes(`\r
19
19
  `)?`\r
20
20
  `:`
21
- `,Q=E.split(/\r?\n/),Ce=Q.map((B,me)=>me!==Q.length-1&&B===A+w?"":B).join(ee);if(q!==Ce)return{node:f,messageId:"improperlyIndented",fix:B=>q.split(I).map((me,ce)=>{let ie=f.quasis[ce];return ie?B.replaceTextRange([ie.range[0]+1,ie.range[1]-(ie.tail?1:2)],me):[]}).flat()}}return{TemplateLiteral(f){if(!C(f))return;let I=h(f);if(I)return e.report(I)}}}});var Gt=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===Gt.AST_NODE_TYPES.NewExpression&&r.callee.type===Gt.AST_NODE_TYPES.Identifier&&r.callee.name==="RegExp"}var Zt=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 re=require("@typescript-eslint/utils"),st=require("zod/v4");var ms=st.z.object({checkOnly:st.z.array(st.z.enum(["function-args","FC","generic-args"])).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(u,g){if(!t.has(u))return;let d=t.get(u);if(!d||d.statement===g)return;let C=o.indexOf(d.statement),h=o.indexOf(g);C===-1||h===-1||(C>h||C!==h-1)&&e.report({node:d.node,messageId:"moveTypeAboveUsage",fix:s(d.statement,g)})}function i(u){for(let g of o)if(u.range[0]>=g.range[0]&&u.range[1]<=g.range[1])return g;return null}function s(u,g){return function*(d){let C=n.getText(u),h=n.getCommentsBefore(u),f=C;h.length>0&&(f=`${h.map(w=>n.getText(w)).join(`
21
+ `,Q=E.split(/\r?\n/),Ce=Q.map((B,me)=>me!==Q.length-1&&B===A+w?"":B).join(ee);if(q!==Ce)return{node:f,messageId:"improperlyIndented",fix:B=>q.split(I).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(!C(f))return;let I=h(f);if(I)return e.report(I)}}}});var Gt=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===Gt.AST_NODE_TYPES.NewExpression&&r.callee.type===Gt.AST_NODE_TYPES.Identifier&&r.callee.name==="RegExp"}var Zt=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 oe=require("@typescript-eslint/utils"),_e=require("zod/v4");var ms=_e.z.object({checkOnly:_e.z.array(_e.z.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:_e.z.array(_e.z.string()).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(u,g){if(!t.has(u))return;let y=t.get(u);if(!y||y.statement===g)return;let C=o.indexOf(y.statement),h=o.indexOf(g);C===-1||h===-1||(C>h||C!==h-1)&&e.report({node:y.node,messageId:"moveTypeAboveUsage",fix:s(y.statement,g)})}function i(u){for(let g of o)if(u.range[0]>=g.range[0]&&u.range[1]<=g.range[1])return g;return null}function s(u,g){return function*(y){let C=n.getText(u),h=n.getCommentsBefore(u),f=C;h.length>0&&(f=`${h.map(w=>n.getText(w)).join(`
22
22
  `)}
23
23
  ${C}`);let I=u.range[0],E=u.range[1];h.length>0&&h[0]&&(I=h[0].range[0]);let S=E;for(;S<n.text.length;){let v=n.text[S];if(v===`
24
24
  `){S++;let w=S;for(;w<n.text.length&&(n.text[w]===" "||n.text[w]===" ");)w++;w<n.text.length&&n.text[w]===`
25
- `&&(S=w+1);break}else if(v===" "||v===" ")S++;else break}E=S,yield d.removeRange([I,E]);let y=n.getCommentsBefore(g),b=y.length>0&&y[0]?y[0].range[0]:g.range[0];yield d.insertTextBeforeRange([b,b],`${f}
25
+ `&&(S=w+1);break}else if(v===" "||v===" ")S++;else break}E=S,yield y.removeRange([I,E]);let d=n.getCommentsBefore(g),b=d.length>0&&d[0]?d[0].range[0]:g.range[0];yield y.insertTextBeforeRange([b,b],`${f}
26
26
 
27
- `)}}function a(u){let g=u.parent;for(;g;){if(g.type===re.AST_NODE_TYPES.FunctionDeclaration||g.type===re.AST_NODE_TYPES.FunctionExpression||g.type===re.AST_NODE_TYPES.ArrowFunctionExpression){let d=g.params;for(let C of d)if(u.range[0]>=C.range[0]&&u.range[1]<=C.range[1])return!0;break}g=g.parent}return!1}function p(u){let g=u.parent;for(;g;){if(g.type===re.AST_NODE_TYPES.TSTypeParameterInstantiation){let d=g.parent;if(d.type===re.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===re.AST_NODE_TYPES.Identifier&&(d.typeName.name==="FC"||d.typeName.name==="React.FC")||d.type===re.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===re.AST_NODE_TYPES.TSQualifiedName&&d.typeName.right.name==="FC")return!0}g=g.parent}return!1}function c(u){let g=u.parent;for(;g;){if(g.type===re.AST_NODE_TYPES.TSTypeParameterInstantiation){let d=g.parent;return!(d.type===re.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===re.AST_NODE_TYPES.Identifier&&(d.typeName.name==="FC"||d.typeName.name==="React.FC")||d.type===re.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===re.AST_NODE_TYPES.TSQualifiedName&&d.typeName.right.name==="FC")}g=g.parent}return!1}let m=[];return{Program(u){o.push(...u.body)},TSTypeAliasDeclaration(u){if(o.some(d=>d.type===re.AST_NODE_TYPES.ExportNamedDeclaration&&d.declaration===u?!0:d===u)){let d=i(u);d&&t.set(u.id.name,{node:u,name:u.id.name,statement:d})}},TSInterfaceDeclaration(u){if(o.some(d=>d.type===re.AST_NODE_TYPES.ExportNamedDeclaration&&d.declaration===u?!0:d===u)){let d=i(u);d&&t.set(u.id.name,{node:u,name:u.id.name,statement:d})}},TSTypeReference(u){u.typeName.type===re.AST_NODE_TYPES.Identifier&&m.push({typeName:u.typeName.name,node:u,inFunctionArgs:a(u),inFCProps:p(u),inGenericArgs:c(u)})},"Program:exit"(){let u=new Map,g=m.filter(h=>{let{typeName:f}=h;if(!r.checkOnly||r.checkOnly.length===0)return!0;if(m.filter(E=>E.typeName===f).length>1)return!1;for(let E of r.checkOnly)if(E==="function-args"&&h.inFunctionArgs||E==="FC"&&h.inFCProps||E==="generic-args"&&h.inGenericArgs)return!0;return!1});for(let h of g){let{typeName:f,node:I}=h;if(t.has(f)){let E=i(I),S=t.get(f);if(E&&S&&E!==S.statement){u.has(f)||u.set(f,[]);let y=u.get(f);if(!y)return;y.includes(E)||y.push(E)}}}let d=[];for(let[h,f]of u)if(f.length>0){let I=f[0];if(!I)continue;for(let E of f)E.range[0]<I.range[0]&&(I=E);d.push({typeName:h,firstUsage:I})}let C=d.sort((h,f)=>h.firstUsage.range[0]-f.firstUsage.range[0]);if(C.length>0){let h=C[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":Zr.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,[Zt.name]:Zt.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});
27
+ `)}}function a(u){let g=u.parent;for(;g;){if(g.type===oe.AST_NODE_TYPES.FunctionDeclaration||g.type===oe.AST_NODE_TYPES.FunctionExpression||g.type===oe.AST_NODE_TYPES.ArrowFunctionExpression){let y=g.params;for(let C of y)if(u.range[0]>=C.range[0]&&u.range[1]<=C.range[1])return!0;break}g=g.parent}return!1}function p(u){let g=u.parent;for(;g;){if(g.type===oe.AST_NODE_TYPES.TSTypeParameterInstantiation){let y=g.parent;if(y.type===oe.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===oe.AST_NODE_TYPES.Identifier&&(y.typeName.name==="FC"||y.typeName.name==="React.FC")||y.type===oe.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===oe.AST_NODE_TYPES.TSQualifiedName&&y.typeName.right.name==="FC")return!0}g=g.parent}return!1}function c(u){let g=u.parent;for(;g;){if(g.type===oe.AST_NODE_TYPES.TSTypeParameterInstantiation){let y=g.parent;if(y.type===oe.AST_NODE_TYPES.CallExpression||y.type===oe.AST_NODE_TYPES.NewExpression)return!0}g=g.parent}return!1}let m=[];return{Program(u){o.push(...u.body)},TSTypeAliasDeclaration(u){if(o.some(y=>y.type===oe.AST_NODE_TYPES.ExportNamedDeclaration&&y.declaration===u?!0:y===u)){let y=i(u);y&&t.set(u.id.name,{node:u,name:u.id.name,statement:y})}},TSInterfaceDeclaration(u){if(o.some(y=>y.type===oe.AST_NODE_TYPES.ExportNamedDeclaration&&y.declaration===u?!0:y===u)){let y=i(u);y&&t.set(u.id.name,{node:u,name:u.id.name,statement:y})}},TSTypeReference(u){u.typeName.type===oe.AST_NODE_TYPES.Identifier&&m.push({typeName:u.typeName.name,node:u,inFunctionArgs:a(u),inFCProps:p(u),inGenericArgAtFunctionCall:c(u)})},"Program:exit"(){let u=new Map,g=m.filter(h=>{let{typeName:f}=h;if(!r.checkOnly||r.checkOnly.length===0)return!0;if(m.filter(E=>E.typeName===f).length>1)return!1;for(let E of r.checkOnly)if(E==="function-args"&&h.inFunctionArgs||E==="FC"&&h.inFCProps||E==="generic-args-at-fn-calls"&&h.inGenericArgAtFunctionCall)return!0;return!1});for(let h of g){let{typeName:f,node:I}=h;if(t.has(f)){let E=i(I),S=t.get(f);if(E&&S&&E!==S.statement){u.has(f)||u.set(f,[]);let d=u.get(f);if(!d)return;d.includes(E)||d.push(E)}}}let y=[];for(let[h,f]of u)if(f.length>0){let I=f[0];if(!I)continue;for(let E of f)E.range[0]<I.range[0]&&(I=E);y.push({typeName:h,firstUsage:I})}let C=y.sort((h,f)=>h.firstUsage.range[0]-f.firstUsage.range[0]);if(C.length>0){let h=C[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":Zr.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,[We.name]:We.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,[Zt.name]:Zt.rule,[Ut.name]:Ut.rule,[Yt.name]:Yt.rule,[Xt.name]:Xt.rule,[Kt.name]:Kt.rule,[We.name]:We.rule};var ds={rules:ln};0&&(module.exports={extendedLintPlugin});
@@ -1,7 +1,7 @@
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}`),Gt="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:Gt,meta:{type:"suggestion",fixable:"code",docs:{description:"Extra rules to enforce best practices when using the React compiler"},messages:{objectMethodIsNotSupported:"Object methods such as `{ method() {} }` have limited support to optimizations in the React compiler, use a function expression `{ method: () => {} }` instead.",replaceWithFunctionExpression:"Replace with function expression",thisKeywordInMethod:"Object method uses `this` keyword which would have different behavior if converted to an arrow function. Fix this manually."},hasSuggestions:!0,schema:[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,c=s.getText(p.body);if(Xt(c))e.report({node:i,messageId:"thisKeywordInMethod"});else{let m=p.params.map(g=>s.getText(g)).join(", "),u="";p.generator?u=`${a}: function* (${m}) ${c}`:u=`${a}: (${m}) => ${c}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:g=>g.replaceText(i,u)})}}}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:Gt,rule:mn};import{AST_NODE_TYPES as te}from"@typescript-eslint/utils";import{z as R}from"zod/v4";var dn=R.object({disallow:R.array(R.object({selector:R.string(),message:R.string(),replace:R.optional(R.union([R.string(),R.object({regex:R.string(),with:R.string()})])),replaceType:R.optional(R.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:R.optional(R.array(R.object({fn:R.string(),withArgs:R.optional(R.array(R.object({atIndex:R.number(),value:R.union([R.string(),R.number(),R.boolean()])}))),message:R.string(),replaceWith:R.optional(R.string()),ignoreRegex:R.optional(R.string())}))),__dev_simulateFileName:R.optional(R.string()),mustMatchSyntax:R.optional(R.array(R.object({includeRegex:R.string(),mustCallFn:R.optional(R.array(R.object({anyCall:R.array(R.object({fn:R.string(),withArgs:R.array(R.object({atIndex:R.number(),literal:R.union([R.string(),R.number(),R.boolean()])}))})),message:R.optional(R.string())}))),mustMatchSelector:R.optional(R.array(R.object({selector:R.string(),message:R.string()}))),mustHaveExport:R.optional(R.array(R.object({name:R.string(),type:R.enum(["function","variable","any"]).default("any"),message:R.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,c=new Set,m=new Map,u=new Set,g=new Map;function d(y){for(let b of y.specifiers)b.type===te.ImportSpecifier&&b.imported.type===te.Identifier&&b.imported.name!==b.local.name&&g.set(b.local.name,b.imported.name)}function C(y){if(y.declaration){if(y.declaration.type===te.FunctionDeclaration&&y.declaration.id){let b=y.declaration.id.name;for(let v of Array.from(u)){let[w,A]=v.split(":");w===b&&(A==="function"||A==="any")&&u.delete(v)}}else if(y.declaration.type===te.VariableDeclaration){for(let b of y.declaration.declarations)if(b.id.type===te.Identifier){let v=b.id.name;for(let w of Array.from(u)){let[A,N]=w.split(":");A===v&&(N==="variable"||N==="any")&&u.delete(w)}}}}for(let b of y.specifiers)if(b.exported.type===te.Identifier){let v=b.exported.name;for(let w of Array.from(u)){let[A,N]=w.split(":");A===v&&N==="any"&&u.delete(w)}}}function h(y){y.id.type===te.Identifier&&y.init?.type===te.Identifier&&g.set(y.id.name,y.init.name)}function f(y){return g.get(y)??y}function I(y,b){return f(y)===b||y===b}for(let{includeRegex:y,mustCallFn:b,mustMatchSelector:v,mustHaveExport:w}of t??[]){let A=yn(s,new RegExp(y));if(!A)continue;let N=z=>{let Y=z;for(let{name:Q,value:Z}of A)Y=Y.replaceAll(Q,Z);return Y};for(let{anyCall:z,message:Y}of b??[]){let Q=`Expected file to call the function: ${z.map(({fn:Z})=>Z).join(" or ")}`;c.add(Q),a.push(Z=>{let{callee:Ee}=Z;if(Ee.type===te.Identifier){for(let{fn:q,withArgs:fe}of z)if(Ee.name===q){c.delete(Q);for(let pe of fe){let ne=Z.arguments[pe.atIndex],ye=typeof pe.literal=="string"?N(pe.literal):pe.literal;if(!ne){e.report({node:Z,messageId:"default",data:{message:`Missing argument with value "${ye}" at index ${pe.atIndex}${Y?`: ${N(Y)}`:""}`}});continue}if(ne.type!==te.Literal){e.report({node:ne,messageId:"default",data:{message:`Argument at position ${pe.atIndex} should the literal "${ye}"${Y?`: ${N(Y)}`:""}`}});continue}ne.value!==ye&&e.report({node:ne,messageId:"default",data:{message:`Argument should have the value "${ye}"${Y?`: ${N(Y)}`:""}`},fix:Re=>Re.replaceText(ne,typeof ye=="string"?`'${ye}'`:String(ye))})}break}}})}for(let{selector:z,message:Y}of v??[])m.set(z,N(Y)),p.set(N(z),()=>{m.delete(z)});for(let{name:z,type:Y,message:Q}of w??[]){let Z=N(z),Ee=N(Q);u.add(`${Z}:${Y}:${Ee}`)}}for(let{fn:y,withArgs:b,message:v,replaceWith:w,ignoreRegex:A}of i??[])A&&new RegExp(A).test(s)||a.push(N=>{let{callee:z}=N;if(z.type!==te.Identifier||!I(z.name,y))return;if(b)for(let Q of b){let Z=N.arguments[Q.atIndex];if(!Z){e.report({node:N,messageId:"default",data:{message:`Missing argument with value "${Q.value}" at index ${Q.atIndex}: ${v}`}});return}if(Z.type!==te.Literal||Z.value!==Q.value)return}let Y=Q=>w?Q.replaceText(N,w):null;e.report({node:N,messageId:"default",data:{message:v},suggest:w?[{messageId:"default",data:{message:`Replace with "${w}"`},fix:Y}]:void 0})});function E(y,b){let v=n[y];v?n[y]=w=>{v(w),b(w)}:n[y]=b}for(let{selector:y,message:b,replace:v,replaceType:w="suggestion"}of l??[]){if(y==="CallExpression"){a.push(A=>{S(v,A,b,w)});continue}n[y]=A=>{S(v,A,b,w)}}if(p.size>0)for(let[y,b]of p)E(y,b);return a.length>0&&(n.CallExpression=y=>{if(y.type===te.CallExpression)for(let b of a)b(y)}),n.ImportDeclaration=y=>{y.type===te.ImportDeclaration&&d(y)},n.ExportNamedDeclaration=y=>{y.type===te.ExportNamedDeclaration&&C(y)},n.VariableDeclarator=y=>{y.type===te.VariableDeclarator&&h(y)},n["Program:exit"]=y=>{for(let b of c)e.report({node:y,messageId:"default",data:{message:b}});for(let[,b]of m)e.report({node:y,messageId:"default",data:{message:b}});for(let b of u){let[v,w,A]=b.split(":");e.report({node:y,messageId:"default",data:{message:`Missing required export "${v}" of type ${w}: ${A}`}})}},n;function S(y,b,v,w){let A=N=>{if(!y)return null;if(typeof y=="string")return N.replaceText(b,y);{let z=new RegExp(y.regex),Y=e.sourceCode.getText(b);return N.replaceText(b,Y.replace(z,y.with))}};e.report({node:b,messageId:"default",data:{message:v},fix:y&&w==="autofix"?A:void 0,suggest:y&&w==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof y=="string"?y:y.with}"`},fix:A}]: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:Zt(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:Zt(a)}),n.push({name:`${s}_uncapitalize`,value:Kt(a)}),n.push({name:s,value:a}))}return n}function Zt(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 c=p.parent.type===U.Property,m=c?i:o,u=p.properties.length;if(u>m)return!1;if(u===1){let d=p.properties[0];return!d||d.type===U.Property&&d.value.type===U.ObjectExpression||d.type===U.Property&&d.value.type===U.ArrayExpression&&!d.value.elements.every(h=>h&&et(h))?!1:{text:n.getText(d),isNested:c,propsSize:u}}let g=[];for(let d of p.properties){if(d.type===U.Property&&!et(d.value))return!1;g.push(n.getText(d))}return{text:g.join(", "),isNested:c,propsSize:u}}else{let c=p.parent.parent?.type===U.TSPropertySignature,m=c?i:o,u=p.members.length;if(u>m)return!1;if(t.length>0&&p.parent.type===U.TSTypeAliasDeclaration){let d=p.parent.id.name;if(t.some(C=>d.endsWith(C)))return!1}if(u===1){let d=p.members[0];return!d||d.type===U.TSPropertySignature&&d.typeAnnotation?.typeAnnotation.type===U.TSTypeLiteral?!1:{text:n.getText(d),isNested:c,propsSize:1}}if(p.parent.type===U.TSIntersectionType||p.parent.type===U.TSUnionType&&p.parent.types[0]!==p)return!1;let g=[];for(let d of p.members){if(d.type!==U.TSPropertySignature)return!1;let C=d.typeAnnotation?.typeAnnotation;if(!C||C.type===U.TSTypeLiteral||!er(C))return!1;if(C.type===U.TSTypeReference&&C.typeArguments){if(C.typeArguments.params.length>1)return!1;let f=C.typeArguments.params[0];if(!f||!er(f))return!1}let h=n.getText(d).trim();(h.endsWith(";")||h.endsWith(","))&&(h=h.slice(0,-1)),g.push(h)}return{text:g.join("; "),isNested:c,propsSize:u}}}function a(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==U.JSXExpressionContainer){let C=0,h=!1,f=n.getTokenAfter(p,{filter:E=>E.type!==Qt.Punctuator||h?!0:E.value===","?(C++,!1):E.value===";"?(C++,h=!0,!1):E.value===")"||E.value==="}"?(C++,!1):!0});if(C>4)return;let I=f?.type===Qt.Template&&f.value.startsWith(`}
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}`),Gt="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:Gt,meta:{type:"suggestion",fixable:"code",docs:{description:"Extra rules to enforce best practices when using the React compiler"},messages:{objectMethodIsNotSupported:"Object methods such as `{ method() {} }` have limited support to optimizations in the React compiler, use a function expression `{ method: () => {} }` instead.",replaceWithFunctionExpression:"Replace with function expression",thisKeywordInMethod:"Object method uses `this` keyword which would have different behavior if converted to an arrow function. Fix this manually."},hasSuggestions:!0,schema:[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,c=s.getText(p.body);if(Xt(c))e.report({node:i,messageId:"thisKeywordInMethod"});else{let m=p.params.map(g=>s.getText(g)).join(", "),u="";p.generator?u=`${a}: function* (${m}) ${c}`:u=`${a}: (${m}) => ${c}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:g=>g.replaceText(i,u)})}}}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))}}}}}),Qe={name:Gt,rule:mn};import{AST_NODE_TYPES as te}from"@typescript-eslint/utils";import{z as R}from"zod/v4";var dn=R.object({disallow:R.array(R.object({selector:R.string(),message:R.string(),replace:R.optional(R.union([R.string(),R.object({regex:R.string(),with:R.string()})])),replaceType:R.optional(R.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:R.optional(R.array(R.object({fn:R.string(),withArgs:R.optional(R.array(R.object({atIndex:R.number(),value:R.union([R.string(),R.number(),R.boolean()])}))),message:R.string(),replaceWith:R.optional(R.string()),ignoreRegex:R.optional(R.string())}))),__dev_simulateFileName:R.optional(R.string()),mustMatchSyntax:R.optional(R.array(R.object({includeRegex:R.string(),mustCallFn:R.optional(R.array(R.object({anyCall:R.array(R.object({fn:R.string(),withArgs:R.array(R.object({atIndex:R.number(),literal:R.union([R.string(),R.number(),R.boolean()])}))})),message:R.optional(R.string())}))),mustMatchSelector:R.optional(R.array(R.object({selector:R.string(),message:R.string()}))),mustHaveExport:R.optional(R.array(R.object({name:R.string(),type:R.enum(["function","variable","any"]).default("any"),message:R.string()})))})))}),et=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,c=new Set,m=new Map,u=new Set,g=new Map;function y(d){for(let b of d.specifiers)b.type===te.ImportSpecifier&&b.imported.type===te.Identifier&&b.imported.name!==b.local.name&&g.set(b.local.name,b.imported.name)}function C(d){if(d.declaration){if(d.declaration.type===te.FunctionDeclaration&&d.declaration.id){let b=d.declaration.id.name;for(let v of Array.from(u)){let[w,A]=v.split(":");w===b&&(A==="function"||A==="any")&&u.delete(v)}}else if(d.declaration.type===te.VariableDeclaration){for(let b of d.declaration.declarations)if(b.id.type===te.Identifier){let v=b.id.name;for(let w of Array.from(u)){let[A,N]=w.split(":");A===v&&(N==="variable"||N==="any")&&u.delete(w)}}}}for(let b of d.specifiers)if(b.exported.type===te.Identifier){let v=b.exported.name;for(let w of Array.from(u)){let[A,N]=w.split(":");A===v&&N==="any"&&u.delete(w)}}}function h(d){d.id.type===te.Identifier&&d.init?.type===te.Identifier&&g.set(d.id.name,d.init.name)}function f(d){return g.get(d)??d}function I(d,b){return f(d)===b||d===b}for(let{includeRegex:d,mustCallFn:b,mustMatchSelector:v,mustHaveExport:w}of t??[]){let A=yn(s,new RegExp(d));if(!A)continue;let N=z=>{let Y=z;for(let{name:Q,value:Z}of A)Y=Y.replaceAll(Q,Z);return Y};for(let{anyCall:z,message:Y}of b??[]){let Q=`Expected file to call the function: ${z.map(({fn:Z})=>Z).join(" or ")}`;c.add(Q),a.push(Z=>{let{callee:Ee}=Z;if(Ee.type===te.Identifier){for(let{fn:q,withArgs:fe}of z)if(Ee.name===q){c.delete(Q);for(let pe of fe){let re=Z.arguments[pe.atIndex],ye=typeof pe.literal=="string"?N(pe.literal):pe.literal;if(!re){e.report({node:Z,messageId:"default",data:{message:`Missing argument with value "${ye}" at index ${pe.atIndex}${Y?`: ${N(Y)}`:""}`}});continue}if(re.type!==te.Literal){e.report({node:re,messageId:"default",data:{message:`Argument at position ${pe.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 v??[])m.set(z,N(Y)),p.set(N(z),()=>{m.delete(z)});for(let{name:z,type:Y,message:Q}of w??[]){let Z=N(z),Ee=N(Q);u.add(`${Z}:${Y}:${Ee}`)}}for(let{fn:d,withArgs:b,message:v,replaceWith:w,ignoreRegex:A}of i??[])A&&new RegExp(A).test(s)||a.push(N=>{let{callee:z}=N;if(z.type!==te.Identifier||!I(z.name,d))return;if(b)for(let Q of b){let Z=N.arguments[Q.atIndex];if(!Z){e.report({node:N,messageId:"default",data:{message:`Missing argument with value "${Q.value}" at index ${Q.atIndex}: ${v}`}});return}if(Z.type!==te.Literal||Z.value!==Q.value)return}let Y=Q=>w?Q.replaceText(N,w):null;e.report({node:N,messageId:"default",data:{message:v},suggest:w?[{messageId:"default",data:{message:`Replace with "${w}"`},fix:Y}]:void 0})});function E(d,b){let v=n[d];v?n[d]=w=>{v(w),b(w)}:n[d]=b}for(let{selector:d,message:b,replace:v,replaceType:w="suggestion"}of l??[]){if(d==="CallExpression"){a.push(A=>{S(v,A,b,w)});continue}n[d]=A=>{S(v,A,b,w)}}if(p.size>0)for(let[d,b]of p)E(d,b);return a.length>0&&(n.CallExpression=d=>{if(d.type===te.CallExpression)for(let b of a)b(d)}),n.ImportDeclaration=d=>{d.type===te.ImportDeclaration&&y(d)},n.ExportNamedDeclaration=d=>{d.type===te.ExportNamedDeclaration&&C(d)},n.VariableDeclarator=d=>{d.type===te.VariableDeclarator&&h(d)},n["Program:exit"]=d=>{for(let b of c)e.report({node:d,messageId:"default",data:{message:b}});for(let[,b]of m)e.report({node:d,messageId:"default",data:{message:b}});for(let b of u){let[v,w,A]=b.split(":");e.report({node:d,messageId:"default",data:{message:`Missing required export "${v}" of type ${w}: ${A}`}})}},n;function S(d,b,v,w){let A=N=>{if(!d)return null;if(typeof d=="string")return N.replaceText(b,d);{let z=new RegExp(d.regex),Y=e.sourceCode.getText(b);return N.replaceText(b,Y.replace(z,d.with))}};e.report({node:b,messageId:"default",data:{message:v},fix:d&&w==="autofix"?A:void 0,suggest:d&&w==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof d=="string"?d:d.with}"`},fix:A}]: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:Zt(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:Zt(a)}),n.push({name:`${s}_uncapitalize`,value:Kt(a)}),n.push({name:s,value:a}))}return n}function Zt(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 c=p.parent.type===U.Property,m=c?i:o,u=p.properties.length;if(u>m)return!1;if(u===1){let y=p.properties[0];return!y||y.type===U.Property&&y.value.type===U.ObjectExpression||y.type===U.Property&&y.value.type===U.ArrayExpression&&!y.value.elements.every(h=>h&&tt(h))?!1:{text:n.getText(y),isNested:c,propsSize:u}}let g=[];for(let y of p.properties){if(y.type===U.Property&&!tt(y.value))return!1;g.push(n.getText(y))}return{text:g.join(", "),isNested:c,propsSize:u}}else{let c=p.parent.parent?.type===U.TSPropertySignature,m=c?i:o,u=p.members.length;if(u>m)return!1;if(t.length>0&&p.parent.type===U.TSTypeAliasDeclaration){let y=p.parent.id.name;if(t.some(C=>y.endsWith(C)))return!1}if(u===1){let y=p.members[0];return!y||y.type===U.TSPropertySignature&&y.typeAnnotation?.typeAnnotation.type===U.TSTypeLiteral?!1:{text:n.getText(y),isNested:c,propsSize:1}}if(p.parent.type===U.TSIntersectionType||p.parent.type===U.TSUnionType&&p.parent.types[0]!==p)return!1;let g=[];for(let y of p.members){if(y.type!==U.TSPropertySignature)return!1;let C=y.typeAnnotation?.typeAnnotation;if(!C||C.type===U.TSTypeLiteral||!er(C))return!1;if(C.type===U.TSTypeReference&&C.typeArguments){if(C.typeArguments.params.length>1)return!1;let f=C.typeArguments.params[0];if(!f||!er(f))return!1}let h=n.getText(y).trim();(h.endsWith(";")||h.endsWith(","))&&(h=h.slice(0,-1)),g.push(h)}return{text:g.join("; "),isNested:c,propsSize:u}}}function a(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==U.JSXExpressionContainer){let C=0,h=!1,f=n.getTokenAfter(p,{filter:E=>E.type!==Qt.Punctuator||h?!0:E.value===","?(C++,!1):E.value===";"?(C++,h=!0,!1):E.value===")"||E.value==="}"?(C++,!1):!0});if(C>4)return;let I=f?.type===Qt.Template&&f.value.startsWith(`}
2
2
  `);if(f?.loc.start.line===p.loc.end.line&&!I)return}let c=s(p);if(!c)return;let m=c.text;if(m.includes(`
3
- `)||n.getCommentsInside(p).length>0)return;m.endsWith(";")&&(m=m.slice(0,-1));let u=`{ ${m} }`,g=bn(n,p),d=c.isNested&&c.propsSize>2?l:r.maxLineLength;d&&u.length+g.length+En(p,n)>d||e.report({node:p,messageId:"singleLineProp",fix:C=>C.replaceText(p,u)})}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,c=new WeakSet,m=new WeakMap,u=new WeakMap,g=new WeakSet;function d(f,I){return function(E){if(I.has(E))return I.get(E);let S=f(E);return I.set(E,S),S}}function C(f,I,E,S,y){y&&f.async&&s({node:f,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
3
+ `)||n.getCommentsInside(p).length>0)return;m.endsWith(";")&&(m=m.slice(0,-1));let u=`{ ${m} }`,g=bn(n,p),y=c.isNested&&c.propsSize>2?l:r.maxLineLength;y&&u.length+g.length+En(p,n)>y||e.report({node:p,messageId:"singleLineProp",fix:C=>C.replaceText(p,u)})}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 tt(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&&tt(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 rt={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,c=new WeakSet,m=new WeakMap,u=new WeakMap,g=new WeakSet;function y(f,I){return function(E){if(I.has(E))return I.get(E);let S=f(E);return I.set(E,S),S}}function C(f,I,E,S,d){d&&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,16 +12,16 @@ 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 b=a.acquire(f),v=new Set,w=null;{let T=b.upper;for(;T&&(v.add(T),T.type!=="function");)T=T.upper;if(!T)return;w=T}let A=Array.isArray;function N(T){if(!A(T.defs))return!1;let x=T.defs[0];if(x==null||x.node.type!=="VariableDeclarator")return!1;let k=x.node.init;if(k==null)return!1;for(;k.type==="TSAsExpression";)k=k.expression;let F=x.node.parent;if(F==null&&(it(w.block,x.node.id),F=x.node.parent,F==null))return!1;if(F.kind==="const"&&k.type==="Literal"&&(typeof k.value=="string"||typeof k.value=="number"||k.value===null))return!0;if(k.type!=="CallExpression")return!1;let P=k.callee;if(P.type==="MemberExpression"&&P.object.name==="React"&&P.property!=null&&!P.computed&&(P=P.property),P.type!=="Identifier")return!1;let O=x.node.id,{name:D}=P;if(D==="useRef"&&O.type==="Identifier")return!0;if(Rn(P)&&O.type==="Identifier"){for(let j of T.references)j!==O&&g.add(j.identifier);return!0}else if(D==="useState"||D==="useReducer"){if(O.type==="ArrayPattern"&&O.elements.length===2&&A(T.identifiers)){if(O.elements[1]===T.identifiers[0]){if(D==="useState"){let j=T.references,ae=0;for(let ge=0;ge<j.length;ge++){if(j[ge].isWrite()&&ae++,ae>1)return!1;p.set(j[ge].identifier,O.elements[0])}}return!0}else if(O.elements[0]===T.identifiers[0]){if(D==="useState"){let j=T.references;for(let ae=0;ae<j.length;ae++)c.add(j[ae].identifier)}return!1}}}else if(D==="useTransition"&&O.type==="ArrayPattern"&&O.elements.length===2&&Array.isArray(T.identifiers)&&O.elements[1]===T.identifiers[0])return!0;return!1}function z(T){if(!A(T.defs))return!1;let x=T.defs[0];if(x==null||x.node==null||x.node.id==null)return!1;let k=x.node,F=w.childScopes,P=null,O;for(O=0;O<F.length;O++){let D=F[O],j=D.block;if(k.type==="FunctionDeclaration"&&j===k||k.type==="VariableDeclarator"&&j.parent===k){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&&v.has(D.resolved.scope)&&!Y(D.resolved))return!1}return!0}let Y=d(N,m),Q=d(z,u),Z=new Map;function Ee(T){let x=T.from,k=!1;for(;x.block!==f;)x.type==="function"&&(k=x.block.parent!=null&&x.block.parent.type==="ReturnStatement"),x=x.upper;return k}let q=new Map,fe=new Map;pe(b);function pe(T){for(let x of T.references){if(!x.resolved||!v.has(x.resolved.scope))continue;let k=it(f,x.identifier),F=ir(k),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(x)&&Z.set(P,{reference:x,dependencyNode:F}),F.parent.type==="TSTypeQuery"||F.parent.type==="TSTypeReference")continue;let O=x.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(x);else{let D=x.resolved,j=Y(D)||Q(D);q.set(P,{isStable:j,references:[x]})}}for(let x of T.childScopes)pe(x)}Z.forEach(({reference:T,dependencyNode:x},k)=>{let F=T.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:x.parent.property,message:`The ref value '${k}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${k}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ne=new Set;function ye(T,x){ne.has(x)||(ne.add(x),s({node:T,message:`Assignments to the '${x}' variable from inside React Hook ${n(E)} 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(E)}.`}))}let Re=new Set;if(q.forEach(({isStable:T,references:x},k)=>{T&&Re.add(k),x.forEach(F=>{F.writeExpr&&ye(F.writeExpr,k)})}),ne.size>0)return;if(!I){let T=null;if(q.forEach(({isStable:x,references:k},F)=>{T||k.forEach(P=>{if(T)return;let O=P.identifier;if(!p.has(O))return;let j=P.from;for(;j.type!=="function";)j=j.upper;j.block===f&&(T=F)})}),T){let{suggestedDependencies:x}=rt({dependencies:q,declaredDependencies:[],stableDependencies:Re,externalDependencies:new Set,isEffect:!0});s({node:E,message:`React Hook ${S} contains a call to '${T}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+x.join(", ")+`] as a second argument to the ${S} Hook.`,suggest:[{desc:`Add dependencies array: [${x.join(", ")}]`,fix(k){return k.insertTextAfter(f,`, [${x.join(", ")}]`)}}]})}return}let Oe=[],Pe=new Set;I.type!=="ArrayExpression"?s({node:I,message:`React Hook ${n(E)} 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(T=>{if(T===null)return;if(T.type==="SpreadElement"){s({node:T,message:`React Hook ${n(E)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}g.has(T)&&s({node:T,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${n(T)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${n(T)}\``,fix(P){return P.removeRange(T.range)}}]});let x;try{x=Se(T,fe)}catch(P){if(/Unsupported node type/.test(P.message)){T.type==="Literal"?q.has(T.value)?s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. Did you mean to include ${T.value} in the array instead?`}):s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:T,message:`React Hook ${n(E)} 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 k=T;for(;k.type==="MemberExpression"||k.type==="OptionalMemberExpression"||k.type==="ChainExpression";)k=k.object||k.expression.object;let F=!w.through.some(P=>P.identifier===k);Oe.push({key:x,node:T}),F||Pe.add(x)});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:I,componentScope:w,scope:b}).forEach(({construction:x,isUsedOutsideOfHook:k,depType:F})=>{let P=F==="function"?"useCallback":"useMemo",O=F==="function"?"definition":"initialization",D=`wrap the ${O} of '${x.name.name}' in its own ${P}() Hook.`,j=k?`To fix this, ${D}`:`Move it inside the ${S} callback. Alternatively, ${D}`,ae=F==="conditional"||F==="logical expression"?"could make":"makes",ge=`The '${x.name.name}' ${F} ${ae} the dependencies of ${S} Hook (at line ${I.loc.start.line}) change on every render. ${j}`,Jt;k&&x.type==="Variable"&&F==="function"&&(Jt=[{desc:`Wrap the ${O} of '${x.name.name}' in its own ${P}() Hook.`,fix(Yt){let[nn,sn]=P==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Yt.insertTextBefore(x.node.init,nn),Yt.insertTextAfter(x.node.init,sn)]}}]),s({node:x.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 T=Oe.map(k=>k.key),x=T.slice().sort();return T.join(",")===x.join(",")}rn()&&_e.sort();function Ge(T){let x=T.split("."),k="";for(let F=0;F<x.length;F++){if(F!==0){let P=x.slice(0,F+1).join("."),O=fe.get(P)===!0;k+=O?"?.":"."}k+=x[F]}return k}function Ze(T,x,k,F){return T.size===0?null:(T.size>1?"":x+" ")+k+" "+(T.size>1?"dependencies":"dependency")+": "+wn(Array.from(T).sort().map(P=>"'"+Ge(P)+"'"))+`. Either ${F} ${T.size>1?"them":"it"} or remove the dependency array.`}let ce="";if(Le.size>0){let T=null;if(Array.from(Le.keys()).forEach(x=>{T===null&&x.endsWith(".current")&&(T=x)}),T!==null)ce=` Mutable values like '${T}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Pe.size>0){let x=Array.from(Pe)[0];b.set.has(x)||(ce=` Outer scope values like '${x}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!ce&&be.has("props")){let T=q.get("props");if(T==null)return;let x=T.references;if(!Array.isArray(x))return;let k=!0;for(let F=0;F<x.length;F++){let P=x[F],O=it(w.block,P.identifier);if(!O){k=!1;break}let D=O.parent;if(D==null){k=!1;break}if(D.type!=="MemberExpression"&&D.type!=="OptionalMemberExpression"){k=!1;break}}k&&(ce=` 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(E)}.`)}if(!ce&&be.size>0){let T=null;be.forEach(x=>{if(T)return;let k=w.set.get(x),F=q.get(x);if(F.references[0].resolved!==k)return;let P=k.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&&(T=x)}),T!==null&&(ce=` If '${T}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!ce&&be.size>0){let T=null;if(be.forEach(x=>{if(T!==null)return;let F=q.get(x).references,P,O;for(let D=0;D<F.length;D++){for(P=F[D].identifier,O=P.parent;O!=null&&O!==w.block;){if(O.type==="CallExpression"){let j=p.get(O.callee);if(j!=null){if(j.name===x)T={missingDep:x,setter:O.callee.name,form:"updater"};else if(c.has(P))T={missingDep:x,setter:O.callee.name,form:"reducer"};else{let ae=F[D].resolved;if(ae!=null){let ge=ae.defs[0];ge!=null&&ge.type==="Parameter"&&(T={missingDep:x,setter:O.callee.name,form:"inlineReducer"})}}break}}O=O.parent}if(T!==null)break}}),T!==null)switch(T.form){case"reducer":ce=` You can also replace multiple useState variables with useReducer if '${T.setter}' needs the current value of '${T.missingDep}'.`;break;case"inlineReducer":ce=` If '${T.setter}' needs the current value of '${T.missingDep}', you can also switch to useReducer instead of useState and read '${T.missingDep}' in the reducer.`;break;case"updater":ce=` You can also do a functional update '${T.setter}(${T.missingDep.slice(0,1)} => ...)' if you only need '${T.missingDep}' in the '${T.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:I,message:`React Hook ${n(E)} has `+(Ze(be,"a","missing","include")||Ze(Le,"an","unnecessary","exclude")||Ze(Ht,"a","duplicate","omit"))+ce,suggest:[{desc:`Update the dependencies array to be: [${_e.map(Ge).join(", ")}]`,fix(T){return T.replaceText(I,`[${_e.map(Ge).join(", ")}]`)}}]})}function h(f){let I=In(f.callee,i);if(I===-1)return;let E=f.arguments[I],S=f.callee,y=sr(S).name,b=f.arguments[I+1],v=/Effect($|[^a-z])/g.test(y);if(!E){s({node:S,message:`React Hook ${y} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(r&&!v)){if(!b&&!v){(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(E.type){case"FunctionExpression":case"ArrowFunctionExpression":C(E,b,S,y,v);return;case"Identifier":if(!b||b.elements&&b.elements.some(N=>N&&N.type==="Identifier"&&N.name===E.name))return;let w=t(f).set.get(E.name);if(w==null||w.defs==null)return;let A=w.defs[0];if(!A||!A.node||A.type!=="Variable"&&A.type!=="FunctionName")break;switch(A.node.type){case"FunctionDeclaration":C(A.node,b,S,y,v);return;case"VariableDeclarator":let N=A.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":C(N,b,S,y,v);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: '${E.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${E.name}]`,fix(w){return w.replaceText(b,`[${E.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let f of e.sourceCode.getAllComments())if(xn.test(f.value))return r=!0,{CallExpression:I=>h(I,!0)}}return{CallExpression:f=>h(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((C,h)=>{let f=s(l,h);f.isUsed=!0,a(l,h,I=>{I.isSubtreeUsed=!0})}),r.forEach(({key:C})=>{let h=s(l,C);h.isSatisfiedRecursively=!0}),n.forEach(C=>{let h=s(l,C);h.isSatisfiedRecursively=!0});function s(C,h){let f=h.split("."),I=C;for(let E of f){let S=I.children.get(E);S||(S=i(),I.children.set(E,S)),I=S}return I}function a(C,h,f){let I=h.split("."),E=C;for(let S of I){let y=E.children.get(S);if(!y)return;f(y),E=y}}let p=new Set,c=new Set;m(l,p,c,C=>C);function m(C,h,f,I){C.children.forEach((E,S)=>{let y=I(S);if(E.isSatisfiedRecursively){E.isSubtreeUsed&&f.add(y);return}if(E.isUsed){h.add(y);return}m(E,h,f,b=>y+"."+b)})}let u=[],g=new Set,d=new Set;return r.forEach(({key:C})=>{c.has(C)?u.indexOf(C)===-1?u.push(C):d.add(C):g.add(C)}),p.forEach(C=>{u.push(C)}),{suggestedDependencies:u,unnecessaryDependencies:g,duplicateDependencies:d,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 c=p.from;for(;c!==t&&c!=null;)c=c.upper;if(c!==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 ie 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&ie.TypeFlags.Any||s.flags&ie.TypeFlags.Unknown?null:s.flags&ie.TypeFlags.StringLike?["string"]:s.flags&ie.TypeFlags.NumberLike?["number"]:s.flags&ie.TypeFlags.BigIntLike?["bigint"]:s.flags&ie.TypeFlags.BooleanLike?["boolean"]:s.flags&ie.TypeFlags.ESSymbolLike?["symbol"]:s.flags&ie.TypeFlags.Undefined||s.flags&ie.TypeFlags.Void?["undefined"]:s.flags&ie.TypeFlags.Null?["object"]:s.getCallSignatures().length>0?["function"]:s.flags&ie.TypeFlags.Object?s.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:s.flags&ie.TypeFlags.NonPrimitive?["object"]:s.flags&ie.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&ie.TypeFlags.Any||p.flags&ie.TypeFlags.Unknown)return null;let c=[];if(p.isUnion()){for(let u of p.types){let g=o(u);if(g)c.push(...g);else return null}return c}let m=o(p);return m?(c.push(...m),c):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,c=null;if(t(s.left)?(p=s.left,c=s.right.type===Ue.Literal&&typeof s.right.value=="string"?s.right.value:null):t(s.right)&&(p=s.right,c=s.left.type===Ue.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!c||!Nn(c,Pn))return;let m=l(p);if(!m)return;let u=s.operator==="!==",g=m.includes(c);m.length===1?g&&!u?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:c}}):!g&&u?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:Array.from(m)[0]}}):!g&&!u?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:$e(m),conditionType:c}}):g&&u&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:$e(m),conditionType:c}}):!g&&!u?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:$e(m),conditionType:c}}):!g&&u&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:$e(m)}})}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(c=>!s&&c.type===ze.TSAnyKeyword||a&&c.type===ze.TSTypeReference&&c.typeName.type===ze.Identifier&&a.includes(c.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(m=>/[a-zA-Z0-9]/.test(m))&&(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 Gn}from"@typescript-eslint/utils";var Zn=Xn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mr="no-default-export",Kn=Zn({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===Gn.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 c=ke(a.parent.parent,V.AST_NODE_TYPES.VariableDeclaration,4);if(!c)return!1;let m=We(c,e.sourceCode);return m?!(m.parent.type===V.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===V.AST_NODE_TYPES.Identifier&&m.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:c}of r.aliases)if(a.startsWith(c)){let m=a.replace(c,p);return{alias:p,newPath:m}}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?c=>c.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 c=o.getTokenAfter(p);c?l.push(t.replaceTextRange([p.range[0],c.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(c,m){switch(c.type){case Me.Literal:return m==="number"?typeof c.value=="number":typeof c.value=="string";case Me.TemplateLiteral:return m==="string";case Me.UnaryExpression:return m==="number"?c.operator==="+"||c.operator==="-"||c.operator==="~":!1;default:return!1}}function s(c,m){return m==="number"?!!(c.flags&bt.TypeFlags.NumberLike):!!(c.flags&bt.TypeFlags.StringLike)}function a(c,m){return u=>u.replaceText(c,e.sourceCode.getText(m))}function p(c){if(!l||c.arguments.length!==1)return;let m=c.arguments[0];if(!m||m.type===Me.SpreadElement)return;let{callee:u}=c;if(u.type!==Me.Identifier)return;let g=u.name,d=t.find(h=>h.name===g);if(!d)return;if(i(m,d.expectedType)||s(l.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(m)),d.expectedType)){let h,f;g==="Number"?h="unnecessaryNumberCasting":g==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",f={name:d.name,type:d.expectedType}),e.report({node:c,messageId:h,...f?{data:f}:{},fix:a(c,m)})}}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 c=l(p);c&&o(c)&&p.arguments.indexOf(a)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(u){return s.typeAnnotation?u.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 oe}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===oe.ObjectPattern||!r.init||r.init.type!==oe.ObjectExpression||r.id.type===oe.Identifier&&r.id.typeAnnotation||r.parent.parent.type===oe.ExportNamedDeclaration)return;let n=new Map;for(let i of r.init.properties)i.type===oe.Property&&i.key.type===oe.Identifier&&n.set(i.key.name,i);if(n.size===0||r.id.type!==oe.Identifier)return;let t=wi(r,e.sourceCode);if(t.length===0)return;let o=r.init.properties.some(i=>i.type!==oe.Property?!1:i.value.type===oe.FunctionExpression),l=new Set;for(let i of t){if(i.identifier.parent.type!==oe.MemberExpression)return;let s=i.identifier.parent;if(s.object!==i.identifier)return;if(s.computed)if(s.property.type===oe.Literal&&typeof s.property.value=="string")l.add(s.property.value);else return;else{if(s.property.type!==oe.Identifier)return;l.add(s.property.name)}if(s.parent.type===oe.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 c=wr(p.properties,void 0);if(!c)return;if(o.id.type===J.ObjectPattern){let g=wr(o.id.properties,s.returnProp);if(!g)return;for(let[d,C]of c)g.has(d)||e.report({node:C,messageId:"unusedSelectedValue",data:{name:d}});return}if(o.id.type!==J.Identifier||s.returnProp)return;let m=Pi(o,e.sourceCode);if(m.length===0)return;let u=new Set;for(let g of m){if(g.identifier.parent.type!==J.MemberExpression)return;let d=g.identifier.parent.property;if(d.type!==J.Identifier)return;u.add(d.name)}for(let[g,d]of c)u.has(g)||e.report({node:d,messageId:"unusedSelectedValue",data:{name:g}})}}}})};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,c,m,u=!0,g=!1){let d=c.name,C=e.sourceCode.getScope(p).references.find(S=>S.identifier.name===d)?.resolved,h=a&&Rt?.some(S=>S.test(d)),f=g&&t;if(!C||!h&&C.references.filter(S=>S.isTypeReference).length>1||!C.defs[0])return;let I=C.defs[0].node,E=I.parent?.type===$.ExportNamedDeclaration;if(!(u&&E&&!f)){if(I.type===$.TSTypeAliasDeclaration){l(a,p,m,I.typeAnnotation,!0,g);return}if(I.type===$.TSInterfaceDeclaration){l(a,p,m,I.body,!0,g);return}}}function l(a,p,c,m,u,g=!1){if(m.type===$.TSInterfaceBody){for(let d of m.body)d.type===$.TSPropertySignature&&d.key.type===$.Identifier&&c.set(d.key.name,d);return}if(m.type===$.TSTypeLiteral){Rr(c,...Ar(m));return}if(m.type===$.TSIntersectionType){for(let d of m.types)l(a,p,c,d,!0,g);return}u||m.type===$.TSTypeReference&&m.typeName.type===$.Identifier&&o(a,p,m.typeName,c,!0,g)}function i(a,p,c,m=!1){for(let u of c)if(u.type===$.ObjectPattern&&u.typeAnnotation){let g=new Map;if(l(a,p,g,u.typeAnnotation.typeAnnotation,!1,m),g.size===0)continue;s(u,g)}else u.type===$.AssignmentPattern&&u.left.type===$.ObjectPattern&&i(a,p,[u.left],m)}function s(a,p){let c=[];if(a.properties.at(-1)?.type===$.RestElement)return;for(let d of a.properties)d.type===$.Property&&d.key.type===$.Identifier&&c.push(d.key.name);let u=[],g=[];for(let[d,C]of p)c.includes(d)||(g.push(d),u.push({node:C,messageId:"unusedObjectTypeProperty",data:{propertyName:d}}));for(let[d,C]of u.entries())e.report({...C,fix:d===u.length-1?h=>{let f=a.properties.at(-1),I=g.join(", ");return f?f.type===$.RestElement?null:h.insertTextAfter(f,`, ${I}`):h.insertTextBeforeRange([a.range[0]+1,a.range[1]],I)}:void 0})}return{VariableDeclaration(a){let p=a.declarations[0],c=new Map,m=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(m){if(m.type===$.TSTypeReference&&m.typeName.type===$.Identifier)o(!0,a,m.typeName,c,!1);else if(m.type===$.TSTypeLiteral)Rr(c,...Ar(m));else if(m.type===$.TSIntersectionType)for(let u of m.types)u.type===$.TSTypeReference&&u.typeName.type===$.Identifier?o(!0,a,u.typeName,c,!1):l(!0,a,c,u,!0);if(c.size!==0&&p.init?.type===$.ArrowFunctionExpression){let u=p.init.params[0];if(!u){e.report({node:p.init,messageId:"missingComponentParam"});return}u.type===$.ObjectPattern&&s(u,c)}}},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 ue}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===ue.Identifier?r.has(t.callee.name):t.callee.type===ue.MemberExpression&&t.callee.object.type===ue.Identifier&&t.callee.property.type===ue.Identifier?t.callee.property.name==="useRef":!1}return{ImportDeclaration(t){if(t.source.value==="react")for(let o of t.specifiers)o.type===ue.ImportSpecifier&&o.imported.type===ue.Identifier&&o.imported.name==="useRef"&&r.add(o.local.name)},VariableDeclarator(t){if(t.init&&t.init.type===ue.CallExpression&&n(t.init)&&t.id.type===ue.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===ue.JSXExpressionContainer&&p.parent.type===ue.JSXAttribute&&p.parent.name.type===ue.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(c=>e.sourceCode.getText(c)).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 G,AST_TOKEN_TYPES as jr,ESLintUtils as Xi}from"@typescript-eslint/utils";import Dt from"zod/v4";var Gi=Xi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_r="prefer-single-line-if",Zi=Dt.object({maxLineLength:Dt.number().optional(),maxNonSimpleConditionLength:Dt.number().optional()}),Ki=Gi({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(Zi)]},defaultOptions:[{}],create(e,[r]){let n=e.sourceCode;return{IfStatement(t){if(t.consequent.type!==G.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===G.ReturnStatement){if(!Ur(l))return}else if(!(l.type===G.ContinueStatement||l.type===G.BreakStatement))return;if(t.test.type===G.LogicalExpression||t.test.type===G.ConditionalExpression)return;let i;if(r.maxNonSimpleConditionLength){let m=Lr(t.test);if(!m&&t.test.type===G.UnaryExpression&&t.test.operator==="!"){let u=t.test.argument;Lr(u)&&(m=!0)}if(m&&(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 m=n.getTokenAfter(a);if(m&&m.type===jr.Keyword&&(m.value==="else"||m.value==="catch"))return}let p=Qi(n,t),c=`if (${i}) ${s}`;r.maxLineLength&&c.length+p.length>r.maxLineLength||e.report({node:t,messageId:"noSingleLineCurly",fix:m=>m.replaceText(t,c)})}}}});function Lr(e){return e.type===G.CallExpression||e.type===G.BinaryExpression||e.type===G.MemberExpression&&$r(e)}function $r(e){return e.object.type===G.MemberExpression?$r(e.object):e.object.type!==G.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===G.ArrayExpression&&r.elements.length===0||r.type===G.ObjectExpression&&r.properties.length===0||r.type===G.Literal||r.type===G.Identifier||r.type===G.TemplateLiteral||r.type===G.TaggedTemplateExpression?!0:r.type===G.CallExpression?r.arguments.length===0:r.type===G.UnaryExpression?Ur(r):!1}var Mt={name:_r,rule:Ki};import{AST_NODE_TYPES as le,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===le.Identifier?e.name.startsWith("use"):e.type===le.MemberExpression&&e.property.type===le.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===le.Identifier?(o=t.callee.name,l=t.callee):t.callee.type===le.MemberExpression&&t.callee.property.type===le.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===le.ObjectExpression){for(let l of o.properties)if(l.type===le.Property&&l.key.type===le.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 c of o.properties)if(c.type===le.Property&&c.key.type===le.Identifier&&c.key.name===a&&c.value.type===le.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=>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 c=new Set;for(let u of i.properties)u.type===_.Property&&u.key.type===_.Identifier&&c.add(u.key.name);let m=s.filter(u=>!c.has(u));if(m.length>0)if(m.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:m[0],fnName:p,customMsg:a||""}});else{let u=m.map(g=>`"${g}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:u,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]=c=>{if(c.type!==_.MemberExpression||c.parent.type!==_.CallExpression)return;let m=c.parent;if(m.parent.type!==_.VariableDeclarator)return;let u=m.parent;if(u.id.type===_.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===_.ObjectPattern){let g=Array.isArray(i.prop)?i.prop:[i.prop];t(u.id,g,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]=m=>{if(m.type!==_.MemberExpression||m.parent.type!==_.CallExpression)return;let u=m.parent;if(u.parent.type!==_.VariableDeclarator)return;let g=u.parent;if(g.id.type===_.Identifier)n.set(g.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:g.id,fnName:i.fromFnCall||"unknown function"});else if(g.id.type===_.ObjectPattern){let d=Array.isArray(i.prop)?i.prop:[i.prop];t(g.id,d,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 c=p.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 u=Array.isArray(i.prop)?i.prop:[i.prop];t(m.id,u,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...l,"Program:exit"(){for(let[i,{props:s,errorMsg:a,node:p,fnName:c}]of n){let u=e.sourceCode.getScope(p).set.get(i);if(u){let g=new Set(s);for(let d of u.references){let C=d.identifier,h=C.parent;if(!(h.type===_.VariableDeclarator&&h.id===C)){if(h.type===_.MemberExpression&&h.object===C&&h.property.type===_.Identifier&&g.has(h.property.name)){if(g.delete(h.property.name),g.size===0)break;continue}if(h.type===_.VariableDeclarator&&h.init===C&&h.id.type===_.ObjectPattern){for(let f of h.id.properties)f.type===_.Property&&f.key.type===_.Identifier&&g.has(f.key.name)&&g.delete(f.key.name);if(g.size===0)break;continue}if(!(h.type===_.MemberExpression&&h.object===C&&h.property.type===_.Identifier&&!s.includes(h.property.name))){g.clear();break}}}if(g.size>0){let d=Array.from(g);if(d.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:d[0],fnName:c,customMsg:a||""}});else{let C=d.map(h=>`"${h}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:C,fnName:c,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 Gr(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)||Gr(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/,Zr={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 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 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 c=p.identifier.parent;if(c.type==="VariableDeclarator"&&c.init&&c.init.type==="CallExpression"&&c.init.callee&&Hr(c.init.callee))for(let m of p.resolved.references)m!==p&&i.add(m.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 m=new Set;function u(S,y){let{cache:b}=u,v=b.get(S.id),w=new Set(y);if(w.has(S.id)){let A=[...w],N=A.slice(A.indexOf(S.id)+1);for(let z of N)m.add(z);return BigInt("0")}if(w.add(S.id),v!==void 0)return v;if(a.thrownSegments.includes(S))v=BigInt("0");else if(S.prevSegments.length===0)v=BigInt("1");else{v=BigInt("0");for(let A of S.prevSegments)v+=u(A,w)}return S.reachable&&v===BigInt("0")?b.delete(S.id):b.set(S.id,v),v}function g(S,y){let{cache:b}=g,v=b.get(S.id),w=new Set(y);if(w.has(S.id)){let A=Array.from(w),N=A.slice(A.indexOf(S.id)+1);for(let z of N)m.add(z);return BigInt("0")}if(w.add(S.id),v!==void 0)return v;if(a.thrownSegments.includes(S))v=BigInt("0");else if(S.nextSegments.length===0)v=BigInt("1");else{v=BigInt("0");for(let A of S.nextSegments)v+=g(A,w)}return b.set(S.id,v),v}function d(S){let{cache:y}=d,b=y.get(S.id);if(b===null)return 1/0;if(b!==void 0)return b;if(y.set(S.id,null),S.prevSegments.length===0)b=1;else{b=1/0;for(let v of S.prevSegments){let w=d(v);w<b&&(b=w)}b+=1}return y.set(S.id,b),b}u.cache=new Map,g.cache=new Map,d.cache=new Map;let C=g(a.initialSegment),h=Kr(p),f=_t(p),I=h?qr(h)||Xe(h):Xr(p)||Gr(p),E=1/0;for(let S of a.finalSegments){if(!S.reachable)continue;let y=d(S);y<E&&(E=y)}for(let[S,y]of c){if(!S.reachable)continue;let b=S.nextSegments.length===0?E<=d(S):E<d(S),v=u(S)*g(S),w=m.has(S.id);for(let A of y)if(w&&!$t(A)&&e.report({node:A,message:`React Hook "${r(A)}" 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:A,message:`React Hook "${r(A)}" cannot be called in an async function.`}),!w&&v!==C&&!$t(A)){let z=`React Hook "${r(A)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(b?" Did you accidentally call a React Hook after an early return?":"");e.report({node:A,message:z})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let N=`React Hook "${r(A)}" 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:A,message:N})}else if(h){let N=`React Hook "${r(A)}" is called in function "${r(h)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:A,message:N})}else if(p.type==="Program"){let N=`React Hook "${r(A)}" 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:A,message:N})}else if(f&&!$t(A)){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(A)}" 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:A,message:N})}}},CallExpression(a){if(Xe(a.callee)){let p=Jr(o),c=Jr(l),m=p.get(c);m||(m=[],p.set(c,m)),m.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 se from"zod/v4";var Ts=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()}),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 I=f.split(/\r?\n/),E=I.filter(y=>y.trim()!=="");if(E.length===0)return f;let S=Number.POSITIVE_INFINITY;for(let y of E){let b=y.match(/^(\s*)/);b&&(S=Math.min(S,b[1]?.length??0))}return!isFinite(S)||S===0?f:I.map(y=>y.slice(S)).join(`
17
- `)}function a(f,I,E){return f.split(/\r?\n/).map(y=>y.trim()===""?y:E.repeat(I)+y).join(`
18
- `)}function p(f){if(f.type===ee.Identifier)return f.name;if(f.type===ee.MemberExpression){let I=f.object.type===ee.Identifier?f.object.name:null,E=f.property.type===ee.Identifier?f.property.name:null;return I&&E?`${I}.${E}`:E}return null}function c(f,I){if(!f)return!1;for(let E of I)if(E.includes(".")){let S=E.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===E)return!0;return!1}function m(f,I){let E=f.parent;if(E.type!==ee.TaggedTemplateExpression)return!1;let S=p(E.tag);return S?I.includes(S):!1}function u(f,I){if(!f||f.type!==ee.CallExpression)return!1;let{method:E,argumentsLength:S,optionalCall:y=!0,optionalMember:b=!0}=I;return S!==void 0&&f.arguments.length!==S||!y&&f.optional||f.callee.type!==ee.MemberExpression||!b&&f.callee.optional||f.callee.property.type!==ee.Identifier?!1:f.callee.property.name===E}function g(f,I){if(!f||f.type!==ee.CallExpression)return!1;let{name:E,argumentsLength:S,optionalCall:y=!0}=I;return S!==void 0&&f.arguments.length!==S||!y&&f.optional||f.callee.type!==ee.Identifier?!1:f.callee.name===E}function d(f){return u(f.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&f.parent.type===ee.CallExpression&&f.parent.arguments[0]===f&&g(f.parent.callee.type===ee.MemberExpression?f.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function C(f){if(i.length>0){let I=r.getTokenBefore(f,{includeComments:!0});if(I?.type===Ss.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(d(f)||o.length>0&&m(f,o)||t.length>0&&f.parent.type===ee.CallExpression&&f.parent.arguments.includes(f)&&c(f.parent.callee,t))}function h(f){let I=`__PLACEHOLDER__${Math.random()}`,E=f.quasis.map(q=>r.getText(q).slice(1,q.tail?-1:-2)).join(I),S=E.match(/\r?\n/);if(!S)return;let y=S[0],b=r.lines[r.getLocFromIndex(f.range[0]).line-1];if(!b)return;let w=b.match(/^(\s*)\S/)?.[1]??"",A;typeof l=="string"?A=l:typeof l=="number"?A=" ".repeat(l):A=w.startsWith(" ")?" ":" ";let z=s(E).replace(new RegExp(`^${y}|${y}[ ]*$`,"g"),""),Y=y+a(z,1,w+A)+y+w,Q=E.includes(`\r
15
+ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let b=a.acquire(f),v=new Set,w=null;{let T=b.upper;for(;T&&(v.add(T),T.type!=="function");)T=T.upper;if(!T)return;w=T}let A=Array.isArray;function N(T){if(!A(T.defs))return!1;let x=T.defs[0];if(x==null||x.node.type!=="VariableDeclarator")return!1;let k=x.node.init;if(k==null)return!1;for(;k.type==="TSAsExpression";)k=k.expression;let F=x.node.parent;if(F==null&&(st(w.block,x.node.id),F=x.node.parent,F==null))return!1;if(F.kind==="const"&&k.type==="Literal"&&(typeof k.value=="string"||typeof k.value=="number"||k.value===null))return!0;if(k.type!=="CallExpression")return!1;let P=k.callee;if(P.type==="MemberExpression"&&P.object.name==="React"&&P.property!=null&&!P.computed&&(P=P.property),P.type!=="Identifier")return!1;let O=x.node.id,{name:D}=P;if(D==="useRef"&&O.type==="Identifier")return!0;if(Rn(P)&&O.type==="Identifier"){for(let j of T.references)j!==O&&g.add(j.identifier);return!0}else if(D==="useState"||D==="useReducer"){if(O.type==="ArrayPattern"&&O.elements.length===2&&A(T.identifiers)){if(O.elements[1]===T.identifiers[0]){if(D==="useState"){let j=T.references,ae=0;for(let ge=0;ge<j.length;ge++){if(j[ge].isWrite()&&ae++,ae>1)return!1;p.set(j[ge].identifier,O.elements[0])}}return!0}else if(O.elements[0]===T.identifiers[0]){if(D==="useState"){let j=T.references;for(let ae=0;ae<j.length;ae++)c.add(j[ae].identifier)}return!1}}}else if(D==="useTransition"&&O.type==="ArrayPattern"&&O.elements.length===2&&Array.isArray(T.identifiers)&&O.elements[1]===T.identifiers[0])return!0;return!1}function z(T){if(!A(T.defs))return!1;let x=T.defs[0];if(x==null||x.node==null||x.node.id==null)return!1;let k=x.node,F=w.childScopes,P=null,O;for(O=0;O<F.length;O++){let D=F[O],j=D.block;if(k.type==="FunctionDeclaration"&&j===k||k.type==="VariableDeclarator"&&j.parent===k){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&&v.has(D.resolved.scope)&&!Y(D.resolved))return!1}return!0}let Y=y(N,m),Q=y(z,u),Z=new Map;function Ee(T){let x=T.from,k=!1;for(;x.block!==f;)x.type==="function"&&(k=x.block.parent!=null&&x.block.parent.type==="ReturnStatement"),x=x.upper;return k}let q=new Map,fe=new Map;pe(b);function pe(T){for(let x of T.references){if(!x.resolved||!v.has(x.resolved.scope))continue;let k=st(f,x.identifier),F=ir(k),P=Se(F,fe);if(d&&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(x)&&Z.set(P,{reference:x,dependencyNode:F}),F.parent.type==="TSTypeQuery"||F.parent.type==="TSTypeReference")continue;let O=x.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(x);else{let D=x.resolved,j=Y(D)||Q(D);q.set(P,{isStable:j,references:[x]})}}for(let x of T.childScopes)pe(x)}Z.forEach(({reference:T,dependencyNode:x},k)=>{let F=T.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:x.parent.property,message:`The ref value '${k}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${k}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let re=new Set;function ye(T,x){re.has(x)||(re.add(x),s({node:T,message:`Assignments to the '${x}' variable from inside React Hook ${n(E)} 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(E)}.`}))}let Re=new Set;if(q.forEach(({isStable:T,references:x},k)=>{T&&Re.add(k),x.forEach(F=>{F.writeExpr&&ye(F.writeExpr,k)})}),re.size>0)return;if(!I){let T=null;if(q.forEach(({isStable:x,references:k},F)=>{T||k.forEach(P=>{if(T)return;let O=P.identifier;if(!p.has(O))return;let j=P.from;for(;j.type!=="function";)j=j.upper;j.block===f&&(T=F)})}),T){let{suggestedDependencies:x}=nt({dependencies:q,declaredDependencies:[],stableDependencies:Re,externalDependencies:new Set,isEffect:!0});s({node:E,message:`React Hook ${S} contains a call to '${T}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+x.join(", ")+`] as a second argument to the ${S} Hook.`,suggest:[{desc:`Add dependencies array: [${x.join(", ")}]`,fix(k){return k.insertTextAfter(f,`, [${x.join(", ")}]`)}}]})}return}let Oe=[],Pe=new Set;I.type!=="ArrayExpression"?s({node:I,message:`React Hook ${n(E)} 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(T=>{if(T===null)return;if(T.type==="SpreadElement"){s({node:T,message:`React Hook ${n(E)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}g.has(T)&&s({node:T,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${n(T)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${n(T)}\``,fix(P){return P.removeRange(T.range)}}]});let x;try{x=Se(T,fe)}catch(P){if(/Unsupported node type/.test(P.message)){T.type==="Literal"?q.has(T.value)?s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. Did you mean to include ${T.value} in the array instead?`}):s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:T,message:`React Hook ${n(E)} 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 k=T;for(;k.type==="MemberExpression"||k.type==="OptionalMemberExpression"||k.type==="ChainExpression";)k=k.object||k.expression.object;let F=!w.through.some(P=>P.identifier===k);Oe.push({key:x,node:T}),F||Pe.add(x)});let{suggestedDependencies:tn,unnecessaryDependencies:_e,missingDependencies:be,duplicateDependencies:Ht}=nt({dependencies:q,declaredDependencies:Oe,stableDependencies:Re,externalDependencies:Pe,isEffect:d}),$e=tn;if(Ht.size+be.size+_e.size===0){if(r)return;Cn({declaredDependencies:Oe,declaredDependenciesNode:I,componentScope:w,scope:b}).forEach(({construction:x,isUsedOutsideOfHook:k,depType:F})=>{let P=F==="function"?"useCallback":"useMemo",O=F==="function"?"definition":"initialization",D=`wrap the ${O} of '${x.name.name}' in its own ${P}() Hook.`,j=k?`To fix this, ${D}`:`Move it inside the ${S} callback. Alternatively, ${D}`,ae=F==="conditional"||F==="logical expression"?"could make":"makes",ge=`The '${x.name.name}' ${F} ${ae} the dependencies of ${S} Hook (at line ${I.loc.start.line}) change on every render. ${j}`,Jt;k&&x.type==="Variable"&&F==="function"&&(Jt=[{desc:`Wrap the ${O} of '${x.name.name}' in its own ${P}() Hook.`,fix(Yt){let[nn,sn]=P==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Yt.insertTextBefore(x.node.init,nn),Yt.insertTextAfter(x.node.init,sn)]}}]),s({node:x.node,message:ge,suggest:Jt})});return}!d&&be.size>0&&($e=nt({dependencies:q,declaredDependencies:[],stableDependencies:Re,externalDependencies:Pe,isEffect:d}).suggestedDependencies);function rn(){if(Oe.length===0)return!0;let T=Oe.map(k=>k.key),x=T.slice().sort();return T.join(",")===x.join(",")}rn()&&$e.sort();function Ze(T){let x=T.split("."),k="";for(let F=0;F<x.length;F++){if(F!==0){let P=x.slice(0,F+1).join("."),O=fe.get(P)===!0;k+=O?"?.":"."}k+=x[F]}return k}function Ke(T,x,k,F){return T.size===0?null:(T.size>1?"":x+" ")+k+" "+(T.size>1?"dependencies":"dependency")+": "+wn(Array.from(T).sort().map(P=>"'"+Ze(P)+"'"))+`. Either ${F} ${T.size>1?"them":"it"} or remove the dependency array.`}let ce="";if(_e.size>0){let T=null;if(Array.from(_e.keys()).forEach(x=>{T===null&&x.endsWith(".current")&&(T=x)}),T!==null)ce=` Mutable values like '${T}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Pe.size>0){let x=Array.from(Pe)[0];b.set.has(x)||(ce=` Outer scope values like '${x}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!ce&&be.has("props")){let T=q.get("props");if(T==null)return;let x=T.references;if(!Array.isArray(x))return;let k=!0;for(let F=0;F<x.length;F++){let P=x[F],O=st(w.block,P.identifier);if(!O){k=!1;break}let D=O.parent;if(D==null){k=!1;break}if(D.type!=="MemberExpression"&&D.type!=="OptionalMemberExpression"){k=!1;break}}k&&(ce=` 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(E)}.`)}if(!ce&&be.size>0){let T=null;be.forEach(x=>{if(T)return;let k=w.set.get(x),F=q.get(x);if(F.references[0].resolved!==k)return;let P=k.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&&(T=x)}),T!==null&&(ce=` If '${T}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!ce&&be.size>0){let T=null;if(be.forEach(x=>{if(T!==null)return;let F=q.get(x).references,P,O;for(let D=0;D<F.length;D++){for(P=F[D].identifier,O=P.parent;O!=null&&O!==w.block;){if(O.type==="CallExpression"){let j=p.get(O.callee);if(j!=null){if(j.name===x)T={missingDep:x,setter:O.callee.name,form:"updater"};else if(c.has(P))T={missingDep:x,setter:O.callee.name,form:"reducer"};else{let ae=F[D].resolved;if(ae!=null){let ge=ae.defs[0];ge!=null&&ge.type==="Parameter"&&(T={missingDep:x,setter:O.callee.name,form:"inlineReducer"})}}break}}O=O.parent}if(T!==null)break}}),T!==null)switch(T.form){case"reducer":ce=` You can also replace multiple useState variables with useReducer if '${T.setter}' needs the current value of '${T.missingDep}'.`;break;case"inlineReducer":ce=` If '${T.setter}' needs the current value of '${T.missingDep}', you can also switch to useReducer instead of useState and read '${T.missingDep}' in the reducer.`;break;case"updater":ce=` You can also do a functional update '${T.setter}(${T.missingDep.slice(0,1)} => ...)' if you only need '${T.missingDep}' in the '${T.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:I,message:`React Hook ${n(E)} has `+(Ke(be,"a","missing","include")||Ke(_e,"an","unnecessary","exclude")||Ke(Ht,"a","duplicate","omit"))+ce,suggest:[{desc:`Update the dependencies array to be: [${$e.map(Ze).join(", ")}]`,fix(T){return T.replaceText(I,`[${$e.map(Ze).join(", ")}]`)}}]})}function h(f){let I=In(f.callee,i);if(I===-1)return;let E=f.arguments[I],S=f.callee,d=sr(S).name,b=f.arguments[I+1],v=/Effect($|[^a-z])/g.test(d);if(!E){s({node:S,message:`React Hook ${d} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(r&&!v)){if(!b&&!v){(d==="useMemo"||d==="useCallback")&&s({node:S,message:`React Hook ${d} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(E.type){case"FunctionExpression":case"ArrowFunctionExpression":C(E,b,S,d,v);return;case"Identifier":if(!b||b.elements&&b.elements.some(N=>N&&N.type==="Identifier"&&N.name===E.name))return;let w=t(f).set.get(E.name);if(w==null||w.defs==null)return;let A=w.defs[0];if(!A||!A.node||A.type!=="Variable"&&A.type!=="FunctionName")break;switch(A.node.type){case"FunctionDeclaration":C(A.node,b,S,d,v);return;case"VariableDeclarator":let N=A.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":C(N,b,S,d,v);return}break}break;default:s({node:S,message:`React Hook ${d} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:S,message:`React Hook ${d} has a missing dependency: '${E.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${E.name}]`,fix(w){return w.replaceText(b,`[${E.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let f of e.sourceCode.getAllComments())if(xn.test(f.value))return r=!0,{CallExpression:I=>h(I,!0)}}return{CallExpression:f=>h(f)}}};function nt({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((C,h)=>{let f=s(l,h);f.isUsed=!0,a(l,h,I=>{I.isSubtreeUsed=!0})}),r.forEach(({key:C})=>{let h=s(l,C);h.isSatisfiedRecursively=!0}),n.forEach(C=>{let h=s(l,C);h.isSatisfiedRecursively=!0});function s(C,h){let f=h.split("."),I=C;for(let E of f){let S=I.children.get(E);S||(S=i(),I.children.set(E,S)),I=S}return I}function a(C,h,f){let I=h.split("."),E=C;for(let S of I){let d=E.children.get(S);if(!d)return;f(d),E=d}}let p=new Set,c=new Set;m(l,p,c,C=>C);function m(C,h,f,I){C.children.forEach((E,S)=>{let d=I(S);if(E.isSatisfiedRecursively){E.isSubtreeUsed&&f.add(d);return}if(E.isUsed){h.add(d);return}m(E,h,f,b=>d+"."+b)})}let u=[],g=new Set,y=new Set;return r.forEach(({key:C})=>{c.has(C)?u.indexOf(C)===-1?u.push(C):y.add(C):g.add(C)}),p.forEach(C=>{u.push(C)}),{suggestedDependencies:u,unnecessaryDependencies:g,duplicateDependencies:y,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 c=p.from;for(;c!==t&&c!=null;)c=c.upper;if(c!==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 it(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 it(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 it(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 it(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 st(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 ze,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),ot={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===ze.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 c=[];if(p.isUnion()){for(let u of p.types){let g=o(u);if(g)c.push(...g);else return null}return c}let m=o(p);return m?(c.push(...m),c):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,c=null;if(t(s.left)?(p=s.left,c=s.right.type===ze.Literal&&typeof s.right.value=="string"?s.right.value:null):t(s.right)&&(p=s.right,c=s.left.type===ze.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!c||!Nn(c,Pn))return;let m=l(p);if(!m)return;let u=s.operator==="!==",g=m.includes(c);m.length===1?g&&!u?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:c}}):!g&&u?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:Array.from(m)[0]}}):!g&&!u?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:Ue(m),conditionType:c}}):g&&u&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:Ue(m),conditionType:c}}):!g&&!u?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ve(p,e),actualType:Ue(m),conditionType:c}}):!g&&u&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ve(p,e),type:Ue(m)}})}return{BinaryExpression:i}}})};function Ue(e){return Array.from(new Set(e)).join(" | ")||"never"}function ve(e,r){let n=e.argument;return n.type===ze.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 at}from"zod/v4";var jn=Mn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pr="no-call-with-explicit-generics",Ln=at.object({functions:at.array(at.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}})}}}}),lt={name:pr,rule:_n};import{AST_NODE_TYPES as We,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!==We.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(c=>!s&&c.type===We.TSAnyKeyword||a&&c.type===We.TSTypeReference&&c.typeName.type===We.Identifier&&a.includes(c.typeName.name))&&e.report({node:t,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),pt={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(m=>/[a-zA-Z0-9]/.test(m))&&(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(", ")}})}}}}}),ct={name:fr,rule:Bn};import{ESLintUtils as Xn,TSESTree as Gn}from"@typescript-eslint/utils";var Zn=Xn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mr="no-default-export",Kn=Zn({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===Gn.AST_NODE_TYPES.Identifier&&n.exported.name==="default"&&e.report({node:r,messageId:"noDefaultExport"})}}}}),ut={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}})}}}}),ft={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}})}}}}}),mt={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*dt(e){yield e,e.parent&&(yield*dt(e.parent))}function yt(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 dt(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 c=ke(a.parent.parent,V.AST_NODE_TYPES.VariableDeclaration,4);if(!c)return!1;let m=Ve(c,e.sourceCode);return m?!(m.parent.type===V.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===V.AST_NODE_TYPES.Identifier&&m.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?!!Ve(p,e.sourceCode):!1}if(a.type===V.AST_NODE_TYPES.FunctionDeclaration)return!!Ve(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&&!(He(t)||!r(t)))for(let o of t.typeAnnotation.members)o.type===V.AST_NODE_TYPES.TSPropertySignature&&n(o)},TSInterfaceDeclaration(t){if(!(He(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=Ve(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 He(e){return e?e.parent?.type===V.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===V.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Ve(e,r){if(He(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])&&!He(l[0].identifier.parent.parent))return l[0].identifier}var gt={name:hr,rule:pi};import{AST_NODE_TYPES as Je}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===Je.Identifier?r.has(t.name):t.type===Je.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===Je.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===Je.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 St 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=St.dirname(s);return St.resolve(a,i)}function l(i){let s=r.rootDir??process.cwd(),a=St.relative(s,i);if(a.startsWith("."))return null;a.startsWith("/")||(a=`/${a}`);for(let{find:p,replacement:c}of r.aliases)if(a.startsWith(c)){let m=a.replace(c,p);return{alias:p,newPath:m}}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?c=>c.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),Tt={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()}),ht=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 Ye}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!==Ye.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===Ye.CallExpression&&r.callee.type===Ye.MemberExpression&&r.callee.property.type===Ye.Identifier){let n=r.callee.property.name;if(n==="filter"||n==="find")return{method:n}}r=r.parent}return null}var Et=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 bt=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 c=o.getTokenAfter(p);c?l.push(t.replaceTextRange([p.range[0],c.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 xt 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()}),Ct={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(c,m){switch(c.type){case Me.Literal:return m==="number"?typeof c.value=="number":typeof c.value=="string";case Me.TemplateLiteral:return m==="string";case Me.UnaryExpression:return m==="number"?c.operator==="+"||c.operator==="-"||c.operator==="~":!1;default:return!1}}function s(c,m){return m==="number"?!!(c.flags&xt.TypeFlags.NumberLike):!!(c.flags&xt.TypeFlags.StringLike)}function a(c,m){return u=>u.replaceText(c,e.sourceCode.getText(m))}function p(c){if(!l||c.arguments.length!==1)return;let m=c.arguments[0];if(!m||m.type===Me.SpreadElement)return;let{callee:u}=c;if(u.type!==Me.Identifier)return;let g=u.name,y=t.find(h=>h.name===g);if(!y)return;if(i(m,y.expectedType)||s(l.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(m)),y.expectedType)){let h,f;g==="Number"?h="unnecessaryNumberCasting":g==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",f={name:y.name,type:y.expectedType}),e.report({node:c,messageId:h,...f?{data:f}:{},fix:a(c,m)})}}return{CallExpression:p}}})};import{AST_NODE_TYPES as qe}from"@typescript-eslint/utils";import*as me from"zod/v4";var Ii=me.object({methods:me.union([me.array(me.string()),me.literal("array")])}),It=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===qe.MemberExpression){let p=a.property;if(p.type===qe.Identifier)return p.name}return null}function i(s,a){if(s.type!==qe.Identifier||!s.typeAnnotation)return;let p=a.parent;if(p.type===qe.CallExpression){let c=l(p);c&&o(c)&&p.arguments.indexOf(a)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(u){return s.typeAnnotation?u.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 oe}from"@typescript-eslint/utils";var wt=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===oe.ObjectPattern||!r.init||r.init.type!==oe.ObjectExpression||r.id.type===oe.Identifier&&r.id.typeAnnotation||r.parent.parent.type===oe.ExportNamedDeclaration)return;let n=new Map;for(let i of r.init.properties)i.type===oe.Property&&i.key.type===oe.Identifier&&n.set(i.key.name,i);if(n.size===0||r.id.type!==oe.Identifier)return;let t=wi(r,e.sourceCode);if(t.length===0)return;let o=r.init.properties.some(i=>i.type!==oe.Property?!1:i.value.type===oe.FunctionExpression),l=new Set;for(let i of t){if(i.identifier.parent.type!==oe.MemberExpression)return;let s=i.identifier.parent;if(s.object!==i.identifier)return;if(s.computed)if(s.property.type===oe.Literal&&typeof s.property.value=="string")l.add(s.property.value);else return;else{if(s.property.type!==oe.Identifier)return;l.add(s.property.name)}if(s.parent.type===oe.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",At={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 c=wr(p.properties,void 0);if(!c)return;if(o.id.type===J.ObjectPattern){let g=wr(o.id.properties,s.returnProp);if(!g)return;for(let[y,C]of c)g.has(y)||e.report({node:C,messageId:"unusedSelectedValue",data:{name:y}});return}if(o.id.type!==J.Identifier||s.returnProp)return;let m=Pi(o,e.sourceCode);if(m.length===0)return;let u=new Set;for(let g of m){if(g.identifier.parent.type!==J.MemberExpression)return;let y=g.identifier.parent.property;if(y.type!==J.Identifier)return;u.add(y.name)}for(let[g,y]of c)u.has(g)||e.report({node:y,messageId:"unusedSelectedValue",data:{name:g}})}}}})};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 Rt=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=yt(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||!yt(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 Be}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=Be.object({forceCheckOnFCPropTypesWithName:Be.array(Be.string()).optional(),alwaysCheckFunctionOptionTypes:Be.boolean().optional()}),vr="no-unused-type-props-in-args",vt=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&&!vt&&(vt=n.map(a=>new RegExp(a)));function o(a,p,c,m,u=!0,g=!1){let y=c.name,C=e.sourceCode.getScope(p).references.find(S=>S.identifier.name===y)?.resolved,h=a&&vt?.some(S=>S.test(y)),f=g&&t;if(!C||!h&&C.references.filter(S=>S.isTypeReference).length>1||!C.defs[0])return;let I=C.defs[0].node,E=I.parent?.type===$.ExportNamedDeclaration;if(!(u&&E&&!f)){if(I.type===$.TSTypeAliasDeclaration){l(a,p,m,I.typeAnnotation,!0,g);return}if(I.type===$.TSInterfaceDeclaration){l(a,p,m,I.body,!0,g);return}}}function l(a,p,c,m,u,g=!1){if(m.type===$.TSInterfaceBody){for(let y of m.body)y.type===$.TSPropertySignature&&y.key.type===$.Identifier&&c.set(y.key.name,y);return}if(m.type===$.TSTypeLiteral){Rr(c,...Ar(m));return}if(m.type===$.TSIntersectionType){for(let y of m.types)l(a,p,c,y,!0,g);return}u||m.type===$.TSTypeReference&&m.typeName.type===$.Identifier&&o(a,p,m.typeName,c,!0,g)}function i(a,p,c,m=!1){for(let u of c)if(u.type===$.ObjectPattern&&u.typeAnnotation){let g=new Map;if(l(a,p,g,u.typeAnnotation.typeAnnotation,!1,m),g.size===0)continue;s(u,g)}else u.type===$.AssignmentPattern&&u.left.type===$.ObjectPattern&&i(a,p,[u.left],m)}function s(a,p){let c=[];if(a.properties.at(-1)?.type===$.RestElement)return;for(let y of a.properties)y.type===$.Property&&y.key.type===$.Identifier&&c.push(y.key.name);let u=[],g=[];for(let[y,C]of p)c.includes(y)||(g.push(y),u.push({node:C,messageId:"unusedObjectTypeProperty",data:{propertyName:y}}));for(let[y,C]of u.entries())e.report({...C,fix:y===u.length-1?h=>{let f=a.properties.at(-1),I=g.join(", ");return f?f.type===$.RestElement?null:h.insertTextAfter(f,`, ${I}`):h.insertTextBeforeRange([a.range[0]+1,a.range[1]],I)}:void 0})}return{VariableDeclaration(a){let p=a.declarations[0],c=new Map,m=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(m){if(m.type===$.TSTypeReference&&m.typeName.type===$.Identifier)o(!0,a,m.typeName,c,!1);else if(m.type===$.TSTypeLiteral)Rr(c,...Ar(m));else if(m.type===$.TSIntersectionType)for(let u of m.types)u.type===$.TSTypeReference&&u.typeName.type===$.Identifier?o(!0,a,u.typeName,c,!1):l(!0,a,c,u,!0);if(c.size!==0&&p.init?.type===$.ArrowFunctionExpression){let u=p.init.params[0];if(!u){e.report({node:p.init,messageId:"missingComponentParam"});return}u.type===$.ObjectPattern&&s(u,c)}}},FunctionDeclaration(a){i(!1,a,a.params,t)},ArrowFunctionExpression(a){i(!1,a,a.params,t)}}}}),kt={name:vr,rule:$i};import{AST_NODE_TYPES as ue}from"@typescript-eslint/utils";var Ft=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===ue.Identifier?r.has(t.callee.name):t.callee.type===ue.MemberExpression&&t.callee.object.type===ue.Identifier&&t.callee.property.type===ue.Identifier?t.callee.property.name==="useRef":!1}return{ImportDeclaration(t){if(t.source.value==="react")for(let o of t.specifiers)o.type===ue.ImportSpecifier&&o.imported.type===ue.Identifier&&o.imported.name==="useRef"&&r.add(o.local.name)},VariableDeclarator(t){if(t.init&&t.init.type===ue.CallExpression&&n(t.init)&&t.id.type===ue.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===ue.JSXExpressionContainer&&p.parent.type===ue.JSXAttribute&&p.parent.name.type===ue.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 Ot,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===Ot.ArrowFunctionExpression&&t.id.type===Ot.Identifier){let o=t.id.name;if(t.id.typeAnnotation||n&&n.test(o)||!r.disallowArrowFnWithImplicitReturns&&t.init.body.type!==Ot.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(c=>e.sourceCode.getText(c)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),Pt={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 Xe(e){return/^use[A-Z]/.test(e)}function Or(e){return/^[A-Z]/.test(e)}function Hi(e){return e.type===M.Identifier?Xe(e.name):e.type===M.MemberExpression&&e.property.type===M.Identifier?Xe(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 Nt(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=Nt(r);if(t&&t.type===M.Identifier){if(Or(t.name)||Xe(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=Nt(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=Nt(t);if(o&&o.type===M.Identifier){if(Or(o.name)||Xe(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 Dt=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 G,AST_TOKEN_TYPES as jr,ESLintUtils as Xi}from"@typescript-eslint/utils";import Mt from"zod/v4";var Gi=Xi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_r="prefer-single-line-if",Zi=Mt.object({maxLineLength:Mt.number().optional(),maxNonSimpleConditionLength:Mt.number().optional()}),Ki=Gi({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(Zi)]},defaultOptions:[{}],create(e,[r]){let n=e.sourceCode;return{IfStatement(t){if(t.consequent.type!==G.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===G.ReturnStatement){if(!Ur(l))return}else if(!(l.type===G.ContinueStatement||l.type===G.BreakStatement))return;if(t.test.type===G.LogicalExpression||t.test.type===G.ConditionalExpression)return;let i;if(r.maxNonSimpleConditionLength){let m=Lr(t.test);if(!m&&t.test.type===G.UnaryExpression&&t.test.operator==="!"){let u=t.test.argument;Lr(u)&&(m=!0)}if(m&&(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 m=n.getTokenAfter(a);if(m&&m.type===jr.Keyword&&(m.value==="else"||m.value==="catch"))return}let p=Qi(n,t),c=`if (${i}) ${s}`;r.maxLineLength&&c.length+p.length>r.maxLineLength||e.report({node:t,messageId:"noSingleLineCurly",fix:m=>m.replaceText(t,c)})}}}});function Lr(e){return e.type===G.CallExpression||e.type===G.BinaryExpression||e.type===G.MemberExpression&&$r(e)}function $r(e){return e.object.type===G.MemberExpression?$r(e.object):e.object.type!==G.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===G.ArrayExpression&&r.elements.length===0||r.type===G.ObjectExpression&&r.properties.length===0||r.type===G.Literal||r.type===G.Identifier||r.type===G.TemplateLiteral||r.type===G.TaggedTemplateExpression?!0:r.type===G.CallExpression?r.arguments.length===0:r.type===G.UnaryExpression?Ur(r):!1}var jt={name:_r,rule:Ki};import{AST_NODE_TYPES as le,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===le.Identifier?e.name.startsWith("use"):e.type===le.MemberExpression&&e.property.type===le.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===le.Identifier?(o=t.callee.name,l=t.callee):t.callee.type===le.MemberExpression&&t.callee.property.type===le.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===le.ObjectExpression){for(let l of o.properties)if(l.type===le.Property&&l.key.type===le.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 c of o.properties)if(c.type===le.Property&&c.key.type===le.Identifier&&c.key.name===a&&c.value.type===le.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=>s.replacement?a.replaceText(l.key,s.replacement):null}]})}}}}}}:{}}}),Lt={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()}))}),_t=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 c=new Set;for(let u of i.properties)u.type===_.Property&&u.key.type===_.Identifier&&c.add(u.key.name);let m=s.filter(u=>!c.has(u));if(m.length>0)if(m.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:m[0],fnName:p,customMsg:a||""}});else{let u=m.map(g=>`"${g}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:u,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]=c=>{if(c.type!==_.MemberExpression||c.parent.type!==_.CallExpression)return;let m=c.parent;if(m.parent.type!==_.VariableDeclarator)return;let u=m.parent;if(u.id.type===_.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===_.ObjectPattern){let g=Array.isArray(i.prop)?i.prop:[i.prop];t(u.id,g,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]=m=>{if(m.type!==_.MemberExpression||m.parent.type!==_.CallExpression)return;let u=m.parent;if(u.parent.type!==_.VariableDeclarator)return;let g=u.parent;if(g.id.type===_.Identifier)n.set(g.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:g.id,fnName:i.fromFnCall||"unknown function"});else if(g.id.type===_.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];t(g.id,y,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 c=p.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 u=Array.isArray(i.prop)?i.prop:[i.prop];t(m.id,u,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...l,"Program:exit"(){for(let[i,{props:s,errorMsg:a,node:p,fnName:c}]of n){let u=e.sourceCode.getScope(p).set.get(i);if(u){let g=new Set(s);for(let y of u.references){let C=y.identifier,h=C.parent;if(!(h.type===_.VariableDeclarator&&h.id===C)){if(h.type===_.MemberExpression&&h.object===C&&h.property.type===_.Identifier&&g.has(h.property.name)){if(g.delete(h.property.name),g.size===0)break;continue}if(h.type===_.VariableDeclarator&&h.init===C&&h.id.type===_.ObjectPattern){for(let f of h.id.properties)f.type===_.Property&&f.key.type===_.Identifier&&g.has(f.key.name)&&g.delete(f.key.name);if(g.size===0)break;continue}if(!(h.type===_.MemberExpression&&h.object===C&&h.property.type===_.Identifier&&!s.includes(h.property.name))){g.clear();break}}}if(g.size>0){let y=Array.from(g);if(y.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:y[0],fnName:c,customMsg:a||""}});else{let C=y.map(h=>`"${h}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:C,fnName:c,customMsg:a||""}})}}}}}}}});function Yr(e){return/^use[A-Z0-9]/.test(e)}function Ge(e){return e.type==="Identifier"?Yr(e.name):e.type==="MemberExpression"&&!e.computed&&Ge(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 Gr(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)||Ge(r))||Xr(e)||Gr(e))return!0;e=e.parent}return!1}function Hr(e){return!1}function Ut(e){return!1}var gs=/eslint +react-compiler\/react-compiler: +\["error/,Zr={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 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 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 c=p.identifier.parent;if(c.type==="VariableDeclarator"&&c.init&&c.init.type==="CallExpression"&&c.init.callee&&Hr(c.init.callee))for(let m of p.resolved.references)m!==p&&i.add(m.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 m=new Set;function u(S,d){let{cache:b}=u,v=b.get(S.id),w=new Set(d);if(w.has(S.id)){let A=[...w],N=A.slice(A.indexOf(S.id)+1);for(let z of N)m.add(z);return BigInt("0")}if(w.add(S.id),v!==void 0)return v;if(a.thrownSegments.includes(S))v=BigInt("0");else if(S.prevSegments.length===0)v=BigInt("1");else{v=BigInt("0");for(let A of S.prevSegments)v+=u(A,w)}return S.reachable&&v===BigInt("0")?b.delete(S.id):b.set(S.id,v),v}function g(S,d){let{cache:b}=g,v=b.get(S.id),w=new Set(d);if(w.has(S.id)){let A=Array.from(w),N=A.slice(A.indexOf(S.id)+1);for(let z of N)m.add(z);return BigInt("0")}if(w.add(S.id),v!==void 0)return v;if(a.thrownSegments.includes(S))v=BigInt("0");else if(S.nextSegments.length===0)v=BigInt("1");else{v=BigInt("0");for(let A of S.nextSegments)v+=g(A,w)}return b.set(S.id,v),v}function y(S){let{cache:d}=y,b=d.get(S.id);if(b===null)return 1/0;if(b!==void 0)return b;if(d.set(S.id,null),S.prevSegments.length===0)b=1;else{b=1/0;for(let v of S.prevSegments){let w=y(v);w<b&&(b=w)}b+=1}return d.set(S.id,b),b}u.cache=new Map,g.cache=new Map,y.cache=new Map;let C=g(a.initialSegment),h=Kr(p),f=$t(p),I=h?qr(h)||Ge(h):Xr(p)||Gr(p),E=1/0;for(let S of a.finalSegments){if(!S.reachable)continue;let d=y(S);d<E&&(E=d)}for(let[S,d]of c){if(!S.reachable)continue;let b=S.nextSegments.length===0?E<=y(S):E<y(S),v=u(S)*g(S),w=m.has(S.id);for(let A of d)if(w&&!Ut(A)&&e.report({node:A,message:`React Hook "${r(A)}" 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:A,message:`React Hook "${r(A)}" cannot be called in an async function.`}),!w&&v!==C&&!Ut(A)){let z=`React Hook "${r(A)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(b?" Did you accidentally call a React Hook after an early return?":"");e.report({node:A,message:z})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let N=`React Hook "${r(A)}" 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:A,message:N})}else if(h){let N=`React Hook "${r(A)}" is called in function "${r(h)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:A,message:N})}else if(p.type==="Program"){let N=`React Hook "${r(A)}" 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:A,message:N})}else if(f&&!Ut(A)){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(A)}" 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:A,message:N})}}},CallExpression(a){if(Ge(a.callee)){let p=Jr(o),c=Jr(l),m=p.get(c);m||(m=[],p.set(c,m)),m.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()}),zt=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 I=f.split(/\r?\n/),E=I.filter(d=>d.trim()!=="");if(E.length===0)return f;let S=Number.POSITIVE_INFINITY;for(let d of E){let b=d.match(/^(\s*)/);b&&(S=Math.min(S,b[1]?.length??0))}return!isFinite(S)||S===0?f:I.map(d=>d.slice(S)).join(`
17
+ `)}function a(f,I,E){return f.split(/\r?\n/).map(d=>d.trim()===""?d:E.repeat(I)+d).join(`
18
+ `)}function p(f){if(f.type===ee.Identifier)return f.name;if(f.type===ee.MemberExpression){let I=f.object.type===ee.Identifier?f.object.name:null,E=f.property.type===ee.Identifier?f.property.name:null;return I&&E?`${I}.${E}`:E}return null}function c(f,I){if(!f)return!1;for(let E of I)if(E.includes(".")){let S=E.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===E)return!0;return!1}function m(f,I){let E=f.parent;if(E.type!==ee.TaggedTemplateExpression)return!1;let S=p(E.tag);return S?I.includes(S):!1}function u(f,I){if(!f||f.type!==ee.CallExpression)return!1;let{method:E,argumentsLength:S,optionalCall:d=!0,optionalMember:b=!0}=I;return S!==void 0&&f.arguments.length!==S||!d&&f.optional||f.callee.type!==ee.MemberExpression||!b&&f.callee.optional||f.callee.property.type!==ee.Identifier?!1:f.callee.property.name===E}function g(f,I){if(!f||f.type!==ee.CallExpression)return!1;let{name:E,argumentsLength:S,optionalCall:d=!0}=I;return S!==void 0&&f.arguments.length!==S||!d&&f.optional||f.callee.type!==ee.Identifier?!1:f.callee.name===E}function y(f){return u(f.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&f.parent.type===ee.CallExpression&&f.parent.arguments[0]===f&&g(f.parent.callee.type===ee.MemberExpression?f.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function C(f){if(i.length>0){let I=r.getTokenBefore(f,{includeComments:!0});if(I?.type===Ss.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(y(f)||o.length>0&&m(f,o)||t.length>0&&f.parent.type===ee.CallExpression&&f.parent.arguments.includes(f)&&c(f.parent.callee,t))}function h(f){let I=`__PLACEHOLDER__${Math.random()}`,E=f.quasis.map(q=>r.getText(q).slice(1,q.tail?-1:-2)).join(I),S=E.match(/\r?\n/);if(!S)return;let d=S[0],b=r.lines[r.getLocFromIndex(f.range[0]).line-1];if(!b)return;let w=b.match(/^(\s*)\S/)?.[1]??"",A;typeof l=="string"?A=l:typeof l=="number"?A=" ".repeat(l):A=w.startsWith(" ")?" ":" ";let z=s(E).replace(new RegExp(`^${d}|${d}[ ]*$`,"g"),""),Y=d+a(z,1,w+A)+d+w,Q=E.includes(`\r
19
19
  `)?`\r
20
20
  `:`
21
- `,Z=E.split(/\r?\n/),Ee=Z.map((q,fe)=>fe!==Z.length-1&&q===A+w?"":q).join(Q);if(Y!==Ee)return{node:f,messageId:"improperlyIndented",fix:q=>Y.split(I).map((fe,pe)=>{let ne=f.quasis[pe];return ne?q.replaceTextRange([ne.range[0]+1,ne.range[1]-(ne.tail?1:2)],fe):[]}).flat()}}return{TemplateLiteral(f){if(!C(f))return;let I=h(f);if(I)return e.report(I)}}}});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 re}from"@typescript-eslint/utils";import{z as Wt}from"zod/v4";var bs=Wt.object({checkOnly:Wt.array(Wt.enum(["function-args","FC","generic-args"])).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(u,g){if(!t.has(u))return;let d=t.get(u);if(!d||d.statement===g)return;let C=o.indexOf(d.statement),h=o.indexOf(g);C===-1||h===-1||(C>h||C!==h-1)&&e.report({node:d.node,messageId:"moveTypeAboveUsage",fix:s(d.statement,g)})}function i(u){for(let g of o)if(u.range[0]>=g.range[0]&&u.range[1]<=g.range[1])return g;return null}function s(u,g){return function*(d){let C=n.getText(u),h=n.getCommentsBefore(u),f=C;h.length>0&&(f=`${h.map(w=>n.getText(w)).join(`
21
+ `,Z=E.split(/\r?\n/),Ee=Z.map((q,fe)=>fe!==Z.length-1&&q===A+w?"":q).join(Q);if(Y!==Ee)return{node:f,messageId:"improperlyIndented",fix:q=>Y.split(I).map((fe,pe)=>{let re=f.quasis[pe];return re?q.replaceTextRange([re.range[0]+1,re.range[1]-(re.tail?1:2)],fe):[]}).flat()}}return{TemplateLiteral(f){if(!C(f))return;let I=h(f);if(I)return e.report(I)}}}});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 Wt=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 se}from"@typescript-eslint/utils";import{z as Le}from"zod/v4";var bs=Le.object({checkOnly:Le.array(Le.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:Le.array(Le.string()).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(u,g){if(!t.has(u))return;let y=t.get(u);if(!y||y.statement===g)return;let C=o.indexOf(y.statement),h=o.indexOf(g);C===-1||h===-1||(C>h||C!==h-1)&&e.report({node:y.node,messageId:"moveTypeAboveUsage",fix:s(y.statement,g)})}function i(u){for(let g of o)if(u.range[0]>=g.range[0]&&u.range[1]<=g.range[1])return g;return null}function s(u,g){return function*(y){let C=n.getText(u),h=n.getCommentsBefore(u),f=C;h.length>0&&(f=`${h.map(w=>n.getText(w)).join(`
22
22
  `)}
23
23
  ${C}`);let I=u.range[0],E=u.range[1];h.length>0&&h[0]&&(I=h[0].range[0]);let S=E;for(;S<n.text.length;){let v=n.text[S];if(v===`
24
24
  `){S++;let w=S;for(;w<n.text.length&&(n.text[w]===" "||n.text[w]===" ");)w++;w<n.text.length&&n.text[w]===`
25
- `&&(S=w+1);break}else if(v===" "||v===" ")S++;else break}E=S,yield d.removeRange([I,E]);let y=n.getCommentsBefore(g),b=y.length>0&&y[0]?y[0].range[0]:g.range[0];yield d.insertTextBeforeRange([b,b],`${f}
25
+ `&&(S=w+1);break}else if(v===" "||v===" ")S++;else break}E=S,yield y.removeRange([I,E]);let d=n.getCommentsBefore(g),b=d.length>0&&d[0]?d[0].range[0]:g.range[0];yield y.insertTextBeforeRange([b,b],`${f}
26
26
 
27
- `)}}function a(u){let g=u.parent;for(;g;){if(g.type===re.FunctionDeclaration||g.type===re.FunctionExpression||g.type===re.ArrowFunctionExpression){let d=g.params;for(let C of d)if(u.range[0]>=C.range[0]&&u.range[1]<=C.range[1])return!0;break}g=g.parent}return!1}function p(u){let g=u.parent;for(;g;){if(g.type===re.TSTypeParameterInstantiation){let d=g.parent;if(d.type===re.TSTypeReference&&d.typeName.type===re.Identifier&&(d.typeName.name==="FC"||d.typeName.name==="React.FC")||d.type===re.TSTypeReference&&d.typeName.type===re.TSQualifiedName&&d.typeName.right.name==="FC")return!0}g=g.parent}return!1}function c(u){let g=u.parent;for(;g;){if(g.type===re.TSTypeParameterInstantiation){let d=g.parent;return!(d.type===re.TSTypeReference&&d.typeName.type===re.Identifier&&(d.typeName.name==="FC"||d.typeName.name==="React.FC")||d.type===re.TSTypeReference&&d.typeName.type===re.TSQualifiedName&&d.typeName.right.name==="FC")}g=g.parent}return!1}let m=[];return{Program(u){o.push(...u.body)},TSTypeAliasDeclaration(u){if(o.some(d=>d.type===re.ExportNamedDeclaration&&d.declaration===u?!0:d===u)){let d=i(u);d&&t.set(u.id.name,{node:u,name:u.id.name,statement:d})}},TSInterfaceDeclaration(u){if(o.some(d=>d.type===re.ExportNamedDeclaration&&d.declaration===u?!0:d===u)){let d=i(u);d&&t.set(u.id.name,{node:u,name:u.id.name,statement:d})}},TSTypeReference(u){u.typeName.type===re.Identifier&&m.push({typeName:u.typeName.name,node:u,inFunctionArgs:a(u),inFCProps:p(u),inGenericArgs:c(u)})},"Program:exit"(){let u=new Map,g=m.filter(h=>{let{typeName:f}=h;if(!r.checkOnly||r.checkOnly.length===0)return!0;if(m.filter(E=>E.typeName===f).length>1)return!1;for(let E of r.checkOnly)if(E==="function-args"&&h.inFunctionArgs||E==="FC"&&h.inFCProps||E==="generic-args"&&h.inGenericArgs)return!0;return!1});for(let h of g){let{typeName:f,node:I}=h;if(t.has(f)){let E=i(I),S=t.get(f);if(E&&S&&E!==S.statement){u.has(f)||u.set(f,[]);let y=u.get(f);if(!y)return;y.includes(E)||y.push(E)}}}let d=[];for(let[h,f]of u)if(f.length>0){let I=f[0];if(!I)continue;for(let E of f)E.range[0]<I.range[0]&&(I=E);d.push({typeName:h,firstUsage:I})}let C=d.sort((h,f)=>h.firstUsage.range[0]-f.firstUsage.range[0]);if(C.length>0){let h=C[0];h&&l(h.typeName,h.firstUsage)}}}}});var en={[vt.name]:vt.rule,[pt.name]:pt.rule,[lt.name]:lt.rule,"rules-of-hooks":Zr,"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};
27
+ `)}}function a(u){let g=u.parent;for(;g;){if(g.type===se.FunctionDeclaration||g.type===se.FunctionExpression||g.type===se.ArrowFunctionExpression){let y=g.params;for(let C of y)if(u.range[0]>=C.range[0]&&u.range[1]<=C.range[1])return!0;break}g=g.parent}return!1}function p(u){let g=u.parent;for(;g;){if(g.type===se.TSTypeParameterInstantiation){let y=g.parent;if(y.type===se.TSTypeReference&&y.typeName.type===se.Identifier&&(y.typeName.name==="FC"||y.typeName.name==="React.FC")||y.type===se.TSTypeReference&&y.typeName.type===se.TSQualifiedName&&y.typeName.right.name==="FC")return!0}g=g.parent}return!1}function c(u){let g=u.parent;for(;g;){if(g.type===se.TSTypeParameterInstantiation){let y=g.parent;if(y.type===se.CallExpression||y.type===se.NewExpression)return!0}g=g.parent}return!1}let m=[];return{Program(u){o.push(...u.body)},TSTypeAliasDeclaration(u){if(o.some(y=>y.type===se.ExportNamedDeclaration&&y.declaration===u?!0:y===u)){let y=i(u);y&&t.set(u.id.name,{node:u,name:u.id.name,statement:y})}},TSInterfaceDeclaration(u){if(o.some(y=>y.type===se.ExportNamedDeclaration&&y.declaration===u?!0:y===u)){let y=i(u);y&&t.set(u.id.name,{node:u,name:u.id.name,statement:y})}},TSTypeReference(u){u.typeName.type===se.Identifier&&m.push({typeName:u.typeName.name,node:u,inFunctionArgs:a(u),inFCProps:p(u),inGenericArgAtFunctionCall:c(u)})},"Program:exit"(){let u=new Map,g=m.filter(h=>{let{typeName:f}=h;if(!r.checkOnly||r.checkOnly.length===0)return!0;if(m.filter(E=>E.typeName===f).length>1)return!1;for(let E of r.checkOnly)if(E==="function-args"&&h.inFunctionArgs||E==="FC"&&h.inFCProps||E==="generic-args-at-fn-calls"&&h.inGenericArgAtFunctionCall)return!0;return!1});for(let h of g){let{typeName:f,node:I}=h;if(t.has(f)){let E=i(I),S=t.get(f);if(E&&S&&E!==S.statement){u.has(f)||u.set(f,[]);let d=u.get(f);if(!d)return;d.includes(E)||d.push(E)}}}let y=[];for(let[h,f]of u)if(f.length>0){let I=f[0];if(!I)continue;for(let E of f)E.range[0]<I.range[0]&&(I=E);y.push({typeName:h,firstUsage:I})}let C=y.sort((h,f)=>h.firstUsage.range[0]-f.firstUsage.range[0]);if(C.length>0){let h=C[0];h&&l(h.typeName,h.firstUsage)}}}}});var en={[kt.name]:kt.rule,[ct.name]:ct.rule,[pt.name]:pt.rule,"rules-of-hooks":Zr,"exhaustive-deps":nr,"require-description":Vr.rule,[ut.name]:ut.rule,[mt.name]:mt.rule,[Pt.name]:Pt.rule,[et.name]:et.rule,[lt.name]:lt.rule,[Tt.name]:Tt.rule,[De.name]:De.rule,[jt.name]:jt.rule,[gt.name]:gt.rule,[ft.name]:ft.rule,[ht.name]:ht.rule,[rt.name]:rt.rule,[Lt.name]:Lt.rule,[Qe.name]:Qe.rule,[ot.name]:ot.rule,[Ct.name]:Ct.rule,[It.name]:It.rule,[At.name]:At.rule,[Rt.name]:Rt.rule,[wt.name]:wt.rule,[Dt.name]:Dt.rule,[bt.name]:bt.rule,[Et.name]:Et.rule,[Wt.name]:Wt.rule,[Ft.name]:Ft.rule,[_t.name]:_t.rule,[zt.name]:zt.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.60.0",
3
+ "version": "0.60.1",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"