@ls-stack/extended-lint 0.51.0 → 0.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- "use strict";var Bn=Object.create;var _e=Object.defineProperty;var qn=Object.getOwnPropertyDescriptor;var Xn=Object.getOwnPropertyNames;var Gn=Object.getPrototypeOf,Kn=Object.prototype.hasOwnProperty;var Zn=(e,t)=>{for(var n in t)_e(e,n,{get:t[n],enumerable:!0})},Mt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Xn(t))!Kn.call(e,o)&&o!==n&&_e(e,o,{get:()=>t[o],enumerable:!(r=qn(t,o))||r.enumerable});return e};var Ee=(e,t,n)=>(n=e!=null?Bn(Gn(e)):{},Mt(t||!e||!e.__esModule?_e(n,"default",{value:e,enumerable:!0}):n,e)),Qn=e=>Mt(_e({},"__esModule",{value:!0}),e);var Wi={};Zn(Wi,{extendedLintPlugin:()=>Ui});module.exports=Qn(Wi);var X=require("@typescript-eslint/utils");var Ge=Symbol.for("optional");function L(e){return{...e,[Ge]:!0}}function _t(e,t){return{enum:e,...t}}function Ae(e){return{...e,type:"boolean"}}function W(e){return{...e,type:"string"}}function pe(e){return{...e,type:"number"}}function G(e,t){return{...t,type:"array",items:e}}function V(e,t){let n={...t,type:"object",properties:e};if(e&&(n.additionalProperties||=!1,!n.required)){let r,o=[];for(r in e)e[r][Ge]?e[r][Ge]=void 0:o.push(r);o.length>0&&(n.required=o)}return n}var er=X.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),$t="react-compiler-extra",tr=V({runOnlyWithEnableCompilerDirective:L(Ae())}),nr=/eslint +react-compiler\/react-compiler: +\["error/;function rr(e){return e.type===X.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===X.AST_NODE_TYPES.MemberExpression&&e.property.type===X.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var ir=/\bthis[.[]/;function Lt(e){return ir.test(e)}var sr=er({name:$t,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:[tr]},defaultOptions:[{}],create(e,[t]){let n=!1;if(t.runOnlyWithEnableCompilerDirective){for(let a of e.sourceCode.getAllComments())if(nr.test(a.value)){n=!0;break}if(!n)return{}}function r(a){for(let s of a.properties)if(s.type===X.AST_NODE_TYPES.Property&&s.method&&s.value.type===X.AST_NODE_TYPES.FunctionExpression){let i=e.sourceCode,l=i.getText(s.key),c=s.value,p=i.getText(c.body);if(Lt(p))e.report({node:s,messageId:"thisKeywordInMethod"});else{let u=c.params.map(h=>i.getText(h)).join(", "),g="";c.generator?g=`${l}: function* (${u}) ${p}`:g=`${l}: (${u}) => ${p}`,e.report({node:s,messageId:"objectMethodIsNotSupported",fix:h=>h.replaceText(s,g)})}}}function o(a){for(let s of a.properties)if(s.type===X.AST_NODE_TYPES.Property&&s.value.type===X.AST_NODE_TYPES.ObjectExpression){for(let i of s.value.properties)if(i.type===X.AST_NODE_TYPES.Property&&i.method&&i.value.type===X.AST_NODE_TYPES.FunctionExpression){let c=e.sourceCode.getText(i.value.body);Lt(c)&&e.report({node:i,messageId:"thisKeywordInMethod"})}}}return{CallExpression(a){if(rr(a.callee))for(let s of a.arguments){if(s.type===X.AST_NODE_TYPES.ObjectExpression&&(r(s),o(s)),s.type===X.AST_NODE_TYPES.ArrowFunctionExpression&&(s.body.type===X.AST_NODE_TYPES.ObjectExpression&&(r(s.body),o(s.body)),s.body.type===X.AST_NODE_TYPES.BlockStatement))for(let i of s.body.body)i.type===X.AST_NODE_TYPES.ReturnStatement&&i.argument?.type===X.AST_NODE_TYPES.ObjectExpression&&(r(i.argument),o(i.argument));if(s.type===X.AST_NODE_TYPES.FunctionExpression)for(let i of s.body.body)i.type===X.AST_NODE_TYPES.ReturnStatement&&i.argument?.type===X.AST_NODE_TYPES.ObjectExpression&&(r(i.argument),o(i.argument))}}}}}),Ke={name:$t,rule:sr};var K=require("@typescript-eslint/utils"),S=Ee(require("zod/v4"));var zt=require("@typescript-eslint/utils"),Ut=Ee(require("zod/v4"));function re(e){let n=zt.ESLintUtils.RuleCreator(r=>`https://github.com/lucasols/extended-lint#${r}`)(e);return{name:e.name,rule:n}}function Le(e){return Ut.toJSONSchema(e)}var or=S.object({disallow:S.array(S.object({selector:S.string(),message:S.string(),replace:S.optional(S.union([S.string(),S.object({regex:S.string(),with:S.string()})])),replaceType:S.optional(S.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:S.optional(S.array(S.object({fn:S.string(),withArgs:S.optional(S.array(S.object({atIndex:S.number(),value:S.union([S.string(),S.number(),S.boolean()])}))),message:S.string(),replaceWith:S.optional(S.string()),ignoreRegex:S.optional(S.string())}))),__dev_simulateFileName:S.optional(S.string()),mustMatchSyntax:S.optional(S.array(S.object({includeRegex:S.string(),mustCallFn:S.optional(S.array(S.object({anyCall:S.array(S.object({fn:S.string(),withArgs:S.array(S.object({atIndex:S.number(),literal:S.union([S.string(),S.number(),S.boolean()])}))})),message:S.optional(S.string())}))),mustMatchSelector:S.optional(S.array(S.object({selector:S.string(),message:S.string()}))),mustHaveExport:S.optional(S.array(S.object({name:S.string(),type:S.enum(["function","variable","any"]).default("any"),message:S.string()})))})))}),Ze=re({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[Le(or)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let n={},{mustMatchSyntax:r,__dev_simulateFileName:o,disallow:a,disallowFnCalls:s}=t,i=o??e.filename,l=[],c=new Map,p=new Set,u=new Map,g=new Set,h=new Map;function x(m){for(let y of m.specifiers)y.type===K.AST_NODE_TYPES.ImportSpecifier&&y.imported.type===K.AST_NODE_TYPES.Identifier&&y.imported.name!==y.local.name&&h.set(y.local.name,y.imported.name)}function b(m){if(m.declaration){if(m.declaration.type===K.AST_NODE_TYPES.FunctionDeclaration&&m.declaration.id){let y=m.declaration.id.name;for(let A of Array.from(g)){let[I,E]=A.split(":");I===y&&(E==="function"||E==="any")&&g.delete(A)}}else if(m.declaration.type===K.AST_NODE_TYPES.VariableDeclaration){for(let y of m.declaration.declarations)if(y.id.type===K.AST_NODE_TYPES.Identifier){let A=y.id.name;for(let I of Array.from(g)){let[E,F]=I.split(":");E===A&&(F==="variable"||F==="any")&&g.delete(I)}}}}for(let y of m.specifiers)if(y.exported.type===K.AST_NODE_TYPES.Identifier){let A=y.exported.name;for(let I of Array.from(g)){let[E,F]=I.split(":");E===A&&F==="any"&&g.delete(I)}}}function k(m){m.id.type===K.AST_NODE_TYPES.Identifier&&m.init?.type===K.AST_NODE_TYPES.Identifier&&h.set(m.id.name,m.init.name)}function w(m){return h.get(m)??m}function M(m,y){return w(m)===y||m===y}for(let{includeRegex:m,mustCallFn:y,mustMatchSelector:A,mustHaveExport:I}of r??[]){let E=ar(i,new RegExp(m));if(!E)continue;let F=Y=>{let q=Y;for(let{name:ee,value:Z}of E)q=q.replaceAll(ee,Z);return q};for(let{anyCall:Y,message:q}of y??[]){let ee=`Expected file to call the function: ${Y.map(({fn:Z})=>Z).join(" or ")}`;p.add(ee),l.push(Z=>{let{callee:Ce}=Z;if(Ce.type===K.AST_NODE_TYPES.Identifier){for(let{fn:ne,withArgs:Oe}of Y)if(Ce.name===ne){p.delete(ee);for(let ue of Oe){let ce=Z.arguments[ue.atIndex],fe=typeof ue.literal=="string"?F(ue.literal):ue.literal;if(!ce){e.report({node:Z,messageId:"default",data:{message:`Missing argument with value "${fe}" at index ${ue.atIndex}${q?`: ${F(q)}`:""}`}});continue}if(ce.type!==K.AST_NODE_TYPES.Literal){e.report({node:ce,messageId:"default",data:{message:`Argument at position ${ue.atIndex} should the literal "${fe}"${q?`: ${F(q)}`:""}`}});continue}ce.value!==fe&&e.report({node:ce,messageId:"default",data:{message:`Argument should have the value "${fe}"${q?`: ${F(q)}`:""}`},fix:Ie=>Ie.replaceText(ce,typeof fe=="string"?`'${fe}'`:String(fe))})}break}}})}for(let{selector:Y,message:q}of A??[])u.set(Y,F(q)),c.set(F(Y),()=>{u.delete(Y)});for(let{name:Y,type:q,message:ee}of I??[]){let Z=F(Y),Ce=F(ee);g.add(`${Z}:${q}:${Ce}`)}}for(let{fn:m,withArgs:y,message:A,replaceWith:I,ignoreRegex:E}of s??[])E&&new RegExp(E).test(i)||l.push(F=>{let{callee:Y}=F;if(Y.type!==K.AST_NODE_TYPES.Identifier||!M(Y.name,m))return;if(y)for(let ee of y){let Z=F.arguments[ee.atIndex];if(!Z){e.report({node:F,messageId:"default",data:{message:`Missing argument with value "${ee.value}" at index ${ee.atIndex}: ${A}`}});return}if(Z.type!==K.AST_NODE_TYPES.Literal||Z.value!==ee.value)return}let q=ee=>I?ee.replaceText(F,I):null;e.report({node:F,messageId:"default",data:{message:A},suggest:I?[{messageId:"default",data:{message:`Replace with "${I}"`},fix:q}]:void 0})});function P(m,y){let A=n[m];A?n[m]=I=>{A(I),y(I)}:n[m]=y}for(let{selector:m,message:y,replace:A,replaceType:I="suggestion"}of a??[]){if(m==="CallExpression"){l.push(E=>{T(A,E,y,I)});continue}n[m]=E=>{T(A,E,y,I)}}if(c.size>0)for(let[m,y]of c)P(m,y);return l.length>0&&(n.CallExpression=m=>{if(m.type===K.AST_NODE_TYPES.CallExpression)for(let y of l)y(m)}),n.ImportDeclaration=m=>{m.type===K.AST_NODE_TYPES.ImportDeclaration&&x(m)},n.ExportNamedDeclaration=m=>{m.type===K.AST_NODE_TYPES.ExportNamedDeclaration&&b(m)},n.VariableDeclarator=m=>{m.type===K.AST_NODE_TYPES.VariableDeclarator&&k(m)},n["Program:exit"]=m=>{for(let y of p)e.report({node:m,messageId:"default",data:{message:y}});for(let[,y]of u)e.report({node:m,messageId:"default",data:{message:y}});for(let y of g){let[A,I,E]=y.split(":");e.report({node:m,messageId:"default",data:{message:`Missing required export "${A}" of type ${I}: ${E}`}})}},n;function T(m,y,A,I){let E=F=>{if(!m)return null;if(typeof m=="string")return F.replaceText(y,m);{let Y=new RegExp(m.regex),q=e.sourceCode.getText(y);return F.replaceText(y,q.replace(Y,m.with))}};e.report({node:y,messageId:"default",data:{message:A},fix:m&&I==="autofix"?E:void 0,suggest:m&&I==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof m=="string"?m:m.with}"`},fix:E}]:void 0})}}});function ar(e,t){let n=[],r=t.exec(e);if(!r)return null;let[o,...a]=r;n.push({name:"$0_lowercase",value:o.toLowerCase()}),n.push({name:"$0_capitalize",value:Wt(o)}),n.push({name:"$0_uncapitalize",value:Vt(o)}),n.push({name:"$0",value:o});for(let s=0;s<a.length;s++){let i=`$${s+1}`,l=a[s];n.push({name:`${i}_lowercase`,value:l.toLowerCase()}),n.push({name:`${i}_capitalize`,value:Wt(l)}),n.push({name:`${i}_uncapitalize`,value:Vt(l)}),n.push({name:i,value:l})}return n}function Wt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Vt(e){return e.charAt(0).toLowerCase()+e.slice(1)}var _=require("@typescript-eslint/utils");var lr=_.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Yt="collapse-simple-objs-in-one-line",cr=V({maxLineLength:L(pe()),maxProperties:L(pe()),nestedObjMaxLineLength:L(pe()),nestedObjMaxProperties:L(pe()),ignoreTypesWithSuffix:L(G(W()))}),pr=lr({name:Yt,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[cr]},defaultOptions:[{}],create(e,[t]){let n=e.sourceCode,r=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,a=t.nestedObjMaxLineLength??t.maxLineLength,s=t.nestedObjMaxProperties??3;function i(c){if(c.type===_.AST_NODE_TYPES.ObjectExpression){let p=c.parent.type===_.AST_NODE_TYPES.Property,u=p?s:o,g=c.properties.length;if(g>u)return!1;if(g===1){let x=c.properties[0];return x.type===_.AST_NODE_TYPES.Property&&x.value.type===_.AST_NODE_TYPES.ObjectExpression||x.type===_.AST_NODE_TYPES.Property&&x.value.type===_.AST_NODE_TYPES.ArrayExpression&&!x.value.elements.every(k=>k&&Qe(k))?!1:{text:n.getText(x),isNested:p,propsSize:g}}let h=[];for(let x of c.properties){if(x.type===_.AST_NODE_TYPES.Property&&!Qe(x.value))return!1;h.push(n.getText(x))}return{text:h.join(", "),isNested:p,propsSize:g}}else{let p=c.parent.parent?.type===_.AST_NODE_TYPES.TSPropertySignature,u=p?s:o,g=c.members.length;if(g>u)return!1;if(r.length>0&&c.parent.type===_.AST_NODE_TYPES.TSTypeAliasDeclaration){let x=c.parent.id.name;if(r.some(b=>x.endsWith(b)))return!1}if(g===1){let x=c.members[0];return x.type===_.AST_NODE_TYPES.TSPropertySignature&&x.typeAnnotation?.typeAnnotation.type===_.AST_NODE_TYPES.TSTypeLiteral?!1:{text:n.getText(x),isNested:p,propsSize:1}}if(c.parent.type===_.AST_NODE_TYPES.TSIntersectionType||c.parent.type===_.AST_NODE_TYPES.TSUnionType&&c.parent.types[0]!==c)return!1;let h=[];for(let x of c.members){if(x.type!==_.AST_NODE_TYPES.TSPropertySignature)return!1;let b=x.typeAnnotation?.typeAnnotation;if(!b||b.type===_.AST_NODE_TYPES.TSTypeLiteral||!Ht(b))return!1;if(b.type===_.AST_NODE_TYPES.TSTypeReference&&b.typeArguments){if(b.typeArguments.params.length>1)return!1;let w=b.typeArguments.params[0];if(!Ht(w))return!1}let k=n.getText(x).trim();(k.endsWith(";")||k.endsWith(","))&&(k=k.slice(0,-1)),h.push(k)}return{text:h.join("; "),isNested:p,propsSize:g}}}function l(c){if(c.loc.start.line===c.loc.end.line)return;if(c.parent.type!==_.AST_NODE_TYPES.JSXExpressionContainer){let b=0,k=!1,w=n.getTokenAfter(c,{filter:P=>P.type!==_.AST_TOKEN_TYPES.Punctuator||k?!0:P.value===","?(b++,!1):P.value===";"?(b++,k=!0,!1):P.value===")"||P.value==="}"?(b++,!1):!0});if(b>4)return;let M=w?.type===_.AST_TOKEN_TYPES.Template&&w.value.startsWith(`}
2
- `);if(w?.loc.start.line===c.loc.end.line&&!M)return}let p=i(c);if(!p)return;let u=p.text;if(u.includes(`
3
- `)||n.getCommentsInside(c).length>0)return;u.endsWith(";")&&(u=u.slice(0,-1));let g=`{ ${u} }`,h=fr(n,c),x=p.isNested&&p.propsSize>2?a:t.maxLineLength;x&&g.length+h.length+ur(c,n)>x||e.report({node:c,messageId:"singleLineProp",fix:b=>b.replaceText(c,g)})}return{TSTypeLiteral:l,ObjectExpression:l}}});function Ht(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 Qe(e,t){return!!(e.type===_.AST_NODE_TYPES.Literal||e.type===_.AST_NODE_TYPES.Identifier||e.type===_.AST_NODE_TYPES.TemplateLiteral||e.type===_.AST_NODE_TYPES.TaggedTemplateExpression||!t&&e.type===_.AST_NODE_TYPES.ArrayExpression&&e.elements.every(n=>n&&Qe(n,!0)))}function ur(e,t){let n=t.getLastToken(e);if(!n)return 0;let r=t.text.indexOf(`
4
- `,n.range[1]);return(r!==-1?r:t.text.length)-n.range[1]}function fr(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var et={name:Yt,rule:pr};var mr=/eslint +react-compiler\/react-compiler: +\["error/,Bt={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"}}}]},create(e){let t=!1,n=typeof e.getSource=="function"?w=>n(w):w=>e.sourceCode.getText(w),r=typeof e.getScope=="function"?()=>r():w=>e.sourceCode.getScope(w),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,a=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,s={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:a};function i(w){a&&Array.isArray(w.suggest)&&w.suggest.length>0&&(w.fix=w.suggest[0].fix),e.report(w)}let l=e.getSourceCode().scopeManager,c=new WeakMap,p=new WeakSet,u=new WeakMap,g=new WeakMap,h=new WeakSet;function x(w,M){return function(P){if(M.has(P))return M.get(P);let T=w(P);return M.set(P,T),T}}function b(w,M,P,T,m){m&&w.async&&i({node:w,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
1
+ "use strict";var er=Object.create;var Ue=Object.defineProperty;var tr=Object.getOwnPropertyDescriptor;var nr=Object.getOwnPropertyNames;var rr=Object.getPrototypeOf,ir=Object.prototype.hasOwnProperty;var sr=(e,t)=>{for(var r in t)Ue(e,r,{get:t[r],enumerable:!0})},Ht=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of nr(t))!ir.call(e,s)&&s!==r&&Ue(e,s,{get:()=>t[s],enumerable:!(n=tr(t,s))||n.enumerable});return e};var Re=(e,t,r)=>(r=e!=null?er(rr(e)):{},Ht(t||!e||!e.__esModule?Ue(r,"default",{value:e,enumerable:!0}):r,e)),or=e=>Ht(Ue({},"__esModule",{value:!0}),e);var Zi={};sr(Zi,{extendedLintPlugin:()=>Ki});module.exports=or(Zi);var X=require("@typescript-eslint/utils");var Qe=Symbol.for("optional");function _(e){return{...e,[Qe]:!0}}function zt(e,t){return{enum:e,...t}}function ve(e){return{...e,type:"boolean"}}function V(e){return{...e,type:"string"}}function ue(e){return{...e,type:"number"}}function K(e,t){return{...t,type:"array",items:e}}function H(e,t){let r={...t,type:"object",properties:e};if(e&&(r.additionalProperties||=!1,!r.required)){let n,s=[];for(n in e)e[n][Qe]?e[n][Qe]=void 0:s.push(n);s.length>0&&(r.required=s)}return r}var ar=X.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Jt="react-compiler-extra",lr=H({runOnlyWithEnableCompilerDirective:_(ve())}),cr=/eslint +react-compiler\/react-compiler: +\["error/;function pr(e){return e.type===X.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===X.AST_NODE_TYPES.MemberExpression&&e.property.type===X.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var ur=/\bthis[.[]/;function Yt(e){return ur.test(e)}var fr=ar({name:Jt,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:[lr]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let a of e.sourceCode.getAllComments())if(cr.test(a.value)){r=!0;break}if(!r)return{}}function n(a){for(let o of a.properties)if(o.type===X.AST_NODE_TYPES.Property&&o.method&&o.value.type===X.AST_NODE_TYPES.FunctionExpression){let i=e.sourceCode,l=i.getText(o.key),c=o.value,p=i.getText(c.body);if(Yt(p))e.report({node:o,messageId:"thisKeywordInMethod"});else{let u=c.params.map(S=>i.getText(S)).join(", "),g="";c.generator?g=`${l}: function* (${u}) ${p}`:g=`${l}: (${u}) => ${p}`,e.report({node:o,messageId:"objectMethodIsNotSupported",fix:S=>S.replaceText(o,g)})}}}function s(a){for(let o of a.properties)if(o.type===X.AST_NODE_TYPES.Property&&o.value.type===X.AST_NODE_TYPES.ObjectExpression){for(let i of o.value.properties)if(i.type===X.AST_NODE_TYPES.Property&&i.method&&i.value.type===X.AST_NODE_TYPES.FunctionExpression){let c=e.sourceCode.getText(i.value.body);Yt(c)&&e.report({node:i,messageId:"thisKeywordInMethod"})}}}return{CallExpression(a){if(pr(a.callee))for(let o of a.arguments){if(o.type===X.AST_NODE_TYPES.ObjectExpression&&(n(o),s(o)),o.type===X.AST_NODE_TYPES.ArrowFunctionExpression&&(o.body.type===X.AST_NODE_TYPES.ObjectExpression&&(n(o.body),s(o.body)),o.body.type===X.AST_NODE_TYPES.BlockStatement))for(let i of o.body.body)i.type===X.AST_NODE_TYPES.ReturnStatement&&i.argument?.type===X.AST_NODE_TYPES.ObjectExpression&&(n(i.argument),s(i.argument));if(o.type===X.AST_NODE_TYPES.FunctionExpression)for(let i of o.body.body)i.type===X.AST_NODE_TYPES.ReturnStatement&&i.argument?.type===X.AST_NODE_TYPES.ObjectExpression&&(n(i.argument),s(i.argument))}}}}}),et={name:Jt,rule:fr};var Z=require("@typescript-eslint/utils"),h=require("zod/v4");var qt=require("@typescript-eslint/utils"),Bt=Re(require("zod/v4"));function G(e){let r=qt.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function ke(e){return Bt.toJSONSchema(e)}var mr=h.z.object({disallow:h.z.array(h.z.object({selector:h.z.string(),message:h.z.string(),replace:h.z.optional(h.z.union([h.z.string(),h.z.object({regex:h.z.string(),with:h.z.string()})])),replaceType:h.z.optional(h.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:h.z.optional(h.z.array(h.z.object({fn:h.z.string(),withArgs:h.z.optional(h.z.array(h.z.object({atIndex:h.z.number(),value:h.z.union([h.z.string(),h.z.number(),h.z.boolean()])}))),message:h.z.string(),replaceWith:h.z.optional(h.z.string()),ignoreRegex:h.z.optional(h.z.string())}))),__dev_simulateFileName:h.z.optional(h.z.string()),mustMatchSyntax:h.z.optional(h.z.array(h.z.object({includeRegex:h.z.string(),mustCallFn:h.z.optional(h.z.array(h.z.object({anyCall:h.z.array(h.z.object({fn:h.z.string(),withArgs:h.z.array(h.z.object({atIndex:h.z.number(),literal:h.z.union([h.z.string(),h.z.number(),h.z.boolean()])}))})),message:h.z.optional(h.z.string())}))),mustMatchSelector:h.z.optional(h.z.array(h.z.object({selector:h.z.string(),message:h.z.string()}))),mustHaveExport:h.z.optional(h.z.array(h.z.object({name:h.z.string(),type:h.z.enum(["function","variable","any"]).default("any"),message:h.z.string()})))})))}),tt=G({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[ke(mr)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:s,disallow:a,disallowFnCalls:o}=t,i=s??e.filename,l=[],c=new Map,p=new Set,u=new Map,g=new Set,S=new Map;function x(m){for(let y of m.specifiers)y.type===Z.AST_NODE_TYPES.ImportSpecifier&&y.imported.type===Z.AST_NODE_TYPES.Identifier&&y.imported.name!==y.local.name&&S.set(y.local.name,y.imported.name)}function b(m){if(m.declaration){if(m.declaration.type===Z.AST_NODE_TYPES.FunctionDeclaration&&m.declaration.id){let y=m.declaration.id.name;for(let A of Array.from(g)){let[C,E]=A.split(":");C===y&&(E==="function"||E==="any")&&g.delete(A)}}else if(m.declaration.type===Z.AST_NODE_TYPES.VariableDeclaration){for(let y of m.declaration.declarations)if(y.id.type===Z.AST_NODE_TYPES.Identifier){let A=y.id.name;for(let C of Array.from(g)){let[E,F]=C.split(":");E===A&&(F==="variable"||F==="any")&&g.delete(C)}}}}for(let y of m.specifiers)if(y.exported.type===Z.AST_NODE_TYPES.Identifier){let A=y.exported.name;for(let C of Array.from(g)){let[E,F]=C.split(":");E===A&&F==="any"&&g.delete(C)}}}function v(m){m.id.type===Z.AST_NODE_TYPES.Identifier&&m.init?.type===Z.AST_NODE_TYPES.Identifier&&S.set(m.id.name,m.init.name)}function w(m){return S.get(m)??m}function L(m,y){return w(m)===y||m===y}for(let{includeRegex:m,mustCallFn:y,mustMatchSelector:A,mustHaveExport:C}of n??[]){let E=dr(i,new RegExp(m));if(!E)continue;let F=Y=>{let B=Y;for(let{name:te,value:Q}of E)B=B.replaceAll(te,Q);return B};for(let{anyCall:Y,message:B}of y??[]){let te=`Expected file to call the function: ${Y.map(({fn:Q})=>Q).join(" or ")}`;p.add(te),l.push(Q=>{let{callee:Ce}=Q;if(Ce.type===Z.AST_NODE_TYPES.Identifier){for(let{fn:re,withArgs:Ne}of Y)if(Ce.name===re){p.delete(te);for(let fe of Ne){let pe=Q.arguments[fe.atIndex],me=typeof fe.literal=="string"?F(fe.literal):fe.literal;if(!pe){e.report({node:Q,messageId:"default",data:{message:`Missing argument with value "${me}" at index ${fe.atIndex}${B?`: ${F(B)}`:""}`}});continue}if(pe.type!==Z.AST_NODE_TYPES.Literal){e.report({node:pe,messageId:"default",data:{message:`Argument at position ${fe.atIndex} should the literal "${me}"${B?`: ${F(B)}`:""}`}});continue}pe.value!==me&&e.report({node:pe,messageId:"default",data:{message:`Argument should have the value "${me}"${B?`: ${F(B)}`:""}`},fix:Ae=>Ae.replaceText(pe,typeof me=="string"?`'${me}'`:String(me))})}break}}})}for(let{selector:Y,message:B}of A??[])u.set(Y,F(B)),c.set(F(Y),()=>{u.delete(Y)});for(let{name:Y,type:B,message:te}of C??[]){let Q=F(Y),Ce=F(te);g.add(`${Q}:${B}:${Ce}`)}}for(let{fn:m,withArgs:y,message:A,replaceWith:C,ignoreRegex:E}of o??[])E&&new RegExp(E).test(i)||l.push(F=>{let{callee:Y}=F;if(Y.type!==Z.AST_NODE_TYPES.Identifier||!L(Y.name,m))return;if(y)for(let te of y){let Q=F.arguments[te.atIndex];if(!Q){e.report({node:F,messageId:"default",data:{message:`Missing argument with value "${te.value}" at index ${te.atIndex}: ${A}`}});return}if(Q.type!==Z.AST_NODE_TYPES.Literal||Q.value!==te.value)return}let B=te=>C?te.replaceText(F,C):null;e.report({node:F,messageId:"default",data:{message:A},suggest:C?[{messageId:"default",data:{message:`Replace with "${C}"`},fix:B}]:void 0})});function P(m,y){let A=r[m];A?r[m]=C=>{A(C),y(C)}:r[m]=y}for(let{selector:m,message:y,replace:A,replaceType:C="suggestion"}of a??[]){if(m==="CallExpression"){l.push(E=>{T(A,E,y,C)});continue}r[m]=E=>{T(A,E,y,C)}}if(c.size>0)for(let[m,y]of c)P(m,y);return l.length>0&&(r.CallExpression=m=>{if(m.type===Z.AST_NODE_TYPES.CallExpression)for(let y of l)y(m)}),r.ImportDeclaration=m=>{m.type===Z.AST_NODE_TYPES.ImportDeclaration&&x(m)},r.ExportNamedDeclaration=m=>{m.type===Z.AST_NODE_TYPES.ExportNamedDeclaration&&b(m)},r.VariableDeclarator=m=>{m.type===Z.AST_NODE_TYPES.VariableDeclarator&&v(m)},r["Program:exit"]=m=>{for(let y of p)e.report({node:m,messageId:"default",data:{message:y}});for(let[,y]of u)e.report({node:m,messageId:"default",data:{message:y}});for(let y of g){let[A,C,E]=y.split(":");e.report({node:m,messageId:"default",data:{message:`Missing required export "${A}" of type ${C}: ${E}`}})}},r;function T(m,y,A,C){let E=F=>{if(!m)return null;if(typeof m=="string")return F.replaceText(y,m);{let Y=new RegExp(m.regex),B=e.sourceCode.getText(y);return F.replaceText(y,B.replace(Y,m.with))}};e.report({node:y,messageId:"default",data:{message:A},fix:m&&C==="autofix"?E:void 0,suggest:m&&C==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof m=="string"?m:m.with}"`},fix:E}]:void 0})}}});function dr(e,t){let r=[],n=t.exec(e);if(!n)return null;let[s,...a]=n;r.push({name:"$0_lowercase",value:s.toLowerCase()}),r.push({name:"$0_capitalize",value:Xt(s)}),r.push({name:"$0_uncapitalize",value:Gt(s)}),r.push({name:"$0",value:s});for(let o=0;o<a.length;o++){let i=`$${o+1}`,l=a[o];r.push({name:`${i}_lowercase`,value:l.toLowerCase()}),r.push({name:`${i}_capitalize`,value:Xt(l)}),r.push({name:`${i}_uncapitalize`,value:Gt(l)}),r.push({name:i,value:l})}return r}function Xt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Gt(e){return e.charAt(0).toLowerCase()+e.slice(1)}var M=require("@typescript-eslint/utils");var yr=M.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Zt="collapse-simple-objs-in-one-line",gr=H({maxLineLength:_(ue()),maxProperties:_(ue()),nestedObjMaxLineLength:_(ue()),nestedObjMaxProperties:_(ue()),ignoreTypesWithSuffix:_(K(V()))}),Sr=yr({name:Zt,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:[gr]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],s=t.maxProperties??2,a=t.nestedObjMaxLineLength??t.maxLineLength,o=t.nestedObjMaxProperties??3;function i(c){if(c.type===M.AST_NODE_TYPES.ObjectExpression){let p=c.parent.type===M.AST_NODE_TYPES.Property,u=p?o:s,g=c.properties.length;if(g>u)return!1;if(g===1){let x=c.properties[0];return x.type===M.AST_NODE_TYPES.Property&&x.value.type===M.AST_NODE_TYPES.ObjectExpression||x.type===M.AST_NODE_TYPES.Property&&x.value.type===M.AST_NODE_TYPES.ArrayExpression&&!x.value.elements.every(v=>v&&nt(v))?!1:{text:r.getText(x),isNested:p,propsSize:g}}let S=[];for(let x of c.properties){if(x.type===M.AST_NODE_TYPES.Property&&!nt(x.value))return!1;S.push(r.getText(x))}return{text:S.join(", "),isNested:p,propsSize:g}}else{let p=c.parent.parent?.type===M.AST_NODE_TYPES.TSPropertySignature,u=p?o:s,g=c.members.length;if(g>u)return!1;if(n.length>0&&c.parent.type===M.AST_NODE_TYPES.TSTypeAliasDeclaration){let x=c.parent.id.name;if(n.some(b=>x.endsWith(b)))return!1}if(g===1){let x=c.members[0];return x.type===M.AST_NODE_TYPES.TSPropertySignature&&x.typeAnnotation?.typeAnnotation.type===M.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(x),isNested:p,propsSize:1}}if(c.parent.type===M.AST_NODE_TYPES.TSIntersectionType||c.parent.type===M.AST_NODE_TYPES.TSUnionType&&c.parent.types[0]!==c)return!1;let S=[];for(let x of c.members){if(x.type!==M.AST_NODE_TYPES.TSPropertySignature)return!1;let b=x.typeAnnotation?.typeAnnotation;if(!b||b.type===M.AST_NODE_TYPES.TSTypeLiteral||!Kt(b))return!1;if(b.type===M.AST_NODE_TYPES.TSTypeReference&&b.typeArguments){if(b.typeArguments.params.length>1)return!1;let w=b.typeArguments.params[0];if(!Kt(w))return!1}let v=r.getText(x).trim();(v.endsWith(";")||v.endsWith(","))&&(v=v.slice(0,-1)),S.push(v)}return{text:S.join("; "),isNested:p,propsSize:g}}}function l(c){if(c.loc.start.line===c.loc.end.line)return;if(c.parent.type!==M.AST_NODE_TYPES.JSXExpressionContainer){let b=0,v=!1,w=r.getTokenAfter(c,{filter:P=>P.type!==M.AST_TOKEN_TYPES.Punctuator||v?!0:P.value===","?(b++,!1):P.value===";"?(b++,v=!0,!1):P.value===")"||P.value==="}"?(b++,!1):!0});if(b>4)return;let L=w?.type===M.AST_TOKEN_TYPES.Template&&w.value.startsWith(`}
2
+ `);if(w?.loc.start.line===c.loc.end.line&&!L)return}let p=i(c);if(!p)return;let u=p.text;if(u.includes(`
3
+ `)||r.getCommentsInside(c).length>0)return;u.endsWith(";")&&(u=u.slice(0,-1));let g=`{ ${u} }`,S=hr(r,c),x=p.isNested&&p.propsSize>2?a:t.maxLineLength;x&&g.length+S.length+Tr(c,r)>x||e.report({node:c,messageId:"singleLineProp",fix:b=>b.replaceText(c,g)})}return{TSTypeLiteral:l,ObjectExpression:l}}});function Kt(e){return e.type===M.AST_NODE_TYPES.TSLiteralType||e.type===M.AST_NODE_TYPES.TSTypeReference||e.type===M.AST_NODE_TYPES.TSNumberKeyword||e.type===M.AST_NODE_TYPES.TSStringKeyword||e.type===M.AST_NODE_TYPES.TSBooleanKeyword||e.type===M.AST_NODE_TYPES.TSNullKeyword||e.type===M.AST_NODE_TYPES.TSUndefinedKeyword}function nt(e,t){return!!(e.type===M.AST_NODE_TYPES.Literal||e.type===M.AST_NODE_TYPES.Identifier||e.type===M.AST_NODE_TYPES.TemplateLiteral||e.type===M.AST_NODE_TYPES.TaggedTemplateExpression||!t&&e.type===M.AST_NODE_TYPES.ArrayExpression&&e.elements.every(r=>r&&nt(r,!0)))}function Tr(e,t){let r=t.getLastToken(e);if(!r)return 0;let n=t.text.indexOf(`
4
+ `,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function hr(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var rt={name:Zt,rule:Sr};var Er=/eslint +react-compiler\/react-compiler: +\["error/,en={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"}}}]},create(e){let t=!1,r=typeof e.getSource=="function"?w=>r(w):w=>e.sourceCode.getText(w),n=typeof e.getScope=="function"?()=>n():w=>e.sourceCode.getScope(w),s=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,a=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,o={additionalHooks:s,enableDangerousAutofixThisMayCauseInfiniteLoops:a};function i(w){a&&Array.isArray(w.suggest)&&w.suggest.length>0&&(w.fix=w.suggest[0].fix),e.report(w)}let l=e.getSourceCode().scopeManager,c=new WeakMap,p=new WeakSet,u=new WeakMap,g=new WeakMap,S=new WeakSet;function x(w,L){return function(P){if(L.has(P))return L.get(P);let T=w(P);return L.set(P,T),T}}function b(w,L,P,T,m){m&&w.async&&i({node:w,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,5 +12,5 @@ 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 y=l.acquire(w),A=new Set,I=null;{let f=y.upper;for(;f&&(A.add(f),f.type!=="function");)f=f.upper;if(!f)return;I=f}let E=Array.isArray;function F(f){if(!E(f.defs))return!1;let d=f.defs[0];if(d==null||d.node.type!=="VariableDeclarator")return!1;let C=d.node.init;if(C==null)return!1;for(;C.type==="TSAsExpression";)C=C.expression;let R=d.node.parent;if(R==null&&(rt(I.block,d.node.id),R=d.node.parent,R==null))return!1;if(R.kind==="const"&&C.type==="Literal"&&(typeof C.value=="string"||typeof C.value=="number"||C.value===null))return!0;if(C.type!=="CallExpression")return!1;let O=C.callee;if(O.type==="MemberExpression"&&O.object.name==="React"&&O.property!=null&&!O.computed&&(O=O.property),O.type!=="Identifier")return!1;let v=d.node.id,{name:j}=O;if(j==="useRef"&&v.type==="Identifier")return!0;if(Tr(O)&&v.type==="Identifier"){for(let D of f.references)D!==v&&h.add(D.identifier);return!0}else if(j==="useState"||j==="useReducer"){if(v.type==="ArrayPattern"&&v.elements.length===2&&E(f.identifiers)){if(v.elements[1]===f.identifiers[0]){if(j==="useState"){let D=f.references,se=0;for(let me=0;me<D.length;me++){if(D[me].isWrite()&&se++,se>1)return!1;c.set(D[me].identifier,v.elements[0])}}return!0}else if(v.elements[0]===f.identifiers[0]){if(j==="useState"){let D=f.references;for(let se=0;se<D.length;se++)p.add(D[se].identifier)}return!1}}}else if(j==="useTransition"&&v.type==="ArrayPattern"&&v.elements.length===2&&Array.isArray(f.identifiers)&&v.elements[1]===f.identifiers[0])return!0;return!1}function Y(f){if(!E(f.defs))return!1;let d=f.defs[0];if(d==null||d.node==null||d.node.id==null)return!1;let C=d.node,R=I.childScopes,O=null,v;for(v=0;v<R.length;v++){let j=R[v],D=j.block;if(C.type==="FunctionDeclaration"&&D===C||C.type==="VariableDeclarator"&&D.parent===C){O=j;break}}if(O==null)return!1;for(v=0;v<O.through.length;v++){let j=O.through[v];if(j.resolved!=null&&A.has(j.resolved.scope)&&!q(j.resolved))return!1}return!0}let q=x(F,u),ee=x(Y,g),Z=new Map;function Ce(f){let d=f.from,C=!1;for(;d.block!==w;)d.type==="function"&&(C=d.block.parent!=null&&d.block.parent.type==="ReturnStatement"),d=d.upper;return C}let ne=new Map,Oe=new Map;ue(y);function ue(f){for(let d of f.references){if(!d.resolved||!A.has(d.resolved.scope))continue;let C=rt(w,d.identifier),R=qt(C),O=de(R,Oe);if(m&&R.type==="Identifier"&&(R.parent.type==="MemberExpression"||R.parent.type==="OptionalMemberExpression")&&!R.parent.computed&&R.parent.property.type==="Identifier"&&R.parent.property.name==="current"&&Ce(d)&&Z.set(O,{reference:d,dependencyNode:R}),R.parent.type==="TSTypeQuery"||R.parent.type==="TSTypeReference")continue;let v=d.resolved.defs[0];if(v!=null&&!(v.node!=null&&v.node.init===w.parent)&&v.type!=="TypeParameter")if(ne.has(O))ne.get(O).references.push(d);else{let j=d.resolved,D=q(j)||ee(j);ne.set(O,{isStable:D,references:[d]})}}for(let d of f.childScopes)ue(d)}Z.forEach(({reference:f,dependencyNode:d},C)=>{let R=f.resolved.references,O=!1;for(let v=0;v<R.length;v++){let{identifier:j}=R[v],{parent:D}=j;if(D!=null&&D.type==="MemberExpression"&&!D.computed&&D.property.type==="Identifier"&&D.property.name==="current"&&D.parent.type==="AssignmentExpression"&&D.parent.left===D){O=!0;break}}O||i({node:d.parent.property,message:`The ref value '${C}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${C}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ce=new Set;function fe(f,d){ce.has(d)||(ce.add(d),i({node:f,message:`Assignments to the '${d}' variable from inside React Hook ${n(P)} 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(P)}.`}))}let Ie=new Set;if(ne.forEach(({isStable:f,references:d},C)=>{f&&Ie.add(C),d.forEach(R=>{R.writeExpr&&fe(R.writeExpr,C)})}),ce.size>0)return;if(!M){let f=null;if(ne.forEach(({isStable:d,references:C},R)=>{f||C.forEach(O=>{if(f)return;let v=O.identifier;if(!c.has(v))return;let D=O.from;for(;D.type!=="function";)D=D.upper;D.block===w&&(f=R)})}),f){let{suggestedDependencies:d}=tt({dependencies:ne,declaredDependencies:[],stableDependencies:Ie,externalDependencies:new Set,isEffect:!0});i({node:P,message:`React Hook ${T} contains a call to '${f}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+d.join(", ")+`] as a second argument to the ${T} Hook.`,suggest:[{desc:`Add dependencies array: [${d.join(", ")}]`,fix(C){return C.insertTextAfter(w,`, [${d.join(", ")}]`)}}]})}return}let Pe=[],Fe=new Set;M.type!=="ArrayExpression"?i({node:M,message:`React Hook ${n(P)} 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.`}):M.elements.forEach(f=>{if(f===null)return;if(f.type==="SpreadElement"){i({node:f,message:`React Hook ${n(P)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}h.has(f)&&i({node:f,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${n(f)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${n(f)}\``,fix(O){return O.removeRange(f.range)}}]});let d;try{d=de(f,Oe)}catch(O){if(/Unsupported node type/.test(O.message)){f.type==="Literal"?ne.has(f.value)?i({node:f,message:`The ${f.raw} literal is not a valid dependency because it never changes. Did you mean to include ${f.value} in the array instead?`}):i({node:f,message:`The ${f.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):i({node:f,message:`React Hook ${n(P)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw O}let C=f;for(;C.type==="MemberExpression"||C.type==="OptionalMemberExpression"||C.type==="ChainExpression";)C=C.object||C.expression.object;let R=!I.through.some(O=>O.identifier===C);Pe.push({key:d,node:f}),R||Fe.add(d)});let{suggestedDependencies:Vn,unnecessaryDependencies:De,missingDependencies:ge,duplicateDependencies:Nt}=tt({dependencies:ne,declaredDependencies:Pe,stableDependencies:Ie,externalDependencies:Fe,isEffect:m}),Me=Vn;if(Nt.size+ge.size+De.size===0){if(t)return;dr({declaredDependencies:Pe,declaredDependenciesNode:M,componentScope:I,scope:y}).forEach(({construction:d,isUsedOutsideOfHook:C,depType:R})=>{let O=R==="function"?"useCallback":"useMemo",v=R==="function"?"definition":"initialization",j=`wrap the ${v} of '${d.name.name}' in its own ${O}() Hook.`,D=C?`To fix this, ${j}`:`Move it inside the ${T} callback. Alternatively, ${j}`,se=R==="conditional"||R==="logical expression"?"could make":"makes",me=`The '${d.name.name}' ${R} ${se} the dependencies of ${T} Hook (at line ${M.loc.start.line}) change on every render. ${D}`,jt;C&&d.type==="Variable"&&R==="function"&&(jt=[{desc:`Wrap the ${v} of '${d.name.name}' in its own ${O}() Hook.`,fix(Dt){let[Yn,Jn]=O==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Dt.insertTextBefore(d.node.init,Yn),Dt.insertTextAfter(d.node.init,Jn)]}}]),i({node:d.node,message:me,suggest:jt})});return}!m&&ge.size>0&&(Me=tt({dependencies:ne,declaredDependencies:[],stableDependencies:Ie,externalDependencies:Fe,isEffect:m}).suggestedDependencies);function Hn(){if(Pe.length===0)return!0;let f=Pe.map(C=>C.key),d=f.slice().sort();return f.join(",")===d.join(",")}Hn()&&Me.sort();function qe(f){let d=f.split("."),C="";for(let R=0;R<d.length;R++){if(R!==0){let O=d.slice(0,R+1).join("."),v=Oe.get(O)===!0;C+=v?"?.":"."}C+=d[R]}return C}function Xe(f,d,C,R){return f.size===0?null:(f.size>1?"":d+" ")+C+" "+(f.size>1?"dependencies":"dependency")+": "+gr(Array.from(f).sort().map(O=>"'"+qe(O)+"'"))+`. Either ${R} ${f.size>1?"them":"it"} or remove the dependency array.`}let ae="";if(De.size>0){let f=null;if(Array.from(De.keys()).forEach(d=>{f===null&&d.endsWith(".current")&&(f=d)}),f!==null)ae=` Mutable values like '${f}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Fe.size>0){let d=Array.from(Fe)[0];y.set.has(d)||(ae=` Outer scope values like '${d}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!ae&&ge.has("props")){let f=ne.get("props");if(f==null)return;let d=f.references;if(!Array.isArray(d))return;let C=!0;for(let R=0;R<d.length;R++){let O=d[R],v=rt(I.block,O.identifier);if(!v){C=!1;break}let j=v.parent;if(j==null){C=!1;break}if(j.type!=="MemberExpression"&&j.type!=="OptionalMemberExpression"){C=!1;break}}C&&(ae=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${T} call and refer to those specific props inside ${n(P)}.`)}if(!ae&&ge.size>0){let f=null;ge.forEach(d=>{if(f)return;let C=I.set.get(d),R=ne.get(d);if(R.references[0].resolved!==C)return;let O=C.defs[0];if(O==null||O.name==null||O.type!=="Parameter")return;let v=!1,j;for(let D=0;D<R.references.length;D++)if(j=R.references[D].identifier,j!=null&&j.parent!=null&&(j.parent.type==="CallExpression"||j.parent.type==="OptionalCallExpression")&&j.parent.callee===j){v=!0;break}v&&(f=d)}),f!==null&&(ae=` If '${f}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!ae&&ge.size>0){let f=null;if(ge.forEach(d=>{if(f!==null)return;let R=ne.get(d).references,O,v;for(let j=0;j<R.length;j++){for(O=R[j].identifier,v=O.parent;v!=null&&v!==I.block;){if(v.type==="CallExpression"){let D=c.get(v.callee);if(D!=null){if(D.name===d)f={missingDep:d,setter:v.callee.name,form:"updater"};else if(p.has(O))f={missingDep:d,setter:v.callee.name,form:"reducer"};else{let se=R[j].resolved;if(se!=null){let me=se.defs[0];me!=null&&me.type==="Parameter"&&(f={missingDep:d,setter:v.callee.name,form:"inlineReducer"})}}break}}v=v.parent}if(f!==null)break}}),f!==null)switch(f.form){case"reducer":ae=` You can also replace multiple useState variables with useReducer if '${f.setter}' needs the current value of '${f.missingDep}'.`;break;case"inlineReducer":ae=` If '${f.setter}' needs the current value of '${f.missingDep}', you can also switch to useReducer instead of useState and read '${f.missingDep}' in the reducer.`;break;case"updater":ae=` You can also do a functional update '${f.setter}(${f.missingDep.slice(0,1)} => ...)' if you only need '${f.missingDep}' in the '${f.setter}' call.`;break;default:throw new Error("Unknown case.")}}i({node:M,message:`React Hook ${n(P)} has `+(Xe(ge,"a","missing","include")||Xe(De,"an","unnecessary","exclude")||Xe(Nt,"a","duplicate","omit"))+ae,suggest:[{desc:`Update the dependencies array to be: [${Me.map(qe).join(", ")}]`,fix(f){return f.replaceText(M,`[${Me.map(qe).join(", ")}]`)}}]})}function k(w){let M=yr(w.callee,s);if(M===-1)return;let P=w.arguments[M],T=w.callee,m=Xt(T).name,y=w.arguments[M+1],A=/Effect($|[^a-z])/g.test(m);if(!P){i({node:T,message:`React Hook ${m} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!A)){if(!y&&!A){(m==="useMemo"||m==="useCallback")&&i({node:T,message:`React Hook ${m} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(P.type){case"FunctionExpression":case"ArrowFunctionExpression":b(P,y,T,m,A);return;case"Identifier":if(!y||y.elements&&y.elements.some(F=>F&&F.type==="Identifier"&&F.name===P.name))return;let I=r(w).set.get(P.name);if(I==null||I.defs==null)return;let E=I.defs[0];if(!E||!E.node||E.type!=="Variable"&&E.type!=="FunctionName")break;switch(E.node.type){case"FunctionDeclaration":b(E.node,y,T,m,A);return;case"VariableDeclarator":let F=E.node.init;if(!F)break;switch(F.type){case"ArrowFunctionExpression":case"FunctionExpression":b(F,y,T,m,A);return}break}break;default:i({node:T,message:`React Hook ${m} received a function whose dependencies are unknown. Pass an inline function instead.`});return}i({node:T,message:`React Hook ${m} has a missing dependency: '${P.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${P.name}]`,fix(I){return I.replaceText(y,`[${P.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let w of e.sourceCode.getAllComments())if(mr.test(w.value))return t=!0,{CallExpression:M=>k(M,!0)}}return{CallExpression:w=>k(w)}}};function tt({dependencies:e,declaredDependencies:t,stableDependencies:n,externalDependencies:r,isEffect:o}){let a=s();function s(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((b,k)=>{let w=i(a,k);w.isUsed=!0,l(a,k,M=>{M.isSubtreeUsed=!0})}),t.forEach(({key:b})=>{let k=i(a,b);k.isSatisfiedRecursively=!0}),n.forEach(b=>{let k=i(a,b);k.isSatisfiedRecursively=!0});function i(b,k){let w=k.split("."),M=b;for(let P of w){let T=M.children.get(P);T||(T=s(),M.children.set(P,T)),M=T}return M}function l(b,k,w){let M=k.split("."),P=b;for(let T of M){let m=P.children.get(T);if(!m)return;w(m),P=m}}let c=new Set,p=new Set;u(a,c,p,b=>b);function u(b,k,w,M){b.children.forEach((P,T)=>{let m=M(T);if(P.isSatisfiedRecursively){P.isSubtreeUsed&&w.add(m);return}if(P.isUsed){k.add(m);return}u(P,k,w,y=>m+"."+y)})}let g=[],h=new Set,x=new Set;return t.forEach(({key:b})=>{p.has(b)?g.indexOf(b)===-1?g.push(b):x.add(b):h.add(b)}),c.forEach(b=>{g.push(b)}),{suggestedDependencies:g,unnecessaryDependencies:h,duplicateDependencies:x,missingDependencies:c}}function Se(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 Se(e.consequent)!=null||Se(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Se(e.left)!=null||Se(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Se(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Se(e.expression);case"TSAsExpression":return Se(e.expression)}return null}function dr({declaredDependencies:e,declaredDependenciesNode:t,componentScope:n,scope:r}){let o=e.map(({key:s})=>{let i=n.variables.find(c=>c.name===s);if(i==null)return null;let l=i.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let c=Se(l.node.init);if(c!=null)return[i,c]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[i,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[i,"class"]:null}).filter(Boolean);function a(s){let i=!1;for(let l=0;l<s.references.length;l++){let c=s.references[l];if(c.writeExpr){if(i)return!0;i=!0;continue}let p=c.from;for(;p!==r&&p!=null;)p=p.upper;if(p!==r&&!Gt(t,c.identifier))return!0}return!1}return o.map(([s,i])=>({construction:s.defs[0],depType:i,isUsedOutsideOfHook:a(s)}))}function qt(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)?qt(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function nt(e,t,n){t&&(e.optional?t.has(n)||t.set(n,!0):t.has(n)||t.set(n,!1))}function de(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let n=e.name;return t&&t.set(n,!1),n}else if(e.type==="MemberExpression"&&!e.computed){let n=de(e.object,t),r=de(e.property,null),o=`${n}.${r}`;return nt(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let n=de(e.object,t),r=de(e.property,null),o=`${n}.${r}`;return nt(e,t,o),o}else if(e.type==="ChainExpression"&&!e.computed){let n=e.expression;if(n.type==="CallExpression")throw new Error(`Unsupported node type: ${n.type}`);let r=de(n.object,t),o=de(n.property,null),a=`${r}.${o}`;return nt(n,t,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function Xt(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function yr(e,t){let n=Xt(e);if(n.type!=="Identifier")return-1;switch(n.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(n===e&&t&&t.additionalHooks){let r;try{r=de(n,null)}catch(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return t.additionalHooks.test(r)?0:-1}else return-1}}function rt(e,t){let n=[e],r=null;for(;n.length;){if(r=n.shift(),Sr(r,t))return r;if(Gt(r,t))for(let[o,a]of Object.entries(r))o!=="parent"&&(Jt(a)?(a.parent=r,n.push(a)):Array.isArray(a)&&a.forEach(s=>{Jt(s)&&(s.parent=r,n.push(s))}))}return null}function gr(e){let t="";for(let n=0;n<e.length;n++)t+=e[n],n===0&&e.length===2?t+=" and ":n===e.length-2&&e.length>2?t+=", and ":n<e.length-1&&(t+=", ");return t}function Jt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Sr(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function Gt(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function Tr(e){return!1}var Te=require("@typescript-eslint/utils");var Q=Ee(require("typescript")),hr=Te.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Kt="improved-no-unnecessary-condition",Er=V({}),br=["string","number","bigint","boolean","symbol","undefined","object","function","never"],xr=new Set(br),it={name:Kt,rule:hr({name:Kt,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:[Er]},defaultOptions:[{}],create(e){let t=Te.ESLintUtils.getParserServices(e,!0),n=t.program?.getTypeChecker();if(!n||!t.program)throw new Error("TypeScript services or program not available");function r(i){return i.type===Te.AST_NODE_TYPES.UnaryExpression&&i.operator==="typeof"}function o(i){return i.flags&Q.default.TypeFlags.Any||i.flags&Q.default.TypeFlags.Unknown?null:i.flags&Q.default.TypeFlags.StringLike?["string"]:i.flags&Q.default.TypeFlags.NumberLike?["number"]:i.flags&Q.default.TypeFlags.BigIntLike?["bigint"]:i.flags&Q.default.TypeFlags.BooleanLike?["boolean"]:i.flags&Q.default.TypeFlags.ESSymbolLike?["symbol"]:i.flags&Q.default.TypeFlags.Undefined||i.flags&Q.default.TypeFlags.Void?["undefined"]:i.flags&Q.default.TypeFlags.Null?["object"]:i.getCallSignatures().length>0?["function"]:i.flags&Q.default.TypeFlags.Object?i.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:i.flags&Q.default.TypeFlags.NonPrimitive?["object"]:i.flags&Q.default.TypeFlags.Never?["never"]:null}function a(i){if(!n)return null;let l=t.esTreeNodeToTSNodeMap.get(i),c=n.getTypeAtLocation(l.expression);if(c.flags&Q.default.TypeFlags.Any||c.flags&Q.default.TypeFlags.Unknown)return null;let p=[];if(c.isUnion()){for(let g of c.types){let h=o(g);if(h)p.push(...h);else return null}return p}let u=o(c);return u?(p.push(...u),p):null}function s(i){if(!(i.operator==="==="||i.operator==="!=="))return;let c=null,p=null;if(r(i.left)?(c=i.left,p=i.right.type===Te.AST_NODE_TYPES.Literal&&typeof i.right.value=="string"?i.right.value:null):r(i.right)&&(c=i.right,p=i.left.type===Te.AST_NODE_TYPES.Literal&&typeof i.left.value=="string"?i.left.value:null),!c||!p||!wr(p,xr))return;let u=a(c);if(!u)return;let g=i.operator==="!==",h=u.includes(p);u.length===1?h&&!g?e.report({node:i,messageId:"unnecessaryTypeofCondition",data:{name:Re(c,e),type:p}}):!h&&g?e.report({node:i,messageId:"unnecessaryTypeofCondition",data:{name:Re(c,e),type:Array.from(u)[0]}}):!h&&!g?e.report({node:i,messageId:"alwaysFalseTypeofCondition",data:{name:Re(c,e),actualType:$e(u),conditionType:p}}):h&&g&&e.report({node:i,messageId:"alwaysFalseTypeofCondition",data:{name:Re(c,e),actualType:$e(u),conditionType:p}}):!h&&!g?e.report({node:i,messageId:"alwaysFalseTypeofCondition",data:{name:Re(c,e),actualType:$e(u),conditionType:p}}):!h&&g&&e.report({node:i,messageId:"unnecessaryTypeofCondition",data:{name:Re(c,e),type:$e(u)}})}return{BinaryExpression:s}}})};function $e(e){return Array.from(new Set(e)).join(" | ")||"never"}function Re(e,t){let n=e.argument;return n.type===Te.AST_NODE_TYPES.Identifier?n.name:t.sourceCode.getText(n)}function wr(e,t){return t.has(e)}var ze=require("@typescript-eslint/utils");var Cr=ze.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Zt="no-call-with-explicit-generics",Ir=V({functions:G(W())}),Ar=Cr({name:Zt,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:[Ir]},defaultOptions:[{functions:[]}],create(e,[t]){let n=new Set(t.functions);return{CallExpression(r){let{callee:o}=r;o.type===ze.AST_NODE_TYPES.Identifier&&n.has(o.name)&&r.typeArguments&&e.report({node:r,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),st={name:Zt,rule:Ar};var be=require("@typescript-eslint/utils"),Rr=be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Qt="no-call-with-inferred-generics",kr=Rr({name:Qt,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let n=new Map(t.functions.map(r=>[r.name,r]));return{CallExpression(r){let{callee:o}=r;if(o.type!==be.AST_NODE_TYPES.Identifier)return;let a=n.get(o.name);if(!a)return;let{minGenerics:s=1,allowAny:i,disallowTypes:l=t.disallowTypes}=a;(r.typeArguments?.params.length||0)<(s||0)&&e.report({node:r,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:s||0}}),!(i&&!l)&&r.typeArguments?.params?.some(p=>!i&&p.type===be.AST_NODE_TYPES.TSAnyKeyword||l&&p.type===be.AST_NODE_TYPES.TSTypeReference&&p.typeName.type===be.AST_NODE_TYPES.Identifier&&l.includes(p.typeName.name))&&e.report({node:r,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),ot={name:Qt,rule:kr};var tn=require("@typescript-eslint/utils"),vr=tn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nn="no-commented-out-code",Or=["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]+>/,colonDescriptiveComment:/^[a-zA-Z]+(\s+[a-zA-Z]+)*:\s+[a-zA-Z]+\s+[a-zA-Z][^{=,'"]*$/,jsdocComment:/^\s*[*\s]*$/},Pr=[") {","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],Fr=["/>","</",B.jsxSelfClosing,B.jsxElement,B.jsxOpeningTag,B.jsxClosingTag,B.htmlOpeningTag,B.htmlClosingTag],en=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Nr=vr({name:nn,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(r,o){if(r.startsWith("/"))return!1;let a=r.trimStart();if(r.startsWith("*")||a.startsWith("eslint-disable")||r.includes("@deprecated")||r.includes("@example")||r.includes("@param")||r.includes("@returns")||r.includes("@throws")||r.includes("typescript-eslint")||r.includes("@ts-")||r.includes("prettier-ignore")||B.jsdocComment.test(r))return!1;for(let s of en)if(a.startsWith(s))return!1;if(r.includes("https://")||a.includes(":")&&B.colonDescriptiveComment.test(a.trim()))return!1;if(o==="Block"){for(let s of Fr)if(typeof s=="string"){if(r.includes(s))return{wrongPattern:s}}else if(s.test(r))return{wrongPattern:`regex(${s.toString()})`};return!1}for(let s of Or)if(a.startsWith(s))return{wrongPattern:s};for(let s of Pr)if(typeof s=="string"){if(r.includes(s))return{wrongPattern:s}}else if(s.test(r))return{wrongPattern:`regex(${s.toString()})`};return!1}function n(r,o){let a=r,s=a.trim();if(s.startsWith("`")&&(s.endsWith("`,")||s.endsWith("`;")||s.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let c=a.split(/```[\s\S]*?```/g);c.some(u=>/[a-zA-Z0-9]/.test(u))&&(a=c.join(""))}if(!a.includes("`"))return a;let i=a.split(/`[^`]*`/g);return i.some(c=>/[a-zA-Z0-9]/.test(c))?i.join(""):a}return{Program(){let o=e.sourceCode.getAllComments();for(let a of o){let s=n(a.value,a.type),i=t(s,a.type);i&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:i.wrongPattern,allowedPrefixes:en.join(", ")}})}}}}}),at={name:nn,rule:Nr};var Ue=require("@typescript-eslint/utils"),jr=Ue.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),rn="no-default-export",Dr=jr({name:rn,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let n of t.specifiers)n.exported.type===Ue.TSESTree.AST_NODE_TYPES.Identifier&&n.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),lt={name:rn,rule:Dr};var sn=require("@typescript-eslint/utils"),Mr=sn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),on="no-leaked-text-in-jsx",_r=[",",";","[","]","(",")"],Lr=Mr({name:on,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(t){let n=t.value.trim();if(!n)return;let r="";_r.includes(n)?r=n:n.includes("&&")?r="&&":n.includes("||")?r="||":n.endsWith("? (")&&(r="? ("),r&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:r}})}}}}),ct={name:on,rule:Lr};var he=require("@typescript-eslint/utils"),$r=he.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ln="no-non-camel-case-functions",zr=/^(\$?[a-z][a-zA-Z0-9]*)$/;function an(e){if(e.typeName.type!==he.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:n}=e.typeName;return t.type===he.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&n.name==="Element"}var Ur=$r({name:ln,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!zr.test(t.id.name)){let n=t.returnType?.typeAnnotation;if(n&&(n.type===he.AST_NODE_TYPES.TSTypeReference?an(n):n.type===he.AST_NODE_TYPES.TSUnionType&&n.types.some(o=>o.type===he.AST_NODE_TYPES.TSTypeReference&&an(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),pt={name:ln,rule:Ur};var z=require("@typescript-eslint/utils");var ut=require("@typescript-eslint/utils");function ke(e,t,n=1/0){if(n!==0&&e.parent)return e.type===t?e:ke(e.parent,t,n===1/0?n:n-1)}function*ft(e){yield e,e.parent&&(yield*ft(e.parent))}function mt(e,t){for(let n of e){let r=t(n);if(r!=null&&r!==!1)return r}}function cn(e,t,n){let o=n.getDeclaredVariables(e).find(a=>a.name===t||a.identifiers[0]?.parent.type===ut.AST_NODE_TYPES.Property&&a.identifiers[0]?.parent.key.type===ut.AST_NODE_TYPES.Identifier&&a.identifiers[0]?.parent.key.name===t);return o?o.references.filter(a=>!a.init):[]}var Wr=z.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pn="no-optional-root-props",Vr=Wr({name:pn,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function t(r){let a=e.sourceCode.getDeclaredVariables(r)[0];if(!a||a.references.length!==1)return!1;let s=a.references[0];if(!s)return!1;for(let i of ft(s.identifier)){if("returnType"in i||i.type===z.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=i.parent;if(!l)return!1;if(l.type===z.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===z.TSESTree.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===z.TSESTree.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let p=ke(l.parent.parent,z.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!p)return!1;let u=We(p,e.sourceCode);return u?!(u.parent.type===z.TSESTree.AST_NODE_TYPES.CallExpression&&u.parent.callee.type===z.TSESTree.AST_NODE_TYPES.Identifier&&u.parent.callee.name==="memo"):!1}if(i.type===z.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===z.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let c=ke(l,z.TSESTree.AST_NODE_TYPES.VariableDeclaration);return c?!!We(c,e.sourceCode):!1}if(l.type===z.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!We(l,e.sourceCode)}return!1}function n(r){r.key.type!==z.TSESTree.AST_NODE_TYPES.Identifier||!r.optional||e.report({node:r.key,messageId:"optionalNotAllowed",data:{propertyName:r.key.name},suggest:[{messageId:"suggestion",fix:o=>{let a=ke(r,z.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let s=e.sourceCode.getText(a);return o.replaceText(a,s.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(r){if(r.typeAnnotation.type===z.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(Ve(r)||!t(r)))for(let o of r.typeAnnotation.members)o.type===z.TSESTree.AST_NODE_TYPES.TSPropertySignature&&n(o)},TSInterfaceDeclaration(r){if(!(Ve(r)||!t(r)))for(let o of r.body.body)o.type===z.TSESTree.AST_NODE_TYPES.TSPropertySignature&&n(o)},TSTypeReference(r){if(r.typeName.type!==z.TSESTree.AST_NODE_TYPES.Identifier||r.typeName.name!=="FC"||!r.typeArguments?.params[0])return;let o=r.typeArguments.params[0];if(o.type!==z.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let a=ke(r.parent,z.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let s=We(a,e.sourceCode);if(!(!s||s.parent.type===z.TSESTree.AST_NODE_TYPES.CallExpression&&s.parent.callee.type===z.TSESTree.AST_NODE_TYPES.Identifier&&s.parent.callee.name==="memo"))for(let l of o.members)l.type===z.TSESTree.AST_NODE_TYPES.TSPropertySignature&&n(l)}}}});function Ve(e){return e?e.parent?.type===z.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===z.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function We(e,t){if(Ve(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 r=t.getScope(e);e.type===z.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&r.upper&&(r=r.upper);let o=r.variables.find(s=>s.identifiers.includes(n));if(!o)return;let a=o.references.filter(s=>s.identifier!==n);if(!(a.length!==1||!a[0])&&!Ve(a[0].identifier.parent.parent))return a[0].identifier}var dt={name:pn,rule:Vr};var un=require("@typescript-eslint/utils"),He=Ee(require("path"));var Hr=un.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),fn="no-relative-imports",Yr=V({find:W(),replacement:W()}),Jr=V({aliases:G(Yr),rootDir:L(W()),allowNotFoundAliases:L(Ae()),_dev_simulateFileName:L(W())}),Br=Hr({name:fn,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:[Jr]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let n=t._dev_simulateFileName??e.filename;function r(s){return s.startsWith(".")||s.startsWith("..")}function o(s,i){let l=He.default.dirname(i);return He.default.resolve(l,s)}function a(s){let i=t.rootDir??process.cwd(),l=He.default.relative(i,s);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:c,replacement:p}of t.aliases)if(l.startsWith(p)){let u=l.replace(p,c);return{alias:c,newPath:u}}return null}return{ImportDeclaration(s){let i=s.source.value;if(!r(i))return;let l=o(i,n),c=a(l);!c&&t.allowNotFoundAliases||e.report({node:s,messageId:c?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:c?.alias},fix:c?p=>p.replaceText(s.source,`'${c.newPath}'`):void 0})}}}}),yt={name:fn,rule:Br};var Ne=require("@typescript-eslint/utils"),xe=Ee(require("zod/v4"));var qr=xe.object({alternativeMsgs:xe.object({inArrayFind:xe.string().optional(),inArrayFilter:xe.string().optional()}).optional(),__dev_simulateFileName:xe.string().optional()});function Xr(e){return e.typeAnnotation.type!==Ne.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}function Gr(e){return/\.(typeGuards|type-guards)\.(ts|tsx)$/.test(e)}function Kr(e){let t=e.parent;for(;t;){if(t.type===Ne.AST_NODE_TYPES.CallExpression&&t.callee.type===Ne.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===Ne.AST_NODE_TYPES.Identifier){let n=t.callee.property.name;if(n==="filter"||n==="find")return{method:n}}t=t.parent}return null}var gt=re({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:"Type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[Le(qr)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let n=t.__dev_simulateFileName??e.filename;if(Gr(n))return{};function r(o){if(!Xr(o))return;let a=Kr(o),s=[];if(t.alternativeMsgs&&a){let i=a.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let l=a.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:l,data:{message:i}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":r,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":r,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":r}}});var we=require("@typescript-eslint/utils");var Zr="no-unnecessary-async-on-jsx-props";function Qr(e){if(e.body.type!==we.AST_NODE_TYPES.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let n=t[0];return!n||n.type!==we.AST_NODE_TYPES.ExpressionStatement?!1:n.expression.type===we.AST_NODE_TYPES.AwaitExpression}var St=re({name:Zr,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function t(n){Qr(n)&&e.report({node:n,messageId:"unnecessaryAsyncInJsxProp",fix(r){let o=e.sourceCode,a=[],s=o.getFirstToken(n,l=>l.value==="async");if(s){let l=o.getTokenAfter(s);l?a.push(r.replaceTextRange([s.range[0],l.range[0]],"")):a.push(r.remove(s))}function i(l){if(l.type===we.AST_NODE_TYPES.AwaitExpression){let c=o.getFirstToken(l);if(c&&c.value==="await"){let p=o.getTokenAfter(c);p?a.push(r.replaceTextRange([c.range[0],p.range[0]],"")):a.push(r.remove(c))}}if(l.type===we.AST_NODE_TYPES.BlockStatement)for(let c of l.body)i(c);else l.type===we.AST_NODE_TYPES.ExpressionStatement&&i(l.expression)}return i(n.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var ye=require("@typescript-eslint/utils");var Tt=Ee(require("typescript")),ei=ye.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mn="no-unnecessary-casting",ti=V({additionalCastFunctions:L(G(V({name:W(),expectedType:_t(["string","number"])})))}),ht={name:mn,rule:ei({name:mn,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:[ti],fixable:"code"},defaultOptions:[{}],create(e){let n=e.options[0].additionalCastFunctions||[],r=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...n],o=ye.ESLintUtils.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function s(p,u){switch(p.type){case ye.AST_NODE_TYPES.Literal:return u==="number"?typeof p.value=="number":typeof p.value=="string";case ye.AST_NODE_TYPES.TemplateLiteral:return u==="string";case ye.AST_NODE_TYPES.UnaryExpression:return u==="number"?p.operator==="+"||p.operator==="-"||p.operator==="~":!1;default:return!1}}function i(p,u){return u==="number"?!!(p.flags&Tt.TypeFlags.NumberLike):!!(p.flags&Tt.TypeFlags.StringLike)}function l(p,u){return g=>g.replaceText(p,e.sourceCode.getText(u))}function c(p){if(!a||p.arguments.length!==1)return;let u=p.arguments[0];if(!u||u.type===ye.AST_NODE_TYPES.SpreadElement)return;let{callee:g}=p;if(g.type!==ye.AST_NODE_TYPES.Identifier)return;let h=g.name,x=r.find(k=>k.name===h);if(!x)return;if(s(u,x.expectedType)||i(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(u)),x.expectedType)){let k,w;h==="Number"?k="unnecessaryNumberCasting":h==="String"?k="unnecessaryStringCasting":(k="unnecessaryCustomCasting",w={name:x.name,type:x.expectedType}),e.report({node:p,messageId:k,...w?{data:w}:{},fix:l(p,u)})}}return{CallExpression:c}}})};var je=require("@typescript-eslint/utils"),oe=Ee(require("zod/v4"));var ni=oe.object({methods:oe.union([oe.array(oe.string()),oe.literal("array")])}),Et=re({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:[oe.toJSONSchema(ni)]},defaultOptions:[{methods:"array"}],create(e,[t]){let n=t.methods,r=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(i){return Array.isArray(n)?n.includes(i):r.has(i)}function a(i){let{callee:l}=i;if(l.type===je.AST_NODE_TYPES.MemberExpression){let c=l.property;if(c.type===je.AST_NODE_TYPES.Identifier)return c.name}return null}function s(i,l){if(i.type!==je.AST_NODE_TYPES.Identifier||!i.typeAnnotation)return;let c=l.parent;if(c.type===je.AST_NODE_TYPES.CallExpression){let p=a(c);p&&o(p)&&c.arguments.indexOf(l)===0&&e.report({node:i.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(g){return g.remove(i.typeAnnotation)}})}}return{ArrowFunctionExpression(i){for(let l of i.params)s(l,i)},FunctionExpression(i){for(let l of i.params)s(l,i)}}}});var ie=require("@typescript-eslint/utils");var bt=re({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===ie.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==ie.AST_NODE_TYPES.ObjectExpression||t.id.type===ie.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===ie.AST_NODE_TYPES.ExportNamedDeclaration)return;let n=new Map;for(let s of t.init.properties)s.type===ie.AST_NODE_TYPES.Property&&s.key.type===ie.AST_NODE_TYPES.Identifier&&n.set(s.key.name,s);if(n.size===0||t.id.type!==ie.AST_NODE_TYPES.Identifier)return;let r=ri(t,e.sourceCode);if(r.length===0)return;let o=t.init.properties.some(s=>s.type!==ie.AST_NODE_TYPES.Property?!1:s.value.type===ie.AST_NODE_TYPES.FunctionExpression),a=new Set;for(let s of r){if(s.identifier.parent.type!==ie.AST_NODE_TYPES.MemberExpression)return;let i=s.identifier.parent;if(i.object!==s.identifier)return;if(i.computed)if(i.property.type===ie.AST_NODE_TYPES.Literal&&typeof i.property.value=="string")a.add(i.property.value);else return;else{if(i.property.type!==ie.AST_NODE_TYPES.Identifier)return;a.add(i.property.name)}if(i.parent.type===ie.AST_NODE_TYPES.CallExpression&&o)return}for(let[s,i]of n)a.has(s)||e.report({node:i,messageId:"unusedObjectProperty",data:{name:s}})}}}});function ri(e,t){let n=t.getDeclaredVariables(e);if(n.length!==1)return[];let r=n[0];return r?r.references.filter(o=>o.identifier!==e.id):[]}var U=require("@typescript-eslint/utils");var ii=V({selectors:G(V({name:W(),selectorProp:L(W()),selectorArgPos:L(pe()),returnProp:L(W())}))}),si=U.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),dn="no-unused-selected-values",xt={name:dn,rule:si({name:dn,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[ii]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:n=[]}=t,r=new Map(n.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===U.AST_NODE_TYPES.CallExpression&&(a=o.init),!a)return;let s=ai(a);if(!s)return;let i=r.get(s);if(!i)return;let l=oi(a,i.selectorArgPos??0,i.selectorProp);if(!l)return;let c=li(l);if(!c)return;let p=yn(c.properties,void 0);if(!p)return;if(o.id.type===U.AST_NODE_TYPES.ObjectPattern){let h=yn(o.id.properties,i.returnProp);if(!h)return;for(let[x,b]of p)h.has(x)||e.report({node:b,messageId:"unusedSelectedValue",data:{name:x}});return}if(o.id.type!==U.AST_NODE_TYPES.Identifier||i.returnProp)return;let u=ci(o,e.sourceCode);if(u.length===0)return;let g=new Set;for(let h of u){if(h.identifier.parent.type!==U.AST_NODE_TYPES.MemberExpression)return;let x=h.identifier.parent.property;if(x.type!==U.AST_NODE_TYPES.Identifier)return;g.add(x.name)}for(let[h,x]of p)g.has(h)||e.report({node:x,messageId:"unusedSelectedValue",data:{name:h}})}}}})};function oi(e,t,n){let r=e.arguments[t];if(!r)return null;if(r.type===U.AST_NODE_TYPES.ArrowFunctionExpression||r.type===U.AST_NODE_TYPES.FunctionExpression)return r;if(n&&r.type===U.AST_NODE_TYPES.ObjectExpression){let o=r.properties.find(s=>s.type===U.AST_NODE_TYPES.Property&&s.key.type===U.AST_NODE_TYPES.Identifier&&s.key.name===n);if(o?.type!==U.AST_NODE_TYPES.Property)return null;let a=o.value;if(a.type===U.AST_NODE_TYPES.ArrowFunctionExpression||a.type===U.AST_NODE_TYPES.FunctionExpression)return a}return null}function ai(e){return e.callee.type===U.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===U.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===U.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function li(e){if(e.body.type===U.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===U.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(n=>n.type===U.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==U.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function yn(e,t){let n=e;if(t){let o=e.find(a=>a.type===U.AST_NODE_TYPES.Property&&a.key.type===U.AST_NODE_TYPES.Identifier&&a.key.name===t);if(o?.type!==U.AST_NODE_TYPES.Property||o.value.type!==U.AST_NODE_TYPES.ObjectPattern)return null;n=o.value.properties}let r=new Map;for(let o of n){if(o.type!==U.AST_NODE_TYPES.Property||o.key.type!==U.AST_NODE_TYPES.Identifier)return null;r.set(o.key.name,o)}return r.size>0?r:null}function ci(e,t){let n=t.getDeclaredVariables(e);if(n.length!==1)return[];let r=n[0];return r?r.references.filter(o=>o.identifier!==e.id):[]}var H=require("@typescript-eslint/utils");var wt=re({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(a=>a.type===H.AST_NODE_TYPES.ImportDeclaration&&a.source.value==="t-state-form"))return{};let r=null,o=!1;return{CallExpression(a){if(o)return;if(!r){let i=pi(a);i&&(r=i);return}let s=ui(a,e.sourceCode);if(s){o=!0;for(let i of s)r.delete(i);if(r.size!==0)for(let[i,l]of r)e.report({node:l,messageId:"unusedField",data:{name:i}})}}}}});function pi(e){if(!(e.callee.type===H.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let n=e.arguments[0];if(!n||n.type!==H.AST_NODE_TYPES.ObjectExpression)return null;let r=mt(n.properties,a=>a.type!==H.AST_NODE_TYPES.Property||a.key.type!==H.AST_NODE_TYPES.Identifier||a.key.name!=="initialConfig"?null:a.value.type===H.AST_NODE_TYPES.ObjectExpression?a.value:a.value.type===H.AST_NODE_TYPES.ArrowFunctionExpression||a.value.type===H.AST_NODE_TYPES.FunctionExpression?fi(a.value):null);if(!r)return null;let o=new Map;for(let a of r.properties)a.type===H.AST_NODE_TYPES.Property&&a.key.type===H.AST_NODE_TYPES.Identifier&&o.set(a.key.name,a);return o}function ui(e,t){if(!(e.callee.type===H.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==H.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==H.AST_NODE_TYPES.ObjectPattern||!mt(e.parent.id.properties,s=>s.type===H.AST_NODE_TYPES.Property&&s.key.type===H.AST_NODE_TYPES.Identifier&&s.key.name==="formFields"&&s))return null;let o=cn(e.parent,"formFields",t),a=new Set;for(let{identifier:s}of o){if(s.type!==H.AST_NODE_TYPES.Identifier||s.parent.type===H.AST_NODE_TYPES.Property&&s.parent.parent.type===H.AST_NODE_TYPES.ObjectExpression&&s.parent.parent.parent.type===H.AST_NODE_TYPES.ReturnStatement||s.parent.type===H.AST_NODE_TYPES.ReturnStatement)return null;if(s.parent.type===H.AST_NODE_TYPES.MemberExpression){if(s.parent.object.type!==H.AST_NODE_TYPES.Identifier||s.parent.property.type!==H.AST_NODE_TYPES.Identifier)return null;a.add(s.parent.property.name)}}return a}function fi(e){if(e.body.type===H.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===H.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(n=>n.type===H.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==H.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var $=require("@typescript-eslint/utils");var mi=$.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function gn(e){let t=[];for(let n of e.members)n.type===$.AST_NODE_TYPES.TSPropertySignature&&n.key.type===$.AST_NODE_TYPES.Identifier&&t.push([n.key.name,n]);return t}function Sn(e,...t){for(let n of t)e.set(...n);return e}var di=V({forceCheckOnFCPropTypesWithName:L(G(W()))}),Tn="no-unused-type-props-in-args",Ct=null,yi=mi({name:Tn,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:[di],fixable:"code"},defaultOptions:[{}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:n}=t;n&&!Ct&&(Ct=n.map(i=>new RegExp(i)));function r(i,l,c,p,u=!0){let g=c.name,h=e.sourceCode.getScope(l).references.find(k=>k.identifier.name===g)?.resolved,x=i&&Ct?.some(k=>k.test(g));if(!h||!x&&h.references.filter(k=>k.isTypeReference).length>1)return;let b=h?.defs[0]?.node;if(!(u&&b?.parent?.type===$.AST_NODE_TYPES.ExportNamedDeclaration)){if(b?.type===$.AST_NODE_TYPES.TSTypeAliasDeclaration){o(i,l,p,b.typeAnnotation,!0);return}if(b?.type===$.AST_NODE_TYPES.TSInterfaceDeclaration){o(i,l,p,b.body,!0);return}}}function o(i,l,c,p,u){if(p.type===$.AST_NODE_TYPES.TSInterfaceBody){for(let g of p.body)g.type===$.AST_NODE_TYPES.TSPropertySignature&&g.key.type===$.AST_NODE_TYPES.Identifier&&c.set(g.key.name,g);return}if(p.type===$.AST_NODE_TYPES.TSTypeLiteral){Sn(c,...gn(p));return}if(p.type===$.AST_NODE_TYPES.TSIntersectionType){for(let g of p.types)o(i,l,c,g,!0);return}u||p.type===$.AST_NODE_TYPES.TSTypeReference&&p.typeName.type===$.AST_NODE_TYPES.Identifier&&r(i,l,p.typeName,c)}function a(i,l,c){for(let p of c)if(p.type==="ObjectPattern"&&p.typeAnnotation){let u=new Map;if(o(i,l,u,p.typeAnnotation.typeAnnotation,!1),u.size===0)continue;s(p,u)}else p.type===$.AST_NODE_TYPES.AssignmentPattern&&p.left.type===$.AST_NODE_TYPES.ObjectPattern&&a(i,l,[p.left])}function s(i,l){let c=[];if(i.properties.at(-1)?.type===$.AST_NODE_TYPES.RestElement)return;for(let h of i.properties)h.type===$.AST_NODE_TYPES.Property&&h.key.type===$.AST_NODE_TYPES.Identifier&&c.push(h.key.name);let u=[],g=[];for(let[h,x]of l)c.includes(h)||(g.push(h),u.push({node:x,messageId:"unusedObjectTypeProperty",data:{propertyName:h}}));for(let[h,x]of u.entries())e.report({...x,fix:h===u.length-1?b=>{let k=i.properties.at(-1),w=g.join(", ");return k?k?.type===$.AST_NODE_TYPES.RestElement?null:b.insertTextAfter(k,`, ${w}`):b.insertTextBeforeRange([i.range[0]+1,i.range[1]],`${w}`)}:void 0})}return{VariableDeclaration(i){let l=i.declarations[0];if(!l)return;let c=new Map,p=l.id.type===$.AST_NODE_TYPES.Identifier&&l.id.typeAnnotation?.typeAnnotation.type===$.AST_NODE_TYPES.TSTypeReference&&l.id.typeAnnotation.typeAnnotation.typeName.type===$.AST_NODE_TYPES.Identifier&&l.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&l.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(p){if(p.type===$.AST_NODE_TYPES.TSTypeReference&&p.typeName.type===$.AST_NODE_TYPES.Identifier)r(!0,i,p.typeName,c,!1);else if(p.type===$.AST_NODE_TYPES.TSTypeLiteral)Sn(c,...gn(p));else if(p.type===$.AST_NODE_TYPES.TSIntersectionType)for(let u of p.types)u.type===$.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===$.AST_NODE_TYPES.Identifier?r(!0,i,u.typeName,c,!1):o(!0,i,c,u,!0);if(c.size!==0&&l.init?.type===$.AST_NODE_TYPES.ArrowFunctionExpression){let u=l.init.params[0];if(!u){e.report({node:l.init,messageId:"missingComponentParam"});return}u.type===$.AST_NODE_TYPES.ObjectPattern&&s(u,c)}}},FunctionDeclaration:function(i){a(!1,i,i.params)},ArrowFunctionExpression(i){a(!1,i,i.params)}}}}),It={name:Tn,rule:yi};var ve=require("@typescript-eslint/utils"),gi=ve.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),En="prefer-named-functions",hn=new Map,Si=gi({name:En,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[t]){let n=null;if(t.ignoreRegex){let r=hn.get(t.ignoreRegex);r?n=r:(n=new RegExp(t.ignoreRegex),hn.set(t.ignoreRegex,n))}return{VariableDeclarator(r){if(r.init&&r.init.type===ve.AST_NODE_TYPES.ArrowFunctionExpression&&r.id.type===ve.AST_NODE_TYPES.Identifier){let o=r.id.name;if(r.id.typeAnnotation||n&&n.test(o)||!t.disallowArrowFnWithImplicitReturns&&r.init.body.type!==ve.AST_NODE_TYPES.BlockStatement)return;let a=r.parent,s=r.init.params,i=r.init.body,l=r.init;e.report({node:r.id,messageId:n?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:c=>c.replaceText(a,`${l.async?"async ":""}function ${o}(${s.map(p=>e.sourceCode.getText(p)).join(", ")||""}) ${e.sourceCode.getText(i)}`)}]})}}}}}),At={name:En,rule:Si};var N=require("@typescript-eslint/utils");var Ti=V({disallowedFunctions:G(V({name:W(),allowUsingWithArgs:L(Ae()),hookAlternative:L(W()),message:L(W()),allowUseInside:L(G(W()))}))});function Ye(e){return/^use[A-Z]/.test(e)}function bn(e){return/^[A-Z]/.test(e)}function hi(e){return e.type===N.AST_NODE_TYPES.Identifier?Ye(e.name):e.type===N.AST_NODE_TYPES.MemberExpression&&e.property.type===N.AST_NODE_TYPES.Identifier?Ye(e.property.name):!1}function xn(e,t){return e.type===N.AST_NODE_TYPES.Identifier?e.name===t:e.type===N.AST_NODE_TYPES.MemberExpression&&e.object.type===N.AST_NODE_TYPES.Identifier&&e.property.type===N.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function wn(e){return!!(e.parent&&e.parent.type===N.AST_NODE_TYPES.CallExpression&&xn(e.parent.callee,"forwardRef"))}function Cn(e){return!!(e.parent&&e.parent.type===N.AST_NODE_TYPES.CallExpression&&xn(e.parent.callee,"memo"))}function Rt(e){if(e.type===N.AST_NODE_TYPES.FunctionDeclaration||e.type===N.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===N.AST_NODE_TYPES.FunctionExpression||e.type===N.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===N.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===N.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===N.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===N.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Ei(e){let t=e.parent,n=!1;for(;t;){if(t.type===N.AST_NODE_TYPES.FunctionDeclaration||t.type===N.AST_NODE_TYPES.FunctionExpression||t.type===N.AST_NODE_TYPES.ArrowFunctionExpression){let r=Rt(t);if(r&&r.type===N.AST_NODE_TYPES.Identifier){if(bn(r.name)||Ye(r.name))return!n;n=!0}else{if(wn(t)||Cn(t))return!n;if(t.parent.type===N.AST_NODE_TYPES.CallExpression){let o=t.parent;hi(o.callee)||(n=!0)}else t.parent.type===N.AST_NODE_TYPES.JSXExpressionContainer||(n=!0)}}t=t.parent}return!1}function In(e){return e.callee.type===N.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===N.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===N.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function bi(e,t){if(!t.length)return!1;let n=e.parent;for(;n;){if(n.type===N.AST_NODE_TYPES.FunctionDeclaration||n.type===N.AST_NODE_TYPES.FunctionExpression||n.type===N.AST_NODE_TYPES.ArrowFunctionExpression){let r=Rt(n);if(r&&r.type===N.AST_NODE_TYPES.Identifier&&t.includes(r.name))return!0}else if(n.type===N.AST_NODE_TYPES.CallExpression){let r=In(n);if(r&&t.includes(r))return!0}n=n.parent}return!1}function xi(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===N.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function wi(e,t){let n=!1,r=e.parent;for(;r;){if(r.type===N.AST_NODE_TYPES.FunctionDeclaration||r.type===N.AST_NODE_TYPES.FunctionExpression||r.type===N.AST_NODE_TYPES.ArrowFunctionExpression){let o=Rt(r);if(o&&o.type===N.AST_NODE_TYPES.Identifier){if(bn(o.name)||Ye(o.name)){n=!0;break}}else if(wn(r)||Cn(r)){n=!0;break}}r=r.parent}return n?t.length===0?Ei(e):!bi(e,t):!1}var kt=re({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:[Ti],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:n}=t,r=new Map(n.map(o=>[o.name,o]));return{CallExpression(o){let a=In(o);if(!a)return;let s=r.get(a);if(!s||s.allowUsingWithArgs&&xi(o))return;let i=s.allowUseInside||[];wi(o,i)&&e.report({node:o,messageId:"preferHookAlternative",data:{message:s.message?` ${s.message}`:` use ${s.hookAlternative} instead`},suggest:s.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${s.hookAlternative}`,hookAlternative:s.hookAlternative},fix:l=>{let c=s.hookAlternative;return o.callee.type===N.AST_NODE_TYPES.Identifier?l.replaceText(o.callee,c):o.callee.type===N.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===N.AST_NODE_TYPES.Identifier?l.replaceText(o.callee.property,c):null}}]:[]})}}}});var J=require("@typescript-eslint/utils");var Ci=J.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Rn="prefer-single-line-if",Ii=V({maxLineLength:L(pe()),maxNonSimpleConditionLength:L(pe())}),Ai=Ci({name:Rn,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:[Ii]},defaultOptions:[{}],create(e,[t]){let n=e.sourceCode;return{IfStatement(r){if(r.consequent.type!==J.AST_NODE_TYPES.BlockStatement||r.loc.start.line===r.loc.end.line||n.getCommentsInside(r.consequent).length>0||r.alternate||r.consequent.body.length!==1)return;let a=r.consequent.body[0];if(a.type===J.AST_NODE_TYPES.ReturnStatement){if(!vn(a))return}else if(!(a.type===J.AST_NODE_TYPES.ContinueStatement||a.type===J.AST_NODE_TYPES.BreakStatement))return;if(r.test.type===J.AST_NODE_TYPES.LogicalExpression||r.test.type===J.AST_NODE_TYPES.ConditionalExpression)return;let s;if(t.maxNonSimpleConditionLength){let u=An(r.test);if(!u&&r.test.type===J.AST_NODE_TYPES.UnaryExpression&&r.test.operator==="!"){let g=r.test.argument;An(g)&&(u=!0)}if(u&&(s=n.getText(r.test),s.length>t.maxNonSimpleConditionLength))return}s||(s=n.getText(r.test));let i=n.getText(a);if(s.includes(`
16
- `))return;let l=n.getTokenAfter(r);if(l&&l.type===J.AST_TOKEN_TYPES.Punctuator&&l.value==="}"){let u=n.getTokenAfter(l);if(u&&u.type===J.AST_TOKEN_TYPES.Keyword&&(u.value==="else"||u.value==="catch"))return}let c=Ri(n,r),p=`if (${s}) ${i}`;t.maxLineLength&&p.length+c.length>t.maxLineLength||e.report({node:r,messageId:"noSingleLineCurly",fix:u=>u.replaceText(r,p)})}}}});function An(e){return e.type===J.AST_NODE_TYPES.CallExpression||e.type===J.AST_NODE_TYPES.BinaryExpression||e.type===J.AST_NODE_TYPES.MemberExpression&&kn(e)}function kn(e){return e.object.type===J.AST_NODE_TYPES.MemberExpression?kn(e.object):e.object.type!==J.AST_NODE_TYPES.Identifier}function Ri(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function vn(e){if(!e.argument)return!0;let t=e.argument;return t.type===J.AST_NODE_TYPES.ArrayExpression&&t.elements.length===0||t.type===J.AST_NODE_TYPES.ObjectExpression&&t.properties.length===0||t.type===J.AST_NODE_TYPES.Literal||t.type===J.AST_NODE_TYPES.Identifier||t.type===J.AST_NODE_TYPES.TemplateLiteral||t.type===J.AST_NODE_TYPES.TaggedTemplateExpression?!0:t.type===J.AST_NODE_TYPES.CallExpression?t.arguments.length===0:t.type===J.AST_NODE_TYPES.UnaryExpression?vn(t):!1}var vt={name:Rn,rule:Ai};var te=require("@typescript-eslint/utils");var ki=te.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),On="react-compiler-migration",vi=V({disallowHooks:L(G(V({name:W(),replacement:W()}))),disallowMethods:L(G(V({name:W(),replacement:L(W()),requireTrueProp:L(W())})))}),Oi=/eslint +react-compiler\/react-compiler: +\["error/;function Pi(e){return e.type===te.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===te.AST_NODE_TYPES.MemberExpression&&e.property.type===te.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var Fi=ki({name:On,meta:{type:"suggestion",fixable:"code",docs:{description:"Rules to help migrate to the new React compiler"},messages:{disallowedFunctionOrMethod:"{{functionOrMethod}} is not supported in react compiler. Use {{replacement}} instead.",replace:"Replace with safe alternative {{replacement}}",disallowedMethodWithMissingRequireTrueProp:"{{method}} is should have a prop named {{requireTrueProp}} set to true when used in react compiler."},hasSuggestions:!0,schema:[vi]},defaultOptions:[{}],create(e,[t]){let n=!1;for(let r of e.sourceCode.getAllComments())if(Oi.test(r.value)){n=!0;break}return n?{CallExpression(r){if(t.disallowHooks?.length){let o=null,a=null;if(r.callee.type===te.AST_NODE_TYPES.Identifier?(o=r.callee.name,a=r.callee):r.callee.type===te.AST_NODE_TYPES.MemberExpression&&r.callee.property.type===te.AST_NODE_TYPES.Identifier&&(o=r.callee.property.name,a=r.callee.property),o){let s=t.disallowHooks.find(i=>i.name===o);s&&a&&e.report({node:r,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:s.name,replacement:s.replacement},suggest:[{messageId:"replace",data:{replacement:s.replacement},fix:i=>i.replaceText(a,s.replacement)}]})}}if(t.disallowMethods?.length&&Pi(r.callee)){for(let o of r.arguments)if(o.type===te.AST_NODE_TYPES.ObjectExpression){for(let a of o.properties)if(a.type===te.AST_NODE_TYPES.Property&&a.key.type===te.AST_NODE_TYPES.Identifier){let s=a.key.name,i=t.disallowMethods.find(l=>l.name===s);if(i){if(i.requireTrueProp){let l=i.requireTrueProp,c=!1;for(let p of o.properties)if(p.type===te.AST_NODE_TYPES.Property&&p.key.type===te.AST_NODE_TYPES.Identifier&&p.key.name===l&&p.value.type===te.AST_NODE_TYPES.Literal&&p.value.value===!0){c=!0;break}if(!c){e.report({node:a,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:i.name,requireTrueProp:l}});continue}}i.replacement&&e.report({node:a,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:l=>l.replaceText(a.key,i.replacement)}]})}}}}}}:{}}}),Ot={name:On,rule:Fi};var Je=require("@typescript-eslint/utils"),Ni=Je.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pn="require-description",ji=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Di=/^eslint-disable-(next-)?line$/u,Mi=Ni({name:Pn,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let n=e.sourceCode,r=new Set(t.ignore||[]);return{Program(){for(let o of n.getAllComments()){let a=_i(o);a!=null&&(r.has(a.kind)||a.description||e.report({loc:$i(o.loc),messageId:"missingDescription"}))}}}}}),Fn={name:Pn,rule:Mi};function _i(e){let{text:t,description:n}=Li(e.value);if(!t)return null;let r=ji.exec(t);if(!r)return null;let o=r[1];if(!o)return null;let a=Di.test(o);if(e.type===Je.TSESTree.AST_TOKEN_TYPES.Line&&!a||a&&e.loc.start.line!==e.loc.end.line)return null;let s=t.slice(r.index+o.length);return{kind:o,value:s.trim(),description:n}}function Li(e){let t=e.split(/\s-{2,}\s/u);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function $i(e){return{start:{line:e.start.line,column:-1},end:e.end}}function Dn(e){return/^use[A-Z0-9]/.test(e)}function Be(e){return e.type==="Identifier"?Dn(e.name):e.type==="MemberExpression"&&!e.computed&&Be(e.property)?e.object.type==="Identifier":!1}function Mn(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function _n(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Ln(e){return!!(e.parent&&e.parent.callee&&_n(e.parent.callee,"forwardRef"))}function $n(e){return!!(e.parent&&e.parent.callee&&_n(e.parent.callee,"memo"))}function Pt(e){for(;e;){let t=Un(e);if(t&&(Mn(t)||Be(t))||Ln(e)||$n(e))return!0;e=e.parent}return!1}function Nn(e){return!1}function Ft(e){return!1}var zi=/eslint +react-compiler\/react-compiler: +\["error/,zn={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let l of e.sourceCode.getAllComments())if(zi.test(l.value))return{CallExpression(c){let p=null;c.callee.name==="useMemo"?p="useMemo":c.callee.name==="useCallback"&&(p="useCallback"),p&&e.report({node:c,message:`"${p}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?l=>t(l):l=>e.sourceCode.getText(l),n=typeof e.getScope=="function"?()=>n():l=>e.sourceCode.getScope(l),r=null,o=[],a=[],s=new WeakSet;function i(l){for(let c of l.references){let p=c.identifier.parent;if(p.type==="VariableDeclarator"&&p.init&&p.init.type==="CallExpression"&&p.init.callee&&Nn(p.init.callee))for(let u of c.resolved.references)u!==c&&s.add(u.identifier)}}return{onCodePathSegmentStart:l=>a.push(l),onCodePathSegmentEnd:()=>a.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(l,c){let p=o.pop();if(p.size===0)return;let u=new Set;function g(T,m){let{cache:y}=g,A=y.get(T.id),I=new Set(m);if(I.has(T.id)){let E=[...I],F=E.slice(E.indexOf(T.id)+1);for(let Y of F)u.add(Y);return BigInt("0")}if(I.add(T.id),A!==void 0)return A;if(l.thrownSegments.includes(T))A=BigInt("0");else if(T.prevSegments.length===0)A=BigInt("1");else{A=BigInt("0");for(let E of T.prevSegments)A+=g(E,I)}return T.reachable&&A===BigInt("0")?y.delete(T.id):y.set(T.id,A),A}function h(T,m){let{cache:y}=h,A=y.get(T.id),I=new Set(m);if(I.has(T.id)){let E=Array.from(I),F=E.slice(E.indexOf(T.id)+1);for(let Y of F)u.add(Y);return BigInt("0")}if(I.add(T.id),A!==void 0)return A;if(l.thrownSegments.includes(T))A=BigInt("0");else if(T.nextSegments.length===0)A=BigInt("1");else{A=BigInt("0");for(let E of T.nextSegments)A+=h(E,I)}return y.set(T.id,A),A}function x(T){let{cache:m}=x,y=m.get(T.id);if(y===null)return 1/0;if(y!==void 0)return y;if(m.set(T.id,null),T.prevSegments.length===0)y=1;else{y=1/0;for(let A of T.prevSegments){let I=x(A);I<y&&(y=I)}y+=1}return m.set(T.id,y),y}g.cache=new Map,h.cache=new Map,x.cache=new Map;let b=h(l.initialSegment),k=Un(c),w=Pt(c),M=k?Mn(k)||Be(k):Ln(c)||$n(c),P=1/0;for(let T of l.finalSegments){if(!T.reachable)continue;let m=x(T);m<P&&(P=m)}for(let[T,m]of p){if(!T.reachable)continue;let y=T.nextSegments.length===0?P<=x(T):P<x(T),A=g(T)*h(T),I=u.has(T.id);for(let E of m)if(I&&!Ft(E)&&e.report({node:E,message:`React Hook "${t(E)}" 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.`}),M){if(c.async&&e.report({node:E,message:`React Hook "${t(E)}" cannot be called in an async function.`}),!I&&A!==b&&!Ft(E)){let Y=`React Hook "${t(E)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(y?" Did you accidentally call a React Hook after an early return?":"");e.report({node:E,message:Y})}}else if(c.parent&&(c.parent.type==="MethodDefinition"||c.parent.type==="ClassProperty")&&c.parent.value===c){let F=`React Hook "${t(E)}" 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:E,message:F})}else if(k){let F=`React Hook "${t(E)}" is called in function "${t(k)}" 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:E,message:F})}else if(c.type==="Program"){let F=`React Hook "${t(E)}" 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:E,message:F})}else if(w&&!Ft(E)){if(c.parent.type==="CallExpression"&&c.parent.callee.type==="Identifier"&&c.parent.callee.name==="useCallback"){let Y=c.parent;if(Y.parent.type==="VariableDeclarator"&&Dn(Y.parent.id.name))return}let F=`React Hook "${t(E)}" 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:E,message:F})}}},CallExpression(l){if(Be(l.callee)){let c=jn(o),p=jn(a),u=c.get(p);u||(u=[],c.set(p,u)),u.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||Nn(l.callee))&&l.arguments.length>0&&(r=l)},Identifier(l){r==null&&s.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${t(l)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(l){l===r&&(r=null)},FunctionDeclaration(l){Pt(l)&&i(n(l))},ArrowFunctionExpression(l){Pt(l)&&i(n(l))}}}};function Un(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 jn(e){return e[e.length-1]}var Wn={[It.name]:It.rule,[at.name]:at.rule,[ot.name]:ot.rule,"rules-of-hooks":zn,"exhaustive-deps":Bt,"require-description":Fn.rule,[lt.name]:lt.rule,[pt.name]:pt.rule,[At.name]:At.rule,[Ze.name]:Ze.rule,[st.name]:st.rule,[yt.name]:yt.rule,[vt.name]:vt.rule,[dt.name]:dt.rule,[ct.name]:ct.rule,[et.name]:et.rule,[Ot.name]:Ot.rule,[Ke.name]:Ke.rule,[it.name]:it.rule,[ht.name]:ht.rule,[Et.name]:Et.rule,[xt.name]:xt.rule,[wt.name]:wt.rule,[bt.name]:bt.rule,[kt.name]:kt.rule,[St.name]:St.rule,[gt.name]:gt.rule};var Ui={rules:Wn};0&&(module.exports={extendedLintPlugin});
15
+ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let y=l.acquire(w),A=new Set,C=null;{let f=y.upper;for(;f&&(A.add(f),f.type!=="function");)f=f.upper;if(!f)return;C=f}let E=Array.isArray;function F(f){if(!E(f.defs))return!1;let d=f.defs[0];if(d==null||d.node.type!=="VariableDeclarator")return!1;let I=d.node.init;if(I==null)return!1;for(;I.type==="TSAsExpression";)I=I.expression;let R=d.node.parent;if(R==null&&(ot(C.block,d.node.id),R=d.node.parent,R==null))return!1;if(R.kind==="const"&&I.type==="Literal"&&(typeof I.value=="string"||typeof I.value=="number"||I.value===null))return!0;if(I.type!=="CallExpression")return!1;let O=I.callee;if(O.type==="MemberExpression"&&O.object.name==="React"&&O.property!=null&&!O.computed&&(O=O.property),O.type!=="Identifier")return!1;let k=d.node.id,{name:D}=O;if(D==="useRef"&&k.type==="Identifier")return!0;if(Cr(O)&&k.type==="Identifier"){for(let j of f.references)j!==k&&S.add(j.identifier);return!0}else if(D==="useState"||D==="useReducer"){if(k.type==="ArrayPattern"&&k.elements.length===2&&E(f.identifiers)){if(k.elements[1]===f.identifiers[0]){if(D==="useState"){let j=f.references,se=0;for(let de=0;de<j.length;de++){if(j[de].isWrite()&&se++,se>1)return!1;c.set(j[de].identifier,k.elements[0])}}return!0}else if(k.elements[0]===f.identifiers[0]){if(D==="useState"){let j=f.references;for(let se=0;se<j.length;se++)p.add(j[se].identifier)}return!1}}}else if(D==="useTransition"&&k.type==="ArrayPattern"&&k.elements.length===2&&Array.isArray(f.identifiers)&&k.elements[1]===f.identifiers[0])return!0;return!1}function Y(f){if(!E(f.defs))return!1;let d=f.defs[0];if(d==null||d.node==null||d.node.id==null)return!1;let I=d.node,R=C.childScopes,O=null,k;for(k=0;k<R.length;k++){let D=R[k],j=D.block;if(I.type==="FunctionDeclaration"&&j===I||I.type==="VariableDeclarator"&&j.parent===I){O=D;break}}if(O==null)return!1;for(k=0;k<O.through.length;k++){let D=O.through[k];if(D.resolved!=null&&A.has(D.resolved.scope)&&!B(D.resolved))return!1}return!0}let B=x(F,u),te=x(Y,g),Q=new Map;function Ce(f){let d=f.from,I=!1;for(;d.block!==w;)d.type==="function"&&(I=d.block.parent!=null&&d.block.parent.type==="ReturnStatement"),d=d.upper;return I}let re=new Map,Ne=new Map;fe(y);function fe(f){for(let d of f.references){if(!d.resolved||!A.has(d.resolved.scope))continue;let I=ot(w,d.identifier),R=tn(I),O=ye(R,Ne);if(m&&R.type==="Identifier"&&(R.parent.type==="MemberExpression"||R.parent.type==="OptionalMemberExpression")&&!R.parent.computed&&R.parent.property.type==="Identifier"&&R.parent.property.name==="current"&&Ce(d)&&Q.set(O,{reference:d,dependencyNode:R}),R.parent.type==="TSTypeQuery"||R.parent.type==="TSTypeReference")continue;let k=d.resolved.defs[0];if(k!=null&&!(k.node!=null&&k.node.init===w.parent)&&k.type!=="TypeParameter")if(re.has(O))re.get(O).references.push(d);else{let D=d.resolved,j=B(D)||te(D);re.set(O,{isStable:j,references:[d]})}}for(let d of f.childScopes)fe(d)}Q.forEach(({reference:f,dependencyNode:d},I)=>{let R=f.resolved.references,O=!1;for(let k=0;k<R.length;k++){let{identifier:D}=R[k],{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){O=!0;break}}O||i({node:d.parent.property,message:`The ref value '${I}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${I}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let pe=new Set;function me(f,d){pe.has(d)||(pe.add(d),i({node:f,message:`Assignments to the '${d}' variable from inside React Hook ${r(P)} will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ${r(P)}.`}))}let Ae=new Set;if(re.forEach(({isStable:f,references:d},I)=>{f&&Ae.add(I),d.forEach(R=>{R.writeExpr&&me(R.writeExpr,I)})}),pe.size>0)return;if(!L){let f=null;if(re.forEach(({isStable:d,references:I},R)=>{f||I.forEach(O=>{if(f)return;let k=O.identifier;if(!c.has(k))return;let j=O.from;for(;j.type!=="function";)j=j.upper;j.block===w&&(f=R)})}),f){let{suggestedDependencies:d}=it({dependencies:re,declaredDependencies:[],stableDependencies:Ae,externalDependencies:new Set,isEffect:!0});i({node:P,message:`React Hook ${T} contains a call to '${f}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+d.join(", ")+`] as a second argument to the ${T} Hook.`,suggest:[{desc:`Add dependencies array: [${d.join(", ")}]`,fix(I){return I.insertTextAfter(w,`, [${d.join(", ")}]`)}}]})}return}let De=[],je=new Set;L.type!=="ArrayExpression"?i({node:L,message:`React Hook ${r(P)} 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.`}):L.elements.forEach(f=>{if(f===null)return;if(f.type==="SpreadElement"){i({node:f,message:`React Hook ${r(P)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}S.has(f)&&i({node:f,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(f)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(f)}\``,fix(O){return O.removeRange(f.range)}}]});let d;try{d=ye(f,Ne)}catch(O){if(/Unsupported node type/.test(O.message)){f.type==="Literal"?re.has(f.value)?i({node:f,message:`The ${f.raw} literal is not a valid dependency because it never changes. Did you mean to include ${f.value} in the array instead?`}):i({node:f,message:`The ${f.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):i({node:f,message:`React Hook ${r(P)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw O}let I=f;for(;I.type==="MemberExpression"||I.type==="OptionalMemberExpression"||I.type==="ChainExpression";)I=I.object||I.expression.object;let R=!C.through.some(O=>O.identifier===I);De.push({key:d,node:f}),R||je.add(d)});let{suggestedDependencies:Gn,unnecessaryDependencies:_e,missingDependencies:Se,duplicateDependencies:Ut}=it({dependencies:re,declaredDependencies:De,stableDependencies:Ae,externalDependencies:je,isEffect:m}),$e=Gn;if(Ut.size+Se.size+_e.size===0){if(t)return;br({declaredDependencies:De,declaredDependenciesNode:L,componentScope:C,scope:y}).forEach(({construction:d,isUsedOutsideOfHook:I,depType:R})=>{let O=R==="function"?"useCallback":"useMemo",k=R==="function"?"definition":"initialization",D=`wrap the ${k} of '${d.name.name}' in its own ${O}() Hook.`,j=I?`To fix this, ${D}`:`Move it inside the ${T} callback. Alternatively, ${D}`,se=R==="conditional"||R==="logical expression"?"could make":"makes",de=`The '${d.name.name}' ${R} ${se} the dependencies of ${T} Hook (at line ${L.loc.start.line}) change on every render. ${j}`,Wt;I&&d.type==="Variable"&&R==="function"&&(Wt=[{desc:`Wrap the ${k} of '${d.name.name}' in its own ${O}() Hook.`,fix(Vt){let[Zn,Qn]=O==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Vt.insertTextBefore(d.node.init,Zn),Vt.insertTextAfter(d.node.init,Qn)]}}]),i({node:d.node,message:de,suggest:Wt})});return}!m&&Se.size>0&&($e=it({dependencies:re,declaredDependencies:[],stableDependencies:Ae,externalDependencies:je,isEffect:m}).suggestedDependencies);function Kn(){if(De.length===0)return!0;let f=De.map(I=>I.key),d=f.slice().sort();return f.join(",")===d.join(",")}Kn()&&$e.sort();function Ke(f){let d=f.split("."),I="";for(let R=0;R<d.length;R++){if(R!==0){let O=d.slice(0,R+1).join("."),k=Ne.get(O)===!0;I+=k?"?.":"."}I+=d[R]}return I}function Ze(f,d,I,R){return f.size===0?null:(f.size>1?"":d+" ")+I+" "+(f.size>1?"dependencies":"dependency")+": "+wr(Array.from(f).sort().map(O=>"'"+Ke(O)+"'"))+`. Either ${R} ${f.size>1?"them":"it"} or remove the dependency array.`}let le="";if(_e.size>0){let f=null;if(Array.from(_e.keys()).forEach(d=>{f===null&&d.endsWith(".current")&&(f=d)}),f!==null)le=` Mutable values like '${f}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(je.size>0){let d=Array.from(je)[0];y.set.has(d)||(le=` Outer scope values like '${d}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!le&&Se.has("props")){let f=re.get("props");if(f==null)return;let d=f.references;if(!Array.isArray(d))return;let I=!0;for(let R=0;R<d.length;R++){let O=d[R],k=ot(C.block,O.identifier);if(!k){I=!1;break}let D=k.parent;if(D==null){I=!1;break}if(D.type!=="MemberExpression"&&D.type!=="OptionalMemberExpression"){I=!1;break}}I&&(le=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${T} call and refer to those specific props inside ${r(P)}.`)}if(!le&&Se.size>0){let f=null;Se.forEach(d=>{if(f)return;let I=C.set.get(d),R=re.get(d);if(R.references[0].resolved!==I)return;let O=I.defs[0];if(O==null||O.name==null||O.type!=="Parameter")return;let k=!1,D;for(let j=0;j<R.references.length;j++)if(D=R.references[j].identifier,D!=null&&D.parent!=null&&(D.parent.type==="CallExpression"||D.parent.type==="OptionalCallExpression")&&D.parent.callee===D){k=!0;break}k&&(f=d)}),f!==null&&(le=` If '${f}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!le&&Se.size>0){let f=null;if(Se.forEach(d=>{if(f!==null)return;let R=re.get(d).references,O,k;for(let D=0;D<R.length;D++){for(O=R[D].identifier,k=O.parent;k!=null&&k!==C.block;){if(k.type==="CallExpression"){let j=c.get(k.callee);if(j!=null){if(j.name===d)f={missingDep:d,setter:k.callee.name,form:"updater"};else if(p.has(O))f={missingDep:d,setter:k.callee.name,form:"reducer"};else{let se=R[D].resolved;if(se!=null){let de=se.defs[0];de!=null&&de.type==="Parameter"&&(f={missingDep:d,setter:k.callee.name,form:"inlineReducer"})}}break}}k=k.parent}if(f!==null)break}}),f!==null)switch(f.form){case"reducer":le=` You can also replace multiple useState variables with useReducer if '${f.setter}' needs the current value of '${f.missingDep}'.`;break;case"inlineReducer":le=` If '${f.setter}' needs the current value of '${f.missingDep}', you can also switch to useReducer instead of useState and read '${f.missingDep}' in the reducer.`;break;case"updater":le=` You can also do a functional update '${f.setter}(${f.missingDep.slice(0,1)} => ...)' if you only need '${f.missingDep}' in the '${f.setter}' call.`;break;default:throw new Error("Unknown case.")}}i({node:L,message:`React Hook ${r(P)} has `+(Ze(Se,"a","missing","include")||Ze(_e,"an","unnecessary","exclude")||Ze(Ut,"a","duplicate","omit"))+le,suggest:[{desc:`Update the dependencies array to be: [${$e.map(Ke).join(", ")}]`,fix(f){return f.replaceText(L,`[${$e.map(Ke).join(", ")}]`)}}]})}function v(w){let L=xr(w.callee,o);if(L===-1)return;let P=w.arguments[L],T=w.callee,m=nn(T).name,y=w.arguments[L+1],A=/Effect($|[^a-z])/g.test(m);if(!P){i({node:T,message:`React Hook ${m} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!A)){if(!y&&!A){(m==="useMemo"||m==="useCallback")&&i({node:T,message:`React Hook ${m} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(P.type){case"FunctionExpression":case"ArrowFunctionExpression":b(P,y,T,m,A);return;case"Identifier":if(!y||y.elements&&y.elements.some(F=>F&&F.type==="Identifier"&&F.name===P.name))return;let C=n(w).set.get(P.name);if(C==null||C.defs==null)return;let E=C.defs[0];if(!E||!E.node||E.type!=="Variable"&&E.type!=="FunctionName")break;switch(E.node.type){case"FunctionDeclaration":b(E.node,y,T,m,A);return;case"VariableDeclarator":let F=E.node.init;if(!F)break;switch(F.type){case"ArrowFunctionExpression":case"FunctionExpression":b(F,y,T,m,A);return}break}break;default:i({node:T,message:`React Hook ${m} received a function whose dependencies are unknown. Pass an inline function instead.`});return}i({node:T,message:`React Hook ${m} has a missing dependency: '${P.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${P.name}]`,fix(C){return C.replaceText(y,`[${P.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let w of e.sourceCode.getAllComments())if(Er.test(w.value))return t=!0,{CallExpression:L=>v(L,!0)}}return{CallExpression:w=>v(w)}}};function it({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:s}){let a=o();function o(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((b,v)=>{let w=i(a,v);w.isUsed=!0,l(a,v,L=>{L.isSubtreeUsed=!0})}),t.forEach(({key:b})=>{let v=i(a,b);v.isSatisfiedRecursively=!0}),r.forEach(b=>{let v=i(a,b);v.isSatisfiedRecursively=!0});function i(b,v){let w=v.split("."),L=b;for(let P of w){let T=L.children.get(P);T||(T=o(),L.children.set(P,T)),L=T}return L}function l(b,v,w){let L=v.split("."),P=b;for(let T of L){let m=P.children.get(T);if(!m)return;w(m),P=m}}let c=new Set,p=new Set;u(a,c,p,b=>b);function u(b,v,w,L){b.children.forEach((P,T)=>{let m=L(T);if(P.isSatisfiedRecursively){P.isSubtreeUsed&&w.add(m);return}if(P.isUsed){v.add(m);return}u(P,v,w,y=>m+"."+y)})}let g=[],S=new Set,x=new Set;return t.forEach(({key:b})=>{p.has(b)?g.indexOf(b)===-1?g.push(b):x.add(b):S.add(b)}),c.forEach(b=>{g.push(b)}),{suggestedDependencies:g,unnecessaryDependencies:S,duplicateDependencies:x,missingDependencies:c}}function Te(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 Te(e.consequent)!=null||Te(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Te(e.left)!=null||Te(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Te(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Te(e.expression);case"TSAsExpression":return Te(e.expression)}return null}function br({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let s=e.map(({key:o})=>{let i=r.variables.find(c=>c.name===o);if(i==null)return null;let l=i.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let c=Te(l.node.init);if(c!=null)return[i,c]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[i,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[i,"class"]:null}).filter(Boolean);function a(o){let i=!1;for(let l=0;l<o.references.length;l++){let c=o.references[l];if(c.writeExpr){if(i)return!0;i=!0;continue}let p=c.from;for(;p!==n&&p!=null;)p=p.upper;if(p!==n&&!rn(t,c.identifier))return!0}return!1}return s.map(([o,i])=>({construction:o.defs[0],depType:i,isUsedOutsideOfHook:a(o)}))}function tn(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)?tn(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function st(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function ye(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return t&&t.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=ye(e.object,t),n=ye(e.property,null),s=`${r}.${n}`;return st(e,t,s),s}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=ye(e.object,t),n=ye(e.property,null),s=`${r}.${n}`;return st(e,t,s),s}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let n=ye(r.object,t),s=ye(r.property,null),a=`${n}.${s}`;return st(r,t,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function nn(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function xr(e,t){let r=nn(e);if(r.type!=="Identifier")return-1;switch(r.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(r===e&&t&&t.additionalHooks){let n;try{n=ye(r,null)}catch(s){if(/Unsupported node type/.test(s.message))return 0;throw s}return t.additionalHooks.test(n)?0:-1}else return-1}}function ot(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),Ir(n,t))return n;if(rn(n,t))for(let[s,a]of Object.entries(n))s!=="parent"&&(Qt(a)?(a.parent=n,r.push(a)):Array.isArray(a)&&a.forEach(o=>{Qt(o)&&(o.parent=n,r.push(o))}))}return null}function wr(e){let t="";for(let r=0;r<e.length;r++)t+=e[r],r===0&&e.length===2?t+=" and ":r===e.length-2&&e.length>2?t+=", and ":r<e.length-1&&(t+=", ");return t}function Qt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Ir(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function rn(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function Cr(e){return!1}var he=require("@typescript-eslint/utils");var ee=Re(require("typescript")),Ar=he.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),sn="improved-no-unnecessary-condition",Rr=H({}),vr=["string","number","bigint","boolean","symbol","undefined","object","function","never"],kr=new Set(vr),at={name:sn,rule:Ar({name:sn,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:[Rr]},defaultOptions:[{}],create(e){let t=he.ESLintUtils.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(i){return i.type===he.AST_NODE_TYPES.UnaryExpression&&i.operator==="typeof"}function s(i){return i.flags&ee.default.TypeFlags.Any||i.flags&ee.default.TypeFlags.Unknown?null:i.flags&ee.default.TypeFlags.StringLike?["string"]:i.flags&ee.default.TypeFlags.NumberLike?["number"]:i.flags&ee.default.TypeFlags.BigIntLike?["bigint"]:i.flags&ee.default.TypeFlags.BooleanLike?["boolean"]:i.flags&ee.default.TypeFlags.ESSymbolLike?["symbol"]:i.flags&ee.default.TypeFlags.Undefined||i.flags&ee.default.TypeFlags.Void?["undefined"]:i.flags&ee.default.TypeFlags.Null?["object"]:i.getCallSignatures().length>0?["function"]:i.flags&ee.default.TypeFlags.Object?i.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:i.flags&ee.default.TypeFlags.NonPrimitive?["object"]:i.flags&ee.default.TypeFlags.Never?["never"]:null}function a(i){if(!r)return null;let l=t.esTreeNodeToTSNodeMap.get(i),c=r.getTypeAtLocation(l.expression);if(c.flags&ee.default.TypeFlags.Any||c.flags&ee.default.TypeFlags.Unknown)return null;let p=[];if(c.isUnion()){for(let g of c.types){let S=s(g);if(S)p.push(...S);else return null}return p}let u=s(c);return u?(p.push(...u),p):null}function o(i){if(!(i.operator==="==="||i.operator==="!=="))return;let c=null,p=null;if(n(i.left)?(c=i.left,p=i.right.type===he.AST_NODE_TYPES.Literal&&typeof i.right.value=="string"?i.right.value:null):n(i.right)&&(c=i.right,p=i.left.type===he.AST_NODE_TYPES.Literal&&typeof i.left.value=="string"?i.left.value:null),!c||!p||!Or(p,kr))return;let u=a(c);if(!u)return;let g=i.operator==="!==",S=u.includes(p);u.length===1?S&&!g?e.report({node:i,messageId:"unnecessaryTypeofCondition",data:{name:Oe(c,e),type:p}}):!S&&g?e.report({node:i,messageId:"unnecessaryTypeofCondition",data:{name:Oe(c,e),type:Array.from(u)[0]}}):!S&&!g?e.report({node:i,messageId:"alwaysFalseTypeofCondition",data:{name:Oe(c,e),actualType:We(u),conditionType:p}}):S&&g&&e.report({node:i,messageId:"alwaysFalseTypeofCondition",data:{name:Oe(c,e),actualType:We(u),conditionType:p}}):!S&&!g?e.report({node:i,messageId:"alwaysFalseTypeofCondition",data:{name:Oe(c,e),actualType:We(u),conditionType:p}}):!S&&g&&e.report({node:i,messageId:"unnecessaryTypeofCondition",data:{name:Oe(c,e),type:We(u)}})}return{BinaryExpression:o}}})};function We(e){return Array.from(new Set(e)).join(" | ")||"never"}function Oe(e,t){let r=e.argument;return r.type===he.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function Or(e,t){return t.has(e)}var Ve=require("@typescript-eslint/utils");var Pr=Ve.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),on="no-call-with-explicit-generics",Fr=H({functions:K(V())}),Nr=Pr({name:on,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:[Fr]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:s}=n;s.type===Ve.AST_NODE_TYPES.Identifier&&r.has(s.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:s.name}})}}}}),lt={name:on,rule:Nr};var be=require("@typescript-eslint/utils"),Dr=be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),an="no-call-with-inferred-generics",jr=Dr({name:an,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:s}=n;if(s.type!==be.AST_NODE_TYPES.Identifier)return;let a=r.get(s.name);if(!a)return;let{minGenerics:o=1,allowAny:i,disallowTypes:l=t.disallowTypes}=a;(n.typeArguments?.params.length||0)<(o||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:s.name,minGenerics:o||0}}),!(i&&!l)&&n.typeArguments?.params?.some(p=>!i&&p.type===be.AST_NODE_TYPES.TSAnyKeyword||l&&p.type===be.AST_NODE_TYPES.TSTypeReference&&p.typeName.type===be.AST_NODE_TYPES.Identifier&&l.includes(p.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:s.name}})}}}}),ct={name:an,rule:jr};var cn=require("@typescript-eslint/utils"),Lr=cn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pn="no-commented-out-code",Mr=["function ","class ","interface ","type ","enum ","namespace ","import ","export ","const ","let ","var ","return ","throw ","break","continue","try {","catch (","finally {","async ","await ","case ","switch (","while (","for (","default:"],q={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]+>/,colonDescriptiveComment:/^[a-zA-Z]+(\s+[a-zA-Z]+)*:\s+[a-zA-Z]+\s+[a-zA-Z][^{=,'"]*$/,jsdocComment:/^\s*[*\s]*$/},_r=[") {","return;",q.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",q.stringAssignment,");",q.objectPropertyWithQuotes,q.computedPropertyAssignment,q.kebabCaseProperty,q.snakeCaseProperty,"&&","||","()",q.ternaryOperator,q.colonWithWord,q.quotedString,q.numberWithComma,q.arrayWithComma,q.objectWithComma,q.methodCall,q.arrayAccess,"?.(","??","=>",q.quotedPropertyKey],$r=["/>","</",q.jsxSelfClosing,q.jsxElement,q.jsxOpeningTag,q.jsxClosingTag,q.htmlOpeningTag,q.htmlClosingTag],ln=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Ur=Lr({name:pn,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(n,s){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||q.jsdocComment.test(n))return!1;for(let o of ln)if(a.startsWith(o))return!1;if(n.includes("https://")||a.includes(":")&&q.colonDescriptiveComment.test(a.trim()))return!1;if(s==="Block"){for(let o of $r)if(typeof o=="string"){if(n.includes(o))return{wrongPattern:o}}else if(o.test(n))return{wrongPattern:`regex(${o.toString()})`};return!1}for(let o of Mr)if(a.startsWith(o))return{wrongPattern:o};for(let o of _r)if(typeof o=="string"){if(n.includes(o))return{wrongPattern:o}}else if(o.test(n))return{wrongPattern:`regex(${o.toString()})`};return!1}function r(n,s){let a=n,o=a.trim();if(o.startsWith("`")&&(o.endsWith("`,")||o.endsWith("`;")||o.endsWith("`")))return a;if(s==="Block"&&a.includes("```")){let c=a.split(/```[\s\S]*?```/g);c.some(u=>/[a-zA-Z0-9]/.test(u))&&(a=c.join(""))}if(!a.includes("`"))return a;let i=a.split(/`[^`]*`/g);return i.some(c=>/[a-zA-Z0-9]/.test(c))?i.join(""):a}return{Program(){let s=e.sourceCode.getAllComments();for(let a of s){let o=r(a.value,a.type),i=t(o,a.type);i&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:i.wrongPattern,allowedPrefixes:ln.join(", ")}})}}}}}),pt={name:pn,rule:Ur};var He=require("@typescript-eslint/utils"),Wr=He.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),un="no-default-export",Vr=Wr({name:un,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let r of t.specifiers)r.exported.type===He.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),ut={name:un,rule:Vr};var fn=require("@typescript-eslint/utils"),Hr=fn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mn="no-leaked-text-in-jsx",zr=[",",";","[","]","(",")"],Yr=Hr({name:mn,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(t){let r=t.value.trim();if(!r)return;let n="";zr.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),ft={name:mn,rule:Yr};var Ee=require("@typescript-eslint/utils"),Jr=Ee.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yn="no-non-camel-case-functions",qr=/^(\$?[a-z][a-zA-Z0-9]*)$/;function dn(e){if(e.typeName.type!==Ee.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Ee.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var Br=Jr({name:yn,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!qr.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Ee.AST_NODE_TYPES.TSTypeReference?dn(r):r.type===Ee.AST_NODE_TYPES.TSUnionType&&r.types.some(s=>s.type===Ee.AST_NODE_TYPES.TSTypeReference&&dn(s))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),mt={name:yn,rule:Br};var U=require("@typescript-eslint/utils");var dt=require("@typescript-eslint/utils");function Pe(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:Pe(e.parent,t,r===1/0?r:r-1)}function*yt(e){yield e,e.parent&&(yield*yt(e.parent))}function gt(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function gn(e,t,r){let s=r.getDeclaredVariables(e).find(a=>a.name===t||a.identifiers[0]?.parent.type===dt.AST_NODE_TYPES.Property&&a.identifiers[0]?.parent.key.type===dt.AST_NODE_TYPES.Identifier&&a.identifiers[0]?.parent.key.name===t);return s?s.references.filter(a=>!a.init):[]}var Xr=U.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sn="no-optional-root-props",Gr=Xr({name:Sn,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function t(n){let a=e.sourceCode.getDeclaredVariables(n)[0];if(!a||a.references.length!==1)return!1;let o=a.references[0];if(!o)return!1;for(let i of yt(o.identifier)){if("returnType"in i||i.type===U.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=i.parent;if(!l)return!1;if(l.type===U.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===U.TSESTree.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===U.TSESTree.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let p=Pe(l.parent.parent,U.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!p)return!1;let u=ze(p,e.sourceCode);return u?!(u.parent.type===U.TSESTree.AST_NODE_TYPES.CallExpression&&u.parent.callee.type===U.TSESTree.AST_NODE_TYPES.Identifier&&u.parent.callee.name==="memo"):!1}if(i.type===U.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===U.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let c=Pe(l,U.TSESTree.AST_NODE_TYPES.VariableDeclaration);return c?!!ze(c,e.sourceCode):!1}if(l.type===U.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!ze(l,e.sourceCode)}return!1}function r(n){n.key.type!==U.TSESTree.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:s=>{let a=Pe(n,U.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let o=e.sourceCode.getText(a);return s.replaceText(a,o.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===U.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(Ye(n)||!t(n)))for(let s of n.typeAnnotation.members)s.type===U.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSInterfaceDeclaration(n){if(!(Ye(n)||!t(n)))for(let s of n.body.body)s.type===U.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSTypeReference(n){if(n.typeName.type!==U.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let s=n.typeArguments.params[0];if(s.type!==U.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let a=Pe(n.parent,U.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let o=ze(a,e.sourceCode);if(!(!o||o.parent.type===U.TSESTree.AST_NODE_TYPES.CallExpression&&o.parent.callee.type===U.TSESTree.AST_NODE_TYPES.Identifier&&o.parent.callee.name==="memo"))for(let l of s.members)l.type===U.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function Ye(e){return e?e.parent?.type===U.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===U.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function ze(e,t){if(Ye(e))return;let r;if(e.type===U.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===U.TSESTree.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let n=t.getScope(e);e.type===U.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let s=n.variables.find(o=>o.identifiers.includes(r));if(!s)return;let a=s.references.filter(o=>o.identifier!==r);if(!(a.length!==1||!a[0])&&!Ye(a[0].identifier.parent.parent))return a[0].identifier}var St={name:Sn,rule:Gr};var Tn=require("@typescript-eslint/utils"),Je=Re(require("path"));var Kr=Tn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),hn="no-relative-imports",Zr=H({find:V(),replacement:V()}),Qr=H({aliases:K(Zr),rootDir:_(V()),allowNotFoundAliases:_(ve()),_dev_simulateFileName:_(V())}),ei=Kr({name:hn,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:[Qr]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(o){return o.startsWith(".")||o.startsWith("..")}function s(o,i){let l=Je.default.dirname(i);return Je.default.resolve(l,o)}function a(o){let i=t.rootDir??process.cwd(),l=Je.default.relative(i,o);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:c,replacement:p}of t.aliases)if(l.startsWith(p)){let u=l.replace(p,c);return{alias:c,newPath:u}}return null}return{ImportDeclaration(o){let i=o.source.value;if(!n(i))return;let l=s(i,r),c=a(l);!c&&t.allowNotFoundAliases||e.report({node:o,messageId:c?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:c?.alias},fix:c?p=>p.replaceText(o.source,`'${c.newPath}'`):void 0})}}}}),Tt={name:hn,rule:ei};var Le=require("@typescript-eslint/utils"),xe=Re(require("zod/v4"));var ti=xe.object({alternativeMsgs:xe.object({inArrayFind:xe.string().optional(),inArrayFilter:xe.string().optional()}).optional(),__dev_simulateFileName:xe.string().optional()});function ni(e){return e.typeAnnotation.type!==Le.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}function ri(e){return/\.(typeGuards|type-guards)\.(ts|tsx)$/.test(e)}function ii(e){let t=e.parent;for(;t;){if(t.type===Le.AST_NODE_TYPES.CallExpression&&t.callee.type===Le.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===Le.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var ht=G({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:"Type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[ke(ti)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(ri(r))return{};function n(s){if(!ni(s))return;let a=ii(s),o=[];if(t.alternativeMsgs&&a){let i=a.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let l=a.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:s,messageId:l,data:{message:i}});return}}e.report({node:s,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});var we=require("@typescript-eslint/utils");var si="no-unnecessary-async-on-jsx-props";function oi(e){if(e.body.type!==we.AST_NODE_TYPES.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let r=t[0];return!r||r.type!==we.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===we.AST_NODE_TYPES.AwaitExpression}var Et=G({name:si,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function t(r){oi(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let s=e.sourceCode,a=[],o=s.getFirstToken(r,l=>l.value==="async");if(o){let l=s.getTokenAfter(o);l?a.push(n.replaceTextRange([o.range[0],l.range[0]],"")):a.push(n.remove(o))}function i(l){if(l.type===we.AST_NODE_TYPES.AwaitExpression){let c=s.getFirstToken(l);if(c&&c.value==="await"){let p=s.getTokenAfter(c);p?a.push(n.replaceTextRange([c.range[0],p.range[0]],"")):a.push(n.remove(c))}}if(l.type===we.AST_NODE_TYPES.BlockStatement)for(let c of l.body)i(c);else l.type===we.AST_NODE_TYPES.ExpressionStatement&&i(l.expression)}return i(r.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var ge=require("@typescript-eslint/utils");var bt=Re(require("typescript")),ai=ge.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),En="no-unnecessary-casting",li=H({additionalCastFunctions:_(K(H({name:V(),expectedType:zt(["string","number"])})))}),xt={name:En,rule:ai({name:En,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:[li],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],s=ge.ESLintUtils.getParserServices(e,!0),a=s.program?.getTypeChecker();if(!a||!s.program)throw new Error("TypeScript services or program not available");function o(p,u){switch(p.type){case ge.AST_NODE_TYPES.Literal:return u==="number"?typeof p.value=="number":typeof p.value=="string";case ge.AST_NODE_TYPES.TemplateLiteral:return u==="string";case ge.AST_NODE_TYPES.UnaryExpression:return u==="number"?p.operator==="+"||p.operator==="-"||p.operator==="~":!1;default:return!1}}function i(p,u){return u==="number"?!!(p.flags&bt.TypeFlags.NumberLike):!!(p.flags&bt.TypeFlags.StringLike)}function l(p,u){return g=>g.replaceText(p,e.sourceCode.getText(u))}function c(p){if(!a||p.arguments.length!==1)return;let u=p.arguments[0];if(!u||u.type===ge.AST_NODE_TYPES.SpreadElement)return;let{callee:g}=p;if(g.type!==ge.AST_NODE_TYPES.Identifier)return;let S=g.name,x=n.find(v=>v.name===S);if(!x)return;if(o(u,x.expectedType)||i(a.getTypeAtLocation(s.esTreeNodeToTSNodeMap.get(u)),x.expectedType)){let v,w;S==="Number"?v="unnecessaryNumberCasting":S==="String"?v="unnecessaryStringCasting":(v="unnecessaryCustomCasting",w={name:x.name,type:x.expectedType}),e.report({node:p,messageId:v,...w?{data:w}:{},fix:l(p,u)})}}return{CallExpression:c}}})};var Me=require("@typescript-eslint/utils"),oe=Re(require("zod/v4"));var ci=oe.object({methods:oe.union([oe.array(oe.string()),oe.literal("array")])}),wt=G({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:[oe.toJSONSchema(ci)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function s(i){return Array.isArray(r)?r.includes(i):n.has(i)}function a(i){let{callee:l}=i;if(l.type===Me.AST_NODE_TYPES.MemberExpression){let c=l.property;if(c.type===Me.AST_NODE_TYPES.Identifier)return c.name}return null}function o(i,l){if(i.type!==Me.AST_NODE_TYPES.Identifier||!i.typeAnnotation)return;let c=l.parent;if(c.type===Me.AST_NODE_TYPES.CallExpression){let p=a(c);p&&s(p)&&c.arguments.indexOf(l)===0&&e.report({node:i.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(g){return g.remove(i.typeAnnotation)}})}}return{ArrowFunctionExpression(i){for(let l of i.params)o(l,i)},FunctionExpression(i){for(let l of i.params)o(l,i)}}}});var ie=require("@typescript-eslint/utils");var It=G({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===ie.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==ie.AST_NODE_TYPES.ObjectExpression||t.id.type===ie.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===ie.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let o of t.init.properties)o.type===ie.AST_NODE_TYPES.Property&&o.key.type===ie.AST_NODE_TYPES.Identifier&&r.set(o.key.name,o);if(r.size===0||t.id.type!==ie.AST_NODE_TYPES.Identifier)return;let n=pi(t,e.sourceCode);if(n.length===0)return;let s=t.init.properties.some(o=>o.type!==ie.AST_NODE_TYPES.Property?!1:o.value.type===ie.AST_NODE_TYPES.FunctionExpression),a=new Set;for(let o of n){if(o.identifier.parent.type!==ie.AST_NODE_TYPES.MemberExpression)return;let i=o.identifier.parent;if(i.object!==o.identifier)return;if(i.computed)if(i.property.type===ie.AST_NODE_TYPES.Literal&&typeof i.property.value=="string")a.add(i.property.value);else return;else{if(i.property.type!==ie.AST_NODE_TYPES.Identifier)return;a.add(i.property.name)}if(i.parent.type===ie.AST_NODE_TYPES.CallExpression&&s)return}for(let[o,i]of r)a.has(o)||e.report({node:i,messageId:"unusedObjectProperty",data:{name:o}})}}}});function pi(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(s=>s.identifier!==e.id):[]}var W=require("@typescript-eslint/utils");var ui=H({selectors:K(H({name:V(),selectorProp:_(V()),selectorArgPos:_(ue()),returnProp:_(V())}))}),fi=W.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),bn="no-unused-selected-values",Ct={name:bn,rule:fi({name:bn,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[ui]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(s=>[s.name,s]));return{VariableDeclarator(s){let a=null;if(s.init?.type===W.AST_NODE_TYPES.CallExpression&&(a=s.init),!a)return;let o=di(a);if(!o)return;let i=n.get(o);if(!i)return;let l=mi(a,i.selectorArgPos??0,i.selectorProp);if(!l)return;let c=yi(l);if(!c)return;let p=xn(c.properties,void 0);if(!p)return;if(s.id.type===W.AST_NODE_TYPES.ObjectPattern){let S=xn(s.id.properties,i.returnProp);if(!S)return;for(let[x,b]of p)S.has(x)||e.report({node:b,messageId:"unusedSelectedValue",data:{name:x}});return}if(s.id.type!==W.AST_NODE_TYPES.Identifier||i.returnProp)return;let u=gi(s,e.sourceCode);if(u.length===0)return;let g=new Set;for(let S of u){if(S.identifier.parent.type!==W.AST_NODE_TYPES.MemberExpression)return;let x=S.identifier.parent.property;if(x.type!==W.AST_NODE_TYPES.Identifier)return;g.add(x.name)}for(let[S,x]of p)g.has(S)||e.report({node:x,messageId:"unusedSelectedValue",data:{name:S}})}}}})};function mi(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===W.AST_NODE_TYPES.ArrowFunctionExpression||n.type===W.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===W.AST_NODE_TYPES.ObjectExpression){let s=n.properties.find(o=>o.type===W.AST_NODE_TYPES.Property&&o.key.type===W.AST_NODE_TYPES.Identifier&&o.key.name===r);if(s?.type!==W.AST_NODE_TYPES.Property)return null;let a=s.value;if(a.type===W.AST_NODE_TYPES.ArrowFunctionExpression||a.type===W.AST_NODE_TYPES.FunctionExpression)return a}return null}function di(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 yi(e){if(e.body.type===W.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===W.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===W.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==W.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function xn(e,t){let r=e;if(t){let s=e.find(a=>a.type===W.AST_NODE_TYPES.Property&&a.key.type===W.AST_NODE_TYPES.Identifier&&a.key.name===t);if(s?.type!==W.AST_NODE_TYPES.Property||s.value.type!==W.AST_NODE_TYPES.ObjectPattern)return null;r=s.value.properties}let n=new Map;for(let s of r){if(s.type!==W.AST_NODE_TYPES.Property||s.key.type!==W.AST_NODE_TYPES.Identifier)return null;n.set(s.key.name,s)}return n.size>0?n:null}function gi(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(s=>s.identifier!==e.id):[]}var z=require("@typescript-eslint/utils");var At=G({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(a=>a.type===z.AST_NODE_TYPES.ImportDeclaration&&a.source.value==="t-state-form"))return{};let n=null,s=!1;return{CallExpression(a){if(s)return;if(!n){let i=Si(a);i&&(n=i);return}let o=Ti(a,e.sourceCode);if(o){s=!0;for(let i of o)n.delete(i);if(n.size!==0)for(let[i,l]of n)e.report({node:l,messageId:"unusedField",data:{name:i}})}}}}});function Si(e){if(!(e.callee.type===z.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==z.AST_NODE_TYPES.ObjectExpression)return null;let n=gt(r.properties,a=>a.type!==z.AST_NODE_TYPES.Property||a.key.type!==z.AST_NODE_TYPES.Identifier||a.key.name!=="initialConfig"?null:a.value.type===z.AST_NODE_TYPES.ObjectExpression?a.value:a.value.type===z.AST_NODE_TYPES.ArrowFunctionExpression||a.value.type===z.AST_NODE_TYPES.FunctionExpression?hi(a.value):null);if(!n)return null;let s=new Map;for(let a of n.properties)a.type===z.AST_NODE_TYPES.Property&&a.key.type===z.AST_NODE_TYPES.Identifier&&s.set(a.key.name,a);return s}function Ti(e,t){if(!(e.callee.type===z.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==z.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==z.AST_NODE_TYPES.ObjectPattern||!gt(e.parent.id.properties,o=>o.type===z.AST_NODE_TYPES.Property&&o.key.type===z.AST_NODE_TYPES.Identifier&&o.key.name==="formFields"&&o))return null;let s=gn(e.parent,"formFields",t),a=new Set;for(let{identifier:o}of s){if(o.type!==z.AST_NODE_TYPES.Identifier||o.parent.type===z.AST_NODE_TYPES.Property&&o.parent.parent.type===z.AST_NODE_TYPES.ObjectExpression&&o.parent.parent.parent.type===z.AST_NODE_TYPES.ReturnStatement||o.parent.type===z.AST_NODE_TYPES.ReturnStatement)return null;if(o.parent.type===z.AST_NODE_TYPES.MemberExpression){if(o.parent.object.type!==z.AST_NODE_TYPES.Identifier||o.parent.property.type!==z.AST_NODE_TYPES.Identifier)return null;a.add(o.parent.property.name)}}return a}function hi(e){if(e.body.type===z.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===z.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===z.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==z.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var $=require("@typescript-eslint/utils");var Ei=$.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function wn(e){let t=[];for(let r of e.members)r.type===$.AST_NODE_TYPES.TSPropertySignature&&r.key.type===$.AST_NODE_TYPES.Identifier&&t.push([r.key.name,r]);return t}function In(e,...t){for(let r of t)e.set(...r);return e}var bi=H({forceCheckOnFCPropTypesWithName:_(K(V()))}),Cn="no-unused-type-props-in-args",Rt=null,xi=Ei({name:Cn,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:[bi],fixable:"code"},defaultOptions:[{}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r}=t;r&&!Rt&&(Rt=r.map(i=>new RegExp(i)));function n(i,l,c,p,u=!0){let g=c.name,S=e.sourceCode.getScope(l).references.find(v=>v.identifier.name===g)?.resolved,x=i&&Rt?.some(v=>v.test(g));if(!S||!x&&S.references.filter(v=>v.isTypeReference).length>1)return;let b=S?.defs[0]?.node;if(!(u&&b?.parent?.type===$.AST_NODE_TYPES.ExportNamedDeclaration)){if(b?.type===$.AST_NODE_TYPES.TSTypeAliasDeclaration){s(i,l,p,b.typeAnnotation,!0);return}if(b?.type===$.AST_NODE_TYPES.TSInterfaceDeclaration){s(i,l,p,b.body,!0);return}}}function s(i,l,c,p,u){if(p.type===$.AST_NODE_TYPES.TSInterfaceBody){for(let g of p.body)g.type===$.AST_NODE_TYPES.TSPropertySignature&&g.key.type===$.AST_NODE_TYPES.Identifier&&c.set(g.key.name,g);return}if(p.type===$.AST_NODE_TYPES.TSTypeLiteral){In(c,...wn(p));return}if(p.type===$.AST_NODE_TYPES.TSIntersectionType){for(let g of p.types)s(i,l,c,g,!0);return}u||p.type===$.AST_NODE_TYPES.TSTypeReference&&p.typeName.type===$.AST_NODE_TYPES.Identifier&&n(i,l,p.typeName,c)}function a(i,l,c){for(let p of c)if(p.type==="ObjectPattern"&&p.typeAnnotation){let u=new Map;if(s(i,l,u,p.typeAnnotation.typeAnnotation,!1),u.size===0)continue;o(p,u)}else p.type===$.AST_NODE_TYPES.AssignmentPattern&&p.left.type===$.AST_NODE_TYPES.ObjectPattern&&a(i,l,[p.left])}function o(i,l){let c=[];if(i.properties.at(-1)?.type===$.AST_NODE_TYPES.RestElement)return;for(let S of i.properties)S.type===$.AST_NODE_TYPES.Property&&S.key.type===$.AST_NODE_TYPES.Identifier&&c.push(S.key.name);let u=[],g=[];for(let[S,x]of l)c.includes(S)||(g.push(S),u.push({node:x,messageId:"unusedObjectTypeProperty",data:{propertyName:S}}));for(let[S,x]of u.entries())e.report({...x,fix:S===u.length-1?b=>{let v=i.properties.at(-1),w=g.join(", ");return v?v?.type===$.AST_NODE_TYPES.RestElement?null:b.insertTextAfter(v,`, ${w}`):b.insertTextBeforeRange([i.range[0]+1,i.range[1]],`${w}`)}:void 0})}return{VariableDeclaration(i){let l=i.declarations[0];if(!l)return;let c=new Map,p=l.id.type===$.AST_NODE_TYPES.Identifier&&l.id.typeAnnotation?.typeAnnotation.type===$.AST_NODE_TYPES.TSTypeReference&&l.id.typeAnnotation.typeAnnotation.typeName.type===$.AST_NODE_TYPES.Identifier&&l.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&l.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(p){if(p.type===$.AST_NODE_TYPES.TSTypeReference&&p.typeName.type===$.AST_NODE_TYPES.Identifier)n(!0,i,p.typeName,c,!1);else if(p.type===$.AST_NODE_TYPES.TSTypeLiteral)In(c,...wn(p));else if(p.type===$.AST_NODE_TYPES.TSIntersectionType)for(let u of p.types)u.type===$.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===$.AST_NODE_TYPES.Identifier?n(!0,i,u.typeName,c,!1):s(!0,i,c,u,!0);if(c.size!==0&&l.init?.type===$.AST_NODE_TYPES.ArrowFunctionExpression){let u=l.init.params[0];if(!u){e.report({node:l.init,messageId:"missingComponentParam"});return}u.type===$.AST_NODE_TYPES.ObjectPattern&&o(u,c)}}},FunctionDeclaration:function(i){a(!1,i,i.params)},ArrowFunctionExpression(i){a(!1,i,i.params)}}}}),vt={name:Cn,rule:xi};var ae=require("@typescript-eslint/utils");var kt=G({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let t=new Set;function r(n){return n.callee.type===ae.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===ae.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===ae.AST_NODE_TYPES.Identifier&&n.callee.property.type===ae.AST_NODE_TYPES.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let s of n.specifiers)s.type===ae.AST_NODE_TYPES.ImportSpecifier&&s.imported.type===ae.AST_NODE_TYPES.Identifier&&s.imported.name==="useRef"&&t.add(s.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===ae.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===ae.AST_NODE_TYPES.Identifier){let a=e.sourceCode.getScope(n).set.get(n.id.name);if(a){let o=!1;for(let i of a.references){let c=i.identifier.parent;if(c!==n&&!(c.type===ae.AST_NODE_TYPES.JSXExpressionContainer&&c.parent.type===ae.AST_NODE_TYPES.JSXAttribute&&c.parent.name.type===ae.AST_NODE_TYPES.JSXIdentifier&&c.parent.name.name==="ref")){o=!0;break}}o||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var Fe=require("@typescript-eslint/utils"),wi=Fe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Rn="prefer-named-functions",An=new Map,Ii=wi({name:Rn,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[t]){let r=null;if(t.ignoreRegex){let n=An.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),An.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===Fe.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===Fe.AST_NODE_TYPES.Identifier){let s=n.id.name;if(n.id.typeAnnotation||r&&r.test(s)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==Fe.AST_NODE_TYPES.BlockStatement)return;let a=n.parent,o=n.init.params,i=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:s,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:c=>c.replaceText(a,`${l.async?"async ":""}function ${s}(${o.map(p=>e.sourceCode.getText(p)).join(", ")||""}) ${e.sourceCode.getText(i)}`)}]})}}}}}),Ot={name:Rn,rule:Ii};var N=require("@typescript-eslint/utils");var Ci=H({disallowedFunctions:K(H({name:V(),allowUsingWithArgs:_(ve()),hookAlternative:_(V()),message:_(V()),allowUseInside:_(K(V()))}))});function qe(e){return/^use[A-Z]/.test(e)}function vn(e){return/^[A-Z]/.test(e)}function Ai(e){return e.type===N.AST_NODE_TYPES.Identifier?qe(e.name):e.type===N.AST_NODE_TYPES.MemberExpression&&e.property.type===N.AST_NODE_TYPES.Identifier?qe(e.property.name):!1}function kn(e,t){return e.type===N.AST_NODE_TYPES.Identifier?e.name===t:e.type===N.AST_NODE_TYPES.MemberExpression&&e.object.type===N.AST_NODE_TYPES.Identifier&&e.property.type===N.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function On(e){return!!(e.parent&&e.parent.type===N.AST_NODE_TYPES.CallExpression&&kn(e.parent.callee,"forwardRef"))}function Pn(e){return!!(e.parent&&e.parent.type===N.AST_NODE_TYPES.CallExpression&&kn(e.parent.callee,"memo"))}function Pt(e){if(e.type===N.AST_NODE_TYPES.FunctionDeclaration||e.type===N.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===N.AST_NODE_TYPES.FunctionExpression||e.type===N.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===N.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===N.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===N.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===N.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Ri(e){let t=e.parent,r=!1;for(;t;){if(t.type===N.AST_NODE_TYPES.FunctionDeclaration||t.type===N.AST_NODE_TYPES.FunctionExpression||t.type===N.AST_NODE_TYPES.ArrowFunctionExpression){let n=Pt(t);if(n&&n.type===N.AST_NODE_TYPES.Identifier){if(vn(n.name)||qe(n.name))return!r;r=!0}else{if(On(t)||Pn(t))return!r;if(t.parent.type===N.AST_NODE_TYPES.CallExpression){let s=t.parent;Ai(s.callee)||(r=!0)}else t.parent.type===N.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Fn(e){return e.callee.type===N.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===N.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===N.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function vi(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===N.AST_NODE_TYPES.FunctionDeclaration||r.type===N.AST_NODE_TYPES.FunctionExpression||r.type===N.AST_NODE_TYPES.ArrowFunctionExpression){let n=Pt(r);if(n&&n.type===N.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===N.AST_NODE_TYPES.CallExpression){let n=Fn(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function ki(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===N.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function Oi(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===N.AST_NODE_TYPES.FunctionDeclaration||n.type===N.AST_NODE_TYPES.FunctionExpression||n.type===N.AST_NODE_TYPES.ArrowFunctionExpression){let s=Pt(n);if(s&&s.type===N.AST_NODE_TYPES.Identifier){if(vn(s.name)||qe(s.name)){r=!0;break}}else if(On(n)||Pn(n)){r=!0;break}}n=n.parent}return r?t.length===0?Ri(e):!vi(e,t):!1}var Ft=G({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:[Ci],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(s=>[s.name,s]));return{CallExpression(s){let a=Fn(s);if(!a)return;let o=n.get(a);if(!o||o.allowUsingWithArgs&&ki(s))return;let i=o.allowUseInside||[];Oi(s,i)&&e.report({node:s,messageId:"preferHookAlternative",data:{message:o.message?` ${o.message}`:` use ${o.hookAlternative} instead`},suggest:o.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${o.hookAlternative}`,hookAlternative:o.hookAlternative},fix:l=>{let c=o.hookAlternative;return s.callee.type===N.AST_NODE_TYPES.Identifier?l.replaceText(s.callee,c):s.callee.type===N.AST_NODE_TYPES.MemberExpression&&s.callee.property.type===N.AST_NODE_TYPES.Identifier?l.replaceText(s.callee.property,c):null}}]:[]})}}}});var J=require("@typescript-eslint/utils");var Pi=J.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Dn="prefer-single-line-if",Fi=H({maxLineLength:_(ue()),maxNonSimpleConditionLength:_(ue())}),Ni=Pi({name:Dn,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:[Fi]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==J.AST_NODE_TYPES.BlockStatement||n.loc.start.line===n.loc.end.line||r.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let a=n.consequent.body[0];if(a.type===J.AST_NODE_TYPES.ReturnStatement){if(!Ln(a))return}else if(!(a.type===J.AST_NODE_TYPES.ContinueStatement||a.type===J.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===J.AST_NODE_TYPES.LogicalExpression||n.test.type===J.AST_NODE_TYPES.ConditionalExpression)return;let o;if(t.maxNonSimpleConditionLength){let u=Nn(n.test);if(!u&&n.test.type===J.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let g=n.test.argument;Nn(g)&&(u=!0)}if(u&&(o=r.getText(n.test),o.length>t.maxNonSimpleConditionLength))return}o||(o=r.getText(n.test));let i=r.getText(a);if(o.includes(`
16
+ `))return;let l=r.getTokenAfter(n);if(l&&l.type===J.AST_TOKEN_TYPES.Punctuator&&l.value==="}"){let u=r.getTokenAfter(l);if(u&&u.type===J.AST_TOKEN_TYPES.Keyword&&(u.value==="else"||u.value==="catch"))return}let c=Di(r,n),p=`if (${o}) ${i}`;t.maxLineLength&&p.length+c.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:u=>u.replaceText(n,p)})}}}});function Nn(e){return e.type===J.AST_NODE_TYPES.CallExpression||e.type===J.AST_NODE_TYPES.BinaryExpression||e.type===J.AST_NODE_TYPES.MemberExpression&&jn(e)}function jn(e){return e.object.type===J.AST_NODE_TYPES.MemberExpression?jn(e.object):e.object.type!==J.AST_NODE_TYPES.Identifier}function Di(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Ln(e){if(!e.argument)return!0;let t=e.argument;return t.type===J.AST_NODE_TYPES.ArrayExpression&&t.elements.length===0||t.type===J.AST_NODE_TYPES.ObjectExpression&&t.properties.length===0||t.type===J.AST_NODE_TYPES.Literal||t.type===J.AST_NODE_TYPES.Identifier||t.type===J.AST_NODE_TYPES.TemplateLiteral||t.type===J.AST_NODE_TYPES.TaggedTemplateExpression?!0:t.type===J.AST_NODE_TYPES.CallExpression?t.arguments.length===0:t.type===J.AST_NODE_TYPES.UnaryExpression?Ln(t):!1}var Nt={name:Dn,rule:Ni};var ne=require("@typescript-eslint/utils");var ji=ne.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mn="react-compiler-migration",Li=H({disallowHooks:_(K(H({name:V(),replacement:V()}))),disallowMethods:_(K(H({name:V(),replacement:_(V()),requireTrueProp:_(V())})))}),Mi=/eslint +react-compiler\/react-compiler: +\["error/;function _i(e){return e.type===ne.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===ne.AST_NODE_TYPES.MemberExpression&&e.property.type===ne.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var $i=ji({name:Mn,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:[Li]},defaultOptions:[{}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(Mi.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let s=null,a=null;if(n.callee.type===ne.AST_NODE_TYPES.Identifier?(s=n.callee.name,a=n.callee):n.callee.type===ne.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===ne.AST_NODE_TYPES.Identifier&&(s=n.callee.property.name,a=n.callee.property),s){let o=t.disallowHooks.find(i=>i.name===s);o&&a&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:o.name,replacement:o.replacement},suggest:[{messageId:"replace",data:{replacement:o.replacement},fix:i=>i.replaceText(a,o.replacement)}]})}}if(t.disallowMethods?.length&&_i(n.callee)){for(let s of n.arguments)if(s.type===ne.AST_NODE_TYPES.ObjectExpression){for(let a of s.properties)if(a.type===ne.AST_NODE_TYPES.Property&&a.key.type===ne.AST_NODE_TYPES.Identifier){let o=a.key.name,i=t.disallowMethods.find(l=>l.name===o);if(i){if(i.requireTrueProp){let l=i.requireTrueProp,c=!1;for(let p of s.properties)if(p.type===ne.AST_NODE_TYPES.Property&&p.key.type===ne.AST_NODE_TYPES.Identifier&&p.key.name===l&&p.value.type===ne.AST_NODE_TYPES.Literal&&p.value.value===!0){c=!0;break}if(!c){e.report({node:a,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:i.name,requireTrueProp:l}});continue}}i.replacement&&e.report({node:a,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:l=>l.replaceText(a.key,i.replacement)}]})}}}}}}:{}}}),Dt={name:Mn,rule:$i};var Be=require("@typescript-eslint/utils"),Ui=Be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_n="require-description",Wi=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Vi=/^eslint-disable-(next-)?line$/u,Hi=Ui({name:_n,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let s of r.getAllComments()){let a=zi(s);a!=null&&(n.has(a.kind)||a.description||e.report({loc:Ji(s.loc),messageId:"missingDescription"}))}}}}}),$n={name:_n,rule:Hi};function zi(e){let{text:t,description:r}=Yi(e.value);if(!t)return null;let n=Wi.exec(t);if(!n)return null;let s=n[1];if(!s)return null;let a=Vi.test(s);if(e.type===Be.TSESTree.AST_TOKEN_TYPES.Line&&!a||a&&e.loc.start.line!==e.loc.end.line)return null;let o=t.slice(n.index+s.length);return{kind:s,value:o.trim(),description:r}}function Yi(e){let t=e.split(/\s-{2,}\s/u);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Ji(e){return{start:{line:e.start.line,column:-1},end:e.end}}var Xe=require("@typescript-eslint/utils"),Ie=require("zod/v4");var qi=Ie.z.object({varsToCheck:Ie.z.array(Ie.z.object({selector:Ie.z.string(),prop:Ie.z.string(),errorMsg:Ie.z.string().optional()}))}),jt=G({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require variables from specific function calls to be used (any usage counts as potentially accessing required properties)"},messages:{propNotRead:'Variable "{{varName}}" is never used. {{customMsg}}'},schema:[ke(qi)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map,n={};for(let s of t.varsToCheck)n[s.selector]=a=>{a.type===Xe.AST_NODE_TYPES.VariableDeclarator&&a.id.type===Xe.AST_NODE_TYPES.Identifier&&r.set(a.id.name,{prop:s.prop,errorMsg:s.errorMsg,node:a.id})};return{...n,"Program:exit"(){for(let[s,{prop:a,errorMsg:o,node:i}]of r){let c=e.sourceCode.getScope(i).set.get(s);if(c){let p=!1;for(let u of c.references){let g=u.identifier,S=g.parent;if(!(S.type===Xe.AST_NODE_TYPES.VariableDeclarator&&S.id===g)){p=!0;break}}p||e.report({node:i,messageId:"propNotRead",data:{prop:a,varName:s,customMsg:o||""}})}}}}}});function Vn(e){return/^use[A-Z0-9]/.test(e)}function Ge(e){return e.type==="Identifier"?Vn(e.name):e.type==="MemberExpression"&&!e.computed&&Ge(e.property)?e.object.type==="Identifier":!1}function Hn(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function zn(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Yn(e){return!!(e.parent&&e.parent.callee&&zn(e.parent.callee,"forwardRef"))}function Jn(e){return!!(e.parent&&e.parent.callee&&zn(e.parent.callee,"memo"))}function Lt(e){for(;e;){let t=Bn(e);if(t&&(Hn(t)||Ge(t))||Yn(e)||Jn(e))return!0;e=e.parent}return!1}function Un(e){return!1}function Mt(e){return!1}var Bi=/eslint +react-compiler\/react-compiler: +\["error/,qn={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let l of e.sourceCode.getAllComments())if(Bi.test(l.value))return{CallExpression(c){let p=null;c.callee.name==="useMemo"?p="useMemo":c.callee.name==="useCallback"&&(p="useCallback"),p&&e.report({node:c,message:`"${p}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?l=>t(l):l=>e.sourceCode.getText(l),r=typeof e.getScope=="function"?()=>r():l=>e.sourceCode.getScope(l),n=null,s=[],a=[],o=new WeakSet;function i(l){for(let c of l.references){let p=c.identifier.parent;if(p.type==="VariableDeclarator"&&p.init&&p.init.type==="CallExpression"&&p.init.callee&&Un(p.init.callee))for(let u of c.resolved.references)u!==c&&o.add(u.identifier)}}return{onCodePathSegmentStart:l=>a.push(l),onCodePathSegmentEnd:()=>a.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(l,c){let p=s.pop();if(p.size===0)return;let u=new Set;function g(T,m){let{cache:y}=g,A=y.get(T.id),C=new Set(m);if(C.has(T.id)){let E=[...C],F=E.slice(E.indexOf(T.id)+1);for(let Y of F)u.add(Y);return BigInt("0")}if(C.add(T.id),A!==void 0)return A;if(l.thrownSegments.includes(T))A=BigInt("0");else if(T.prevSegments.length===0)A=BigInt("1");else{A=BigInt("0");for(let E of T.prevSegments)A+=g(E,C)}return T.reachable&&A===BigInt("0")?y.delete(T.id):y.set(T.id,A),A}function S(T,m){let{cache:y}=S,A=y.get(T.id),C=new Set(m);if(C.has(T.id)){let E=Array.from(C),F=E.slice(E.indexOf(T.id)+1);for(let Y of F)u.add(Y);return BigInt("0")}if(C.add(T.id),A!==void 0)return A;if(l.thrownSegments.includes(T))A=BigInt("0");else if(T.nextSegments.length===0)A=BigInt("1");else{A=BigInt("0");for(let E of T.nextSegments)A+=S(E,C)}return y.set(T.id,A),A}function x(T){let{cache:m}=x,y=m.get(T.id);if(y===null)return 1/0;if(y!==void 0)return y;if(m.set(T.id,null),T.prevSegments.length===0)y=1;else{y=1/0;for(let A of T.prevSegments){let C=x(A);C<y&&(y=C)}y+=1}return m.set(T.id,y),y}g.cache=new Map,S.cache=new Map,x.cache=new Map;let b=S(l.initialSegment),v=Bn(c),w=Lt(c),L=v?Hn(v)||Ge(v):Yn(c)||Jn(c),P=1/0;for(let T of l.finalSegments){if(!T.reachable)continue;let m=x(T);m<P&&(P=m)}for(let[T,m]of p){if(!T.reachable)continue;let y=T.nextSegments.length===0?P<=x(T):P<x(T),A=g(T)*S(T),C=u.has(T.id);for(let E of m)if(C&&!Mt(E)&&e.report({node:E,message:`React Hook "${t(E)}" 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.`}),L){if(c.async&&e.report({node:E,message:`React Hook "${t(E)}" cannot be called in an async function.`}),!C&&A!==b&&!Mt(E)){let Y=`React Hook "${t(E)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(y?" Did you accidentally call a React Hook after an early return?":"");e.report({node:E,message:Y})}}else if(c.parent&&(c.parent.type==="MethodDefinition"||c.parent.type==="ClassProperty")&&c.parent.value===c){let F=`React Hook "${t(E)}" 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:E,message:F})}else if(v){let F=`React Hook "${t(E)}" is called in function "${t(v)}" 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:E,message:F})}else if(c.type==="Program"){let F=`React Hook "${t(E)}" 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:E,message:F})}else if(w&&!Mt(E)){if(c.parent.type==="CallExpression"&&c.parent.callee.type==="Identifier"&&c.parent.callee.name==="useCallback"){let Y=c.parent;if(Y.parent.type==="VariableDeclarator"&&Vn(Y.parent.id.name))return}let F=`React Hook "${t(E)}" 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:E,message:F})}}},CallExpression(l){if(Ge(l.callee)){let c=Wn(s),p=Wn(a),u=c.get(p);u||(u=[],c.set(p,u)),u.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||Un(l.callee))&&l.arguments.length>0&&(n=l)},Identifier(l){n==null&&o.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${t(l)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(l){l===n&&(n=null)},FunctionDeclaration(l){Lt(l)&&i(r(l))},ArrowFunctionExpression(l){Lt(l)&&i(r(l))}}}};function Bn(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 Wn(e){return e[e.length-1]}var _t=require("@typescript-eslint/utils");function Xi(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function Gi(e){let t=e.parent;return t?.type===_t.AST_NODE_TYPES.NewExpression&&t.callee.type===_t.AST_NODE_TYPES.Identifier&&t.callee.name==="RegExp"}var $t=G({name:"use-top-level-regex",meta:{type:"suggestion",docs:{description:"Require regex literals to be declared at the top level to avoid performance issues"},messages:{regexShouldBeTopLevel:"Move this regex literal to the top level to avoid creating new RegExp objects on each function call."},schema:[],hasSuggestions:!1},defaultOptions:[],create(e){function t(r){Xi(r)||Gi(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var Xn={[vt.name]:vt.rule,[pt.name]:pt.rule,[ct.name]:ct.rule,"rules-of-hooks":qn,"exhaustive-deps":en,"require-description":$n.rule,[ut.name]:ut.rule,[mt.name]:mt.rule,[Ot.name]:Ot.rule,[tt.name]:tt.rule,[lt.name]:lt.rule,[Tt.name]:Tt.rule,[Nt.name]:Nt.rule,[St.name]:St.rule,[ft.name]:ft.rule,[rt.name]:rt.rule,[Dt.name]:Dt.rule,[et.name]:et.rule,[at.name]:at.rule,[xt.name]:xt.rule,[wt.name]:wt.rule,[Ct.name]:Ct.rule,[At.name]:At.rule,[It.name]:It.rule,[Ft.name]:Ft.rule,[Et.name]:Et.rule,[ht.name]:ht.rule,[$t.name]:$t.rule,[kt.name]:kt.rule,[jt.name]:jt.rule};var Ki={rules:Xn};0&&(module.exports={extendedLintPlugin});
@@ -1,7 +1,7 @@
1
- import{AST_NODE_TYPES as G,ESLintUtils as Un}from"@typescript-eslint/utils";var Ve=Symbol.for("optional");function _(e){return{...e,[Ve]:!0}}function Ot(e,t){return{enum:e,...t}}function Ee(e){return{...e,type:"boolean"}}function z(e){return{...e,type:"string"}}function pe(e){return{...e,type:"number"}}function X(e,t){return{...t,type:"array",items:e}}function U(e,t){let r={...t,type:"object",properties:e};if(e&&(r.additionalProperties||=!1,!r.required)){let n,o=[];for(n in e)e[n][Ve]?e[n][Ve]=void 0:o.push(n);o.length>0&&(r.required=o)}return r}var Wn=Un.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ft="react-compiler-extra",Vn=U({runOnlyWithEnableCompilerDirective:_(Ee())}),Hn=/eslint +react-compiler\/react-compiler: +\["error/;function Yn(e){return e.type===G.Identifier?e.name.startsWith("use"):e.type===G.MemberExpression&&e.property.type===G.Identifier?e.property.name.startsWith("use"):!1}var Jn=/\bthis[.[]/;function Pt(e){return Jn.test(e)}var Bn=Wn({name:Ft,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:[Vn]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let a of e.sourceCode.getAllComments())if(Hn.test(a.value)){r=!0;break}if(!r)return{}}function n(a){for(let s of a.properties)if(s.type===G.Property&&s.method&&s.value.type===G.FunctionExpression){let i=e.sourceCode,l=i.getText(s.key),c=s.value,p=i.getText(c.body);if(Pt(p))e.report({node:s,messageId:"thisKeywordInMethod"});else{let u=c.params.map(h=>i.getText(h)).join(", "),g="";c.generator?g=`${l}: function* (${u}) ${p}`:g=`${l}: (${u}) => ${p}`,e.report({node:s,messageId:"objectMethodIsNotSupported",fix:h=>h.replaceText(s,g)})}}}function o(a){for(let s of a.properties)if(s.type===G.Property&&s.value.type===G.ObjectExpression){for(let i of s.value.properties)if(i.type===G.Property&&i.method&&i.value.type===G.FunctionExpression){let c=e.sourceCode.getText(i.value.body);Pt(c)&&e.report({node:i,messageId:"thisKeywordInMethod"})}}}return{CallExpression(a){if(Yn(a.callee))for(let s of a.arguments){if(s.type===G.ObjectExpression&&(n(s),o(s)),s.type===G.ArrowFunctionExpression&&(s.body.type===G.ObjectExpression&&(n(s.body),o(s.body)),s.body.type===G.BlockStatement))for(let i of s.body.body)i.type===G.ReturnStatement&&i.argument?.type===G.ObjectExpression&&(n(i.argument),o(i.argument));if(s.type===G.FunctionExpression)for(let i of s.body.body)i.type===G.ReturnStatement&&i.argument?.type===G.ObjectExpression&&(n(i.argument),o(i.argument))}}}}}),He={name:Ft,rule:Bn};import{AST_NODE_TYPES as Z}from"@typescript-eslint/utils";import*as S from"zod/v4";import{ESLintUtils as qn}from"@typescript-eslint/utils";import*as Nt from"zod/v4";function ne(e){let r=qn.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function Pe(e){return Nt.toJSONSchema(e)}var Xn=S.object({disallow:S.array(S.object({selector:S.string(),message:S.string(),replace:S.optional(S.union([S.string(),S.object({regex:S.string(),with:S.string()})])),replaceType:S.optional(S.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:S.optional(S.array(S.object({fn:S.string(),withArgs:S.optional(S.array(S.object({atIndex:S.number(),value:S.union([S.string(),S.number(),S.boolean()])}))),message:S.string(),replaceWith:S.optional(S.string()),ignoreRegex:S.optional(S.string())}))),__dev_simulateFileName:S.optional(S.string()),mustMatchSyntax:S.optional(S.array(S.object({includeRegex:S.string(),mustCallFn:S.optional(S.array(S.object({anyCall:S.array(S.object({fn:S.string(),withArgs:S.array(S.object({atIndex:S.number(),literal:S.union([S.string(),S.number(),S.boolean()])}))})),message:S.optional(S.string())}))),mustMatchSelector:S.optional(S.array(S.object({selector:S.string(),message:S.string()}))),mustHaveExport:S.optional(S.array(S.object({name:S.string(),type:S.enum(["function","variable","any"]).default("any"),message:S.string()})))})))}),Ye=ne({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[Pe(Xn)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:a,disallowFnCalls:s}=t,i=o??e.filename,l=[],c=new Map,p=new Set,u=new Map,g=new Set,h=new Map;function x(m){for(let y of m.specifiers)y.type===Z.ImportSpecifier&&y.imported.type===Z.Identifier&&y.imported.name!==y.local.name&&h.set(y.local.name,y.imported.name)}function b(m){if(m.declaration){if(m.declaration.type===Z.FunctionDeclaration&&m.declaration.id){let y=m.declaration.id.name;for(let A of Array.from(g)){let[I,E]=A.split(":");I===y&&(E==="function"||E==="any")&&g.delete(A)}}else if(m.declaration.type===Z.VariableDeclaration){for(let y of m.declaration.declarations)if(y.id.type===Z.Identifier){let A=y.id.name;for(let I of Array.from(g)){let[E,F]=I.split(":");E===A&&(F==="variable"||F==="any")&&g.delete(I)}}}}for(let y of m.specifiers)if(y.exported.type===Z.Identifier){let A=y.exported.name;for(let I of Array.from(g)){let[E,F]=I.split(":");E===A&&F==="any"&&g.delete(I)}}}function k(m){m.id.type===Z.Identifier&&m.init?.type===Z.Identifier&&h.set(m.id.name,m.init.name)}function w(m){return h.get(m)??m}function M(m,y){return w(m)===y||m===y}for(let{includeRegex:m,mustCallFn:y,mustMatchSelector:A,mustHaveExport:I}of n??[]){let E=Gn(i,new RegExp(m));if(!E)continue;let F=H=>{let B=H;for(let{name:Q,value:K}of E)B=B.replaceAll(Q,K);return B};for(let{anyCall:H,message:B}of y??[]){let Q=`Expected file to call the function: ${H.map(({fn:K})=>K).join(" or ")}`;p.add(Q),l.push(K=>{let{callee:Te}=K;if(Te.type===Z.Identifier){for(let{fn:te,withArgs:Ce}of H)if(Te.name===te){p.delete(Q);for(let ue of Ce){let ce=K.arguments[ue.atIndex],fe=typeof ue.literal=="string"?F(ue.literal):ue.literal;if(!ce){e.report({node:K,messageId:"default",data:{message:`Missing argument with value "${fe}" at index ${ue.atIndex}${B?`: ${F(B)}`:""}`}});continue}if(ce.type!==Z.Literal){e.report({node:ce,messageId:"default",data:{message:`Argument at position ${ue.atIndex} should the literal "${fe}"${B?`: ${F(B)}`:""}`}});continue}ce.value!==fe&&e.report({node:ce,messageId:"default",data:{message:`Argument should have the value "${fe}"${B?`: ${F(B)}`:""}`},fix:he=>he.replaceText(ce,typeof fe=="string"?`'${fe}'`:String(fe))})}break}}})}for(let{selector:H,message:B}of A??[])u.set(H,F(B)),c.set(F(H),()=>{u.delete(H)});for(let{name:H,type:B,message:Q}of I??[]){let K=F(H),Te=F(Q);g.add(`${K}:${B}:${Te}`)}}for(let{fn:m,withArgs:y,message:A,replaceWith:I,ignoreRegex:E}of s??[])E&&new RegExp(E).test(i)||l.push(F=>{let{callee:H}=F;if(H.type!==Z.Identifier||!M(H.name,m))return;if(y)for(let Q of y){let K=F.arguments[Q.atIndex];if(!K){e.report({node:F,messageId:"default",data:{message:`Missing argument with value "${Q.value}" at index ${Q.atIndex}: ${A}`}});return}if(K.type!==Z.Literal||K.value!==Q.value)return}let B=Q=>I?Q.replaceText(F,I):null;e.report({node:F,messageId:"default",data:{message:A},suggest:I?[{messageId:"default",data:{message:`Replace with "${I}"`},fix:B}]:void 0})});function P(m,y){let A=r[m];A?r[m]=I=>{A(I),y(I)}:r[m]=y}for(let{selector:m,message:y,replace:A,replaceType:I="suggestion"}of a??[]){if(m==="CallExpression"){l.push(E=>{T(A,E,y,I)});continue}r[m]=E=>{T(A,E,y,I)}}if(c.size>0)for(let[m,y]of c)P(m,y);return l.length>0&&(r.CallExpression=m=>{if(m.type===Z.CallExpression)for(let y of l)y(m)}),r.ImportDeclaration=m=>{m.type===Z.ImportDeclaration&&x(m)},r.ExportNamedDeclaration=m=>{m.type===Z.ExportNamedDeclaration&&b(m)},r.VariableDeclarator=m=>{m.type===Z.VariableDeclarator&&k(m)},r["Program:exit"]=m=>{for(let y of p)e.report({node:m,messageId:"default",data:{message:y}});for(let[,y]of u)e.report({node:m,messageId:"default",data:{message:y}});for(let y of g){let[A,I,E]=y.split(":");e.report({node:m,messageId:"default",data:{message:`Missing required export "${A}" of type ${I}: ${E}`}})}},r;function T(m,y,A,I){let E=F=>{if(!m)return null;if(typeof m=="string")return F.replaceText(y,m);{let H=new RegExp(m.regex),B=e.sourceCode.getText(y);return F.replaceText(y,B.replace(H,m.with))}};e.report({node:y,messageId:"default",data:{message:A},fix:m&&I==="autofix"?E:void 0,suggest:m&&I==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof m=="string"?m:m.with}"`},fix:E}]:void 0})}}});function Gn(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...a]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:jt(o)}),r.push({name:"$0_uncapitalize",value:Dt(o)}),r.push({name:"$0",value:o});for(let s=0;s<a.length;s++){let i=`$${s+1}`,l=a[s];r.push({name:`${i}_lowercase`,value:l.toLowerCase()}),r.push({name:`${i}_capitalize`,value:jt(l)}),r.push({name:`${i}_uncapitalize`,value:Dt(l)}),r.push({name:i,value:l})}return r}function jt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Dt(e){return e.charAt(0).toLowerCase()+e.slice(1)}import{AST_NODE_TYPES as L,AST_TOKEN_TYPES as Mt,ESLintUtils as Kn}from"@typescript-eslint/utils";var Zn=Kn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Lt="collapse-simple-objs-in-one-line",Qn=U({maxLineLength:_(pe()),maxProperties:_(pe()),nestedObjMaxLineLength:_(pe()),nestedObjMaxProperties:_(pe()),ignoreTypesWithSuffix:_(X(z()))}),er=Zn({name:Lt,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:[Qn]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,a=t.nestedObjMaxLineLength??t.maxLineLength,s=t.nestedObjMaxProperties??3;function i(c){if(c.type===L.ObjectExpression){let p=c.parent.type===L.Property,u=p?s:o,g=c.properties.length;if(g>u)return!1;if(g===1){let x=c.properties[0];return x.type===L.Property&&x.value.type===L.ObjectExpression||x.type===L.Property&&x.value.type===L.ArrayExpression&&!x.value.elements.every(k=>k&&Je(k))?!1:{text:r.getText(x),isNested:p,propsSize:g}}let h=[];for(let x of c.properties){if(x.type===L.Property&&!Je(x.value))return!1;h.push(r.getText(x))}return{text:h.join(", "),isNested:p,propsSize:g}}else{let p=c.parent.parent?.type===L.TSPropertySignature,u=p?s:o,g=c.members.length;if(g>u)return!1;if(n.length>0&&c.parent.type===L.TSTypeAliasDeclaration){let x=c.parent.id.name;if(n.some(b=>x.endsWith(b)))return!1}if(g===1){let x=c.members[0];return x.type===L.TSPropertySignature&&x.typeAnnotation?.typeAnnotation.type===L.TSTypeLiteral?!1:{text:r.getText(x),isNested:p,propsSize:1}}if(c.parent.type===L.TSIntersectionType||c.parent.type===L.TSUnionType&&c.parent.types[0]!==c)return!1;let h=[];for(let x of c.members){if(x.type!==L.TSPropertySignature)return!1;let b=x.typeAnnotation?.typeAnnotation;if(!b||b.type===L.TSTypeLiteral||!_t(b))return!1;if(b.type===L.TSTypeReference&&b.typeArguments){if(b.typeArguments.params.length>1)return!1;let w=b.typeArguments.params[0];if(!_t(w))return!1}let k=r.getText(x).trim();(k.endsWith(";")||k.endsWith(","))&&(k=k.slice(0,-1)),h.push(k)}return{text:h.join("; "),isNested:p,propsSize:g}}}function l(c){if(c.loc.start.line===c.loc.end.line)return;if(c.parent.type!==L.JSXExpressionContainer){let b=0,k=!1,w=r.getTokenAfter(c,{filter:P=>P.type!==Mt.Punctuator||k?!0:P.value===","?(b++,!1):P.value===";"?(b++,k=!0,!1):P.value===")"||P.value==="}"?(b++,!1):!0});if(b>4)return;let M=w?.type===Mt.Template&&w.value.startsWith(`}
2
- `);if(w?.loc.start.line===c.loc.end.line&&!M)return}let p=i(c);if(!p)return;let u=p.text;if(u.includes(`
3
- `)||r.getCommentsInside(c).length>0)return;u.endsWith(";")&&(u=u.slice(0,-1));let g=`{ ${u} }`,h=nr(r,c),x=p.isNested&&p.propsSize>2?a:t.maxLineLength;x&&g.length+h.length+tr(c,r)>x||e.report({node:c,messageId:"singleLineProp",fix:b=>b.replaceText(c,g)})}return{TSTypeLiteral:l,ObjectExpression:l}}});function _t(e){return e.type===L.TSLiteralType||e.type===L.TSTypeReference||e.type===L.TSNumberKeyword||e.type===L.TSStringKeyword||e.type===L.TSBooleanKeyword||e.type===L.TSNullKeyword||e.type===L.TSUndefinedKeyword}function Je(e,t){return!!(e.type===L.Literal||e.type===L.Identifier||e.type===L.TemplateLiteral||e.type===L.TaggedTemplateExpression||!t&&e.type===L.ArrayExpression&&e.elements.every(r=>r&&Je(r,!0)))}function tr(e,t){let r=t.getLastToken(e);if(!r)return 0;let n=t.text.indexOf(`
4
- `,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function nr(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var Be={name:Lt,rule:er};var rr=/eslint +react-compiler\/react-compiler: +\["error/,zt={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"}}}]},create(e){let t=!1,r=typeof e.getSource=="function"?w=>r(w):w=>e.sourceCode.getText(w),n=typeof e.getScope=="function"?()=>n():w=>e.sourceCode.getScope(w),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,a=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,s={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:a};function i(w){a&&Array.isArray(w.suggest)&&w.suggest.length>0&&(w.fix=w.suggest[0].fix),e.report(w)}let l=e.getSourceCode().scopeManager,c=new WeakMap,p=new WeakSet,u=new WeakMap,g=new WeakMap,h=new WeakSet;function x(w,M){return function(P){if(M.has(P))return M.get(P);let T=w(P);return M.set(P,T),T}}function b(w,M,P,T,m){m&&w.async&&i({node:w,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
1
+ import{AST_NODE_TYPES as K,ESLintUtils as Bn}from"@typescript-eslint/utils";var Ye=Symbol.for("optional");function M(e){return{...e,[Ye]:!0}}function Lt(e,t){return{enum:e,...t}}function be(e){return{...e,type:"boolean"}}function U(e){return{...e,type:"string"}}function ue(e){return{...e,type:"number"}}function G(e,t){return{...t,type:"array",items:e}}function W(e,t){let r={...t,type:"object",properties:e};if(e&&(r.additionalProperties||=!1,!r.required)){let n,o=[];for(n in e)e[n][Ye]?e[n][Ye]=void 0:o.push(n);o.length>0&&(r.required=o)}return r}var Xn=Bn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_t="react-compiler-extra",Gn=W({runOnlyWithEnableCompilerDirective:M(be())}),Kn=/eslint +react-compiler\/react-compiler: +\["error/;function Zn(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 Qn=/\bthis[.[]/;function Mt(e){return Qn.test(e)}var er=Xn({name:_t,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:[Gn]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let a of e.sourceCode.getAllComments())if(Kn.test(a.value)){r=!0;break}if(!r)return{}}function n(a){for(let s of a.properties)if(s.type===K.Property&&s.method&&s.value.type===K.FunctionExpression){let i=e.sourceCode,l=i.getText(s.key),c=s.value,p=i.getText(c.body);if(Mt(p))e.report({node:s,messageId:"thisKeywordInMethod"});else{let u=c.params.map(S=>i.getText(S)).join(", "),g="";c.generator?g=`${l}: function* (${u}) ${p}`:g=`${l}: (${u}) => ${p}`,e.report({node:s,messageId:"objectMethodIsNotSupported",fix:S=>S.replaceText(s,g)})}}}function o(a){for(let s of a.properties)if(s.type===K.Property&&s.value.type===K.ObjectExpression){for(let i of s.value.properties)if(i.type===K.Property&&i.method&&i.value.type===K.FunctionExpression){let c=e.sourceCode.getText(i.value.body);Mt(c)&&e.report({node:i,messageId:"thisKeywordInMethod"})}}}return{CallExpression(a){if(Zn(a.callee))for(let s of a.arguments){if(s.type===K.ObjectExpression&&(n(s),o(s)),s.type===K.ArrowFunctionExpression&&(s.body.type===K.ObjectExpression&&(n(s.body),o(s.body)),s.body.type===K.BlockStatement))for(let i of s.body.body)i.type===K.ReturnStatement&&i.argument?.type===K.ObjectExpression&&(n(i.argument),o(i.argument));if(s.type===K.FunctionExpression)for(let i of s.body.body)i.type===K.ReturnStatement&&i.argument?.type===K.ObjectExpression&&(n(i.argument),o(i.argument))}}}}}),Je={name:_t,rule:er};import{AST_NODE_TYPES as Q}from"@typescript-eslint/utils";import{z as h}from"zod/v4";import{ESLintUtils as tr}from"@typescript-eslint/utils";import*as $t from"zod/v4";function B(e){let r=tr.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function xe(e){return $t.toJSONSchema(e)}var nr=h.object({disallow:h.array(h.object({selector:h.string(),message:h.string(),replace:h.optional(h.union([h.string(),h.object({regex:h.string(),with:h.string()})])),replaceType:h.optional(h.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:h.optional(h.array(h.object({fn:h.string(),withArgs:h.optional(h.array(h.object({atIndex:h.number(),value:h.union([h.string(),h.number(),h.boolean()])}))),message:h.string(),replaceWith:h.optional(h.string()),ignoreRegex:h.optional(h.string())}))),__dev_simulateFileName:h.optional(h.string()),mustMatchSyntax:h.optional(h.array(h.object({includeRegex:h.string(),mustCallFn:h.optional(h.array(h.object({anyCall:h.array(h.object({fn:h.string(),withArgs:h.array(h.object({atIndex:h.number(),literal:h.union([h.string(),h.number(),h.boolean()])}))})),message:h.optional(h.string())}))),mustMatchSelector:h.optional(h.array(h.object({selector:h.string(),message:h.string()}))),mustHaveExport:h.optional(h.array(h.object({name:h.string(),type:h.enum(["function","variable","any"]).default("any"),message:h.string()})))})))}),qe=B({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[xe(nr)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:a,disallowFnCalls:s}=t,i=o??e.filename,l=[],c=new Map,p=new Set,u=new Map,g=new Set,S=new Map;function x(m){for(let y of m.specifiers)y.type===Q.ImportSpecifier&&y.imported.type===Q.Identifier&&y.imported.name!==y.local.name&&S.set(y.local.name,y.imported.name)}function b(m){if(m.declaration){if(m.declaration.type===Q.FunctionDeclaration&&m.declaration.id){let y=m.declaration.id.name;for(let A of Array.from(g)){let[C,E]=A.split(":");C===y&&(E==="function"||E==="any")&&g.delete(A)}}else if(m.declaration.type===Q.VariableDeclaration){for(let y of m.declaration.declarations)if(y.id.type===Q.Identifier){let A=y.id.name;for(let C of Array.from(g)){let[E,F]=C.split(":");E===A&&(F==="variable"||F==="any")&&g.delete(C)}}}}for(let y of m.specifiers)if(y.exported.type===Q.Identifier){let A=y.exported.name;for(let C of Array.from(g)){let[E,F]=C.split(":");E===A&&F==="any"&&g.delete(C)}}}function v(m){m.id.type===Q.Identifier&&m.init?.type===Q.Identifier&&S.set(m.id.name,m.init.name)}function w(m){return S.get(m)??m}function L(m,y){return w(m)===y||m===y}for(let{includeRegex:m,mustCallFn:y,mustMatchSelector:A,mustHaveExport:C}of n??[]){let E=rr(i,new RegExp(m));if(!E)continue;let F=z=>{let q=z;for(let{name:ee,value:Z}of E)q=q.replaceAll(ee,Z);return q};for(let{anyCall:z,message:q}of y??[]){let ee=`Expected file to call the function: ${z.map(({fn:Z})=>Z).join(" or ")}`;p.add(ee),l.push(Z=>{let{callee:he}=Z;if(he.type===Q.Identifier){for(let{fn:ne,withArgs:Re}of z)if(he.name===ne){p.delete(ee);for(let fe of Re){let pe=Z.arguments[fe.atIndex],me=typeof fe.literal=="string"?F(fe.literal):fe.literal;if(!pe){e.report({node:Z,messageId:"default",data:{message:`Missing argument with value "${me}" at index ${fe.atIndex}${q?`: ${F(q)}`:""}`}});continue}if(pe.type!==Q.Literal){e.report({node:pe,messageId:"default",data:{message:`Argument at position ${fe.atIndex} should the literal "${me}"${q?`: ${F(q)}`:""}`}});continue}pe.value!==me&&e.report({node:pe,messageId:"default",data:{message:`Argument should have the value "${me}"${q?`: ${F(q)}`:""}`},fix:Ee=>Ee.replaceText(pe,typeof me=="string"?`'${me}'`:String(me))})}break}}})}for(let{selector:z,message:q}of A??[])u.set(z,F(q)),c.set(F(z),()=>{u.delete(z)});for(let{name:z,type:q,message:ee}of C??[]){let Z=F(z),he=F(ee);g.add(`${Z}:${q}:${he}`)}}for(let{fn:m,withArgs:y,message:A,replaceWith:C,ignoreRegex:E}of s??[])E&&new RegExp(E).test(i)||l.push(F=>{let{callee:z}=F;if(z.type!==Q.Identifier||!L(z.name,m))return;if(y)for(let ee of y){let Z=F.arguments[ee.atIndex];if(!Z){e.report({node:F,messageId:"default",data:{message:`Missing argument with value "${ee.value}" at index ${ee.atIndex}: ${A}`}});return}if(Z.type!==Q.Literal||Z.value!==ee.value)return}let q=ee=>C?ee.replaceText(F,C):null;e.report({node:F,messageId:"default",data:{message:A},suggest:C?[{messageId:"default",data:{message:`Replace with "${C}"`},fix:q}]:void 0})});function P(m,y){let A=r[m];A?r[m]=C=>{A(C),y(C)}:r[m]=y}for(let{selector:m,message:y,replace:A,replaceType:C="suggestion"}of a??[]){if(m==="CallExpression"){l.push(E=>{T(A,E,y,C)});continue}r[m]=E=>{T(A,E,y,C)}}if(c.size>0)for(let[m,y]of c)P(m,y);return l.length>0&&(r.CallExpression=m=>{if(m.type===Q.CallExpression)for(let y of l)y(m)}),r.ImportDeclaration=m=>{m.type===Q.ImportDeclaration&&x(m)},r.ExportNamedDeclaration=m=>{m.type===Q.ExportNamedDeclaration&&b(m)},r.VariableDeclarator=m=>{m.type===Q.VariableDeclarator&&v(m)},r["Program:exit"]=m=>{for(let y of p)e.report({node:m,messageId:"default",data:{message:y}});for(let[,y]of u)e.report({node:m,messageId:"default",data:{message:y}});for(let y of g){let[A,C,E]=y.split(":");e.report({node:m,messageId:"default",data:{message:`Missing required export "${A}" of type ${C}: ${E}`}})}},r;function T(m,y,A,C){let E=F=>{if(!m)return null;if(typeof m=="string")return F.replaceText(y,m);{let z=new RegExp(m.regex),q=e.sourceCode.getText(y);return F.replaceText(y,q.replace(z,m.with))}};e.report({node:y,messageId:"default",data:{message:A},fix:m&&C==="autofix"?E:void 0,suggest:m&&C==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof m=="string"?m:m.with}"`},fix:E}]:void 0})}}});function rr(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...a]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:Ut(o)}),r.push({name:"$0_uncapitalize",value:Wt(o)}),r.push({name:"$0",value:o});for(let s=0;s<a.length;s++){let i=`$${s+1}`,l=a[s];r.push({name:`${i}_lowercase`,value:l.toLowerCase()}),r.push({name:`${i}_capitalize`,value:Ut(l)}),r.push({name:`${i}_uncapitalize`,value:Wt(l)}),r.push({name:i,value:l})}return r}function Ut(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Wt(e){return e.charAt(0).toLowerCase()+e.slice(1)}import{AST_NODE_TYPES as _,AST_TOKEN_TYPES as Vt,ESLintUtils as ir}from"@typescript-eslint/utils";var sr=ir.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),zt="collapse-simple-objs-in-one-line",or=W({maxLineLength:M(ue()),maxProperties:M(ue()),nestedObjMaxLineLength:M(ue()),nestedObjMaxProperties:M(ue()),ignoreTypesWithSuffix:M(G(U()))}),ar=sr({name:zt,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:[or]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,a=t.nestedObjMaxLineLength??t.maxLineLength,s=t.nestedObjMaxProperties??3;function i(c){if(c.type===_.ObjectExpression){let p=c.parent.type===_.Property,u=p?s:o,g=c.properties.length;if(g>u)return!1;if(g===1){let x=c.properties[0];return x.type===_.Property&&x.value.type===_.ObjectExpression||x.type===_.Property&&x.value.type===_.ArrayExpression&&!x.value.elements.every(v=>v&&Be(v))?!1:{text:r.getText(x),isNested:p,propsSize:g}}let S=[];for(let x of c.properties){if(x.type===_.Property&&!Be(x.value))return!1;S.push(r.getText(x))}return{text:S.join(", "),isNested:p,propsSize:g}}else{let p=c.parent.parent?.type===_.TSPropertySignature,u=p?s:o,g=c.members.length;if(g>u)return!1;if(n.length>0&&c.parent.type===_.TSTypeAliasDeclaration){let x=c.parent.id.name;if(n.some(b=>x.endsWith(b)))return!1}if(g===1){let x=c.members[0];return x.type===_.TSPropertySignature&&x.typeAnnotation?.typeAnnotation.type===_.TSTypeLiteral?!1:{text:r.getText(x),isNested:p,propsSize:1}}if(c.parent.type===_.TSIntersectionType||c.parent.type===_.TSUnionType&&c.parent.types[0]!==c)return!1;let S=[];for(let x of c.members){if(x.type!==_.TSPropertySignature)return!1;let b=x.typeAnnotation?.typeAnnotation;if(!b||b.type===_.TSTypeLiteral||!Ht(b))return!1;if(b.type===_.TSTypeReference&&b.typeArguments){if(b.typeArguments.params.length>1)return!1;let w=b.typeArguments.params[0];if(!Ht(w))return!1}let v=r.getText(x).trim();(v.endsWith(";")||v.endsWith(","))&&(v=v.slice(0,-1)),S.push(v)}return{text:S.join("; "),isNested:p,propsSize:g}}}function l(c){if(c.loc.start.line===c.loc.end.line)return;if(c.parent.type!==_.JSXExpressionContainer){let b=0,v=!1,w=r.getTokenAfter(c,{filter:P=>P.type!==Vt.Punctuator||v?!0:P.value===","?(b++,!1):P.value===";"?(b++,v=!0,!1):P.value===")"||P.value==="}"?(b++,!1):!0});if(b>4)return;let L=w?.type===Vt.Template&&w.value.startsWith(`}
2
+ `);if(w?.loc.start.line===c.loc.end.line&&!L)return}let p=i(c);if(!p)return;let u=p.text;if(u.includes(`
3
+ `)||r.getCommentsInside(c).length>0)return;u.endsWith(";")&&(u=u.slice(0,-1));let g=`{ ${u} }`,S=cr(r,c),x=p.isNested&&p.propsSize>2?a:t.maxLineLength;x&&g.length+S.length+lr(c,r)>x||e.report({node:c,messageId:"singleLineProp",fix:b=>b.replaceText(c,g)})}return{TSTypeLiteral:l,ObjectExpression:l}}});function Ht(e){return e.type===_.TSLiteralType||e.type===_.TSTypeReference||e.type===_.TSNumberKeyword||e.type===_.TSStringKeyword||e.type===_.TSBooleanKeyword||e.type===_.TSNullKeyword||e.type===_.TSUndefinedKeyword}function Be(e,t){return!!(e.type===_.Literal||e.type===_.Identifier||e.type===_.TemplateLiteral||e.type===_.TaggedTemplateExpression||!t&&e.type===_.ArrayExpression&&e.elements.every(r=>r&&Be(r,!0)))}function lr(e,t){let r=t.getLastToken(e);if(!r)return 0;let n=t.text.indexOf(`
4
+ `,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function cr(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var Xe={name:zt,rule:ar};var pr=/eslint +react-compiler\/react-compiler: +\["error/,Jt={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"}}}]},create(e){let t=!1,r=typeof e.getSource=="function"?w=>r(w):w=>e.sourceCode.getText(w),n=typeof e.getScope=="function"?()=>n():w=>e.sourceCode.getScope(w),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,a=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,s={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:a};function i(w){a&&Array.isArray(w.suggest)&&w.suggest.length>0&&(w.fix=w.suggest[0].fix),e.report(w)}let l=e.getSourceCode().scopeManager,c=new WeakMap,p=new WeakSet,u=new WeakMap,g=new WeakMap,S=new WeakSet;function x(w,L){return function(P){if(L.has(P))return L.get(P);let T=w(P);return L.set(P,T),T}}function b(w,L,P,T,m){m&&w.async&&i({node:w,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,5 +12,5 @@ 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 y=l.acquire(w),A=new Set,I=null;{let f=y.upper;for(;f&&(A.add(f),f.type!=="function");)f=f.upper;if(!f)return;I=f}let E=Array.isArray;function F(f){if(!E(f.defs))return!1;let d=f.defs[0];if(d==null||d.node.type!=="VariableDeclarator")return!1;let C=d.node.init;if(C==null)return!1;for(;C.type==="TSAsExpression";)C=C.expression;let R=d.node.parent;if(R==null&&(Ge(I.block,d.node.id),R=d.node.parent,R==null))return!1;if(R.kind==="const"&&C.type==="Literal"&&(typeof C.value=="string"||typeof C.value=="number"||C.value===null))return!0;if(C.type!=="CallExpression")return!1;let O=C.callee;if(O.type==="MemberExpression"&&O.object.name==="React"&&O.property!=null&&!O.computed&&(O=O.property),O.type!=="Identifier")return!1;let v=d.node.id,{name:N}=O;if(N==="useRef"&&v.type==="Identifier")return!0;if(lr(O)&&v.type==="Identifier"){for(let D of f.references)D!==v&&h.add(D.identifier);return!0}else if(N==="useState"||N==="useReducer"){if(v.type==="ArrayPattern"&&v.elements.length===2&&E(f.identifiers)){if(v.elements[1]===f.identifiers[0]){if(N==="useState"){let D=f.references,ie=0;for(let me=0;me<D.length;me++){if(D[me].isWrite()&&ie++,ie>1)return!1;c.set(D[me].identifier,v.elements[0])}}return!0}else if(v.elements[0]===f.identifiers[0]){if(N==="useState"){let D=f.references;for(let ie=0;ie<D.length;ie++)p.add(D[ie].identifier)}return!1}}}else if(N==="useTransition"&&v.type==="ArrayPattern"&&v.elements.length===2&&Array.isArray(f.identifiers)&&v.elements[1]===f.identifiers[0])return!0;return!1}function H(f){if(!E(f.defs))return!1;let d=f.defs[0];if(d==null||d.node==null||d.node.id==null)return!1;let C=d.node,R=I.childScopes,O=null,v;for(v=0;v<R.length;v++){let N=R[v],D=N.block;if(C.type==="FunctionDeclaration"&&D===C||C.type==="VariableDeclarator"&&D.parent===C){O=N;break}}if(O==null)return!1;for(v=0;v<O.through.length;v++){let N=O.through[v];if(N.resolved!=null&&A.has(N.resolved.scope)&&!B(N.resolved))return!1}return!0}let B=x(F,u),Q=x(H,g),K=new Map;function Te(f){let d=f.from,C=!1;for(;d.block!==w;)d.type==="function"&&(C=d.block.parent!=null&&d.block.parent.type==="ReturnStatement"),d=d.upper;return C}let te=new Map,Ce=new Map;ue(y);function ue(f){for(let d of f.references){if(!d.resolved||!A.has(d.resolved.scope))continue;let C=Ge(w,d.identifier),R=Ut(C),O=de(R,Ce);if(m&&R.type==="Identifier"&&(R.parent.type==="MemberExpression"||R.parent.type==="OptionalMemberExpression")&&!R.parent.computed&&R.parent.property.type==="Identifier"&&R.parent.property.name==="current"&&Te(d)&&K.set(O,{reference:d,dependencyNode:R}),R.parent.type==="TSTypeQuery"||R.parent.type==="TSTypeReference")continue;let v=d.resolved.defs[0];if(v!=null&&!(v.node!=null&&v.node.init===w.parent)&&v.type!=="TypeParameter")if(te.has(O))te.get(O).references.push(d);else{let N=d.resolved,D=B(N)||Q(N);te.set(O,{isStable:D,references:[d]})}}for(let d of f.childScopes)ue(d)}K.forEach(({reference:f,dependencyNode:d},C)=>{let R=f.resolved.references,O=!1;for(let v=0;v<R.length;v++){let{identifier:N}=R[v],{parent:D}=N;if(D!=null&&D.type==="MemberExpression"&&!D.computed&&D.property.type==="Identifier"&&D.property.name==="current"&&D.parent.type==="AssignmentExpression"&&D.parent.left===D){O=!0;break}}O||i({node:d.parent.property,message:`The ref value '${C}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${C}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ce=new Set;function fe(f,d){ce.has(d)||(ce.add(d),i({node:f,message:`Assignments to the '${d}' variable from inside React Hook ${r(P)} will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ${r(P)}.`}))}let he=new Set;if(te.forEach(({isStable:f,references:d},C)=>{f&&he.add(C),d.forEach(R=>{R.writeExpr&&fe(R.writeExpr,C)})}),ce.size>0)return;if(!M){let f=null;if(te.forEach(({isStable:d,references:C},R)=>{f||C.forEach(O=>{if(f)return;let v=O.identifier;if(!c.has(v))return;let D=O.from;for(;D.type!=="function";)D=D.upper;D.block===w&&(f=R)})}),f){let{suggestedDependencies:d}=qe({dependencies:te,declaredDependencies:[],stableDependencies:he,externalDependencies:new Set,isEffect:!0});i({node:P,message:`React Hook ${T} contains a call to '${f}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+d.join(", ")+`] as a second argument to the ${T} Hook.`,suggest:[{desc:`Add dependencies array: [${d.join(", ")}]`,fix(C){return C.insertTextAfter(w,`, [${d.join(", ")}]`)}}]})}return}let Ie=[],Ae=new Set;M.type!=="ArrayExpression"?i({node:M,message:`React Hook ${r(P)} 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.`}):M.elements.forEach(f=>{if(f===null)return;if(f.type==="SpreadElement"){i({node:f,message:`React Hook ${r(P)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}h.has(f)&&i({node:f,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(f)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(f)}\``,fix(O){return O.removeRange(f.range)}}]});let d;try{d=de(f,Ce)}catch(O){if(/Unsupported node type/.test(O.message)){f.type==="Literal"?te.has(f.value)?i({node:f,message:`The ${f.raw} literal is not a valid dependency because it never changes. Did you mean to include ${f.value} in the array instead?`}):i({node:f,message:`The ${f.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):i({node:f,message:`React Hook ${r(P)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw O}let C=f;for(;C.type==="MemberExpression"||C.type==="OptionalMemberExpression"||C.type==="ChainExpression";)C=C.object||C.expression.object;let R=!I.through.some(O=>O.identifier===C);Ie.push({key:d,node:f}),R||Ae.add(d)});let{suggestedDependencies:_n,unnecessaryDependencies:ve,missingDependencies:ye,duplicateDependencies:Rt}=qe({dependencies:te,declaredDependencies:Ie,stableDependencies:he,externalDependencies:Ae,isEffect:m}),Oe=_n;if(Rt.size+ye.size+ve.size===0){if(t)return;ir({declaredDependencies:Ie,declaredDependenciesNode:M,componentScope:I,scope:y}).forEach(({construction:d,isUsedOutsideOfHook:C,depType:R})=>{let O=R==="function"?"useCallback":"useMemo",v=R==="function"?"definition":"initialization",N=`wrap the ${v} of '${d.name.name}' in its own ${O}() Hook.`,D=C?`To fix this, ${N}`:`Move it inside the ${T} callback. Alternatively, ${N}`,ie=R==="conditional"||R==="logical expression"?"could make":"makes",me=`The '${d.name.name}' ${R} ${ie} the dependencies of ${T} Hook (at line ${M.loc.start.line}) change on every render. ${D}`,kt;C&&d.type==="Variable"&&R==="function"&&(kt=[{desc:`Wrap the ${v} of '${d.name.name}' in its own ${O}() Hook.`,fix(vt){let[$n,zn]=O==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[vt.insertTextBefore(d.node.init,$n),vt.insertTextAfter(d.node.init,zn)]}}]),i({node:d.node,message:me,suggest:kt})});return}!m&&ye.size>0&&(Oe=qe({dependencies:te,declaredDependencies:[],stableDependencies:he,externalDependencies:Ae,isEffect:m}).suggestedDependencies);function Ln(){if(Ie.length===0)return!0;let f=Ie.map(C=>C.key),d=f.slice().sort();return f.join(",")===d.join(",")}Ln()&&Oe.sort();function Ue(f){let d=f.split("."),C="";for(let R=0;R<d.length;R++){if(R!==0){let O=d.slice(0,R+1).join("."),v=Ce.get(O)===!0;C+=v?"?.":"."}C+=d[R]}return C}function We(f,d,C,R){return f.size===0?null:(f.size>1?"":d+" ")+C+" "+(f.size>1?"dependencies":"dependency")+": "+or(Array.from(f).sort().map(O=>"'"+Ue(O)+"'"))+`. Either ${R} ${f.size>1?"them":"it"} or remove the dependency array.`}let ae="";if(ve.size>0){let f=null;if(Array.from(ve.keys()).forEach(d=>{f===null&&d.endsWith(".current")&&(f=d)}),f!==null)ae=` Mutable values like '${f}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Ae.size>0){let d=Array.from(Ae)[0];y.set.has(d)||(ae=` Outer scope values like '${d}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!ae&&ye.has("props")){let f=te.get("props");if(f==null)return;let d=f.references;if(!Array.isArray(d))return;let C=!0;for(let R=0;R<d.length;R++){let O=d[R],v=Ge(I.block,O.identifier);if(!v){C=!1;break}let N=v.parent;if(N==null){C=!1;break}if(N.type!=="MemberExpression"&&N.type!=="OptionalMemberExpression"){C=!1;break}}C&&(ae=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${T} call and refer to those specific props inside ${r(P)}.`)}if(!ae&&ye.size>0){let f=null;ye.forEach(d=>{if(f)return;let C=I.set.get(d),R=te.get(d);if(R.references[0].resolved!==C)return;let O=C.defs[0];if(O==null||O.name==null||O.type!=="Parameter")return;let v=!1,N;for(let D=0;D<R.references.length;D++)if(N=R.references[D].identifier,N!=null&&N.parent!=null&&(N.parent.type==="CallExpression"||N.parent.type==="OptionalCallExpression")&&N.parent.callee===N){v=!0;break}v&&(f=d)}),f!==null&&(ae=` If '${f}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!ae&&ye.size>0){let f=null;if(ye.forEach(d=>{if(f!==null)return;let R=te.get(d).references,O,v;for(let N=0;N<R.length;N++){for(O=R[N].identifier,v=O.parent;v!=null&&v!==I.block;){if(v.type==="CallExpression"){let D=c.get(v.callee);if(D!=null){if(D.name===d)f={missingDep:d,setter:v.callee.name,form:"updater"};else if(p.has(O))f={missingDep:d,setter:v.callee.name,form:"reducer"};else{let ie=R[N].resolved;if(ie!=null){let me=ie.defs[0];me!=null&&me.type==="Parameter"&&(f={missingDep:d,setter:v.callee.name,form:"inlineReducer"})}}break}}v=v.parent}if(f!==null)break}}),f!==null)switch(f.form){case"reducer":ae=` You can also replace multiple useState variables with useReducer if '${f.setter}' needs the current value of '${f.missingDep}'.`;break;case"inlineReducer":ae=` If '${f.setter}' needs the current value of '${f.missingDep}', you can also switch to useReducer instead of useState and read '${f.missingDep}' in the reducer.`;break;case"updater":ae=` You can also do a functional update '${f.setter}(${f.missingDep.slice(0,1)} => ...)' if you only need '${f.missingDep}' in the '${f.setter}' call.`;break;default:throw new Error("Unknown case.")}}i({node:M,message:`React Hook ${r(P)} has `+(We(ye,"a","missing","include")||We(ve,"an","unnecessary","exclude")||We(Rt,"a","duplicate","omit"))+ae,suggest:[{desc:`Update the dependencies array to be: [${Oe.map(Ue).join(", ")}]`,fix(f){return f.replaceText(M,`[${Oe.map(Ue).join(", ")}]`)}}]})}function k(w){let M=sr(w.callee,s);if(M===-1)return;let P=w.arguments[M],T=w.callee,m=Wt(T).name,y=w.arguments[M+1],A=/Effect($|[^a-z])/g.test(m);if(!P){i({node:T,message:`React Hook ${m} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!A)){if(!y&&!A){(m==="useMemo"||m==="useCallback")&&i({node:T,message:`React Hook ${m} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(P.type){case"FunctionExpression":case"ArrowFunctionExpression":b(P,y,T,m,A);return;case"Identifier":if(!y||y.elements&&y.elements.some(F=>F&&F.type==="Identifier"&&F.name===P.name))return;let I=n(w).set.get(P.name);if(I==null||I.defs==null)return;let E=I.defs[0];if(!E||!E.node||E.type!=="Variable"&&E.type!=="FunctionName")break;switch(E.node.type){case"FunctionDeclaration":b(E.node,y,T,m,A);return;case"VariableDeclarator":let F=E.node.init;if(!F)break;switch(F.type){case"ArrowFunctionExpression":case"FunctionExpression":b(F,y,T,m,A);return}break}break;default:i({node:T,message:`React Hook ${m} received a function whose dependencies are unknown. Pass an inline function instead.`});return}i({node:T,message:`React Hook ${m} has a missing dependency: '${P.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${P.name}]`,fix(I){return I.replaceText(y,`[${P.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let w of e.sourceCode.getAllComments())if(rr.test(w.value))return t=!0,{CallExpression:M=>k(M,!0)}}return{CallExpression:w=>k(w)}}};function qe({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:o}){let a=s();function s(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((b,k)=>{let w=i(a,k);w.isUsed=!0,l(a,k,M=>{M.isSubtreeUsed=!0})}),t.forEach(({key:b})=>{let k=i(a,b);k.isSatisfiedRecursively=!0}),r.forEach(b=>{let k=i(a,b);k.isSatisfiedRecursively=!0});function i(b,k){let w=k.split("."),M=b;for(let P of w){let T=M.children.get(P);T||(T=s(),M.children.set(P,T)),M=T}return M}function l(b,k,w){let M=k.split("."),P=b;for(let T of M){let m=P.children.get(T);if(!m)return;w(m),P=m}}let c=new Set,p=new Set;u(a,c,p,b=>b);function u(b,k,w,M){b.children.forEach((P,T)=>{let m=M(T);if(P.isSatisfiedRecursively){P.isSubtreeUsed&&w.add(m);return}if(P.isUsed){k.add(m);return}u(P,k,w,y=>m+"."+y)})}let g=[],h=new Set,x=new Set;return t.forEach(({key:b})=>{p.has(b)?g.indexOf(b)===-1?g.push(b):x.add(b):h.add(b)}),c.forEach(b=>{g.push(b)}),{suggestedDependencies:g,unnecessaryDependencies:h,duplicateDependencies:x,missingDependencies:c}}function ge(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 ge(e.consequent)!=null||ge(e.alternate)!=null?"conditional":null;case"LogicalExpression":return ge(e.left)!=null||ge(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return ge(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return ge(e.expression);case"TSAsExpression":return ge(e.expression)}return null}function ir({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let o=e.map(({key:s})=>{let i=r.variables.find(c=>c.name===s);if(i==null)return null;let l=i.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let c=ge(l.node.init);if(c!=null)return[i,c]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[i,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[i,"class"]:null}).filter(Boolean);function a(s){let i=!1;for(let l=0;l<s.references.length;l++){let c=s.references[l];if(c.writeExpr){if(i)return!0;i=!0;continue}let p=c.from;for(;p!==n&&p!=null;)p=p.upper;if(p!==n&&!Vt(t,c.identifier))return!0}return!1}return o.map(([s,i])=>({construction:s.defs[0],depType:i,isUsedOutsideOfHook:a(s)}))}function Ut(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)?Ut(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function Xe(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function de(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return t&&t.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=de(e.object,t),n=de(e.property,null),o=`${r}.${n}`;return Xe(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=de(e.object,t),n=de(e.property,null),o=`${r}.${n}`;return Xe(e,t,o),o}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let n=de(r.object,t),o=de(r.property,null),a=`${n}.${o}`;return Xe(r,t,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function Wt(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function sr(e,t){let r=Wt(e);if(r.type!=="Identifier")return-1;switch(r.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(r===e&&t&&t.additionalHooks){let n;try{n=de(r,null)}catch(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return t.additionalHooks.test(n)?0:-1}else return-1}}function Ge(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),ar(n,t))return n;if(Vt(n,t))for(let[o,a]of Object.entries(n))o!=="parent"&&($t(a)?(a.parent=n,r.push(a)):Array.isArray(a)&&a.forEach(s=>{$t(s)&&(s.parent=n,r.push(s))}))}return null}function or(e){let t="";for(let r=0;r<e.length;r++)t+=e[r],r===0&&e.length===2?t+=" and ":r===e.length-2&&e.length>2?t+=", and ":r<e.length-1&&(t+=", ");return t}function $t(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function ar(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function Vt(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function lr(e){return!1}import{AST_NODE_TYPES as Ne,ESLintUtils as Yt}from"@typescript-eslint/utils";import ee from"typescript";var cr=Yt.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ht="improved-no-unnecessary-condition",pr=U({}),ur=["string","number","bigint","boolean","symbol","undefined","object","function","never"],fr=new Set(ur),Ke={name:Ht,rule:cr({name:Ht,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".'},schema:[pr]},defaultOptions:[{}],create(e){let t=Yt.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(i){return i.type===Ne.UnaryExpression&&i.operator==="typeof"}function o(i){return i.flags&ee.TypeFlags.Any||i.flags&ee.TypeFlags.Unknown?null:i.flags&ee.TypeFlags.StringLike?["string"]:i.flags&ee.TypeFlags.NumberLike?["number"]:i.flags&ee.TypeFlags.BigIntLike?["bigint"]:i.flags&ee.TypeFlags.BooleanLike?["boolean"]:i.flags&ee.TypeFlags.ESSymbolLike?["symbol"]:i.flags&ee.TypeFlags.Undefined||i.flags&ee.TypeFlags.Void?["undefined"]:i.flags&ee.TypeFlags.Null?["object"]:i.getCallSignatures().length>0?["function"]:i.flags&ee.TypeFlags.Object?i.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:i.flags&ee.TypeFlags.NonPrimitive?["object"]:i.flags&ee.TypeFlags.Never?["never"]:null}function a(i){if(!r)return null;let l=t.esTreeNodeToTSNodeMap.get(i),c=r.getTypeAtLocation(l.expression);if(c.flags&ee.TypeFlags.Any||c.flags&ee.TypeFlags.Unknown)return null;let p=[];if(c.isUnion()){for(let g of c.types){let h=o(g);if(h)p.push(...h);else return null}return p}let u=o(c);return u?(p.push(...u),p):null}function s(i){if(!(i.operator==="==="||i.operator==="!=="))return;let c=null,p=null;if(n(i.left)?(c=i.left,p=i.right.type===Ne.Literal&&typeof i.right.value=="string"?i.right.value:null):n(i.right)&&(c=i.right,p=i.left.type===Ne.Literal&&typeof i.left.value=="string"?i.left.value:null),!c||!p||!mr(p,fr))return;let u=a(c);if(!u)return;let g=i.operator==="!==",h=u.includes(p);u.length===1?h&&!g?e.report({node:i,messageId:"unnecessaryTypeofCondition",data:{name:be(c,e),type:p}}):!h&&g?e.report({node:i,messageId:"unnecessaryTypeofCondition",data:{name:be(c,e),type:Array.from(u)[0]}}):!h&&!g?e.report({node:i,messageId:"alwaysFalseTypeofCondition",data:{name:be(c,e),actualType:Fe(u),conditionType:p}}):h&&g&&e.report({node:i,messageId:"alwaysFalseTypeofCondition",data:{name:be(c,e),actualType:Fe(u),conditionType:p}}):!h&&!g?e.report({node:i,messageId:"alwaysFalseTypeofCondition",data:{name:be(c,e),actualType:Fe(u),conditionType:p}}):!h&&g&&e.report({node:i,messageId:"unnecessaryTypeofCondition",data:{name:be(c,e),type:Fe(u)}})}return{BinaryExpression:s}}})};function Fe(e){return Array.from(new Set(e)).join(" | ")||"never"}function be(e,t){let r=e.argument;return r.type===Ne.Identifier?r.name:t.sourceCode.getText(r)}function mr(e,t){return t.has(e)}import{AST_NODE_TYPES as dr,ESLintUtils as yr}from"@typescript-eslint/utils";var gr=yr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Jt="no-call-with-explicit-generics",Sr=U({functions:X(z())}),Tr=gr({name:Jt,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:[Sr]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:o}=n;o.type===dr.Identifier&&r.has(o.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),Ze={name:Jt,rule:Tr};import{AST_NODE_TYPES as je,ESLintUtils as hr}from"@typescript-eslint/utils";var Er=hr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Bt="no-call-with-inferred-generics",br=Er({name:Bt,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:o}=n;if(o.type!==je.Identifier)return;let a=r.get(o.name);if(!a)return;let{minGenerics:s=1,allowAny:i,disallowTypes:l=t.disallowTypes}=a;(n.typeArguments?.params.length||0)<(s||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:s||0}}),!(i&&!l)&&n.typeArguments?.params?.some(p=>!i&&p.type===je.TSAnyKeyword||l&&p.type===je.TSTypeReference&&p.typeName.type===je.Identifier&&l.includes(p.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),Qe={name:Bt,rule:br};import{ESLintUtils as xr}from"@typescript-eslint/utils";var wr=xr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Xt="no-commented-out-code",Cr=["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:"],J={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]+>/,colonDescriptiveComment:/^[a-zA-Z]+(\s+[a-zA-Z]+)*:\s+[a-zA-Z]+\s+[a-zA-Z][^{=,'"]*$/,jsdocComment:/^\s*[*\s]*$/},Ir=[") {","return;",J.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",J.stringAssignment,");",J.objectPropertyWithQuotes,J.computedPropertyAssignment,J.kebabCaseProperty,J.snakeCaseProperty,"&&","||","()",J.ternaryOperator,J.colonWithWord,J.quotedString,J.numberWithComma,J.arrayWithComma,J.objectWithComma,J.methodCall,J.arrayAccess,"?.(","??","=>",J.quotedPropertyKey],Ar=["/>","</",J.jsxSelfClosing,J.jsxElement,J.jsxOpeningTag,J.jsxClosingTag,J.htmlOpeningTag,J.htmlClosingTag],qt=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Rr=wr({name:Xt,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(n,o){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||J.jsdocComment.test(n))return!1;for(let s of qt)if(a.startsWith(s))return!1;if(n.includes("https://")||a.includes(":")&&J.colonDescriptiveComment.test(a.trim()))return!1;if(o==="Block"){for(let s of Ar)if(typeof s=="string"){if(n.includes(s))return{wrongPattern:s}}else if(s.test(n))return{wrongPattern:`regex(${s.toString()})`};return!1}for(let s of Cr)if(a.startsWith(s))return{wrongPattern:s};for(let s of Ir)if(typeof s=="string"){if(n.includes(s))return{wrongPattern:s}}else if(s.test(n))return{wrongPattern:`regex(${s.toString()})`};return!1}function r(n,o){let a=n,s=a.trim();if(s.startsWith("`")&&(s.endsWith("`,")||s.endsWith("`;")||s.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let c=a.split(/```[\s\S]*?```/g);c.some(u=>/[a-zA-Z0-9]/.test(u))&&(a=c.join(""))}if(!a.includes("`"))return a;let i=a.split(/`[^`]*`/g);return i.some(c=>/[a-zA-Z0-9]/.test(c))?i.join(""):a}return{Program(){let o=e.sourceCode.getAllComments();for(let a of o){let s=r(a.value,a.type),i=t(s,a.type);i&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:i.wrongPattern,allowedPrefixes:qt.join(", ")}})}}}}}),et={name:Xt,rule:Rr};import{ESLintUtils as kr,TSESTree as vr}from"@typescript-eslint/utils";var Or=kr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Gt="no-default-export",Pr=Or({name:Gt,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let r of t.specifiers)r.exported.type===vr.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),tt={name:Gt,rule:Pr};import{ESLintUtils as Fr}from"@typescript-eslint/utils";var Nr=Fr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Kt="no-leaked-text-in-jsx",jr=[",",";","[","]","(",")"],Dr=Nr({name:Kt,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(t){let r=t.value.trim();if(!r)return;let n="";jr.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),nt={name:Kt,rule:Dr};import{AST_NODE_TYPES as Re,ESLintUtils as Mr}from"@typescript-eslint/utils";var _r=Mr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Qt="no-non-camel-case-functions",Lr=/^(\$?[a-z][a-zA-Z0-9]*)$/;function Zt(e){if(e.typeName.type!==Re.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Re.Identifier&&t.name==="JSX"&&r.name==="Element"}var $r=_r({name:Qt,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!Lr.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Re.TSTypeReference?Zt(r):r.type===Re.TSUnionType&&r.types.some(o=>o.type===Re.TSTypeReference&&Zt(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),rt={name:Qt,rule:$r};import{ESLintUtils as zr,TSESTree as W}from"@typescript-eslint/utils";import{AST_NODE_TYPES as en}from"@typescript-eslint/utils";function xe(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:xe(e.parent,t,r===1/0?r:r-1)}function*it(e){yield e,e.parent&&(yield*it(e.parent))}function st(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function tn(e,t,r){let o=r.getDeclaredVariables(e).find(a=>a.name===t||a.identifiers[0]?.parent.type===en.Property&&a.identifiers[0]?.parent.key.type===en.Identifier&&a.identifiers[0]?.parent.key.name===t);return o?o.references.filter(a=>!a.init):[]}var Ur=zr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nn="no-optional-root-props",Wr=Ur({name:nn,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function t(n){let a=e.sourceCode.getDeclaredVariables(n)[0];if(!a||a.references.length!==1)return!1;let s=a.references[0];if(!s)return!1;for(let i of it(s.identifier)){if("returnType"in i||i.type===W.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=i.parent;if(!l)return!1;if(l.type===W.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===W.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===W.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let p=xe(l.parent.parent,W.AST_NODE_TYPES.VariableDeclaration,4);if(!p)return!1;let u=De(p,e.sourceCode);return u?!(u.parent.type===W.AST_NODE_TYPES.CallExpression&&u.parent.callee.type===W.AST_NODE_TYPES.Identifier&&u.parent.callee.name==="memo"):!1}if(i.type===W.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===W.AST_NODE_TYPES.ArrowFunctionExpression){let c=xe(l,W.AST_NODE_TYPES.VariableDeclaration);return c?!!De(c,e.sourceCode):!1}if(l.type===W.AST_NODE_TYPES.FunctionDeclaration)return!!De(l,e.sourceCode)}return!1}function r(n){n.key.type!==W.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:o=>{let a=xe(n,W.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let s=e.sourceCode.getText(a);return o.replaceText(a,s.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===W.AST_NODE_TYPES.TSTypeLiteral&&!(Me(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===W.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(Me(n)||!t(n)))for(let o of n.body.body)o.type===W.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(n){if(n.typeName.type!==W.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==W.AST_NODE_TYPES.TSTypeLiteral)return;let a=xe(n.parent,W.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let s=De(a,e.sourceCode);if(!(!s||s.parent.type===W.AST_NODE_TYPES.CallExpression&&s.parent.callee.type===W.AST_NODE_TYPES.Identifier&&s.parent.callee.name==="memo"))for(let l of o.members)l.type===W.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function Me(e){return e?e.parent?.type===W.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===W.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function De(e,t){if(Me(e))return;let r;if(e.type===W.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===W.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let n=t.getScope(e);e.type===W.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let o=n.variables.find(s=>s.identifiers.includes(r));if(!o)return;let a=o.references.filter(s=>s.identifier!==r);if(!(a.length!==1||!a[0])&&!Me(a[0].identifier.parent.parent))return a[0].identifier}var ot={name:nn,rule:Wr};import{ESLintUtils as Vr}from"@typescript-eslint/utils";import at from"node:path";var Hr=Vr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),rn="no-relative-imports",Yr=U({find:z(),replacement:z()}),Jr=U({aliases:X(Yr),rootDir:_(z()),allowNotFoundAliases:_(Ee()),_dev_simulateFileName:_(z())}),Br=Hr({name:rn,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:[Jr]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(s){return s.startsWith(".")||s.startsWith("..")}function o(s,i){let l=at.dirname(i);return at.resolve(l,s)}function a(s){let i=t.rootDir??process.cwd(),l=at.relative(i,s);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:c,replacement:p}of t.aliases)if(l.startsWith(p)){let u=l.replace(p,c);return{alias:c,newPath:u}}return null}return{ImportDeclaration(s){let i=s.source.value;if(!n(i))return;let l=o(i,r),c=a(l);!c&&t.allowNotFoundAliases||e.report({node:s,messageId:c?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:c?.alias},fix:c?p=>p.replaceText(s.source,`'${c.newPath}'`):void 0})}}}}),lt={name:rn,rule:Br};import{AST_NODE_TYPES as _e}from"@typescript-eslint/utils";import*as Se from"zod/v4";var qr=Se.object({alternativeMsgs:Se.object({inArrayFind:Se.string().optional(),inArrayFilter:Se.string().optional()}).optional(),__dev_simulateFileName:Se.string().optional()});function Xr(e){return e.typeAnnotation.type!==_e.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}function Gr(e){return/\.(typeGuards|type-guards)\.(ts|tsx)$/.test(e)}function Kr(e){let t=e.parent;for(;t;){if(t.type===_e.CallExpression&&t.callee.type===_e.MemberExpression&&t.callee.property.type===_e.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var ct=ne({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:"Type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[Pe(qr)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(Gr(r))return{};function n(o){if(!Xr(o))return;let a=Kr(o),s=[];if(t.alternativeMsgs&&a){let i=a.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let l=a.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:l,data:{message:i}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});import{AST_NODE_TYPES as we}from"@typescript-eslint/utils";var Zr="no-unnecessary-async-on-jsx-props";function Qr(e){if(e.body.type!==we.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let r=t[0];return!r||r.type!==we.ExpressionStatement?!1:r.expression.type===we.AwaitExpression}var pt=ne({name:Zr,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function t(r){Qr(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,a=[],s=o.getFirstToken(r,l=>l.value==="async");if(s){let l=o.getTokenAfter(s);l?a.push(n.replaceTextRange([s.range[0],l.range[0]],"")):a.push(n.remove(s))}function i(l){if(l.type===we.AwaitExpression){let c=o.getFirstToken(l);if(c&&c.value==="await"){let p=o.getTokenAfter(c);p?a.push(n.replaceTextRange([c.range[0],p.range[0]],"")):a.push(n.remove(c))}}if(l.type===we.BlockStatement)for(let c of l.body)i(c);else l.type===we.ExpressionStatement&&i(l.expression)}return i(r.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});import{AST_NODE_TYPES as ke,ESLintUtils as on}from"@typescript-eslint/utils";import*as ut from"typescript";var ei=on.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),sn="no-unnecessary-casting",ti=U({additionalCastFunctions:_(X(U({name:z(),expectedType:Ot(["string","number"])})))}),ft={name:sn,rule:ei({name:sn,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:[ti],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=on.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function s(p,u){switch(p.type){case ke.Literal:return u==="number"?typeof p.value=="number":typeof p.value=="string";case ke.TemplateLiteral:return u==="string";case ke.UnaryExpression:return u==="number"?p.operator==="+"||p.operator==="-"||p.operator==="~":!1;default:return!1}}function i(p,u){return u==="number"?!!(p.flags&ut.TypeFlags.NumberLike):!!(p.flags&ut.TypeFlags.StringLike)}function l(p,u){return g=>g.replaceText(p,e.sourceCode.getText(u))}function c(p){if(!a||p.arguments.length!==1)return;let u=p.arguments[0];if(!u||u.type===ke.SpreadElement)return;let{callee:g}=p;if(g.type!==ke.Identifier)return;let h=g.name,x=n.find(k=>k.name===h);if(!x)return;if(s(u,x.expectedType)||i(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(u)),x.expectedType)){let k,w;h==="Number"?k="unnecessaryNumberCasting":h==="String"?k="unnecessaryStringCasting":(k="unnecessaryCustomCasting",w={name:x.name,type:x.expectedType}),e.report({node:p,messageId:k,...w?{data:w}:{},fix:l(p,u)})}}return{CallExpression:c}}})};import{AST_NODE_TYPES as Le}from"@typescript-eslint/utils";import*as se from"zod/v4";var ni=se.object({methods:se.union([se.array(se.string()),se.literal("array")])}),mt=ne({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:[se.toJSONSchema(ni)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(i){return Array.isArray(r)?r.includes(i):n.has(i)}function a(i){let{callee:l}=i;if(l.type===Le.MemberExpression){let c=l.property;if(c.type===Le.Identifier)return c.name}return null}function s(i,l){if(i.type!==Le.Identifier||!i.typeAnnotation)return;let c=l.parent;if(c.type===Le.CallExpression){let p=a(c);p&&o(p)&&c.arguments.indexOf(l)===0&&e.report({node:i.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(g){return g.remove(i.typeAnnotation)}})}}return{ArrowFunctionExpression(i){for(let l of i.params)s(l,i)},FunctionExpression(i){for(let l of i.params)s(l,i)}}}});import{AST_NODE_TYPES as re}from"@typescript-eslint/utils";var dt=ne({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===re.ObjectPattern||!t.init||t.init.type!==re.ObjectExpression||t.id.type===re.Identifier&&t.id.typeAnnotation||t.parent.parent.type===re.ExportNamedDeclaration)return;let r=new Map;for(let s of t.init.properties)s.type===re.Property&&s.key.type===re.Identifier&&r.set(s.key.name,s);if(r.size===0||t.id.type!==re.Identifier)return;let n=ri(t,e.sourceCode);if(n.length===0)return;let o=t.init.properties.some(s=>s.type!==re.Property?!1:s.value.type===re.FunctionExpression),a=new Set;for(let s of n){if(s.identifier.parent.type!==re.MemberExpression)return;let i=s.identifier.parent;if(i.object!==s.identifier)return;if(i.computed)if(i.property.type===re.Literal&&typeof i.property.value=="string")a.add(i.property.value);else return;else{if(i.property.type!==re.Identifier)return;a.add(i.property.name)}if(i.parent.type===re.CallExpression&&o)return}for(let[s,i]of r)a.has(s)||e.report({node:i,messageId:"unusedObjectProperty",data:{name:s}})}}}});function ri(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}import{AST_NODE_TYPES as Y,ESLintUtils as ii}from"@typescript-eslint/utils";var si=U({selectors:X(U({name:z(),selectorProp:_(z()),selectorArgPos:_(pe()),returnProp:_(z())}))}),oi=ii.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),an="no-unused-selected-values",yt={name:an,rule:oi({name:an,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[si]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===Y.CallExpression&&(a=o.init),!a)return;let s=li(a);if(!s)return;let i=n.get(s);if(!i)return;let l=ai(a,i.selectorArgPos??0,i.selectorProp);if(!l)return;let c=ci(l);if(!c)return;let p=ln(c.properties,void 0);if(!p)return;if(o.id.type===Y.ObjectPattern){let h=ln(o.id.properties,i.returnProp);if(!h)return;for(let[x,b]of p)h.has(x)||e.report({node:b,messageId:"unusedSelectedValue",data:{name:x}});return}if(o.id.type!==Y.Identifier||i.returnProp)return;let u=pi(o,e.sourceCode);if(u.length===0)return;let g=new Set;for(let h of u){if(h.identifier.parent.type!==Y.MemberExpression)return;let x=h.identifier.parent.property;if(x.type!==Y.Identifier)return;g.add(x.name)}for(let[h,x]of p)g.has(h)||e.report({node:x,messageId:"unusedSelectedValue",data:{name:h}})}}}})};function ai(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===Y.ArrowFunctionExpression||n.type===Y.FunctionExpression)return n;if(r&&n.type===Y.ObjectExpression){let o=n.properties.find(s=>s.type===Y.Property&&s.key.type===Y.Identifier&&s.key.name===r);if(o?.type!==Y.Property)return null;let a=o.value;if(a.type===Y.ArrowFunctionExpression||a.type===Y.FunctionExpression)return a}return null}function li(e){return e.callee.type===Y.Identifier?e.callee.name:e.callee.type===Y.MemberExpression&&e.callee.property.type===Y.Identifier?e.callee.property.name:null}function ci(e){if(e.body.type===Y.ObjectExpression)return e.body;if(e.body.type===Y.BlockStatement){let t=e.body.body.filter(r=>r.type===Y.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==Y.ObjectExpression?null:t[0].argument}return null}function ln(e,t){let r=e;if(t){let o=e.find(a=>a.type===Y.Property&&a.key.type===Y.Identifier&&a.key.name===t);if(o?.type!==Y.Property||o.value.type!==Y.ObjectPattern)return null;r=o.value.properties}let n=new Map;for(let o of r){if(o.type!==Y.Property||o.key.type!==Y.Identifier)return null;n.set(o.key.name,o)}return n.size>0?n:null}function pi(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}import{AST_NODE_TYPES as V}from"@typescript-eslint/utils";var gt=ne({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(a=>a.type===V.ImportDeclaration&&a.source.value==="t-state-form"))return{};let n=null,o=!1;return{CallExpression(a){if(o)return;if(!n){let i=ui(a);i&&(n=i);return}let s=fi(a,e.sourceCode);if(s){o=!0;for(let i of s)n.delete(i);if(n.size!==0)for(let[i,l]of n)e.report({node:l,messageId:"unusedField",data:{name:i}})}}}}});function ui(e){if(!(e.callee.type===V.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==V.ObjectExpression)return null;let n=st(r.properties,a=>a.type!==V.Property||a.key.type!==V.Identifier||a.key.name!=="initialConfig"?null:a.value.type===V.ObjectExpression?a.value:a.value.type===V.ArrowFunctionExpression||a.value.type===V.FunctionExpression?mi(a.value):null);if(!n)return null;let o=new Map;for(let a of n.properties)a.type===V.Property&&a.key.type===V.Identifier&&o.set(a.key.name,a);return o}function fi(e,t){if(!(e.callee.type===V.Identifier&&e.callee.name==="useFormState")||e.parent.type!==V.VariableDeclarator||e.parent.id.type!==V.ObjectPattern||!st(e.parent.id.properties,s=>s.type===V.Property&&s.key.type===V.Identifier&&s.key.name==="formFields"&&s))return null;let o=tn(e.parent,"formFields",t),a=new Set;for(let{identifier:s}of o){if(s.type!==V.Identifier||s.parent.type===V.Property&&s.parent.parent.type===V.ObjectExpression&&s.parent.parent.parent.type===V.ReturnStatement||s.parent.type===V.ReturnStatement)return null;if(s.parent.type===V.MemberExpression){if(s.parent.object.type!==V.Identifier||s.parent.property.type!==V.Identifier)return null;a.add(s.parent.property.name)}}return a}function mi(e){if(e.body.type===V.ObjectExpression)return e.body;if(e.body.type===V.BlockStatement){let t=e.body.body.filter(r=>r.type===V.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==V.ObjectExpression?null:t[0].argument}return null}import{AST_NODE_TYPES as $,ESLintUtils as di}from"@typescript-eslint/utils";var yi=di.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function cn(e){let t=[];for(let r of e.members)r.type===$.TSPropertySignature&&r.key.type===$.Identifier&&t.push([r.key.name,r]);return t}function pn(e,...t){for(let r of t)e.set(...r);return e}var gi=U({forceCheckOnFCPropTypesWithName:_(X(z()))}),un="no-unused-type-props-in-args",St=null,Si=yi({name:un,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:[gi],fixable:"code"},defaultOptions:[{}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r}=t;r&&!St&&(St=r.map(i=>new RegExp(i)));function n(i,l,c,p,u=!0){let g=c.name,h=e.sourceCode.getScope(l).references.find(k=>k.identifier.name===g)?.resolved,x=i&&St?.some(k=>k.test(g));if(!h||!x&&h.references.filter(k=>k.isTypeReference).length>1)return;let b=h?.defs[0]?.node;if(!(u&&b?.parent?.type===$.ExportNamedDeclaration)){if(b?.type===$.TSTypeAliasDeclaration){o(i,l,p,b.typeAnnotation,!0);return}if(b?.type===$.TSInterfaceDeclaration){o(i,l,p,b.body,!0);return}}}function o(i,l,c,p,u){if(p.type===$.TSInterfaceBody){for(let g of p.body)g.type===$.TSPropertySignature&&g.key.type===$.Identifier&&c.set(g.key.name,g);return}if(p.type===$.TSTypeLiteral){pn(c,...cn(p));return}if(p.type===$.TSIntersectionType){for(let g of p.types)o(i,l,c,g,!0);return}u||p.type===$.TSTypeReference&&p.typeName.type===$.Identifier&&n(i,l,p.typeName,c)}function a(i,l,c){for(let p of c)if(p.type==="ObjectPattern"&&p.typeAnnotation){let u=new Map;if(o(i,l,u,p.typeAnnotation.typeAnnotation,!1),u.size===0)continue;s(p,u)}else p.type===$.AssignmentPattern&&p.left.type===$.ObjectPattern&&a(i,l,[p.left])}function s(i,l){let c=[];if(i.properties.at(-1)?.type===$.RestElement)return;for(let h of i.properties)h.type===$.Property&&h.key.type===$.Identifier&&c.push(h.key.name);let u=[],g=[];for(let[h,x]of l)c.includes(h)||(g.push(h),u.push({node:x,messageId:"unusedObjectTypeProperty",data:{propertyName:h}}));for(let[h,x]of u.entries())e.report({...x,fix:h===u.length-1?b=>{let k=i.properties.at(-1),w=g.join(", ");return k?k?.type===$.RestElement?null:b.insertTextAfter(k,`, ${w}`):b.insertTextBeforeRange([i.range[0]+1,i.range[1]],`${w}`)}:void 0})}return{VariableDeclaration(i){let l=i.declarations[0];if(!l)return;let c=new Map,p=l.id.type===$.Identifier&&l.id.typeAnnotation?.typeAnnotation.type===$.TSTypeReference&&l.id.typeAnnotation.typeAnnotation.typeName.type===$.Identifier&&l.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&l.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(p){if(p.type===$.TSTypeReference&&p.typeName.type===$.Identifier)n(!0,i,p.typeName,c,!1);else if(p.type===$.TSTypeLiteral)pn(c,...cn(p));else if(p.type===$.TSIntersectionType)for(let u of p.types)u.type===$.TSTypeReference&&u.typeName.type===$.Identifier?n(!0,i,u.typeName,c,!1):o(!0,i,c,u,!0);if(c.size!==0&&l.init?.type===$.ArrowFunctionExpression){let u=l.init.params[0];if(!u){e.report({node:l.init,messageId:"missingComponentParam"});return}u.type===$.ObjectPattern&&s(u,c)}}},FunctionDeclaration:function(i){a(!1,i,i.params)},ArrowFunctionExpression(i){a(!1,i,i.params)}}}}),Tt={name:un,rule:Si};import{AST_NODE_TYPES as ht,ESLintUtils as Ti}from"@typescript-eslint/utils";var hi=Ti.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mn="prefer-named-functions",fn=new Map,Ei=hi({name:mn,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[t]){let r=null;if(t.ignoreRegex){let n=fn.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),fn.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===ht.ArrowFunctionExpression&&n.id.type===ht.Identifier){let o=n.id.name;if(n.id.typeAnnotation||r&&r.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==ht.BlockStatement)return;let a=n.parent,s=n.init.params,i=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:c=>c.replaceText(a,`${l.async?"async ":""}function ${o}(${s.map(p=>e.sourceCode.getText(p)).join(", ")||""}) ${e.sourceCode.getText(i)}`)}]})}}}}}),Et={name:mn,rule:Ei};import{AST_NODE_TYPES as j}from"@typescript-eslint/utils";var bi=U({disallowedFunctions:X(U({name:z(),allowUsingWithArgs:_(Ee()),hookAlternative:_(z()),message:_(z()),allowUseInside:_(X(z()))}))});function $e(e){return/^use[A-Z]/.test(e)}function dn(e){return/^[A-Z]/.test(e)}function xi(e){return e.type===j.Identifier?$e(e.name):e.type===j.MemberExpression&&e.property.type===j.Identifier?$e(e.property.name):!1}function yn(e,t){return e.type===j.Identifier?e.name===t:e.type===j.MemberExpression&&e.object.type===j.Identifier&&e.property.type===j.Identifier?e.object.name==="React"&&e.property.name===t:!1}function gn(e){return!!(e.parent&&e.parent.type===j.CallExpression&&yn(e.parent.callee,"forwardRef"))}function Sn(e){return!!(e.parent&&e.parent.type===j.CallExpression&&yn(e.parent.callee,"memo"))}function bt(e){if(e.type===j.FunctionDeclaration||e.type===j.FunctionExpression&&e.id)return e.id||void 0;if(e.type===j.FunctionExpression||e.type===j.ArrowFunctionExpression){if(e.parent.type===j.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===j.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===j.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===j.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function wi(e){let t=e.parent,r=!1;for(;t;){if(t.type===j.FunctionDeclaration||t.type===j.FunctionExpression||t.type===j.ArrowFunctionExpression){let n=bt(t);if(n&&n.type===j.Identifier){if(dn(n.name)||$e(n.name))return!r;r=!0}else{if(gn(t)||Sn(t))return!r;if(t.parent.type===j.CallExpression){let o=t.parent;xi(o.callee)||(r=!0)}else t.parent.type===j.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Tn(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 Ci(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===j.FunctionDeclaration||r.type===j.FunctionExpression||r.type===j.ArrowFunctionExpression){let n=bt(r);if(n&&n.type===j.Identifier&&t.includes(n.name))return!0}else if(r.type===j.CallExpression){let n=Tn(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function Ii(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===j.Identifier&&t.name==="undefined")}function Ai(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===j.FunctionDeclaration||n.type===j.FunctionExpression||n.type===j.ArrowFunctionExpression){let o=bt(n);if(o&&o.type===j.Identifier){if(dn(o.name)||$e(o.name)){r=!0;break}}else if(gn(n)||Sn(n)){r=!0;break}}n=n.parent}return r?t.length===0?wi(e):!Ci(e,t):!1}var xt=ne({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:[bi],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let a=Tn(o);if(!a)return;let s=n.get(a);if(!s||s.allowUsingWithArgs&&Ii(o))return;let i=s.allowUseInside||[];Ai(o,i)&&e.report({node:o,messageId:"preferHookAlternative",data:{message:s.message?` ${s.message}`:` use ${s.hookAlternative} instead`},suggest:s.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${s.hookAlternative}`,hookAlternative:s.hookAlternative},fix:l=>{let c=s.hookAlternative;return o.callee.type===j.Identifier?l.replaceText(o.callee,c):o.callee.type===j.MemberExpression&&o.callee.property.type===j.Identifier?l.replaceText(o.callee.property,c):null}}]:[]})}}}});import{AST_NODE_TYPES as q,AST_TOKEN_TYPES as hn,ESLintUtils as Ri}from"@typescript-eslint/utils";var ki=Ri.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),bn="prefer-single-line-if",vi=U({maxLineLength:_(pe()),maxNonSimpleConditionLength:_(pe())}),Oi=ki({name:bn,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[vi]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==q.BlockStatement||n.loc.start.line===n.loc.end.line||r.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let a=n.consequent.body[0];if(a.type===q.ReturnStatement){if(!wn(a))return}else if(!(a.type===q.ContinueStatement||a.type===q.BreakStatement))return;if(n.test.type===q.LogicalExpression||n.test.type===q.ConditionalExpression)return;let s;if(t.maxNonSimpleConditionLength){let u=En(n.test);if(!u&&n.test.type===q.UnaryExpression&&n.test.operator==="!"){let g=n.test.argument;En(g)&&(u=!0)}if(u&&(s=r.getText(n.test),s.length>t.maxNonSimpleConditionLength))return}s||(s=r.getText(n.test));let i=r.getText(a);if(s.includes(`
16
- `))return;let l=r.getTokenAfter(n);if(l&&l.type===hn.Punctuator&&l.value==="}"){let u=r.getTokenAfter(l);if(u&&u.type===hn.Keyword&&(u.value==="else"||u.value==="catch"))return}let c=Pi(r,n),p=`if (${s}) ${i}`;t.maxLineLength&&p.length+c.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:u=>u.replaceText(n,p)})}}}});function En(e){return e.type===q.CallExpression||e.type===q.BinaryExpression||e.type===q.MemberExpression&&xn(e)}function xn(e){return e.object.type===q.MemberExpression?xn(e.object):e.object.type!==q.Identifier}function Pi(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function wn(e){if(!e.argument)return!0;let t=e.argument;return t.type===q.ArrayExpression&&t.elements.length===0||t.type===q.ObjectExpression&&t.properties.length===0||t.type===q.Literal||t.type===q.Identifier||t.type===q.TemplateLiteral||t.type===q.TaggedTemplateExpression?!0:t.type===q.CallExpression?t.arguments.length===0:t.type===q.UnaryExpression?wn(t):!1}var wt={name:bn,rule:Oi};import{AST_NODE_TYPES as oe,ESLintUtils as Fi}from"@typescript-eslint/utils";var Ni=Fi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cn="react-compiler-migration",ji=U({disallowHooks:_(X(U({name:z(),replacement:z()}))),disallowMethods:_(X(U({name:z(),replacement:_(z()),requireTrueProp:_(z())})))}),Di=/eslint +react-compiler\/react-compiler: +\["error/;function Mi(e){return e.type===oe.Identifier?e.name.startsWith("use"):e.type===oe.MemberExpression&&e.property.type===oe.Identifier?e.property.name.startsWith("use"):!1}var _i=Ni({name:Cn,meta:{type:"suggestion",fixable:"code",docs:{description:"Rules to help migrate to the new React compiler"},messages:{disallowedFunctionOrMethod:"{{functionOrMethod}} is not supported in react compiler. Use {{replacement}} instead.",replace:"Replace with safe alternative {{replacement}}",disallowedMethodWithMissingRequireTrueProp:"{{method}} is should have a prop named {{requireTrueProp}} set to true when used in react compiler."},hasSuggestions:!0,schema:[ji]},defaultOptions:[{}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(Di.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let o=null,a=null;if(n.callee.type===oe.Identifier?(o=n.callee.name,a=n.callee):n.callee.type===oe.MemberExpression&&n.callee.property.type===oe.Identifier&&(o=n.callee.property.name,a=n.callee.property),o){let s=t.disallowHooks.find(i=>i.name===o);s&&a&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:s.name,replacement:s.replacement},suggest:[{messageId:"replace",data:{replacement:s.replacement},fix:i=>i.replaceText(a,s.replacement)}]})}}if(t.disallowMethods?.length&&Mi(n.callee)){for(let o of n.arguments)if(o.type===oe.ObjectExpression){for(let a of o.properties)if(a.type===oe.Property&&a.key.type===oe.Identifier){let s=a.key.name,i=t.disallowMethods.find(l=>l.name===s);if(i){if(i.requireTrueProp){let l=i.requireTrueProp,c=!1;for(let p of o.properties)if(p.type===oe.Property&&p.key.type===oe.Identifier&&p.key.name===l&&p.value.type===oe.Literal&&p.value.value===!0){c=!0;break}if(!c){e.report({node:a,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:i.name,requireTrueProp:l}});continue}}i.replacement&&e.report({node:a,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:l=>l.replaceText(a.key,i.replacement)}]})}}}}}}:{}}}),Ct={name:Cn,rule:_i};import{ESLintUtils as Li,TSESTree as $i}from"@typescript-eslint/utils";var zi=Li.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),In="require-description",Ui=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Wi=/^eslint-disable-(next-)?line$/u,Vi=zi({name:In,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of r.getAllComments()){let a=Hi(o);a!=null&&(n.has(a.kind)||a.description||e.report({loc:Ji(o.loc),messageId:"missingDescription"}))}}}}}),An={name:In,rule:Vi};function Hi(e){let{text:t,description:r}=Yi(e.value);if(!t)return null;let n=Ui.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let a=Wi.test(o);if(e.type===$i.AST_TOKEN_TYPES.Line&&!a||a&&e.loc.start.line!==e.loc.end.line)return null;let s=t.slice(n.index+o.length);return{kind:o,value:s.trim(),description:r}}function Yi(e){let t=e.split(/\s-{2,}\s/u);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Ji(e){return{start:{line:e.start.line,column:-1},end:e.end}}function vn(e){return/^use[A-Z0-9]/.test(e)}function ze(e){return e.type==="Identifier"?vn(e.name):e.type==="MemberExpression"&&!e.computed&&ze(e.property)?e.object.type==="Identifier":!1}function On(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Pn(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Fn(e){return!!(e.parent&&e.parent.callee&&Pn(e.parent.callee,"forwardRef"))}function Nn(e){return!!(e.parent&&e.parent.callee&&Pn(e.parent.callee,"memo"))}function It(e){for(;e;){let t=Dn(e);if(t&&(On(t)||ze(t))||Fn(e)||Nn(e))return!0;e=e.parent}return!1}function Rn(e){return!1}function At(e){return!1}var Bi=/eslint +react-compiler\/react-compiler: +\["error/,jn={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let l of e.sourceCode.getAllComments())if(Bi.test(l.value))return{CallExpression(c){let p=null;c.callee.name==="useMemo"?p="useMemo":c.callee.name==="useCallback"&&(p="useCallback"),p&&e.report({node:c,message:`"${p}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?l=>t(l):l=>e.sourceCode.getText(l),r=typeof e.getScope=="function"?()=>r():l=>e.sourceCode.getScope(l),n=null,o=[],a=[],s=new WeakSet;function i(l){for(let c of l.references){let p=c.identifier.parent;if(p.type==="VariableDeclarator"&&p.init&&p.init.type==="CallExpression"&&p.init.callee&&Rn(p.init.callee))for(let u of c.resolved.references)u!==c&&s.add(u.identifier)}}return{onCodePathSegmentStart:l=>a.push(l),onCodePathSegmentEnd:()=>a.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(l,c){let p=o.pop();if(p.size===0)return;let u=new Set;function g(T,m){let{cache:y}=g,A=y.get(T.id),I=new Set(m);if(I.has(T.id)){let E=[...I],F=E.slice(E.indexOf(T.id)+1);for(let H of F)u.add(H);return BigInt("0")}if(I.add(T.id),A!==void 0)return A;if(l.thrownSegments.includes(T))A=BigInt("0");else if(T.prevSegments.length===0)A=BigInt("1");else{A=BigInt("0");for(let E of T.prevSegments)A+=g(E,I)}return T.reachable&&A===BigInt("0")?y.delete(T.id):y.set(T.id,A),A}function h(T,m){let{cache:y}=h,A=y.get(T.id),I=new Set(m);if(I.has(T.id)){let E=Array.from(I),F=E.slice(E.indexOf(T.id)+1);for(let H of F)u.add(H);return BigInt("0")}if(I.add(T.id),A!==void 0)return A;if(l.thrownSegments.includes(T))A=BigInt("0");else if(T.nextSegments.length===0)A=BigInt("1");else{A=BigInt("0");for(let E of T.nextSegments)A+=h(E,I)}return y.set(T.id,A),A}function x(T){let{cache:m}=x,y=m.get(T.id);if(y===null)return 1/0;if(y!==void 0)return y;if(m.set(T.id,null),T.prevSegments.length===0)y=1;else{y=1/0;for(let A of T.prevSegments){let I=x(A);I<y&&(y=I)}y+=1}return m.set(T.id,y),y}g.cache=new Map,h.cache=new Map,x.cache=new Map;let b=h(l.initialSegment),k=Dn(c),w=It(c),M=k?On(k)||ze(k):Fn(c)||Nn(c),P=1/0;for(let T of l.finalSegments){if(!T.reachable)continue;let m=x(T);m<P&&(P=m)}for(let[T,m]of p){if(!T.reachable)continue;let y=T.nextSegments.length===0?P<=x(T):P<x(T),A=g(T)*h(T),I=u.has(T.id);for(let E of m)if(I&&!At(E)&&e.report({node:E,message:`React Hook "${t(E)}" 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.`}),M){if(c.async&&e.report({node:E,message:`React Hook "${t(E)}" cannot be called in an async function.`}),!I&&A!==b&&!At(E)){let H=`React Hook "${t(E)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(y?" Did you accidentally call a React Hook after an early return?":"");e.report({node:E,message:H})}}else if(c.parent&&(c.parent.type==="MethodDefinition"||c.parent.type==="ClassProperty")&&c.parent.value===c){let F=`React Hook "${t(E)}" 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:E,message:F})}else if(k){let F=`React Hook "${t(E)}" is called in function "${t(k)}" 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:E,message:F})}else if(c.type==="Program"){let F=`React Hook "${t(E)}" 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:E,message:F})}else if(w&&!At(E)){if(c.parent.type==="CallExpression"&&c.parent.callee.type==="Identifier"&&c.parent.callee.name==="useCallback"){let H=c.parent;if(H.parent.type==="VariableDeclarator"&&vn(H.parent.id.name))return}let F=`React Hook "${t(E)}" 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:E,message:F})}}},CallExpression(l){if(ze(l.callee)){let c=kn(o),p=kn(a),u=c.get(p);u||(u=[],c.set(p,u)),u.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||Rn(l.callee))&&l.arguments.length>0&&(n=l)},Identifier(l){n==null&&s.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${t(l)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(l){l===n&&(n=null)},FunctionDeclaration(l){It(l)&&i(r(l))},ArrowFunctionExpression(l){It(l)&&i(r(l))}}}};function Dn(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 kn(e){return e[e.length-1]}var Mn={[Tt.name]:Tt.rule,[et.name]:et.rule,[Qe.name]:Qe.rule,"rules-of-hooks":jn,"exhaustive-deps":zt,"require-description":An.rule,[tt.name]:tt.rule,[rt.name]:rt.rule,[Et.name]:Et.rule,[Ye.name]:Ye.rule,[Ze.name]:Ze.rule,[lt.name]:lt.rule,[wt.name]:wt.rule,[ot.name]:ot.rule,[nt.name]:nt.rule,[Be.name]:Be.rule,[Ct.name]:Ct.rule,[He.name]:He.rule,[Ke.name]:Ke.rule,[ft.name]:ft.rule,[mt.name]:mt.rule,[yt.name]:yt.rule,[gt.name]:gt.rule,[dt.name]:dt.rule,[xt.name]:xt.rule,[pt.name]:pt.rule,[ct.name]:ct.rule};var ma={rules:Mn};export{ma as extendedLintPlugin};
15
+ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let y=l.acquire(w),A=new Set,C=null;{let f=y.upper;for(;f&&(A.add(f),f.type!=="function");)f=f.upper;if(!f)return;C=f}let E=Array.isArray;function F(f){if(!E(f.defs))return!1;let d=f.defs[0];if(d==null||d.node.type!=="VariableDeclarator")return!1;let I=d.node.init;if(I==null)return!1;for(;I.type==="TSAsExpression";)I=I.expression;let R=d.node.parent;if(R==null&&(Ze(C.block,d.node.id),R=d.node.parent,R==null))return!1;if(R.kind==="const"&&I.type==="Literal"&&(typeof I.value=="string"||typeof I.value=="number"||I.value===null))return!0;if(I.type!=="CallExpression")return!1;let O=I.callee;if(O.type==="MemberExpression"&&O.object.name==="React"&&O.property!=null&&!O.computed&&(O=O.property),O.type!=="Identifier")return!1;let k=d.node.id,{name:N}=O;if(N==="useRef"&&k.type==="Identifier")return!0;if(yr(O)&&k.type==="Identifier"){for(let j of f.references)j!==k&&S.add(j.identifier);return!0}else if(N==="useState"||N==="useReducer"){if(k.type==="ArrayPattern"&&k.elements.length===2&&E(f.identifiers)){if(k.elements[1]===f.identifiers[0]){if(N==="useState"){let j=f.references,ie=0;for(let de=0;de<j.length;de++){if(j[de].isWrite()&&ie++,ie>1)return!1;c.set(j[de].identifier,k.elements[0])}}return!0}else if(k.elements[0]===f.identifiers[0]){if(N==="useState"){let j=f.references;for(let ie=0;ie<j.length;ie++)p.add(j[ie].identifier)}return!1}}}else if(N==="useTransition"&&k.type==="ArrayPattern"&&k.elements.length===2&&Array.isArray(f.identifiers)&&k.elements[1]===f.identifiers[0])return!0;return!1}function z(f){if(!E(f.defs))return!1;let d=f.defs[0];if(d==null||d.node==null||d.node.id==null)return!1;let I=d.node,R=C.childScopes,O=null,k;for(k=0;k<R.length;k++){let N=R[k],j=N.block;if(I.type==="FunctionDeclaration"&&j===I||I.type==="VariableDeclarator"&&j.parent===I){O=N;break}}if(O==null)return!1;for(k=0;k<O.through.length;k++){let N=O.through[k];if(N.resolved!=null&&A.has(N.resolved.scope)&&!q(N.resolved))return!1}return!0}let q=x(F,u),ee=x(z,g),Z=new Map;function he(f){let d=f.from,I=!1;for(;d.block!==w;)d.type==="function"&&(I=d.block.parent!=null&&d.block.parent.type==="ReturnStatement"),d=d.upper;return I}let ne=new Map,Re=new Map;fe(y);function fe(f){for(let d of f.references){if(!d.resolved||!A.has(d.resolved.scope))continue;let I=Ze(w,d.identifier),R=qt(I),O=ye(R,Re);if(m&&R.type==="Identifier"&&(R.parent.type==="MemberExpression"||R.parent.type==="OptionalMemberExpression")&&!R.parent.computed&&R.parent.property.type==="Identifier"&&R.parent.property.name==="current"&&he(d)&&Z.set(O,{reference:d,dependencyNode:R}),R.parent.type==="TSTypeQuery"||R.parent.type==="TSTypeReference")continue;let k=d.resolved.defs[0];if(k!=null&&!(k.node!=null&&k.node.init===w.parent)&&k.type!=="TypeParameter")if(ne.has(O))ne.get(O).references.push(d);else{let N=d.resolved,j=q(N)||ee(N);ne.set(O,{isStable:j,references:[d]})}}for(let d of f.childScopes)fe(d)}Z.forEach(({reference:f,dependencyNode:d},I)=>{let R=f.resolved.references,O=!1;for(let k=0;k<R.length;k++){let{identifier:N}=R[k],{parent:j}=N;if(j!=null&&j.type==="MemberExpression"&&!j.computed&&j.property.type==="Identifier"&&j.property.name==="current"&&j.parent.type==="AssignmentExpression"&&j.parent.left===j){O=!0;break}}O||i({node:d.parent.property,message:`The ref value '${I}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${I}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let pe=new Set;function me(f,d){pe.has(d)||(pe.add(d),i({node:f,message:`Assignments to the '${d}' variable from inside React Hook ${r(P)} will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ${r(P)}.`}))}let Ee=new Set;if(ne.forEach(({isStable:f,references:d},I)=>{f&&Ee.add(I),d.forEach(R=>{R.writeExpr&&me(R.writeExpr,I)})}),pe.size>0)return;if(!L){let f=null;if(ne.forEach(({isStable:d,references:I},R)=>{f||I.forEach(O=>{if(f)return;let k=O.identifier;if(!c.has(k))return;let j=O.from;for(;j.type!=="function";)j=j.upper;j.block===w&&(f=R)})}),f){let{suggestedDependencies:d}=Ge({dependencies:ne,declaredDependencies:[],stableDependencies:Ee,externalDependencies:new Set,isEffect:!0});i({node:P,message:`React Hook ${T} contains a call to '${f}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+d.join(", ")+`] as a second argument to the ${T} Hook.`,suggest:[{desc:`Add dependencies array: [${d.join(", ")}]`,fix(I){return I.insertTextAfter(w,`, [${d.join(", ")}]`)}}]})}return}let ve=[],ke=new Set;L.type!=="ArrayExpression"?i({node:L,message:`React Hook ${r(P)} 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.`}):L.elements.forEach(f=>{if(f===null)return;if(f.type==="SpreadElement"){i({node:f,message:`React Hook ${r(P)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}S.has(f)&&i({node:f,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(f)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(f)}\``,fix(O){return O.removeRange(f.range)}}]});let d;try{d=ye(f,Re)}catch(O){if(/Unsupported node type/.test(O.message)){f.type==="Literal"?ne.has(f.value)?i({node:f,message:`The ${f.raw} literal is not a valid dependency because it never changes. Did you mean to include ${f.value} in the array instead?`}):i({node:f,message:`The ${f.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):i({node:f,message:`React Hook ${r(P)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw O}let I=f;for(;I.type==="MemberExpression"||I.type==="OptionalMemberExpression"||I.type==="ChainExpression";)I=I.object||I.expression.object;let R=!C.through.some(O=>O.identifier===I);ve.push({key:d,node:f}),R||ke.add(d)});let{suggestedDependencies:zn,unnecessaryDependencies:Fe,missingDependencies:ge,duplicateDependencies:Nt}=Ge({dependencies:ne,declaredDependencies:ve,stableDependencies:Ee,externalDependencies:ke,isEffect:m}),Ne=zn;if(Nt.size+ge.size+Fe.size===0){if(t)return;ur({declaredDependencies:ve,declaredDependenciesNode:L,componentScope:C,scope:y}).forEach(({construction:d,isUsedOutsideOfHook:I,depType:R})=>{let O=R==="function"?"useCallback":"useMemo",k=R==="function"?"definition":"initialization",N=`wrap the ${k} of '${d.name.name}' in its own ${O}() Hook.`,j=I?`To fix this, ${N}`:`Move it inside the ${T} callback. Alternatively, ${N}`,ie=R==="conditional"||R==="logical expression"?"could make":"makes",de=`The '${d.name.name}' ${R} ${ie} the dependencies of ${T} Hook (at line ${L.loc.start.line}) change on every render. ${j}`,Dt;I&&d.type==="Variable"&&R==="function"&&(Dt=[{desc:`Wrap the ${k} of '${d.name.name}' in its own ${O}() Hook.`,fix(jt){let[Jn,qn]=O==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[jt.insertTextBefore(d.node.init,Jn),jt.insertTextAfter(d.node.init,qn)]}}]),i({node:d.node,message:de,suggest:Dt})});return}!m&&ge.size>0&&(Ne=Ge({dependencies:ne,declaredDependencies:[],stableDependencies:Ee,externalDependencies:ke,isEffect:m}).suggestedDependencies);function Yn(){if(ve.length===0)return!0;let f=ve.map(I=>I.key),d=f.slice().sort();return f.join(",")===d.join(",")}Yn()&&Ne.sort();function He(f){let d=f.split("."),I="";for(let R=0;R<d.length;R++){if(R!==0){let O=d.slice(0,R+1).join("."),k=Re.get(O)===!0;I+=k?"?.":"."}I+=d[R]}return I}function ze(f,d,I,R){return f.size===0?null:(f.size>1?"":d+" ")+I+" "+(f.size>1?"dependencies":"dependency")+": "+mr(Array.from(f).sort().map(O=>"'"+He(O)+"'"))+`. Either ${R} ${f.size>1?"them":"it"} or remove the dependency array.`}let ae="";if(Fe.size>0){let f=null;if(Array.from(Fe.keys()).forEach(d=>{f===null&&d.endsWith(".current")&&(f=d)}),f!==null)ae=` Mutable values like '${f}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(ke.size>0){let d=Array.from(ke)[0];y.set.has(d)||(ae=` Outer scope values like '${d}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!ae&&ge.has("props")){let f=ne.get("props");if(f==null)return;let d=f.references;if(!Array.isArray(d))return;let I=!0;for(let R=0;R<d.length;R++){let O=d[R],k=Ze(C.block,O.identifier);if(!k){I=!1;break}let N=k.parent;if(N==null){I=!1;break}if(N.type!=="MemberExpression"&&N.type!=="OptionalMemberExpression"){I=!1;break}}I&&(ae=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${T} call and refer to those specific props inside ${r(P)}.`)}if(!ae&&ge.size>0){let f=null;ge.forEach(d=>{if(f)return;let I=C.set.get(d),R=ne.get(d);if(R.references[0].resolved!==I)return;let O=I.defs[0];if(O==null||O.name==null||O.type!=="Parameter")return;let k=!1,N;for(let j=0;j<R.references.length;j++)if(N=R.references[j].identifier,N!=null&&N.parent!=null&&(N.parent.type==="CallExpression"||N.parent.type==="OptionalCallExpression")&&N.parent.callee===N){k=!0;break}k&&(f=d)}),f!==null&&(ae=` If '${f}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!ae&&ge.size>0){let f=null;if(ge.forEach(d=>{if(f!==null)return;let R=ne.get(d).references,O,k;for(let N=0;N<R.length;N++){for(O=R[N].identifier,k=O.parent;k!=null&&k!==C.block;){if(k.type==="CallExpression"){let j=c.get(k.callee);if(j!=null){if(j.name===d)f={missingDep:d,setter:k.callee.name,form:"updater"};else if(p.has(O))f={missingDep:d,setter:k.callee.name,form:"reducer"};else{let ie=R[N].resolved;if(ie!=null){let de=ie.defs[0];de!=null&&de.type==="Parameter"&&(f={missingDep:d,setter:k.callee.name,form:"inlineReducer"})}}break}}k=k.parent}if(f!==null)break}}),f!==null)switch(f.form){case"reducer":ae=` You can also replace multiple useState variables with useReducer if '${f.setter}' needs the current value of '${f.missingDep}'.`;break;case"inlineReducer":ae=` If '${f.setter}' needs the current value of '${f.missingDep}', you can also switch to useReducer instead of useState and read '${f.missingDep}' in the reducer.`;break;case"updater":ae=` You can also do a functional update '${f.setter}(${f.missingDep.slice(0,1)} => ...)' if you only need '${f.missingDep}' in the '${f.setter}' call.`;break;default:throw new Error("Unknown case.")}}i({node:L,message:`React Hook ${r(P)} has `+(ze(ge,"a","missing","include")||ze(Fe,"an","unnecessary","exclude")||ze(Nt,"a","duplicate","omit"))+ae,suggest:[{desc:`Update the dependencies array to be: [${Ne.map(He).join(", ")}]`,fix(f){return f.replaceText(L,`[${Ne.map(He).join(", ")}]`)}}]})}function v(w){let L=fr(w.callee,s);if(L===-1)return;let P=w.arguments[L],T=w.callee,m=Bt(T).name,y=w.arguments[L+1],A=/Effect($|[^a-z])/g.test(m);if(!P){i({node:T,message:`React Hook ${m} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!A)){if(!y&&!A){(m==="useMemo"||m==="useCallback")&&i({node:T,message:`React Hook ${m} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(P.type){case"FunctionExpression":case"ArrowFunctionExpression":b(P,y,T,m,A);return;case"Identifier":if(!y||y.elements&&y.elements.some(F=>F&&F.type==="Identifier"&&F.name===P.name))return;let C=n(w).set.get(P.name);if(C==null||C.defs==null)return;let E=C.defs[0];if(!E||!E.node||E.type!=="Variable"&&E.type!=="FunctionName")break;switch(E.node.type){case"FunctionDeclaration":b(E.node,y,T,m,A);return;case"VariableDeclarator":let F=E.node.init;if(!F)break;switch(F.type){case"ArrowFunctionExpression":case"FunctionExpression":b(F,y,T,m,A);return}break}break;default:i({node:T,message:`React Hook ${m} received a function whose dependencies are unknown. Pass an inline function instead.`});return}i({node:T,message:`React Hook ${m} has a missing dependency: '${P.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${P.name}]`,fix(C){return C.replaceText(y,`[${P.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let w of e.sourceCode.getAllComments())if(pr.test(w.value))return t=!0,{CallExpression:L=>v(L,!0)}}return{CallExpression:w=>v(w)}}};function Ge({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:o}){let a=s();function s(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((b,v)=>{let w=i(a,v);w.isUsed=!0,l(a,v,L=>{L.isSubtreeUsed=!0})}),t.forEach(({key:b})=>{let v=i(a,b);v.isSatisfiedRecursively=!0}),r.forEach(b=>{let v=i(a,b);v.isSatisfiedRecursively=!0});function i(b,v){let w=v.split("."),L=b;for(let P of w){let T=L.children.get(P);T||(T=s(),L.children.set(P,T)),L=T}return L}function l(b,v,w){let L=v.split("."),P=b;for(let T of L){let m=P.children.get(T);if(!m)return;w(m),P=m}}let c=new Set,p=new Set;u(a,c,p,b=>b);function u(b,v,w,L){b.children.forEach((P,T)=>{let m=L(T);if(P.isSatisfiedRecursively){P.isSubtreeUsed&&w.add(m);return}if(P.isUsed){v.add(m);return}u(P,v,w,y=>m+"."+y)})}let g=[],S=new Set,x=new Set;return t.forEach(({key:b})=>{p.has(b)?g.indexOf(b)===-1?g.push(b):x.add(b):S.add(b)}),c.forEach(b=>{g.push(b)}),{suggestedDependencies:g,unnecessaryDependencies:S,duplicateDependencies:x,missingDependencies:c}}function Se(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 Se(e.consequent)!=null||Se(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Se(e.left)!=null||Se(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Se(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Se(e.expression);case"TSAsExpression":return Se(e.expression)}return null}function ur({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let o=e.map(({key:s})=>{let i=r.variables.find(c=>c.name===s);if(i==null)return null;let l=i.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let c=Se(l.node.init);if(c!=null)return[i,c]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[i,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[i,"class"]:null}).filter(Boolean);function a(s){let i=!1;for(let l=0;l<s.references.length;l++){let c=s.references[l];if(c.writeExpr){if(i)return!0;i=!0;continue}let p=c.from;for(;p!==n&&p!=null;)p=p.upper;if(p!==n&&!Xt(t,c.identifier))return!0}return!1}return o.map(([s,i])=>({construction:s.defs[0],depType:i,isUsedOutsideOfHook:a(s)}))}function qt(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)?qt(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function Ke(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function ye(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return t&&t.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=ye(e.object,t),n=ye(e.property,null),o=`${r}.${n}`;return Ke(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=ye(e.object,t),n=ye(e.property,null),o=`${r}.${n}`;return Ke(e,t,o),o}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let n=ye(r.object,t),o=ye(r.property,null),a=`${n}.${o}`;return Ke(r,t,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function Bt(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function fr(e,t){let r=Bt(e);if(r.type!=="Identifier")return-1;switch(r.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(r===e&&t&&t.additionalHooks){let n;try{n=ye(r,null)}catch(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return t.additionalHooks.test(n)?0:-1}else return-1}}function Ze(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),dr(n,t))return n;if(Xt(n,t))for(let[o,a]of Object.entries(n))o!=="parent"&&(Yt(a)?(a.parent=n,r.push(a)):Array.isArray(a)&&a.forEach(s=>{Yt(s)&&(s.parent=n,r.push(s))}))}return null}function mr(e){let t="";for(let r=0;r<e.length;r++)t+=e[r],r===0&&e.length===2?t+=" and ":r===e.length-2&&e.length>2?t+=", and ":r<e.length-1&&(t+=", ");return t}function Yt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function dr(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function Xt(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function yr(e){return!1}import{AST_NODE_TYPES as je,ESLintUtils as Kt}from"@typescript-eslint/utils";import te from"typescript";var gr=Kt.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Gt="improved-no-unnecessary-condition",Sr=W({}),Tr=["string","number","bigint","boolean","symbol","undefined","object","function","never"],hr=new Set(Tr),Qe={name:Gt,rule:gr({name:Gt,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:[Sr]},defaultOptions:[{}],create(e){let t=Kt.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(i){return i.type===je.UnaryExpression&&i.operator==="typeof"}function o(i){return i.flags&te.TypeFlags.Any||i.flags&te.TypeFlags.Unknown?null:i.flags&te.TypeFlags.StringLike?["string"]:i.flags&te.TypeFlags.NumberLike?["number"]:i.flags&te.TypeFlags.BigIntLike?["bigint"]:i.flags&te.TypeFlags.BooleanLike?["boolean"]:i.flags&te.TypeFlags.ESSymbolLike?["symbol"]:i.flags&te.TypeFlags.Undefined||i.flags&te.TypeFlags.Void?["undefined"]:i.flags&te.TypeFlags.Null?["object"]:i.getCallSignatures().length>0?["function"]:i.flags&te.TypeFlags.Object?i.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:i.flags&te.TypeFlags.NonPrimitive?["object"]:i.flags&te.TypeFlags.Never?["never"]:null}function a(i){if(!r)return null;let l=t.esTreeNodeToTSNodeMap.get(i),c=r.getTypeAtLocation(l.expression);if(c.flags&te.TypeFlags.Any||c.flags&te.TypeFlags.Unknown)return null;let p=[];if(c.isUnion()){for(let g of c.types){let S=o(g);if(S)p.push(...S);else return null}return p}let u=o(c);return u?(p.push(...u),p):null}function s(i){if(!(i.operator==="==="||i.operator==="!=="))return;let c=null,p=null;if(n(i.left)?(c=i.left,p=i.right.type===je.Literal&&typeof i.right.value=="string"?i.right.value:null):n(i.right)&&(c=i.right,p=i.left.type===je.Literal&&typeof i.left.value=="string"?i.left.value:null),!c||!p||!Er(p,hr))return;let u=a(c);if(!u)return;let g=i.operator==="!==",S=u.includes(p);u.length===1?S&&!g?e.report({node:i,messageId:"unnecessaryTypeofCondition",data:{name:we(c,e),type:p}}):!S&&g?e.report({node:i,messageId:"unnecessaryTypeofCondition",data:{name:we(c,e),type:Array.from(u)[0]}}):!S&&!g?e.report({node:i,messageId:"alwaysFalseTypeofCondition",data:{name:we(c,e),actualType:De(u),conditionType:p}}):S&&g&&e.report({node:i,messageId:"alwaysFalseTypeofCondition",data:{name:we(c,e),actualType:De(u),conditionType:p}}):!S&&!g?e.report({node:i,messageId:"alwaysFalseTypeofCondition",data:{name:we(c,e),actualType:De(u),conditionType:p}}):!S&&g&&e.report({node:i,messageId:"unnecessaryTypeofCondition",data:{name:we(c,e),type:De(u)}})}return{BinaryExpression:s}}})};function De(e){return Array.from(new Set(e)).join(" | ")||"never"}function we(e,t){let r=e.argument;return r.type===je.Identifier?r.name:t.sourceCode.getText(r)}function Er(e,t){return t.has(e)}import{AST_NODE_TYPES as br,ESLintUtils as xr}from"@typescript-eslint/utils";var wr=xr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Zt="no-call-with-explicit-generics",Ir=W({functions:G(U())}),Cr=wr({name:Zt,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:[Ir]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:o}=n;o.type===br.Identifier&&r.has(o.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),et={name:Zt,rule:Cr};import{AST_NODE_TYPES as Le,ESLintUtils as Ar}from"@typescript-eslint/utils";var Rr=Ar.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Qt="no-call-with-inferred-generics",vr=Rr({name:Qt,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:o}=n;if(o.type!==Le.Identifier)return;let a=r.get(o.name);if(!a)return;let{minGenerics:s=1,allowAny:i,disallowTypes:l=t.disallowTypes}=a;(n.typeArguments?.params.length||0)<(s||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:s||0}}),!(i&&!l)&&n.typeArguments?.params?.some(p=>!i&&p.type===Le.TSAnyKeyword||l&&p.type===Le.TSTypeReference&&p.typeName.type===Le.Identifier&&l.includes(p.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),tt={name:Qt,rule:vr};import{ESLintUtils as kr}from"@typescript-eslint/utils";var Or=kr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),tn="no-commented-out-code",Pr=["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:"],J={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]+>/,colonDescriptiveComment:/^[a-zA-Z]+(\s+[a-zA-Z]+)*:\s+[a-zA-Z]+\s+[a-zA-Z][^{=,'"]*$/,jsdocComment:/^\s*[*\s]*$/},Fr=[") {","return;",J.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",J.stringAssignment,");",J.objectPropertyWithQuotes,J.computedPropertyAssignment,J.kebabCaseProperty,J.snakeCaseProperty,"&&","||","()",J.ternaryOperator,J.colonWithWord,J.quotedString,J.numberWithComma,J.arrayWithComma,J.objectWithComma,J.methodCall,J.arrayAccess,"?.(","??","=>",J.quotedPropertyKey],Nr=["/>","</",J.jsxSelfClosing,J.jsxElement,J.jsxOpeningTag,J.jsxClosingTag,J.htmlOpeningTag,J.htmlClosingTag],en=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Dr=Or({name:tn,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(n,o){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||J.jsdocComment.test(n))return!1;for(let s of en)if(a.startsWith(s))return!1;if(n.includes("https://")||a.includes(":")&&J.colonDescriptiveComment.test(a.trim()))return!1;if(o==="Block"){for(let s of Nr)if(typeof s=="string"){if(n.includes(s))return{wrongPattern:s}}else if(s.test(n))return{wrongPattern:`regex(${s.toString()})`};return!1}for(let s of Pr)if(a.startsWith(s))return{wrongPattern:s};for(let s of Fr)if(typeof s=="string"){if(n.includes(s))return{wrongPattern:s}}else if(s.test(n))return{wrongPattern:`regex(${s.toString()})`};return!1}function r(n,o){let a=n,s=a.trim();if(s.startsWith("`")&&(s.endsWith("`,")||s.endsWith("`;")||s.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let c=a.split(/```[\s\S]*?```/g);c.some(u=>/[a-zA-Z0-9]/.test(u))&&(a=c.join(""))}if(!a.includes("`"))return a;let i=a.split(/`[^`]*`/g);return i.some(c=>/[a-zA-Z0-9]/.test(c))?i.join(""):a}return{Program(){let o=e.sourceCode.getAllComments();for(let a of o){let s=r(a.value,a.type),i=t(s,a.type);i&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:i.wrongPattern,allowedPrefixes:en.join(", ")}})}}}}}),nt={name:tn,rule:Dr};import{ESLintUtils as jr,TSESTree as Lr}from"@typescript-eslint/utils";var Mr=jr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nn="no-default-export",_r=Mr({name:nn,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let r of t.specifiers)r.exported.type===Lr.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),rt={name:nn,rule:_r};import{ESLintUtils as $r}from"@typescript-eslint/utils";var Ur=$r.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),rn="no-leaked-text-in-jsx",Wr=[",",";","[","]","(",")"],Vr=Ur({name:rn,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(t){let r=t.value.trim();if(!r)return;let n="";Wr.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),it={name:rn,rule:Vr};import{AST_NODE_TYPES as Oe,ESLintUtils as Hr}from"@typescript-eslint/utils";var zr=Hr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),on="no-non-camel-case-functions",Yr=/^(\$?[a-z][a-zA-Z0-9]*)$/;function sn(e){if(e.typeName.type!==Oe.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Oe.Identifier&&t.name==="JSX"&&r.name==="Element"}var Jr=zr({name:on,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!Yr.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Oe.TSTypeReference?sn(r):r.type===Oe.TSUnionType&&r.types.some(o=>o.type===Oe.TSTypeReference&&sn(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),st={name:on,rule:Jr};import{ESLintUtils as qr,TSESTree as V}from"@typescript-eslint/utils";import{AST_NODE_TYPES as an}from"@typescript-eslint/utils";function Ie(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:Ie(e.parent,t,r===1/0?r:r-1)}function*ot(e){yield e,e.parent&&(yield*ot(e.parent))}function at(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function ln(e,t,r){let o=r.getDeclaredVariables(e).find(a=>a.name===t||a.identifiers[0]?.parent.type===an.Property&&a.identifiers[0]?.parent.key.type===an.Identifier&&a.identifiers[0]?.parent.key.name===t);return o?o.references.filter(a=>!a.init):[]}var Br=qr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cn="no-optional-root-props",Xr=Br({name:cn,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function t(n){let a=e.sourceCode.getDeclaredVariables(n)[0];if(!a||a.references.length!==1)return!1;let s=a.references[0];if(!s)return!1;for(let i of ot(s.identifier)){if("returnType"in i||i.type===V.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=i.parent;if(!l)return!1;if(l.type===V.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===V.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===V.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let p=Ie(l.parent.parent,V.AST_NODE_TYPES.VariableDeclaration,4);if(!p)return!1;let u=Me(p,e.sourceCode);return u?!(u.parent.type===V.AST_NODE_TYPES.CallExpression&&u.parent.callee.type===V.AST_NODE_TYPES.Identifier&&u.parent.callee.name==="memo"):!1}if(i.type===V.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===V.AST_NODE_TYPES.ArrowFunctionExpression){let c=Ie(l,V.AST_NODE_TYPES.VariableDeclaration);return c?!!Me(c,e.sourceCode):!1}if(l.type===V.AST_NODE_TYPES.FunctionDeclaration)return!!Me(l,e.sourceCode)}return!1}function r(n){n.key.type!==V.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:o=>{let a=Ie(n,V.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let s=e.sourceCode.getText(a);return o.replaceText(a,s.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===V.AST_NODE_TYPES.TSTypeLiteral&&!(_e(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===V.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(_e(n)||!t(n)))for(let o of n.body.body)o.type===V.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(n){if(n.typeName.type!==V.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==V.AST_NODE_TYPES.TSTypeLiteral)return;let a=Ie(n.parent,V.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let s=Me(a,e.sourceCode);if(!(!s||s.parent.type===V.AST_NODE_TYPES.CallExpression&&s.parent.callee.type===V.AST_NODE_TYPES.Identifier&&s.parent.callee.name==="memo"))for(let l of o.members)l.type===V.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function _e(e){return e?e.parent?.type===V.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===V.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Me(e,t){if(_e(e))return;let r;if(e.type===V.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===V.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let n=t.getScope(e);e.type===V.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let o=n.variables.find(s=>s.identifiers.includes(r));if(!o)return;let a=o.references.filter(s=>s.identifier!==r);if(!(a.length!==1||!a[0])&&!_e(a[0].identifier.parent.parent))return a[0].identifier}var lt={name:cn,rule:Xr};import{ESLintUtils as Gr}from"@typescript-eslint/utils";import ct from"node:path";var Kr=Gr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pn="no-relative-imports",Zr=W({find:U(),replacement:U()}),Qr=W({aliases:G(Zr),rootDir:M(U()),allowNotFoundAliases:M(be()),_dev_simulateFileName:M(U())}),ei=Kr({name:pn,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:[Qr]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(s){return s.startsWith(".")||s.startsWith("..")}function o(s,i){let l=ct.dirname(i);return ct.resolve(l,s)}function a(s){let i=t.rootDir??process.cwd(),l=ct.relative(i,s);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:c,replacement:p}of t.aliases)if(l.startsWith(p)){let u=l.replace(p,c);return{alias:c,newPath:u}}return null}return{ImportDeclaration(s){let i=s.source.value;if(!n(i))return;let l=o(i,r),c=a(l);!c&&t.allowNotFoundAliases||e.report({node:s,messageId:c?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:c?.alias},fix:c?p=>p.replaceText(s.source,`'${c.newPath}'`):void 0})}}}}),pt={name:pn,rule:ei};import{AST_NODE_TYPES as $e}from"@typescript-eslint/utils";import*as Te from"zod/v4";var ti=Te.object({alternativeMsgs:Te.object({inArrayFind:Te.string().optional(),inArrayFilter:Te.string().optional()}).optional(),__dev_simulateFileName:Te.string().optional()});function ni(e){return e.typeAnnotation.type!==$e.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}function ri(e){return/\.(typeGuards|type-guards)\.(ts|tsx)$/.test(e)}function ii(e){let t=e.parent;for(;t;){if(t.type===$e.CallExpression&&t.callee.type===$e.MemberExpression&&t.callee.property.type===$e.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var ut=B({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[xe(ti)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(ri(r))return{};function n(o){if(!ni(o))return;let a=ii(o),s=[];if(t.alternativeMsgs&&a){let i=a.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let l=a.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:l,data:{message:i}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});import{AST_NODE_TYPES as Ce}from"@typescript-eslint/utils";var si="no-unnecessary-async-on-jsx-props";function oi(e){if(e.body.type!==Ce.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let r=t[0];return!r||r.type!==Ce.ExpressionStatement?!1:r.expression.type===Ce.AwaitExpression}var ft=B({name:si,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function t(r){oi(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,a=[],s=o.getFirstToken(r,l=>l.value==="async");if(s){let l=o.getTokenAfter(s);l?a.push(n.replaceTextRange([s.range[0],l.range[0]],"")):a.push(n.remove(s))}function i(l){if(l.type===Ce.AwaitExpression){let c=o.getFirstToken(l);if(c&&c.value==="await"){let p=o.getTokenAfter(c);p?a.push(n.replaceTextRange([c.range[0],p.range[0]],"")):a.push(n.remove(c))}}if(l.type===Ce.BlockStatement)for(let c of l.body)i(c);else l.type===Ce.ExpressionStatement&&i(l.expression)}return i(r.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});import{AST_NODE_TYPES as Pe,ESLintUtils as fn}from"@typescript-eslint/utils";import*as mt from"typescript";var ai=fn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),un="no-unnecessary-casting",li=W({additionalCastFunctions:M(G(W({name:U(),expectedType:Lt(["string","number"])})))}),dt={name:un,rule:ai({name:un,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:[li],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=fn.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function s(p,u){switch(p.type){case Pe.Literal:return u==="number"?typeof p.value=="number":typeof p.value=="string";case Pe.TemplateLiteral:return u==="string";case Pe.UnaryExpression:return u==="number"?p.operator==="+"||p.operator==="-"||p.operator==="~":!1;default:return!1}}function i(p,u){return u==="number"?!!(p.flags&mt.TypeFlags.NumberLike):!!(p.flags&mt.TypeFlags.StringLike)}function l(p,u){return g=>g.replaceText(p,e.sourceCode.getText(u))}function c(p){if(!a||p.arguments.length!==1)return;let u=p.arguments[0];if(!u||u.type===Pe.SpreadElement)return;let{callee:g}=p;if(g.type!==Pe.Identifier)return;let S=g.name,x=n.find(v=>v.name===S);if(!x)return;if(s(u,x.expectedType)||i(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(u)),x.expectedType)){let v,w;S==="Number"?v="unnecessaryNumberCasting":S==="String"?v="unnecessaryStringCasting":(v="unnecessaryCustomCasting",w={name:x.name,type:x.expectedType}),e.report({node:p,messageId:v,...w?{data:w}:{},fix:l(p,u)})}}return{CallExpression:c}}})};import{AST_NODE_TYPES as Ue}from"@typescript-eslint/utils";import*as se from"zod/v4";var ci=se.object({methods:se.union([se.array(se.string()),se.literal("array")])}),yt=B({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[se.toJSONSchema(ci)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(i){return Array.isArray(r)?r.includes(i):n.has(i)}function a(i){let{callee:l}=i;if(l.type===Ue.MemberExpression){let c=l.property;if(c.type===Ue.Identifier)return c.name}return null}function s(i,l){if(i.type!==Ue.Identifier||!i.typeAnnotation)return;let c=l.parent;if(c.type===Ue.CallExpression){let p=a(c);p&&o(p)&&c.arguments.indexOf(l)===0&&e.report({node:i.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(g){return g.remove(i.typeAnnotation)}})}}return{ArrowFunctionExpression(i){for(let l of i.params)s(l,i)},FunctionExpression(i){for(let l of i.params)s(l,i)}}}});import{AST_NODE_TYPES as re}from"@typescript-eslint/utils";var gt=B({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===re.ObjectPattern||!t.init||t.init.type!==re.ObjectExpression||t.id.type===re.Identifier&&t.id.typeAnnotation||t.parent.parent.type===re.ExportNamedDeclaration)return;let r=new Map;for(let s of t.init.properties)s.type===re.Property&&s.key.type===re.Identifier&&r.set(s.key.name,s);if(r.size===0||t.id.type!==re.Identifier)return;let n=pi(t,e.sourceCode);if(n.length===0)return;let o=t.init.properties.some(s=>s.type!==re.Property?!1:s.value.type===re.FunctionExpression),a=new Set;for(let s of n){if(s.identifier.parent.type!==re.MemberExpression)return;let i=s.identifier.parent;if(i.object!==s.identifier)return;if(i.computed)if(i.property.type===re.Literal&&typeof i.property.value=="string")a.add(i.property.value);else return;else{if(i.property.type!==re.Identifier)return;a.add(i.property.name)}if(i.parent.type===re.CallExpression&&o)return}for(let[s,i]of r)a.has(s)||e.report({node:i,messageId:"unusedObjectProperty",data:{name:s}})}}}});function pi(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}import{AST_NODE_TYPES as Y,ESLintUtils as ui}from"@typescript-eslint/utils";var fi=W({selectors:G(W({name:U(),selectorProp:M(U()),selectorArgPos:M(ue()),returnProp:M(U())}))}),mi=ui.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mn="no-unused-selected-values",St={name:mn,rule:mi({name:mn,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[fi]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===Y.CallExpression&&(a=o.init),!a)return;let s=yi(a);if(!s)return;let i=n.get(s);if(!i)return;let l=di(a,i.selectorArgPos??0,i.selectorProp);if(!l)return;let c=gi(l);if(!c)return;let p=dn(c.properties,void 0);if(!p)return;if(o.id.type===Y.ObjectPattern){let S=dn(o.id.properties,i.returnProp);if(!S)return;for(let[x,b]of p)S.has(x)||e.report({node:b,messageId:"unusedSelectedValue",data:{name:x}});return}if(o.id.type!==Y.Identifier||i.returnProp)return;let u=Si(o,e.sourceCode);if(u.length===0)return;let g=new Set;for(let S of u){if(S.identifier.parent.type!==Y.MemberExpression)return;let x=S.identifier.parent.property;if(x.type!==Y.Identifier)return;g.add(x.name)}for(let[S,x]of p)g.has(S)||e.report({node:x,messageId:"unusedSelectedValue",data:{name:S}})}}}})};function di(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===Y.ArrowFunctionExpression||n.type===Y.FunctionExpression)return n;if(r&&n.type===Y.ObjectExpression){let o=n.properties.find(s=>s.type===Y.Property&&s.key.type===Y.Identifier&&s.key.name===r);if(o?.type!==Y.Property)return null;let a=o.value;if(a.type===Y.ArrowFunctionExpression||a.type===Y.FunctionExpression)return a}return null}function yi(e){return e.callee.type===Y.Identifier?e.callee.name:e.callee.type===Y.MemberExpression&&e.callee.property.type===Y.Identifier?e.callee.property.name:null}function gi(e){if(e.body.type===Y.ObjectExpression)return e.body;if(e.body.type===Y.BlockStatement){let t=e.body.body.filter(r=>r.type===Y.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==Y.ObjectExpression?null:t[0].argument}return null}function dn(e,t){let r=e;if(t){let o=e.find(a=>a.type===Y.Property&&a.key.type===Y.Identifier&&a.key.name===t);if(o?.type!==Y.Property||o.value.type!==Y.ObjectPattern)return null;r=o.value.properties}let n=new Map;for(let o of r){if(o.type!==Y.Property||o.key.type!==Y.Identifier)return null;n.set(o.key.name,o)}return n.size>0?n:null}function Si(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}import{AST_NODE_TYPES as H}from"@typescript-eslint/utils";var Tt=B({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(a=>a.type===H.ImportDeclaration&&a.source.value==="t-state-form"))return{};let n=null,o=!1;return{CallExpression(a){if(o)return;if(!n){let i=Ti(a);i&&(n=i);return}let s=hi(a,e.sourceCode);if(s){o=!0;for(let i of s)n.delete(i);if(n.size!==0)for(let[i,l]of n)e.report({node:l,messageId:"unusedField",data:{name:i}})}}}}});function Ti(e){if(!(e.callee.type===H.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==H.ObjectExpression)return null;let n=at(r.properties,a=>a.type!==H.Property||a.key.type!==H.Identifier||a.key.name!=="initialConfig"?null:a.value.type===H.ObjectExpression?a.value:a.value.type===H.ArrowFunctionExpression||a.value.type===H.FunctionExpression?Ei(a.value):null);if(!n)return null;let o=new Map;for(let a of n.properties)a.type===H.Property&&a.key.type===H.Identifier&&o.set(a.key.name,a);return o}function hi(e,t){if(!(e.callee.type===H.Identifier&&e.callee.name==="useFormState")||e.parent.type!==H.VariableDeclarator||e.parent.id.type!==H.ObjectPattern||!at(e.parent.id.properties,s=>s.type===H.Property&&s.key.type===H.Identifier&&s.key.name==="formFields"&&s))return null;let o=ln(e.parent,"formFields",t),a=new Set;for(let{identifier:s}of o){if(s.type!==H.Identifier||s.parent.type===H.Property&&s.parent.parent.type===H.ObjectExpression&&s.parent.parent.parent.type===H.ReturnStatement||s.parent.type===H.ReturnStatement)return null;if(s.parent.type===H.MemberExpression){if(s.parent.object.type!==H.Identifier||s.parent.property.type!==H.Identifier)return null;a.add(s.parent.property.name)}}return a}function Ei(e){if(e.body.type===H.ObjectExpression)return e.body;if(e.body.type===H.BlockStatement){let t=e.body.body.filter(r=>r.type===H.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==H.ObjectExpression?null:t[0].argument}return null}import{AST_NODE_TYPES as $,ESLintUtils as bi}from"@typescript-eslint/utils";var xi=bi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function yn(e){let t=[];for(let r of e.members)r.type===$.TSPropertySignature&&r.key.type===$.Identifier&&t.push([r.key.name,r]);return t}function gn(e,...t){for(let r of t)e.set(...r);return e}var wi=W({forceCheckOnFCPropTypesWithName:M(G(U()))}),Sn="no-unused-type-props-in-args",ht=null,Ii=xi({name:Sn,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:[wi],fixable:"code"},defaultOptions:[{}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r}=t;r&&!ht&&(ht=r.map(i=>new RegExp(i)));function n(i,l,c,p,u=!0){let g=c.name,S=e.sourceCode.getScope(l).references.find(v=>v.identifier.name===g)?.resolved,x=i&&ht?.some(v=>v.test(g));if(!S||!x&&S.references.filter(v=>v.isTypeReference).length>1)return;let b=S?.defs[0]?.node;if(!(u&&b?.parent?.type===$.ExportNamedDeclaration)){if(b?.type===$.TSTypeAliasDeclaration){o(i,l,p,b.typeAnnotation,!0);return}if(b?.type===$.TSInterfaceDeclaration){o(i,l,p,b.body,!0);return}}}function o(i,l,c,p,u){if(p.type===$.TSInterfaceBody){for(let g of p.body)g.type===$.TSPropertySignature&&g.key.type===$.Identifier&&c.set(g.key.name,g);return}if(p.type===$.TSTypeLiteral){gn(c,...yn(p));return}if(p.type===$.TSIntersectionType){for(let g of p.types)o(i,l,c,g,!0);return}u||p.type===$.TSTypeReference&&p.typeName.type===$.Identifier&&n(i,l,p.typeName,c)}function a(i,l,c){for(let p of c)if(p.type==="ObjectPattern"&&p.typeAnnotation){let u=new Map;if(o(i,l,u,p.typeAnnotation.typeAnnotation,!1),u.size===0)continue;s(p,u)}else p.type===$.AssignmentPattern&&p.left.type===$.ObjectPattern&&a(i,l,[p.left])}function s(i,l){let c=[];if(i.properties.at(-1)?.type===$.RestElement)return;for(let S of i.properties)S.type===$.Property&&S.key.type===$.Identifier&&c.push(S.key.name);let u=[],g=[];for(let[S,x]of l)c.includes(S)||(g.push(S),u.push({node:x,messageId:"unusedObjectTypeProperty",data:{propertyName:S}}));for(let[S,x]of u.entries())e.report({...x,fix:S===u.length-1?b=>{let v=i.properties.at(-1),w=g.join(", ");return v?v?.type===$.RestElement?null:b.insertTextAfter(v,`, ${w}`):b.insertTextBeforeRange([i.range[0]+1,i.range[1]],`${w}`)}:void 0})}return{VariableDeclaration(i){let l=i.declarations[0];if(!l)return;let c=new Map,p=l.id.type===$.Identifier&&l.id.typeAnnotation?.typeAnnotation.type===$.TSTypeReference&&l.id.typeAnnotation.typeAnnotation.typeName.type===$.Identifier&&l.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&l.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(p){if(p.type===$.TSTypeReference&&p.typeName.type===$.Identifier)n(!0,i,p.typeName,c,!1);else if(p.type===$.TSTypeLiteral)gn(c,...yn(p));else if(p.type===$.TSIntersectionType)for(let u of p.types)u.type===$.TSTypeReference&&u.typeName.type===$.Identifier?n(!0,i,u.typeName,c,!1):o(!0,i,c,u,!0);if(c.size!==0&&l.init?.type===$.ArrowFunctionExpression){let u=l.init.params[0];if(!u){e.report({node:l.init,messageId:"missingComponentParam"});return}u.type===$.ObjectPattern&&s(u,c)}}},FunctionDeclaration:function(i){a(!1,i,i.params)},ArrowFunctionExpression(i){a(!1,i,i.params)}}}}),Et={name:Sn,rule:Ii};import{AST_NODE_TYPES as ce}from"@typescript-eslint/utils";var bt=B({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let t=new Set;function r(n){return n.callee.type===ce.Identifier?t.has(n.callee.name):n.callee.type===ce.MemberExpression&&n.callee.object.type===ce.Identifier&&n.callee.property.type===ce.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let o of n.specifiers)o.type===ce.ImportSpecifier&&o.imported.type===ce.Identifier&&o.imported.name==="useRef"&&t.add(o.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===ce.CallExpression&&r(n.init)&&n.id.type===ce.Identifier){let a=e.sourceCode.getScope(n).set.get(n.id.name);if(a){let s=!1;for(let i of a.references){let c=i.identifier.parent;if(c!==n&&!(c.type===ce.JSXExpressionContainer&&c.parent.type===ce.JSXAttribute&&c.parent.name.type===ce.JSXIdentifier&&c.parent.name.name==="ref")){s=!0;break}}s||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});import{AST_NODE_TYPES as xt,ESLintUtils as Ci}from"@typescript-eslint/utils";var Ai=Ci.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),hn="prefer-named-functions",Tn=new Map,Ri=Ai({name:hn,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[t]){let r=null;if(t.ignoreRegex){let n=Tn.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),Tn.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===xt.ArrowFunctionExpression&&n.id.type===xt.Identifier){let o=n.id.name;if(n.id.typeAnnotation||r&&r.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==xt.BlockStatement)return;let a=n.parent,s=n.init.params,i=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:c=>c.replaceText(a,`${l.async?"async ":""}function ${o}(${s.map(p=>e.sourceCode.getText(p)).join(", ")||""}) ${e.sourceCode.getText(i)}`)}]})}}}}}),wt={name:hn,rule:Ri};import{AST_NODE_TYPES as D}from"@typescript-eslint/utils";var vi=W({disallowedFunctions:G(W({name:U(),allowUsingWithArgs:M(be()),hookAlternative:M(U()),message:M(U()),allowUseInside:M(G(U()))}))});function We(e){return/^use[A-Z]/.test(e)}function En(e){return/^[A-Z]/.test(e)}function ki(e){return e.type===D.Identifier?We(e.name):e.type===D.MemberExpression&&e.property.type===D.Identifier?We(e.property.name):!1}function bn(e,t){return e.type===D.Identifier?e.name===t:e.type===D.MemberExpression&&e.object.type===D.Identifier&&e.property.type===D.Identifier?e.object.name==="React"&&e.property.name===t:!1}function xn(e){return!!(e.parent&&e.parent.type===D.CallExpression&&bn(e.parent.callee,"forwardRef"))}function wn(e){return!!(e.parent&&e.parent.type===D.CallExpression&&bn(e.parent.callee,"memo"))}function It(e){if(e.type===D.FunctionDeclaration||e.type===D.FunctionExpression&&e.id)return e.id||void 0;if(e.type===D.FunctionExpression||e.type===D.ArrowFunctionExpression){if(e.parent.type===D.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===D.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===D.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===D.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Oi(e){let t=e.parent,r=!1;for(;t;){if(t.type===D.FunctionDeclaration||t.type===D.FunctionExpression||t.type===D.ArrowFunctionExpression){let n=It(t);if(n&&n.type===D.Identifier){if(En(n.name)||We(n.name))return!r;r=!0}else{if(xn(t)||wn(t))return!r;if(t.parent.type===D.CallExpression){let o=t.parent;ki(o.callee)||(r=!0)}else t.parent.type===D.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function In(e){return e.callee.type===D.Identifier?e.callee.name:e.callee.type===D.MemberExpression&&e.callee.property.type===D.Identifier?e.callee.property.name:null}function Pi(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===D.FunctionDeclaration||r.type===D.FunctionExpression||r.type===D.ArrowFunctionExpression){let n=It(r);if(n&&n.type===D.Identifier&&t.includes(n.name))return!0}else if(r.type===D.CallExpression){let n=In(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function Fi(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===D.Identifier&&t.name==="undefined")}function Ni(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===D.FunctionDeclaration||n.type===D.FunctionExpression||n.type===D.ArrowFunctionExpression){let o=It(n);if(o&&o.type===D.Identifier){if(En(o.name)||We(o.name)){r=!0;break}}else if(xn(n)||wn(n)){r=!0;break}}n=n.parent}return r?t.length===0?Oi(e):!Pi(e,t):!1}var Ct=B({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[vi],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let a=In(o);if(!a)return;let s=n.get(a);if(!s||s.allowUsingWithArgs&&Fi(o))return;let i=s.allowUseInside||[];Ni(o,i)&&e.report({node:o,messageId:"preferHookAlternative",data:{message:s.message?` ${s.message}`:` use ${s.hookAlternative} instead`},suggest:s.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${s.hookAlternative}`,hookAlternative:s.hookAlternative},fix:l=>{let c=s.hookAlternative;return o.callee.type===D.Identifier?l.replaceText(o.callee,c):o.callee.type===D.MemberExpression&&o.callee.property.type===D.Identifier?l.replaceText(o.callee.property,c):null}}]:[]})}}}});import{AST_NODE_TYPES as X,AST_TOKEN_TYPES as Cn,ESLintUtils as Di}from"@typescript-eslint/utils";var ji=Di.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Rn="prefer-single-line-if",Li=W({maxLineLength:M(ue()),maxNonSimpleConditionLength:M(ue())}),Mi=ji({name:Rn,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[Li]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==X.BlockStatement||n.loc.start.line===n.loc.end.line||r.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let a=n.consequent.body[0];if(a.type===X.ReturnStatement){if(!kn(a))return}else if(!(a.type===X.ContinueStatement||a.type===X.BreakStatement))return;if(n.test.type===X.LogicalExpression||n.test.type===X.ConditionalExpression)return;let s;if(t.maxNonSimpleConditionLength){let u=An(n.test);if(!u&&n.test.type===X.UnaryExpression&&n.test.operator==="!"){let g=n.test.argument;An(g)&&(u=!0)}if(u&&(s=r.getText(n.test),s.length>t.maxNonSimpleConditionLength))return}s||(s=r.getText(n.test));let i=r.getText(a);if(s.includes(`
16
+ `))return;let l=r.getTokenAfter(n);if(l&&l.type===Cn.Punctuator&&l.value==="}"){let u=r.getTokenAfter(l);if(u&&u.type===Cn.Keyword&&(u.value==="else"||u.value==="catch"))return}let c=_i(r,n),p=`if (${s}) ${i}`;t.maxLineLength&&p.length+c.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:u=>u.replaceText(n,p)})}}}});function An(e){return e.type===X.CallExpression||e.type===X.BinaryExpression||e.type===X.MemberExpression&&vn(e)}function vn(e){return e.object.type===X.MemberExpression?vn(e.object):e.object.type!==X.Identifier}function _i(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function kn(e){if(!e.argument)return!0;let t=e.argument;return t.type===X.ArrayExpression&&t.elements.length===0||t.type===X.ObjectExpression&&t.properties.length===0||t.type===X.Literal||t.type===X.Identifier||t.type===X.TemplateLiteral||t.type===X.TaggedTemplateExpression?!0:t.type===X.CallExpression?t.arguments.length===0:t.type===X.UnaryExpression?kn(t):!1}var At={name:Rn,rule:Mi};import{AST_NODE_TYPES as oe,ESLintUtils as $i}from"@typescript-eslint/utils";var Ui=$i.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),On="react-compiler-migration",Wi=W({disallowHooks:M(G(W({name:U(),replacement:U()}))),disallowMethods:M(G(W({name:U(),replacement:M(U()),requireTrueProp:M(U())})))}),Vi=/eslint +react-compiler\/react-compiler: +\["error/;function Hi(e){return e.type===oe.Identifier?e.name.startsWith("use"):e.type===oe.MemberExpression&&e.property.type===oe.Identifier?e.property.name.startsWith("use"):!1}var zi=Ui({name:On,meta:{type:"suggestion",fixable:"code",docs:{description:"Rules to help migrate to the new React compiler"},messages:{disallowedFunctionOrMethod:"{{functionOrMethod}} is not supported in react compiler. Use {{replacement}} instead.",replace:"Replace with safe alternative {{replacement}}",disallowedMethodWithMissingRequireTrueProp:"{{method}} is should have a prop named {{requireTrueProp}} set to true when used in react compiler."},hasSuggestions:!0,schema:[Wi]},defaultOptions:[{}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(Vi.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let o=null,a=null;if(n.callee.type===oe.Identifier?(o=n.callee.name,a=n.callee):n.callee.type===oe.MemberExpression&&n.callee.property.type===oe.Identifier&&(o=n.callee.property.name,a=n.callee.property),o){let s=t.disallowHooks.find(i=>i.name===o);s&&a&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:s.name,replacement:s.replacement},suggest:[{messageId:"replace",data:{replacement:s.replacement},fix:i=>i.replaceText(a,s.replacement)}]})}}if(t.disallowMethods?.length&&Hi(n.callee)){for(let o of n.arguments)if(o.type===oe.ObjectExpression){for(let a of o.properties)if(a.type===oe.Property&&a.key.type===oe.Identifier){let s=a.key.name,i=t.disallowMethods.find(l=>l.name===s);if(i){if(i.requireTrueProp){let l=i.requireTrueProp,c=!1;for(let p of o.properties)if(p.type===oe.Property&&p.key.type===oe.Identifier&&p.key.name===l&&p.value.type===oe.Literal&&p.value.value===!0){c=!0;break}if(!c){e.report({node:a,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:i.name,requireTrueProp:l}});continue}}i.replacement&&e.report({node:a,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:l=>l.replaceText(a.key,i.replacement)}]})}}}}}}:{}}}),Rt={name:On,rule:zi};import{ESLintUtils as Yi,TSESTree as Ji}from"@typescript-eslint/utils";var qi=Yi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pn="require-description",Bi=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Xi=/^eslint-disable-(next-)?line$/u,Gi=qi({name:Pn,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of r.getAllComments()){let a=Ki(o);a!=null&&(n.has(a.kind)||a.description||e.report({loc:Qi(o.loc),messageId:"missingDescription"}))}}}}}),Fn={name:Pn,rule:Gi};function Ki(e){let{text:t,description:r}=Zi(e.value);if(!t)return null;let n=Bi.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let a=Xi.test(o);if(e.type===Ji.AST_TOKEN_TYPES.Line&&!a||a&&e.loc.start.line!==e.loc.end.line)return null;let s=t.slice(n.index+o.length);return{kind:o,value:s.trim(),description:r}}function Zi(e){let t=e.split(/\s-{2,}\s/u);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Qi(e){return{start:{line:e.start.line,column:-1},end:e.end}}import{AST_NODE_TYPES as vt}from"@typescript-eslint/utils";import{z as Ae}from"zod/v4";var es=Ae.object({varsToCheck:Ae.array(Ae.object({selector:Ae.string(),prop:Ae.string(),errorMsg:Ae.string().optional()}))}),kt=B({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require variables from specific function calls to be used (any usage counts as potentially accessing required properties)"},messages:{propNotRead:'Variable "{{varName}}" is never used. {{customMsg}}'},schema:[xe(es)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map,n={};for(let o of t.varsToCheck)n[o.selector]=a=>{a.type===vt.VariableDeclarator&&a.id.type===vt.Identifier&&r.set(a.id.name,{prop:o.prop,errorMsg:o.errorMsg,node:a.id})};return{...n,"Program:exit"(){for(let[o,{prop:a,errorMsg:s,node:i}]of r){let c=e.sourceCode.getScope(i).set.get(o);if(c){let p=!1;for(let u of c.references){let g=u.identifier,S=g.parent;if(!(S.type===vt.VariableDeclarator&&S.id===g)){p=!0;break}}p||e.report({node:i,messageId:"propNotRead",data:{prop:a,varName:o,customMsg:s||""}})}}}}}});function jn(e){return/^use[A-Z0-9]/.test(e)}function Ve(e){return e.type==="Identifier"?jn(e.name):e.type==="MemberExpression"&&!e.computed&&Ve(e.property)?e.object.type==="Identifier":!1}function Ln(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Mn(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function _n(e){return!!(e.parent&&e.parent.callee&&Mn(e.parent.callee,"forwardRef"))}function $n(e){return!!(e.parent&&e.parent.callee&&Mn(e.parent.callee,"memo"))}function Ot(e){for(;e;){let t=Wn(e);if(t&&(Ln(t)||Ve(t))||_n(e)||$n(e))return!0;e=e.parent}return!1}function Nn(e){return!1}function Pt(e){return!1}var ts=/eslint +react-compiler\/react-compiler: +\["error/,Un={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let l of e.sourceCode.getAllComments())if(ts.test(l.value))return{CallExpression(c){let p=null;c.callee.name==="useMemo"?p="useMemo":c.callee.name==="useCallback"&&(p="useCallback"),p&&e.report({node:c,message:`"${p}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?l=>t(l):l=>e.sourceCode.getText(l),r=typeof e.getScope=="function"?()=>r():l=>e.sourceCode.getScope(l),n=null,o=[],a=[],s=new WeakSet;function i(l){for(let c of l.references){let p=c.identifier.parent;if(p.type==="VariableDeclarator"&&p.init&&p.init.type==="CallExpression"&&p.init.callee&&Nn(p.init.callee))for(let u of c.resolved.references)u!==c&&s.add(u.identifier)}}return{onCodePathSegmentStart:l=>a.push(l),onCodePathSegmentEnd:()=>a.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(l,c){let p=o.pop();if(p.size===0)return;let u=new Set;function g(T,m){let{cache:y}=g,A=y.get(T.id),C=new Set(m);if(C.has(T.id)){let E=[...C],F=E.slice(E.indexOf(T.id)+1);for(let z of F)u.add(z);return BigInt("0")}if(C.add(T.id),A!==void 0)return A;if(l.thrownSegments.includes(T))A=BigInt("0");else if(T.prevSegments.length===0)A=BigInt("1");else{A=BigInt("0");for(let E of T.prevSegments)A+=g(E,C)}return T.reachable&&A===BigInt("0")?y.delete(T.id):y.set(T.id,A),A}function S(T,m){let{cache:y}=S,A=y.get(T.id),C=new Set(m);if(C.has(T.id)){let E=Array.from(C),F=E.slice(E.indexOf(T.id)+1);for(let z of F)u.add(z);return BigInt("0")}if(C.add(T.id),A!==void 0)return A;if(l.thrownSegments.includes(T))A=BigInt("0");else if(T.nextSegments.length===0)A=BigInt("1");else{A=BigInt("0");for(let E of T.nextSegments)A+=S(E,C)}return y.set(T.id,A),A}function x(T){let{cache:m}=x,y=m.get(T.id);if(y===null)return 1/0;if(y!==void 0)return y;if(m.set(T.id,null),T.prevSegments.length===0)y=1;else{y=1/0;for(let A of T.prevSegments){let C=x(A);C<y&&(y=C)}y+=1}return m.set(T.id,y),y}g.cache=new Map,S.cache=new Map,x.cache=new Map;let b=S(l.initialSegment),v=Wn(c),w=Ot(c),L=v?Ln(v)||Ve(v):_n(c)||$n(c),P=1/0;for(let T of l.finalSegments){if(!T.reachable)continue;let m=x(T);m<P&&(P=m)}for(let[T,m]of p){if(!T.reachable)continue;let y=T.nextSegments.length===0?P<=x(T):P<x(T),A=g(T)*S(T),C=u.has(T.id);for(let E of m)if(C&&!Pt(E)&&e.report({node:E,message:`React Hook "${t(E)}" 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.`}),L){if(c.async&&e.report({node:E,message:`React Hook "${t(E)}" cannot be called in an async function.`}),!C&&A!==b&&!Pt(E)){let z=`React Hook "${t(E)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(y?" Did you accidentally call a React Hook after an early return?":"");e.report({node:E,message:z})}}else if(c.parent&&(c.parent.type==="MethodDefinition"||c.parent.type==="ClassProperty")&&c.parent.value===c){let F=`React Hook "${t(E)}" 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:E,message:F})}else if(v){let F=`React Hook "${t(E)}" is called in function "${t(v)}" 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:E,message:F})}else if(c.type==="Program"){let F=`React Hook "${t(E)}" 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:E,message:F})}else if(w&&!Pt(E)){if(c.parent.type==="CallExpression"&&c.parent.callee.type==="Identifier"&&c.parent.callee.name==="useCallback"){let z=c.parent;if(z.parent.type==="VariableDeclarator"&&jn(z.parent.id.name))return}let F=`React Hook "${t(E)}" 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:E,message:F})}}},CallExpression(l){if(Ve(l.callee)){let c=Dn(o),p=Dn(a),u=c.get(p);u||(u=[],c.set(p,u)),u.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||Nn(l.callee))&&l.arguments.length>0&&(n=l)},Identifier(l){n==null&&s.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${t(l)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(l){l===n&&(n=null)},FunctionDeclaration(l){Ot(l)&&i(r(l))},ArrowFunctionExpression(l){Ot(l)&&i(r(l))}}}};function Wn(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 Dn(e){return e[e.length-1]}import{AST_NODE_TYPES as Vn}from"@typescript-eslint/utils";function ns(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function rs(e){let t=e.parent;return t?.type===Vn.NewExpression&&t.callee.type===Vn.Identifier&&t.callee.name==="RegExp"}var Ft=B({name:"use-top-level-regex",meta:{type:"suggestion",docs:{description:"Require regex literals to be declared at the top level to avoid performance issues"},messages:{regexShouldBeTopLevel:"Move this regex literal to the top level to avoid creating new RegExp objects on each function call."},schema:[],hasSuggestions:!1},defaultOptions:[],create(e){function t(r){ns(r)||rs(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var Hn={[Et.name]:Et.rule,[nt.name]:nt.rule,[tt.name]:tt.rule,"rules-of-hooks":Un,"exhaustive-deps":Jt,"require-description":Fn.rule,[rt.name]:rt.rule,[st.name]:st.rule,[wt.name]:wt.rule,[qe.name]:qe.rule,[et.name]:et.rule,[pt.name]:pt.rule,[At.name]:At.rule,[lt.name]:lt.rule,[it.name]:it.rule,[Xe.name]:Xe.rule,[Rt.name]:Rt.rule,[Je.name]:Je.rule,[Qe.name]:Qe.rule,[dt.name]:dt.rule,[yt.name]:yt.rule,[St.name]:St.rule,[Tt.name]:Tt.rule,[gt.name]:gt.rule,[Ct.name]:Ct.rule,[ft.name]:ft.rule,[ut.name]:ut.rule,[Ft.name]:Ft.rule,[bt.name]:bt.rule,[kt.name]:kt.rule};var $a={rules:Hn};export{$a as extendedLintPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ls-stack/extended-lint",
3
- "version": "0.51.0",
3
+ "version": "0.53.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"