@ls-stack/extended-lint 0.70.0 → 0.70.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extended-lint.js +17 -17
- package/dist/extended-lint.mjs +17 -17
- package/package.json +1 -1
package/dist/extended-lint.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var ri=Object.create;var at=Object.defineProperty;var ii=Object.getOwnPropertyDescriptor;var si=Object.getOwnPropertyNames;var oi=Object.getPrototypeOf,ai=Object.prototype.hasOwnProperty;var li=(e,t)=>{for(var r in t)at(e,r,{get:t[r],enumerable:!0})},jn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of si(t))!ai.call(e,s)&&s!==r&&at(e,s,{get:()=>t[s],enumerable:!(n=ii(t,s))||n.enumerable});return e};var Ee=(e,t,r)=>(r=e!=null?ri(oi(e)):{},jn(t||!e||!e.__esModule?at(r,"default",{value:e,enumerable:!0}):r,e)),pi=e=>jn(at({},"__esModule",{value:!0}),e);var Ca={};li(Ca,{extendedLintPlugin:()=>xa});module.exports=pi(Ca);var le=require("@typescript-eslint/utils"),k=require("zod/v4");var Ln=require("@typescript-eslint/utils"),Mn=Ee(require("zod/v4"));function M(e){let r=Ln.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function L(e){return Mn.toJSONSchema(e)}var ci=k.z.object({disallow:k.z.array(k.z.object({selector:k.z.string(),message:k.z.string(),replace:k.z.optional(k.z.union([k.z.string(),k.z.object({regex:k.z.string(),with:k.z.string()})])),replaceType:k.z.optional(k.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:k.z.optional(k.z.array(k.z.object({fn:k.z.string(),withArgs:k.z.optional(k.z.array(k.z.object({atIndex:k.z.number(),value:k.z.union([k.z.string(),k.z.number(),k.z.boolean()])}))),message:k.z.string(),replaceWith:k.z.optional(k.z.string()),ignoreRegex:k.z.optional(k.z.string())}))),__dev_simulateFileName:k.z.optional(k.z.string()),mustMatchSyntax:k.z.optional(k.z.array(k.z.object({includeRegex:k.z.string(),mustCallFn:k.z.optional(k.z.array(k.z.object({anyCall:k.z.array(k.z.object({fn:k.z.string(),withArgs:k.z.array(k.z.object({atIndex:k.z.number(),literal:k.z.union([k.z.string(),k.z.number(),k.z.boolean()])}))})),message:k.z.optional(k.z.string())}))),mustMatchSelector:k.z.optional(k.z.array(k.z.object({selector:k.z.string(),message:k.z.string()}))),mustHaveExport:k.z.optional(k.z.array(k.z.object({name:k.z.string(),type:k.z.enum(["function","variable","any"]).default("any"),message:k.z.string()})))})))}),At=M({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[L(ci)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:s,disallow:o,disallowFnCalls:i}=t,p=s??e.filename,a=[],c=new Map,y=new Set,S=new Map,l=new Set,m=new Map;function f(g){for(let C of g.specifiers)C.type===le.AST_NODE_TYPES.ImportSpecifier&&C.imported.type===le.AST_NODE_TYPES.Identifier&&C.imported.name!==C.local.name&&m.set(C.local.name,C.imported.name)}function T(g){if(g.declaration){if(g.declaration.type===le.AST_NODE_TYPES.FunctionDeclaration&&g.declaration.id){let C=g.declaration.id.name;for(let A of Array.from(l)){let[w,O]=A.split(":");w===C&&(O==="function"||O==="any")&&l.delete(A)}}else if(g.declaration.type===le.AST_NODE_TYPES.VariableDeclaration){for(let C of g.declaration.declarations)if(C.id.type===le.AST_NODE_TYPES.Identifier){let A=C.id.name;for(let w of Array.from(l)){let[O,_]=w.split(":");O===A&&(_==="variable"||_==="any")&&l.delete(w)}}}}for(let C of g.specifiers)if(C.exported.type===le.AST_NODE_TYPES.Identifier){let A=C.exported.name;for(let w of Array.from(l)){let[O,_]=w.split(":");O===A&&_==="any"&&l.delete(w)}}}function h(g){g.id.type===le.AST_NODE_TYPES.Identifier&&g.init?.type===le.AST_NODE_TYPES.Identifier&&m.set(g.id.name,g.init.name)}function u(g){return m.get(g)??g}function E(g,C){return u(g)===C||g===C}for(let{includeRegex:g,mustCallFn:C,mustMatchSelector:A,mustHaveExport:w}of n??[]){let _=function(ne){let Q=ne;for(let{name:oe,value:ae}of O??[])Q=Q.replaceAll(oe,ae);return Q};var b=_;let O=ui(p,new RegExp(g));if(O){for(let{anyCall:ne,message:Q}of C??[]){let oe=`Expected file to call the function: ${ne.map(({fn:ae})=>ae).join(" or ")}`;y.add(oe),a.push(ae=>{let{callee:Z}=ae;if(Z.type===le.AST_NODE_TYPES.Identifier){for(let{fn:xe,withArgs:Ve}of ne)if(Z.name===xe){y.delete(oe);for(let ce of Ve){let Oe=ae.arguments[ce.atIndex],ge=typeof ce.literal=="string"?_(ce.literal):ce.literal;if(!Oe){e.report({node:ae,messageId:"default",data:{message:`Missing argument with value "${ge}" at index ${ce.atIndex}${Q?`: ${_(Q)}`:""}`}});continue}if(Oe.type!==le.AST_NODE_TYPES.Literal){e.report({node:Oe,messageId:"default",data:{message:`Argument at position ${ce.atIndex} should the literal "${ge}"${Q?`: ${_(Q)}`:""}`}});continue}Oe.value!==ge&&e.report({node:Oe,messageId:"default",data:{message:`Argument should have the value "${ge}"${Q?`: ${_(Q)}`:""}`},fix:_e=>_e.replaceText(Oe,typeof ge=="string"?`'${ge}'`:String(ge))})}break}}})}for(let{selector:ne,message:Q}of A??[])S.set(ne,_(Q)),c.set(_(ne),()=>{S.delete(ne)});for(let{name:ne,type:Q,message:oe}of w??[]){let ae=_(ne),Z=_(oe);l.add(`${ae}:${Q}:${Z}`)}}}for(let{fn:g,withArgs:C,message:A,replaceWith:w,ignoreRegex:O}of i??[])O&&new RegExp(O).test(p)||a.push(_=>{let{callee:ne}=_;if(ne.type!==le.AST_NODE_TYPES.Identifier||!E(ne.name,g))return;if(C)for(let oe of C){let ae=_.arguments[oe.atIndex];if(!ae){e.report({node:_,messageId:"default",data:{message:`Missing argument with value "${oe.value}" at index ${oe.atIndex}: ${A}`}});return}if(ae.type!==le.AST_NODE_TYPES.Literal||ae.value!==oe.value)return}let Q=oe=>w?oe.replaceText(_,w):null;e.report({node:_,messageId:"default",data:{message:A},suggest:w?[{messageId:"default",data:{message:`Replace with "${w}"`},fix:Q}]:void 0})});function x(g,C){let A=r[g];A?r[g]=w=>{A(w),C(w)}:r[g]=C}for(let{selector:g,message:C,replace:A,replaceType:w="suggestion"}of o??[]){if(g==="CallExpression"){a.push(O=>{d(A,O,C,w)});continue}r[g]=O=>{d(A,O,C,w)}}if(c.size>0)for(let[g,C]of c)x(g,C);return a.length>0&&(r.CallExpression=g=>{if(g.type===le.AST_NODE_TYPES.CallExpression)for(let C of a)C(g)}),r.ImportDeclaration=g=>{g.type===le.AST_NODE_TYPES.ImportDeclaration&&f(g)},r.ExportNamedDeclaration=g=>{g.type===le.AST_NODE_TYPES.ExportNamedDeclaration&&T(g)},r.VariableDeclarator=g=>{g.type===le.AST_NODE_TYPES.VariableDeclarator&&h(g)},r["Program:exit"]=g=>{for(let C of y)e.report({node:g,messageId:"default",data:{message:C}});for(let[,C]of S)e.report({node:g,messageId:"default",data:{message:C}});for(let C of l){let[A,w,O]=C.split(":");e.report({node:g,messageId:"default",data:{message:`Missing required export "${A}" of type ${w}: ${O}`}})}},r;function d(g,C,A,w){let O=_=>{if(!g)return null;if(typeof g=="string")return _.replaceText(C,g);{let ne=new RegExp(g.regex),Q=e.sourceCode.getText(C);return _.replaceText(C,Q.replace(ne,g.with))}};e.report({node:C,messageId:"default",data:{message:A},fix:g&&w==="autofix"?O:void 0,suggest:g&&w==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof g=="string"?g:g.with}"`},fix:O}]:void 0})}}});function ui(e,t){let r=[],n=t.exec(e);if(!n)return null;let[s,...o]=n;r.push({name:"$0_lowercase",value:s.toLowerCase()}),r.push({name:"$0_capitalize",value:$n(s)}),r.push({name:"$0_uncapitalize",value:_n(s)}),r.push({name:"$0",value:s});for(let i=0;i<o.length;i++){let p=`$${i+1}`,a=o[i];a!==void 0&&(r.push({name:`${p}_lowercase`,value:a.toLowerCase()}),r.push({name:`${p}_capitalize`,value:$n(a)}),r.push({name:`${p}_uncapitalize`,value:_n(a)}),r.push({name:p,value:a}))}return r}function $n(e){return e.charAt(0).toUpperCase()+e.slice(1)}function _n(e){return e.charAt(0).toLowerCase()+e.slice(1)}var V=require("@typescript-eslint/utils"),De=require("zod/v4");var fi=V.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),zn="collapse-simple-objs-in-one-line",mi=De.z.object({maxLineLength:De.z.number().optional(),maxProperties:De.z.number().optional(),nestedObjMaxLineLength:De.z.number().optional(),nestedObjMaxProperties:De.z.number().optional(),ignoreTypesWithSuffix:De.z.array(De.z.string()).optional()}),yi=fi({name:zn,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[L(mi)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],s=t.maxProperties??2,o=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function p(c){if(c.type===V.AST_NODE_TYPES.ObjectExpression){let y=c.parent.type===V.AST_NODE_TYPES.Property,S=y?i:s,l=c.properties.length;if(l>S)return!1;if(l===1){let f=c.properties[0];return!f||f.type===V.AST_NODE_TYPES.Property&&f.value.type===V.AST_NODE_TYPES.ObjectExpression||f.type===V.AST_NODE_TYPES.Property&&f.value.type===V.AST_NODE_TYPES.ArrayExpression&&!f.value.elements.every(h=>h&&wt(h))?!1:{text:r.getText(f),isNested:y,propsSize:l}}let m=[];for(let f of c.properties){if(f.type===V.AST_NODE_TYPES.Property&&!wt(f.value))return!1;m.push(r.getText(f))}return{text:m.join(", "),isNested:y,propsSize:l}}else{let y=c.parent.parent?.type===V.AST_NODE_TYPES.TSPropertySignature,S=y?i:s,l=c.members.length;if(l>S)return!1;if(n.length>0&&c.parent.type===V.AST_NODE_TYPES.TSTypeAliasDeclaration){let f=c.parent.id.name;if(n.some(T=>f.endsWith(T)))return!1}if(l===1){let f=c.members[0];return!f||f.type===V.AST_NODE_TYPES.TSPropertySignature&&f.typeAnnotation?.typeAnnotation.type===V.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(f),isNested:y,propsSize:1}}if(c.parent.type===V.AST_NODE_TYPES.TSIntersectionType||c.parent.type===V.AST_NODE_TYPES.TSUnionType&&c.parent.types[0]!==c)return!1;let m=[];for(let f of c.members){if(f.type!==V.AST_NODE_TYPES.TSPropertySignature)return!1;let T=f.typeAnnotation?.typeAnnotation;if(!T||T.type===V.AST_NODE_TYPES.TSTypeLiteral||!Un(T))return!1;if(T.type===V.AST_NODE_TYPES.TSTypeReference&&T.typeArguments){if(T.typeArguments.params.length>1)return!1;let u=T.typeArguments.params[0];if(!u||!Un(u))return!1}let h=r.getText(f).trim();(h.endsWith(";")||h.endsWith(","))&&(h=h.slice(0,-1)),m.push(h)}return{text:m.join("; "),isNested:y,propsSize:l}}}function a(c){if(c.loc.start.line===c.loc.end.line)return;if(c.parent.type!==V.AST_NODE_TYPES.JSXExpressionContainer){let T=0,h=!1,u=r.getTokenAfter(c,{filter:x=>x.type!==V.AST_TOKEN_TYPES.Punctuator||h?!0:x.value===","?(T++,!1):x.value===";"?(T++,h=!0,!1):x.value===")"||x.value==="}"?(T++,!1):!0});if(T>4)return;let E=u?.type===V.AST_TOKEN_TYPES.Template&&u.value.startsWith(`}
|
|
2
|
-
`);if(
|
|
3
|
-
`)||r.getCommentsInside(c).length>0)return;
|
|
4
|
-
`,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function gi(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var Rt={name:zn,rule:yi};var Si=/eslint +react-compiler\/react-compiler: +\["error/,Jn={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"?
|
|
1
|
+
"use strict";var ri=Object.create;var at=Object.defineProperty;var ii=Object.getOwnPropertyDescriptor;var si=Object.getOwnPropertyNames;var oi=Object.getPrototypeOf,ai=Object.prototype.hasOwnProperty;var li=(e,t)=>{for(var r in t)at(e,r,{get:t[r],enumerable:!0})},jn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of si(t))!ai.call(e,s)&&s!==r&&at(e,s,{get:()=>t[s],enumerable:!(n=ii(t,s))||n.enumerable});return e};var Ee=(e,t,r)=>(r=e!=null?ri(oi(e)):{},jn(t||!e||!e.__esModule?at(r,"default",{value:e,enumerable:!0}):r,e)),pi=e=>jn(at({},"__esModule",{value:!0}),e);var Ca={};li(Ca,{extendedLintPlugin:()=>xa});module.exports=pi(Ca);var pe=require("@typescript-eslint/utils"),k=require("zod/v4");var Ln=require("@typescript-eslint/utils"),Mn=Ee(require("zod/v4"));function $(e){let r=Ln.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function L(e){return Mn.toJSONSchema(e)}var ci=k.z.object({disallow:k.z.array(k.z.object({selector:k.z.string(),message:k.z.string(),replace:k.z.optional(k.z.union([k.z.string(),k.z.object({regex:k.z.string(),with:k.z.string()})])),replaceType:k.z.optional(k.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:k.z.optional(k.z.array(k.z.object({fn:k.z.string(),withArgs:k.z.optional(k.z.array(k.z.object({atIndex:k.z.number(),value:k.z.union([k.z.string(),k.z.number(),k.z.boolean()])}))),message:k.z.string(),replaceWith:k.z.optional(k.z.string()),ignoreRegex:k.z.optional(k.z.string())}))),__dev_simulateFileName:k.z.optional(k.z.string()),mustMatchSyntax:k.z.optional(k.z.array(k.z.object({includeRegex:k.z.string(),mustCallFn:k.z.optional(k.z.array(k.z.object({anyCall:k.z.array(k.z.object({fn:k.z.string(),withArgs:k.z.array(k.z.object({atIndex:k.z.number(),literal:k.z.union([k.z.string(),k.z.number(),k.z.boolean()])}))})),message:k.z.optional(k.z.string())}))),mustMatchSelector:k.z.optional(k.z.array(k.z.object({selector:k.z.string(),message:k.z.string()}))),mustHaveExport:k.z.optional(k.z.array(k.z.object({name:k.z.string(),type:k.z.enum(["function","variable","any"]).default("any"),message:k.z.string()})))})))}),At=$({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[L(ci)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:s,disallow:o,disallowFnCalls:i}=t,p=s??e.filename,a=[],c=new Map,y=new Set,d=new Map,l=new Set,h=new Map;function u(T){for(let C of T.specifiers)C.type===pe.AST_NODE_TYPES.ImportSpecifier&&C.imported.type===pe.AST_NODE_TYPES.Identifier&&C.imported.name!==C.local.name&&h.set(C.local.name,C.imported.name)}function S(T){if(T.declaration){if(T.declaration.type===pe.AST_NODE_TYPES.FunctionDeclaration&&T.declaration.id){let C=T.declaration.id.name;for(let A of Array.from(l)){let[w,O]=A.split(":");w===C&&(O==="function"||O==="any")&&l.delete(A)}}else if(T.declaration.type===pe.AST_NODE_TYPES.VariableDeclaration){for(let C of T.declaration.declarations)if(C.id.type===pe.AST_NODE_TYPES.Identifier){let A=C.id.name;for(let w of Array.from(l)){let[O,M]=w.split(":");O===A&&(M==="variable"||M==="any")&&l.delete(w)}}}}for(let C of T.specifiers)if(C.exported.type===pe.AST_NODE_TYPES.Identifier){let A=C.exported.name;for(let w of Array.from(l)){let[O,M]=w.split(":");O===A&&M==="any"&&l.delete(w)}}}function g(T){T.id.type===pe.AST_NODE_TYPES.Identifier&&T.init?.type===pe.AST_NODE_TYPES.Identifier&&h.set(T.id.name,T.init.name)}function f(T){return h.get(T)??T}function E(T,C){return f(T)===C||T===C}for(let{includeRegex:T,mustCallFn:C,mustMatchSelector:A,mustHaveExport:w}of n??[]){let M=function(K){let ee=K;for(let{name:oe,value:le}of O??[])ee=ee.replaceAll(oe,le);return ee};var b=M;let O=ui(p,new RegExp(T));if(O){for(let{anyCall:K,message:ee}of C??[]){let oe=`Expected file to call the function: ${K.map(({fn:le})=>le).join(" or ")}`;y.add(oe),a.push(le=>{let{callee:Z}=le;if(Z.type===pe.AST_NODE_TYPES.Identifier){for(let{fn:xe,withArgs:Ve}of K)if(Z.name===xe){y.delete(oe);for(let ce of Ve){let Oe=le.arguments[ce.atIndex],ge=typeof ce.literal=="string"?M(ce.literal):ce.literal;if(!Oe){e.report({node:le,messageId:"default",data:{message:`Missing argument with value "${ge}" at index ${ce.atIndex}${ee?`: ${M(ee)}`:""}`}});continue}if(Oe.type!==pe.AST_NODE_TYPES.Literal){e.report({node:Oe,messageId:"default",data:{message:`Argument at position ${ce.atIndex} should the literal "${ge}"${ee?`: ${M(ee)}`:""}`}});continue}Oe.value!==ge&&e.report({node:Oe,messageId:"default",data:{message:`Argument should have the value "${ge}"${ee?`: ${M(ee)}`:""}`},fix:_e=>_e.replaceText(Oe,typeof ge=="string"?`'${ge}'`:String(ge))})}break}}})}for(let{selector:K,message:ee}of A??[])d.set(K,M(ee)),c.set(M(K),()=>{d.delete(K)});for(let{name:K,type:ee,message:oe}of w??[]){let le=M(K),Z=M(oe);l.add(`${le}:${ee}:${Z}`)}}}for(let{fn:T,withArgs:C,message:A,replaceWith:w,ignoreRegex:O}of i??[])O&&new RegExp(O).test(p)||a.push(M=>{let{callee:K}=M;if(K.type!==pe.AST_NODE_TYPES.Identifier||!E(K.name,T))return;if(C)for(let oe of C){let le=M.arguments[oe.atIndex];if(!le){e.report({node:M,messageId:"default",data:{message:`Missing argument with value "${oe.value}" at index ${oe.atIndex}: ${A}`}});return}if(le.type!==pe.AST_NODE_TYPES.Literal||le.value!==oe.value)return}let ee=oe=>w?oe.replaceText(M,w):null;e.report({node:M,messageId:"default",data:{message:A},suggest:w?[{messageId:"default",data:{message:`Replace with "${w}"`},fix:ee}]:void 0})});function x(T,C){let A=r[T];A?r[T]=w=>{A(w),C(w)}:r[T]=C}for(let{selector:T,message:C,replace:A,replaceType:w="suggestion"}of o??[]){if(T==="CallExpression"){a.push(O=>{m(A,O,C,w)});continue}r[T]=O=>{m(A,O,C,w)}}if(c.size>0)for(let[T,C]of c)x(T,C);return a.length>0&&(r.CallExpression=T=>{if(T.type===pe.AST_NODE_TYPES.CallExpression)for(let C of a)C(T)}),r.ImportDeclaration=T=>{T.type===pe.AST_NODE_TYPES.ImportDeclaration&&u(T)},r.ExportNamedDeclaration=T=>{T.type===pe.AST_NODE_TYPES.ExportNamedDeclaration&&S(T)},r.VariableDeclarator=T=>{T.type===pe.AST_NODE_TYPES.VariableDeclarator&&g(T)},r["Program:exit"]=T=>{for(let C of y)e.report({node:T,messageId:"default",data:{message:C}});for(let[,C]of d)e.report({node:T,messageId:"default",data:{message:C}});for(let C of l){let[A,w,O]=C.split(":");e.report({node:T,messageId:"default",data:{message:`Missing required export "${A}" of type ${w}: ${O}`}})}},r;function m(T,C,A,w){let O=M=>{if(!T)return null;if(typeof T=="string")return M.replaceText(C,T);{let K=new RegExp(T.regex),ee=e.sourceCode.getText(C);return M.replaceText(C,ee.replace(K,T.with))}};e.report({node:C,messageId:"default",data:{message:A},fix:T&&w==="autofix"?O:void 0,suggest:T&&w==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof T=="string"?T:T.with}"`},fix:O}]:void 0})}}});function ui(e,t){let r=[],n=t.exec(e);if(!n)return null;let[s,...o]=n;r.push({name:"$0_lowercase",value:s.toLowerCase()}),r.push({name:"$0_capitalize",value:$n(s)}),r.push({name:"$0_uncapitalize",value:_n(s)}),r.push({name:"$0",value:s});for(let i=0;i<o.length;i++){let p=`$${i+1}`,a=o[i];a!==void 0&&(r.push({name:`${p}_lowercase`,value:a.toLowerCase()}),r.push({name:`${p}_capitalize`,value:$n(a)}),r.push({name:`${p}_uncapitalize`,value:_n(a)}),r.push({name:p,value:a}))}return r}function $n(e){return e.charAt(0).toUpperCase()+e.slice(1)}function _n(e){return e.charAt(0).toLowerCase()+e.slice(1)}var V=require("@typescript-eslint/utils"),De=require("zod/v4");var fi=V.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),zn="collapse-simple-objs-in-one-line",mi=De.z.object({maxLineLength:De.z.number().optional(),maxProperties:De.z.number().optional(),nestedObjMaxLineLength:De.z.number().optional(),nestedObjMaxProperties:De.z.number().optional(),ignoreTypesWithSuffix:De.z.array(De.z.string()).optional()}),yi=fi({name:zn,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[L(mi)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],s=t.maxProperties??2,o=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function p(c){if(c.type===V.AST_NODE_TYPES.ObjectExpression){let y=c.parent.type===V.AST_NODE_TYPES.Property,d=y?i:s,l=c.properties.length;if(l>d)return!1;if(l===1){let u=c.properties[0];return!u||u.type===V.AST_NODE_TYPES.Property&&u.value.type===V.AST_NODE_TYPES.ObjectExpression||u.type===V.AST_NODE_TYPES.Property&&u.value.type===V.AST_NODE_TYPES.ArrayExpression&&!u.value.elements.every(g=>g&&wt(g))?!1:{text:r.getText(u),isNested:y,propsSize:l}}let h=[];for(let u of c.properties){if(u.type===V.AST_NODE_TYPES.Property&&!wt(u.value))return!1;h.push(r.getText(u))}return{text:h.join(", "),isNested:y,propsSize:l}}else{let y=c.parent.parent?.type===V.AST_NODE_TYPES.TSPropertySignature,d=y?i:s,l=c.members.length;if(l>d)return!1;if(n.length>0&&c.parent.type===V.AST_NODE_TYPES.TSTypeAliasDeclaration){let u=c.parent.id.name;if(n.some(S=>u.endsWith(S)))return!1}if(l===1){let u=c.members[0];return!u||u.type===V.AST_NODE_TYPES.TSPropertySignature&&u.typeAnnotation?.typeAnnotation.type===V.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(u),isNested:y,propsSize:1}}if(c.parent.type===V.AST_NODE_TYPES.TSIntersectionType||c.parent.type===V.AST_NODE_TYPES.TSUnionType&&c.parent.types[0]!==c)return!1;let h=[];for(let u of c.members){if(u.type!==V.AST_NODE_TYPES.TSPropertySignature)return!1;let S=u.typeAnnotation?.typeAnnotation;if(!S||S.type===V.AST_NODE_TYPES.TSTypeLiteral||!Un(S))return!1;if(S.type===V.AST_NODE_TYPES.TSTypeReference&&S.typeArguments){if(S.typeArguments.params.length>1)return!1;let f=S.typeArguments.params[0];if(!f||!Un(f))return!1}let g=r.getText(u).trim();(g.endsWith(";")||g.endsWith(","))&&(g=g.slice(0,-1)),h.push(g)}return{text:h.join("; "),isNested:y,propsSize:l}}}function a(c){if(c.loc.start.line===c.loc.end.line)return;if(c.parent.type!==V.AST_NODE_TYPES.JSXExpressionContainer){let S=0,g=!1,f=r.getTokenAfter(c,{filter:x=>x.type!==V.AST_TOKEN_TYPES.Punctuator||g?!0:x.value===","?(S++,!1):x.value===";"?(S++,g=!0,!1):x.value===")"||x.value==="}"?(S++,!1):!0});if(S>4)return;let E=f?.type===V.AST_TOKEN_TYPES.Template&&f.value.startsWith(`}
|
|
2
|
+
`);if(f?.loc.start.line===c.loc.end.line&&!E)return}let y=p(c);if(!y)return;let d=y.text;if(d.includes(`
|
|
3
|
+
`)||r.getCommentsInside(c).length>0)return;d.endsWith(";")&&(d=d.slice(0,-1));let l=`{ ${d} }`,h=gi(r,c),u=y.isNested&&y.propsSize>2?o:t.maxLineLength;u&&l.length+h.length+di(c,r)>u||e.report({node:c,messageId:"singleLineProp",fix:S=>S.replaceText(c,l)})}return{TSTypeLiteral:a,ObjectExpression:a}}});function Un(e){return e.type===V.AST_NODE_TYPES.TSLiteralType||e.type===V.AST_NODE_TYPES.TSTypeReference||e.type===V.AST_NODE_TYPES.TSNumberKeyword||e.type===V.AST_NODE_TYPES.TSStringKeyword||e.type===V.AST_NODE_TYPES.TSBooleanKeyword||e.type===V.AST_NODE_TYPES.TSNullKeyword||e.type===V.AST_NODE_TYPES.TSUndefinedKeyword}function wt(e,t){return!!(e.type===V.AST_NODE_TYPES.Literal||e.type===V.AST_NODE_TYPES.Identifier||e.type===V.AST_NODE_TYPES.TemplateLiteral||e.type===V.AST_NODE_TYPES.TaggedTemplateExpression||!t&&e.type===V.AST_NODE_TYPES.ArrayExpression&&e.elements.every(r=>r&&wt(r,!0)))}function di(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 gi(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var Rt={name:zn,rule:yi};var Si=/eslint +react-compiler\/react-compiler: +\["error/,Jn={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"?f=>r(f):f=>e.sourceCode.getText(f),n=typeof e.getScope=="function"?()=>n():f=>e.sourceCode.getScope(f),s=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,o=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:s,enableDangerousAutofixThisMayCauseInfiniteLoops:o};function p(f){o&&Array.isArray(f.suggest)&&f.suggest.length>0&&(f.fix=f.suggest[0].fix),e.report(f)}let a=e.getSourceCode().scopeManager,c=new WeakMap,y=new WeakSet,d=new WeakMap,l=new WeakMap,h=new WeakSet;function u(f,E){return function(x){if(E.has(x))return E.get(x);let m=f(x);return E.set(x,m),m}}function S(f,E,x,m,b){b&&f.async&&p({node:f,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
|
|
5
5
|
|
|
6
6
|
useEffect(() => {
|
|
7
7
|
async function fetchData() {
|
|
@@ -12,15 +12,15 @@ useEffect(() => {
|
|
|
12
12
|
fetchData();
|
|
13
13
|
}, [someId]); // Or [] if effect doesn't need props or state
|
|
14
14
|
|
|
15
|
-
Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let g=a.acquire(u),C=new Set,A=null;{let I=g.upper;for(;I&&(C.add(I),I.type!=="function");)I=I.upper;if(!I)return;A=I}let w=Array.isArray;function O(I){if(!w(I.defs))return!1;let R=I.defs[0];if(R==null||R.node.type!=="VariableDeclarator")return!1;let P=R.node.init;if(P==null)return!1;for(;P.type==="TSAsExpression";)P=P.expression;let N=R.node.parent;if(N==null&&(Pt(A.block,R.node.id),N=R.node.parent,N==null))return!1;if(N.kind==="const"&&P.type==="Literal"&&(typeof P.value=="string"||typeof P.value=="number"||P.value===null))return!0;if(P.type!=="CallExpression")return!1;let j=P.callee;if(j.type==="MemberExpression"&&j.object.name==="React"&&j.property!=null&&!j.computed&&(j=j.property),j.type!=="Identifier")return!1;let D=R.node.id,{name:U}=j;if(U==="useRef"&&D.type==="Identifier")return!0;if(xi(j)&&D.type==="Identifier"){for(let z of I.references)z!==D&&m.add(z.identifier);return!0}else if(U==="useState"||U==="useReducer"){if(D.type==="ArrayPattern"&&D.elements.length===2&&w(I.identifiers)){if(D.elements[1]===I.identifiers[0]){if(U==="useState"){let z=I.references,Se=0;for(let Re=0;Re<z.length;Re++){if(z[Re].isWrite()&&Se++,Se>1)return!1;c.set(z[Re].identifier,D.elements[0])}}return!0}else if(D.elements[0]===I.identifiers[0]){if(U==="useState"){let z=I.references;for(let Se=0;Se<z.length;Se++)y.add(z[Se].identifier)}return!1}}}else if(U==="useTransition"&&D.type==="ArrayPattern"&&D.elements.length===2&&Array.isArray(I.identifiers)&&D.elements[1]===I.identifiers[0])return!0;return!1}function _(I){if(!w(I.defs))return!1;let R=I.defs[0];if(R==null||R.node==null||R.node.id==null)return!1;let P=R.node,N=A.childScopes,j=null,D;for(D=0;D<N.length;D++){let U=N[D],z=U.block;if(P.type==="FunctionDeclaration"&&z===P||P.type==="VariableDeclarator"&&z.parent===P){j=U;break}}if(j==null)return!1;for(D=0;D<j.through.length;D++){let U=j.through[D];if(U.resolved!=null&&C.has(U.resolved.scope)&&!ne(U.resolved))return!1}return!0}let ne=f(O,S),Q=f(_,l),oe=new Map;function ae(I){let R=I.from,P=!1;for(;R.block!==u;)R.type==="function"&&(P=R.block.parent!=null&&R.block.parent.type==="ReturnStatement"),R=R.upper;return P}let Z=new Map,xe=new Map;Ve(g);function Ve(I){for(let R of I.references){if(!R.resolved||!C.has(R.resolved.scope))continue;let P=Pt(u,R.identifier),N=Vn(P),j=ke(N,xe);if(b&&N.type==="Identifier"&&(N.parent.type==="MemberExpression"||N.parent.type==="OptionalMemberExpression")&&!N.parent.computed&&N.parent.property.type==="Identifier"&&N.parent.property.name==="current"&&ae(R)&&oe.set(j,{reference:R,dependencyNode:N}),N.parent.type==="TSTypeQuery"||N.parent.type==="TSTypeReference")continue;let D=R.resolved.defs[0];if(D!=null&&!(D.node!=null&&D.node.init===u.parent)&&D.type!=="TypeParameter")if(Z.has(j))Z.get(j).references.push(R);else{let U=R.resolved,z=ne(U)||Q(U);Z.set(j,{isStable:z,references:[R]})}}for(let R of I.childScopes)Ve(R)}oe.forEach(({reference:I,dependencyNode:R},P)=>{let N=I.resolved.references,j=!1;for(let D=0;D<N.length;D++){let{identifier:U}=N[D],{parent:z}=U;if(z!=null&&z.type==="MemberExpression"&&!z.computed&&z.property.type==="Identifier"&&z.property.name==="current"&&z.parent.type==="AssignmentExpression"&&z.parent.left===z){j=!0;break}}j||p({node:R.parent.property,message:`The ref value '${P}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${P}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ce=new Set;function Oe(I,R){ce.has(R)||(ce.add(R),p({node:I,message:`Assignments to the '${R}' variable from inside React Hook ${r(x)} 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(x)}.`}))}let ge=new Set;if(Z.forEach(({isStable:I,references:R},P)=>{I&&ge.add(P),R.forEach(N=>{N.writeExpr&&Oe(N.writeExpr,P)})}),ce.size>0)return;if(!E){let I=null;if(Z.forEach(({isStable:R,references:P},N)=>{I||P.forEach(j=>{if(I)return;let D=j.identifier;if(!c.has(D))return;let z=j.from;for(;z.type!=="function";)z=z.upper;z.block===u&&(I=N)})}),I){let{suggestedDependencies:R}=kt({dependencies:Z,declaredDependencies:[],stableDependencies:ge,externalDependencies:new Set,isEffect:!0});p({node:x,message:`React Hook ${d} contains a call to '${I}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+R.join(", ")+`] as a second argument to the ${d} Hook.`,suggest:[{desc:`Add dependencies array: [${R.join(", ")}]`,fix(P){return P.insertTextAfter(u,`, [${R.join(", ")}]`)}}]})}return}let _e=[],Ge=new Set;E.type!=="ArrayExpression"?p({node:E,message:`React Hook ${r(x)} 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.`}):E.elements.forEach(I=>{if(I===null)return;if(I.type==="SpreadElement"){p({node:I,message:`React Hook ${r(x)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}m.has(I)&&p({node:I,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(I)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(I)}\``,fix(j){return j.removeRange(I.range)}}]});let R;try{R=ke(I,xe)}catch(j){if(/Unsupported node type/.test(j.message)){I.type==="Literal"?Z.has(I.value)?p({node:I,message:`The ${I.raw} literal is not a valid dependency because it never changes. Did you mean to include ${I.value} in the array instead?`}):p({node:I,message:`The ${I.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):p({node:I,message:`React Hook ${r(x)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw j}let P=I;for(;P.type==="MemberExpression"||P.type==="OptionalMemberExpression"||P.type==="ChainExpression";)P=P.object||P.expression.object;let N=!A.through.some(j=>j.identifier===P);_e.push({key:R,node:I}),N||Ge.add(R)});let{suggestedDependencies:Qr,unnecessaryDependencies:st,missingDependencies:Ne,duplicateDependencies:On}=kt({dependencies:Z,declaredDependencies:_e,stableDependencies:ge,externalDependencies:Ge,isEffect:b}),ot=Qr;if(On.size+Ne.size+st.size===0){if(t)return;Ti({declaredDependencies:_e,declaredDependenciesNode:E,componentScope:A,scope:g}).forEach(({construction:R,isUsedOutsideOfHook:P,depType:N})=>{let j=N==="function"?"useCallback":"useMemo",D=N==="function"?"definition":"initialization",U=`wrap the ${D} of '${R.name.name}' in its own ${j}() Hook.`,z=P?`To fix this, ${U}`:`Move it inside the ${d} callback. Alternatively, ${U}`,Se=N==="conditional"||N==="logical expression"?"could make":"makes",Re=`The '${R.name.name}' ${N} ${Se} the dependencies of ${d} Hook (at line ${E.loc.start.line}) change on every render. ${z}`,Nn;P&&R.type==="Variable"&&N==="function"&&(Nn=[{desc:`Wrap the ${D} of '${R.name.name}' in its own ${j}() Hook.`,fix(Dn){let[ti,ni]=j==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Dn.insertTextBefore(R.node.init,ti),Dn.insertTextAfter(R.node.init,ni)]}}]),p({node:R.node,message:Re,suggest:Nn})});return}!b&&Ne.size>0&&(ot=kt({dependencies:Z,declaredDependencies:[],stableDependencies:ge,externalDependencies:Ge,isEffect:b}).suggestedDependencies);function ei(){if(_e.length===0)return!0;let I=_e.map(P=>P.key),R=I.slice().sort();return I.join(",")===R.join(",")}ei()&&ot.sort();function Ct(I){let R=I.split("."),P="";for(let N=0;N<R.length;N++){if(N!==0){let j=R.slice(0,N+1).join("."),D=xe.get(j)===!0;P+=D?"?.":"."}P+=R[N]}return P}function It(I,R,P,N){return I.size===0?null:(I.size>1?"":R+" ")+P+" "+(I.size>1?"dependencies":"dependency")+": "+Ei(Array.from(I).sort().map(j=>"'"+Ct(j)+"'"))+`. Either ${N} ${I.size>1?"them":"it"} or remove the dependency array.`}let he="";if(st.size>0){let I=null;if(Array.from(st.keys()).forEach(R=>{I===null&&R.endsWith(".current")&&(I=R)}),I!==null)he=` Mutable values like '${I}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Ge.size>0){let R=Array.from(Ge)[0];g.set.has(R)||(he=` Outer scope values like '${R}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!he&&Ne.has("props")){let I=Z.get("props");if(I==null)return;let R=I.references;if(!Array.isArray(R))return;let P=!0;for(let N=0;N<R.length;N++){let j=R[N],D=Pt(A.block,j.identifier);if(!D){P=!1;break}let U=D.parent;if(U==null){P=!1;break}if(U.type!=="MemberExpression"&&U.type!=="OptionalMemberExpression"){P=!1;break}}P&&(he=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${d} call and refer to those specific props inside ${r(x)}.`)}if(!he&&Ne.size>0){let I=null;Ne.forEach(R=>{if(I)return;let P=A.set.get(R),N=Z.get(R);if(N.references[0].resolved!==P)return;let j=P.defs[0];if(j==null||j.name==null||j.type!=="Parameter")return;let D=!1,U;for(let z=0;z<N.references.length;z++)if(U=N.references[z].identifier,U!=null&&U.parent!=null&&(U.parent.type==="CallExpression"||U.parent.type==="OptionalCallExpression")&&U.parent.callee===U){D=!0;break}D&&(I=R)}),I!==null&&(he=` If '${I}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!he&&Ne.size>0){let I=null;if(Ne.forEach(R=>{if(I!==null)return;let N=Z.get(R).references,j,D;for(let U=0;U<N.length;U++){for(j=N[U].identifier,D=j.parent;D!=null&&D!==A.block;){if(D.type==="CallExpression"){let z=c.get(D.callee);if(z!=null){if(z.name===R)I={missingDep:R,setter:D.callee.name,form:"updater"};else if(y.has(j))I={missingDep:R,setter:D.callee.name,form:"reducer"};else{let Se=N[U].resolved;if(Se!=null){let Re=Se.defs[0];Re!=null&&Re.type==="Parameter"&&(I={missingDep:R,setter:D.callee.name,form:"inlineReducer"})}}break}}D=D.parent}if(I!==null)break}}),I!==null)switch(I.form){case"reducer":he=` You can also replace multiple useState variables with useReducer if '${I.setter}' needs the current value of '${I.missingDep}'.`;break;case"inlineReducer":he=` If '${I.setter}' needs the current value of '${I.missingDep}', you can also switch to useReducer instead of useState and read '${I.missingDep}' in the reducer.`;break;case"updater":he=` You can also do a functional update '${I.setter}(${I.missingDep.slice(0,1)} => ...)' if you only need '${I.missingDep}' in the '${I.setter}' call.`;break;default:throw new Error("Unknown case.")}}p({node:E,message:`React Hook ${r(x)} has `+(It(Ne,"a","missing","include")||It(st,"an","unnecessary","exclude")||It(On,"a","duplicate","omit"))+he,suggest:[{desc:`Update the dependencies array to be: [${ot.map(Ct).join(", ")}]`,fix(I){return I.replaceText(E,`[${ot.map(Ct).join(", ")}]`)}}]})}function h(u){let E=hi(u.callee,i);if(E===-1)return;let x=u.arguments[E],d=u.callee,b=Xn(d).name,g=u.arguments[E+1],C=/Effect($|[^a-z])/g.test(b);if(!x){p({node:d,message:`React Hook ${b} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!C)){if(!g&&!C){(b==="useMemo"||b==="useCallback")&&p({node:d,message:`React Hook ${b} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(x.type){case"FunctionExpression":case"ArrowFunctionExpression":T(x,g,d,b,C);return;case"Identifier":if(!g||g.elements&&g.elements.some(O=>O&&O.type==="Identifier"&&O.name===x.name))return;let A=n(u).set.get(x.name);if(A==null||A.defs==null)return;let w=A.defs[0];if(!w||!w.node||w.type!=="Variable"&&w.type!=="FunctionName")break;switch(w.node.type){case"FunctionDeclaration":T(w.node,g,d,b,C);return;case"VariableDeclarator":let O=w.node.init;if(!O)break;switch(O.type){case"ArrowFunctionExpression":case"FunctionExpression":T(O,g,d,b,C);return}break}break;default:p({node:d,message:`React Hook ${b} received a function whose dependencies are unknown. Pass an inline function instead.`});return}p({node:d,message:`React Hook ${b} has a missing dependency: '${x.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${x.name}]`,fix(A){return A.replaceText(g,`[${x.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let u of e.sourceCode.getAllComments())if(Si.test(u.value))return t=!0,{CallExpression:E=>h(E,!0)}}return{CallExpression:u=>h(u)}}};function kt({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:s}){let o=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((T,h)=>{let u=p(o,h);u.isUsed=!0,a(o,h,E=>{E.isSubtreeUsed=!0})}),t.forEach(({key:T})=>{let h=p(o,T);h.isSatisfiedRecursively=!0}),r.forEach(T=>{let h=p(o,T);h.isSatisfiedRecursively=!0});function p(T,h){let u=h.split("."),E=T;for(let x of u){let d=E.children.get(x);d||(d=i(),E.children.set(x,d)),E=d}return E}function a(T,h,u){let E=h.split("."),x=T;for(let d of E){let b=x.children.get(d);if(!b)return;u(b),x=b}}let c=new Set,y=new Set;S(o,c,y,T=>T);function S(T,h,u,E){T.children.forEach((x,d)=>{let b=E(d);if(x.isSatisfiedRecursively){x.isSubtreeUsed&&u.add(b);return}if(x.isUsed){h.add(b);return}S(x,h,u,g=>b+"."+g)})}let l=[],m=new Set,f=new Set;return t.forEach(({key:T})=>{y.has(T)?l.indexOf(T)===-1?l.push(T):f.add(T):m.add(T)}),c.forEach(T=>{l.push(T)}),{suggestedDependencies:l,unnecessaryDependencies:m,duplicateDependencies:f,missingDependencies:c}}function je(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 je(e.consequent)!=null||je(e.alternate)!=null?"conditional":null;case"LogicalExpression":return je(e.left)!=null||je(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return je(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return je(e.expression);case"TSAsExpression":return je(e.expression)}return null}function Ti({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let s=e.map(({key:i})=>{let p=r.variables.find(c=>c.name===i);if(p==null)return null;let a=p.defs[0];if(a==null)return null;if(a.type==="Variable"&&a.node.type==="VariableDeclarator"&&a.node.id.type==="Identifier"&&a.node.init!=null){let c=je(a.node.init);if(c!=null)return[p,c]}return a.type==="FunctionName"&&a.node.type==="FunctionDeclaration"?[p,"function"]:a.type==="ClassName"&&a.node.type==="ClassDeclaration"?[p,"class"]:null}).filter(Boolean);function o(i){let p=!1;for(let a=0;a<i.references.length;a++){let c=i.references[a];if(c.writeExpr){if(p)return!0;p=!0;continue}let y=c.from;for(;y!==n&&y!=null;)y=y.upper;if(y!==n&&!Hn(t,c.identifier))return!0}return!1}return s.map(([i,p])=>({construction:i.defs[0],depType:p,isUsedOutsideOfHook:o(i)}))}function Vn(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)?Vn(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function vt(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function ke(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=ke(e.object,t),n=ke(e.property,null),s=`${r}.${n}`;return vt(e,t,s),s}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=ke(e.object,t),n=ke(e.property,null),s=`${r}.${n}`;return vt(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=ke(r.object,t),s=ke(r.property,null),o=`${n}.${s}`;return vt(r,t,o),o}else throw new Error(`Unsupported node type: ${e.type}`)}function Xn(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function hi(e,t){let r=Xn(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=ke(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 Pt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),bi(n,t))return n;if(Hn(n,t))for(let[s,o]of Object.entries(n))s!=="parent"&&(Wn(o)?(o.parent=n,r.push(o)):Array.isArray(o)&&o.forEach(i=>{Wn(i)&&(i.parent=n,r.push(i))}))}return null}function Ei(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 Wn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function bi(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 Hn(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function xi(e){return!1}var K=require("@typescript-eslint/utils"),ie=Ee(require("typescript")),Zn=require("zod/v4");var Ft=require("@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*Ot(e){yield e,e.parent&&(yield*Ot(e.parent))}function Nt(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function Yn(e,t,r){let s=r.getDeclaredVariables(e).find(o=>o.name===t||o.identifiers[0]?.parent.type===Ft.AST_NODE_TYPES.Property&&o.identifiers[0].parent.key.type===Ft.AST_NODE_TYPES.Identifier&&o.identifiers[0].parent.key.name===t);return s?s.references.filter(o=>!o.init):[]}function Bn(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function Ci(e,t){return e[t]}function Le(e,t,r){let n=r.visitorKeys,s=new Set;function o(i){if(s.has(i))return!1;if(s.add(i),t(i)===!0)return!0;let a=n[i.type];if(a)for(let c of a){let y=Ci(i,c);if(y){if(Array.isArray(y)){for(let S of y)if(Bn(S)&&o(S))return!0}else if(Bn(y)&&o(y))return!0}}return!1}o(e)}var Ii=K.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),qn="improved-no-unnecessary-condition",Ai=Zn.z.object({}),wi=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Ri=new Set(wi),Dt={name:qn,rule:Ii({name:qn,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".',unnecessaryStartsWithCondition:"This startsWith check is unnecessary as it always evaluates to true.",alwaysFalseStartsWithCondition:"This startsWith check will always be false.",unnecessaryEndsWithCondition:"This endsWith check is unnecessary as it always evaluates to true.",alwaysFalseEndsWithCondition:"This endsWith check will always be false.",unnecessaryIncludesCondition:"This includes check is unnecessary as it always evaluates to true.",alwaysFalseIncludesCondition:"This includes check will always be false.",unnecessaryLengthCondition:"This length comparison is unnecessary as it always evaluates to true.",alwaysFalseLengthCondition:"This length comparison will always be false."},schema:[L(Ai)]},defaultOptions:[{}],create(e){let t=K.ESLintUtils.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(l){return l.type===K.AST_NODE_TYPES.UnaryExpression&&l.operator==="typeof"}function s(l){return l.flags&ie.default.TypeFlags.Any||l.flags&ie.default.TypeFlags.Unknown?null:l.flags&ie.default.TypeFlags.StringLike?["string"]:l.flags&ie.default.TypeFlags.NumberLike?["number"]:l.flags&ie.default.TypeFlags.BigIntLike?["bigint"]:l.flags&ie.default.TypeFlags.BooleanLike?["boolean"]:l.flags&ie.default.TypeFlags.ESSymbolLike?["symbol"]:l.flags&ie.default.TypeFlags.Undefined||l.flags&ie.default.TypeFlags.Void?["undefined"]:l.flags&ie.default.TypeFlags.Null?["object"]:l.getCallSignatures().length>0?["function"]:l.flags&ie.default.TypeFlags.Object?l.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:l.flags&ie.default.TypeFlags.NonPrimitive?["object"]:l.flags&ie.default.TypeFlags.Never?["never"]:null}function o(l){if(!r)return null;let m=t.esTreeNodeToTSNodeMap.get(l),f=r.getTypeAtLocation(m.expression);if(f.flags&ie.default.TypeFlags.Any||f.flags&ie.default.TypeFlags.Unknown)return null;let T=[];if(f.isUnion()){for(let u of f.types){let E=s(u);if(E)T.push(...E);else return null}return T}let h=s(f);return h?(T.push(...h),T):null}function i(l){if(!(l.operator==="==="||l.operator==="!=="))return;let f=null,T=null;if(n(l.left)?(f=l.left,T=l.right.type===K.AST_NODE_TYPES.Literal&&typeof l.right.value=="string"?l.right.value:null):n(l.right)&&(f=l.right,T=l.left.type===K.AST_NODE_TYPES.Literal&&typeof l.left.value=="string"?l.left.value:null),!f||!T||!ki(T,Ri))return;let h=o(f);if(!h)return;let u=l.operator==="!==",E=h.includes(T);h.length===1?E&&!u?e.report({node:l,messageId:"unnecessaryTypeofCondition",data:{name:He(f,e),type:T}}):!E&&u?e.report({node:l,messageId:"unnecessaryTypeofCondition",data:{name:He(f,e),type:Array.from(h)[0]}}):!E&&!u?e.report({node:l,messageId:"alwaysFalseTypeofCondition",data:{name:He(f,e),actualType:lt(h),conditionType:T}}):E&&u&&e.report({node:l,messageId:"alwaysFalseTypeofCondition",data:{name:He(f,e),actualType:lt(h),conditionType:T}}):!E&&!u?e.report({node:l,messageId:"alwaysFalseTypeofCondition",data:{name:He(f,e),actualType:lt(h),conditionType:T}}):!E&&u&&e.report({node:l,messageId:"unnecessaryTypeofCondition",data:{name:He(f,e),type:lt(h)}})}function p(l){if(l.flags&ie.default.TypeFlags.Any||l.flags&ie.default.TypeFlags.Unknown)return null;if(l.isUnion()){let m=[];for(let f of l.types)if(f.flags&ie.default.TypeFlags.StringLiteral){let T=f.value;m.push(T)}else return null;return m}return l.flags&ie.default.TypeFlags.StringLiteral?[l.value]:null}function a(l){if(!r)return null;let m=t.esTreeNodeToTSNodeMap.get(l),f=r.getTypeAtLocation(m),T=p(f);if(T)return T;let h=r.getSymbolAtLocation(m);if(h){let u=r.getTypeOfSymbolAtLocation(h,m),E=p(u);if(E)return E}return null}function c(l){let m=e.sourceCode.ast,f=null;return Le(m,T=>{if(T.type===K.AST_NODE_TYPES.VariableDeclarator&&T.id.type===K.AST_NODE_TYPES.Identifier&&T.id.name===l.name&&T.id.typeAnnotation){let h=T.id.typeAnnotation.typeAnnotation;if(h.type===K.AST_NODE_TYPES.TSUnionType){let u=[];for(let E of h.types)if(E.type===K.AST_NODE_TYPES.TSLiteralType&&E.literal.type===K.AST_NODE_TYPES.Literal&&typeof E.literal.value=="string")u.push(E.literal.value);else return!0;return f=u,!0}if(h.type===K.AST_NODE_TYPES.TSLiteralType&&h.literal.type===K.AST_NODE_TYPES.Literal&&typeof h.literal.value=="string")return f=[h.literal.value],!0}return!1},e.sourceCode),f}function y(l){if(l.callee.type!==K.AST_NODE_TYPES.MemberExpression||l.callee.property.type!==K.AST_NODE_TYPES.Identifier||l.callee.computed)return;let m=l.callee.property.name;if(m!=="startsWith"&&m!=="endsWith"&&m!=="includes"||l.arguments.length!==1)return;let[f]=l.arguments;if(!f||f.type!==K.AST_NODE_TYPES.Literal||typeof f.value!="string")return;let T=l.callee.object,h=a(T);if(!h&&T.type===K.AST_NODE_TYPES.Identifier&&(h=c(T)),!h||h.length===0)return;let u=f.value;if(m==="includes"&&h.length>1)return;let E=0,x=0;for(let d of h)if((m==="startsWith"?d.startsWith(u):m==="endsWith"?d.endsWith(u):d.includes(u))?E++:x++,E>0&&x>0)return;if(E>0&&x===0){let d=m==="startsWith"?"unnecessaryStartsWithCondition":m==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:l,messageId:d})}else if(x>0&&E===0){let d=m==="startsWith"?"alwaysFalseStartsWithCondition":m==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:l,messageId:d})}}function S(l){if(!new Set(["===","!==",">",">=","<","<="]).has(l.operator))return;function f(b){if(b.type!==K.AST_NODE_TYPES.MemberExpression||b.computed||b.property.type!==K.AST_NODE_TYPES.Identifier||b.property.name!=="length")return null;let g=b.object,C=a(g);if(!C||C.length===0)return null;let A=[];for(let w of C)A.push(w.length);return{values:A}}let T=f(l.left),h=f(l.right),u=null,E=null;if(T?l.right.type===K.AST_NODE_TYPES.Literal&&typeof l.right.value=="number"&&(u=T.values,E=l.right.value):h&&l.left.type===K.AST_NODE_TYPES.Literal&&typeof l.left.value=="number"&&(u=h.values,E=l.left.value),!u||E===null)return;let x=0,d=0;for(let b of u){let g=!1;if(l.operator==="==="?g=b===E:l.operator==="!=="?g=b!==E:l.operator===">"?g=b>E:l.operator===">="?g=b>=E:l.operator==="<"?g=b<E:l.operator==="<="&&(g=b<=E),g?x++:d++,x>0&&d>0)return}x>0&&d===0?e.report({node:l,messageId:"unnecessaryLengthCondition"}):d>0&&x===0&&e.report({node:l,messageId:"alwaysFalseLengthCondition"})}return{BinaryExpression(l){i(l),S(l)},CallExpression:y}}})};function lt(e){return Array.from(new Set(e)).join(" | ")||"never"}function He(e,t){let r=e.argument;return r.type===K.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function ki(e,t){return t.has(e)}var ct=require("@typescript-eslint/utils"),pt=require("zod/v4");var vi=ct.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Gn="no-call-with-explicit-generics",Pi=pt.z.object({functions:pt.z.array(pt.z.string())}),Fi=vi({name:Gn,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[L(Pi)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:s}=n;s.type===ct.AST_NODE_TYPES.Identifier&&r.has(s.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:s.name}})}}}}),jt={name:Gn,rule:Fi};var Ue=require("@typescript-eslint/utils"),Oi=Ue.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Kn="no-call-with-inferred-generics",Ni=Oi({name:Kn,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!==Ue.AST_NODE_TYPES.Identifier)return;let o=r.get(s.name);if(!o)return;let{minGenerics:i=1,allowAny:p,disallowTypes:a=t.disallowTypes}=o;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:s.name,minGenerics:i||0}}),!(p&&!a)&&n.typeArguments?.params.some(y=>!p&&y.type===Ue.AST_NODE_TYPES.TSAnyKeyword||a&&y.type===Ue.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===Ue.AST_NODE_TYPES.Identifier&&a.includes(y.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:s.name}})}}}}),Lt={name:Kn,rule:Ni};var tr=require("@typescript-eslint/utils"),Di=tr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nr="no-commented-out-code",ji=["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:"],Li=/^\s*return\s+/,Mi=/\w=("|'|`)/,$i=/\w+:\s*('|"|`)/,_i=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,Ui=/\w+-\w+:/,zi=/\w+_\w+:/,Wi=/\?\s+\w/,Ji=/:\s+\w/,Vi=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,Xi=/^\s*\d+[,}]/,Hi=/^\s*\[[^\]]*\][,}]/,Bi=/^\s*\{[^}]*\}[,}]/,Yi=/\.\w+\(/,qi=/\[\w+\]/,Zi=/^\s*(['"`]).+?\1\s*:/,Gi=/^<[A-Z]\w*(\s|>|\/)/,Ki=/^<[a-z]+(\s|>|\/)/,Qi=/<[A-Z]\w*(\s.*)?>/,es=/<\/[A-Z]\w*>/,ts=/<[a-z]+(\s.*)?>/,ns=/<\/[a-z]+>/,rs=/^\s*[*\s]*$/,is=/^[a-zA-Z]/,ss=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,os=/```[\s\S]*?```/g,as=/`[^`]*`/g,Qn=/[a-zA-Z0-9]/,ls=/\.[A-Za-z_][A-Za-z0-9_]*\(/,ps=/[{}[\]()`=<>]/,cs=/:\s*(['"`[{(]|\w+\s*=>)/,us=/\bif\s*\(|\belse\b|=>/,ee={returnStatement:Li,stringAssignment:Mi,objectPropertyWithQuotes:$i,computedPropertyAssignment:_i,kebabCaseProperty:Ui,snakeCaseProperty:zi,ternaryOperator:Wi,colonWithWord:Ji,quotedString:Vi,numberWithComma:Xi,arrayWithComma:Hi,objectWithComma:Bi,methodCall:Yi,arrayAccess:qi,quotedPropertyKey:Zi,jsxSelfClosing:Gi,jsxElement:Ki,jsxOpeningTag:Qi,jsxClosingTag:es,htmlOpeningTag:ts,htmlClosingTag:ns,jsdocComment:rs};function fs(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&is.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||ls.test(t)||ps.test(t)||cs.test(t)||us.test(t)?!1:!!(t.includes(":")&&ss.test(t))}var ms=[") {","return;",ee.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",ee.stringAssignment,");",ee.objectPropertyWithQuotes,ee.computedPropertyAssignment,ee.kebabCaseProperty,ee.snakeCaseProperty,"&&","||","()",ee.ternaryOperator,ee.colonWithWord,ee.quotedString,ee.numberWithComma,ee.arrayWithComma,ee.objectWithComma,ee.methodCall,ee.arrayAccess,"?.(","??","=>",ee.quotedPropertyKey],ys=["/>","</",ee.jsxSelfClosing,ee.jsxElement,ee.jsxOpeningTag,ee.jsxClosingTag,ee.htmlOpeningTag,ee.htmlClosingTag],er=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],ds=Di({name:nr,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 o=n.trimStart();if(n.startsWith("*")||o.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")||ee.jsdocComment.test(n))return!1;for(let i of er)if(o.startsWith(i))return!1;if(n.includes("https://")||fs(o))return!1;if(s==="Block"){for(let i of ys)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of ji)if(o.startsWith(i))return{wrongPattern:i};for(let i of ms)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,s){let o=n,i=o.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return o;if(s==="Block"&&o.includes("```")){let c=o.split(os);c.some(S=>Qn.test(S))&&(o=c.join(""))}if(!o.includes("`"))return o;let p=o.split(as);return p.some(c=>Qn.test(c))?p.join(""):o}return{Program(){let s=e.sourceCode.getAllComments();for(let o of s){let i=r(o.value,o.type),p=t(i,o.type);p&&e.report({node:o,messageId:"commentedOutCode",data:{wrongPattern:p.wrongPattern,allowedPrefixes:er.join(", ")}})}}}}}),Mt={name:nr,rule:ds};var ut=require("@typescript-eslint/utils"),gs=ut.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),rr="no-default-export",Ss=gs({name:rr,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===ut.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),$t={name:rr,rule:Ss};var ir=require("@typescript-eslint/utils"),Ts=ir.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),sr="no-leaked-text-in-jsx",hs=[",",";","[","]","(",")"],Es=Ts({name:sr,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(t){let r=t.value.trim();if(!r)return;let n="";hs.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),_t={name:sr,rule:Es};var Me=require("@typescript-eslint/utils"),bs=Me.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ar="no-non-camel-case-functions",xs=/^(\$?[a-z][a-zA-Z0-9]*)$/;function or(e){if(e.typeName.type!==Me.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Me.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var Cs=bs({name:ar,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&&!xs.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Me.AST_NODE_TYPES.TSTypeReference?or(r):r.type===Me.AST_NODE_TYPES.TSUnionType&&r.types.some(s=>s.type===Me.AST_NODE_TYPES.TSTypeReference&&or(s))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),Ut={name:ar,rule:Cs};var B=require("@typescript-eslint/utils");var Is=B.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),lr="no-optional-root-props",As=Is({name:lr,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 o=e.sourceCode.getDeclaredVariables(n)[0];if(!o||o.references.length!==1)return!1;let i=o.references[0];if(!i)return!1;for(let p of Ot(i.identifier)){if("returnType"in p||p.type===B.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let a=p.parent;if(!a)return!1;if(a.type===B.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&a.parent.type===B.TSESTree.AST_NODE_TYPES.TSTypeReference&&a.parent.typeName.type===B.TSESTree.AST_NODE_TYPES.Identifier&&a.parent.typeName.name==="FC"){let y=Xe(a.parent.parent,B.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!y)return!1;let S=ft(y,e.sourceCode);return S?!(S.parent.type===B.TSESTree.AST_NODE_TYPES.CallExpression&&S.parent.callee.type===B.TSESTree.AST_NODE_TYPES.Identifier&&S.parent.callee.name==="memo"):!1}if(p.type===B.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(a.type===B.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let c=Xe(a,B.TSESTree.AST_NODE_TYPES.VariableDeclaration);return c?!!ft(c,e.sourceCode):!1}if(a.type===B.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!ft(a,e.sourceCode)}return!1}function r(n){n.key.type!==B.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 o=Xe(n,B.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!o)return null;let i=e.sourceCode.getText(o);return s.replaceText(o,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===B.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(mt(n)||!t(n)))for(let s of n.typeAnnotation.members)s.type===B.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSInterfaceDeclaration(n){if(!(mt(n)||!t(n)))for(let s of n.body.body)s.type===B.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSTypeReference(n){if(n.typeName.type!==B.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let s=n.typeArguments.params[0];if(s.type!==B.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let o=Xe(n.parent,B.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!o)return;let i=ft(o,e.sourceCode);if(!(!i||i.parent.type===B.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===B.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let a of s.members)a.type===B.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(a)}}}});function mt(e){return e?e.parent?.type===B.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===B.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function ft(e,t){if(mt(e))return;let r;if(e.type===B.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===B.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===B.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let s=n.variables.find(i=>i.identifiers.includes(r));if(!s)return;let o=s.references.filter(i=>i.identifier!==r);if(!(o.length!==1||!o[0])&&!mt(o[0].identifier.parent.parent))return o[0].identifier}var zt={name:lr,rule:As};var Ke=require("@typescript-eslint/utils");var Qe=M({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let t=new Set;function r(n){return n?n.type===Ke.AST_NODE_TYPES.Identifier?t.has(n.name):n.type===Ke.AST_NODE_TYPES.MemberExpression?r(n.object):!1:!1}return{ImportDeclaration(n){for(let s of n.specifiers)t.add(s.local.name)},ExportNamedDeclaration(n){if(n.source){e.report({node:n,messageId:"noReexport"});return}if(n.declaration?.type===Ke.AST_NODE_TYPES.VariableDeclaration)for(let s of n.declaration.declarations)r(s.init)&&e.report({node:n,messageId:"noReexport"});n.specifiers.length>0&&e.report({node:n,messageId:"noReexport"})},ExportDefaultDeclaration(n){n.declaration.type===Ke.AST_NODE_TYPES.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});var pr=require("@typescript-eslint/utils"),yt=Ee(require("path")),ve=require("zod/v4");var ws=pr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cr="no-relative-imports",Rs=ve.z.object({find:ve.z.string(),replacement:ve.z.string()}),ks=ve.z.object({aliases:ve.z.array(Rs),rootDir:ve.z.string().optional(),allowNotFoundAliases:ve.z.boolean().optional(),_dev_simulateFileName:ve.z.string().optional()}),vs=ws({name:cr,meta:{type:"problem",fixable:"code",docs:{description:"Prevent relative imports and auto-fix them using configured aliases"},messages:{noRelativeImports:"Relative imports are not allowed. Use one of the valid aliases in tsconfig.json instead.",noRelativeImportsWithAlias:'Relative imports are not allowed. Use the "{{ alias }}" alias instead.'},schema:[L(ks)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function s(i,p){let a=yt.default.dirname(p);return yt.default.resolve(a,i)}function o(i){let p=t.rootDir??process.cwd(),a=yt.default.relative(p,i);if(a.startsWith("."))return null;a.startsWith("/")||(a=`/${a}`);for(let{find:c,replacement:y}of t.aliases)if(a.startsWith(y)){let S=a.replace(y,c);return{alias:c,newPath:S}}return null}return{ImportDeclaration(i){let p=i.source.value;if(!n(p))return;let a=s(p,r),c=o(a);!c&&t.allowNotFoundAliases||e.report({node:i,messageId:c?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:c?.alias},fix:c?y=>y.replaceText(i.source,`'${c.newPath}'`):void 0})}}}}),Wt={name:cr,rule:vs};var te=require("@typescript-eslint/utils"),Jt=require("zod/v4");var Ps=Jt.z.object({customMessage:Jt.z.string().optional()}),Vt=M({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[L(Ps)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case te.AST_NODE_TYPES.Literal:return!0;case te.AST_NODE_TYPES.ObjectExpression:return n.properties.every(s=>s.type===te.AST_NODE_TYPES.Property?s.computed||s.value.type===te.AST_NODE_TYPES.Identifier&&s.key.type===te.AST_NODE_TYPES.Identifier&&s.key.name===s.value.name?!1:r(s.value):!1);case te.AST_NODE_TYPES.ArrayExpression:return n.elements.every(s=>s?s.type===te.AST_NODE_TYPES.SpreadElement?!1:r(s):!0);case te.AST_NODE_TYPES.TemplateLiteral:return n.expressions.length===0;case te.AST_NODE_TYPES.ConditionalExpression:case te.AST_NODE_TYPES.LogicalExpression:case te.AST_NODE_TYPES.BinaryExpression:case te.AST_NODE_TYPES.UnaryExpression:case te.AST_NODE_TYPES.CallExpression:case te.AST_NODE_TYPES.MemberExpression:case te.AST_NODE_TYPES.Identifier:case te.AST_NODE_TYPES.ArrowFunctionExpression:case te.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===te.AST_NODE_TYPES.JSXIdentifier&&n.name.name==="style"&&n.value){let s=null;n.value.type===te.AST_NODE_TYPES.JSXExpressionContainer?n.value.expression.type!==te.AST_NODE_TYPES.JSXEmptyExpression&&(s=n.value.expression):n.value.type===te.AST_NODE_TYPES.Literal&&(s=n.value),s&&r(s)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var et=require("@typescript-eslint/utils"),ze=Ee(require("zod/v4"));var Fs=ze.object({alternativeMsgs:ze.object({inArrayFind:ze.string().optional(),inArrayFilter:ze.string().optional()}).optional(),__dev_simulateFileName:ze.string().optional()});function Os(e){return e.typeAnnotation.type!==et.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var Ns=/(typeGuards|type-guards)\.(ts|tsx)$/;function Ds(e){return Ns.test(e)}function js(e){let t=e.parent;for(;t;){if(t.type===et.AST_NODE_TYPES.CallExpression&&t.callee.type===et.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===et.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var Xt=M({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[L(Fs)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(Ds(r))return{};function n(s){if(!Os(s))return;let o=js(s);if(t.alternativeMsgs&&o){let i=o.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let p=o.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:s,messageId:p,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 Ls="no-unnecessary-async-on-jsx-props";function Ms(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 Ht=M({name:Ls,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){Ms(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let s=e.sourceCode,o=[],i=s.getFirstToken(r,a=>a.value==="async");if(i){let a=s.getTokenAfter(i);a?o.push(n.replaceTextRange([i.range[0],a.range[0]],"")):o.push(n.remove(i))}function p(a){if(a.type===We.AST_NODE_TYPES.AwaitExpression){let c=s.getFirstToken(a);if(c&&c.value==="await"){let y=s.getTokenAfter(c);y?o.push(n.replaceTextRange([c.range[0],y.range[0]],"")):o.push(n.remove(c))}}if(a.type===We.AST_NODE_TYPES.BlockStatement)for(let c of a.body)p(c);else a.type===We.AST_NODE_TYPES.ExpressionStatement&&p(a.expression)}return p(r.body),o}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var Pe=require("@typescript-eslint/utils"),Bt=Ee(require("typescript")),Be=Ee(require("zod/v4"));var $s=Pe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ur="no-unnecessary-casting",_s=Be.default.object({additionalCastFunctions:Be.default.array(Be.default.object({name:Be.default.string(),expectedType:Be.default.enum(["string","number"])})).optional()}),Yt={name:ur,rule:$s({name:ur,meta:{type:"suggestion",docs:{description:"Prevents unnecessary Number and String castings"},messages:{unnecessaryNumberCasting:"Unnecessary Number() casting on a value already of number type",unnecessaryStringCasting:"Unnecessary String() casting on a value already of string type",unnecessaryCustomCasting:"Unnecessary {{name}}() casting on a value already of {{type}} type"},schema:[L(_s)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],s=Pe.ESLintUtils.getParserServices(e,!0),o=s.program?.getTypeChecker();if(!o||!s.program)throw new Error("TypeScript services or program not available");function i(y,S){switch(y.type){case Pe.AST_NODE_TYPES.Literal:return S==="number"?typeof y.value=="number":typeof y.value=="string";case Pe.AST_NODE_TYPES.TemplateLiteral:return S==="string";case Pe.AST_NODE_TYPES.UnaryExpression:return S==="number"?y.operator==="+"||y.operator==="-"||y.operator==="~":!1;default:return!1}}function p(y,S){return S==="number"?!!(y.flags&Bt.TypeFlags.NumberLike):!!(y.flags&Bt.TypeFlags.StringLike)}function a(y,S){return l=>l.replaceText(y,e.sourceCode.getText(S))}function c(y){if(!o||y.arguments.length!==1)return;let S=y.arguments[0];if(!S||S.type===Pe.AST_NODE_TYPES.SpreadElement)return;let{callee:l}=y;if(l.type!==Pe.AST_NODE_TYPES.Identifier)return;let m=l.name,f=n.find(h=>h.name===m);if(!f)return;if(i(S,f.expectedType)||p(o.getTypeAtLocation(s.esTreeNodeToTSNodeMap.get(S)),f.expectedType)){let h,u;m==="Number"?h="unnecessaryNumberCasting":m==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",u={name:f.name,type:f.expectedType}),e.report({node:y,messageId:h,...u?{data:u}:{},fix:a(y,S)})}}return{CallExpression:c}}})};var ye=require("@typescript-eslint/utils"),dt=Ee(require("zod/v4"));var Us=dt.object({ignoreWithDescription:dt.string().optional()}),qt=M({name:"no-unnecessary-describe",meta:{type:"suggestion",docs:{description:"Disallow unnecessary describe blocks that wrap all tests in a file"},messages:{unnecessaryDescribe:"Describe blocks that solely wrap all tests in the file are unnecessary, they just add unnecessary nesting to the code. The file itself should be enough to group tests. Remove it.",removeDescribe:"Remove the describe block"},hasSuggestions:!0,schema:[L(Us)]},defaultOptions:[{}],create(e,[t]){let r=e.getSourceCode(),n=r.ast;function s(a){let c=a.arguments[0];return c&&c.type===ye.AST_NODE_TYPES.Literal&&typeof c.value=="string"?c.value:null}function o(a){return!a||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(a)}function i(a){return a.length!==1?!1:n.body.filter(y=>{if(y.type===ye.AST_NODE_TYPES.ExpressionStatement){let S=y.expression;if(S.type===ye.AST_NODE_TYPES.CallExpression&&S.callee.type===ye.AST_NODE_TYPES.Identifier){let l=S.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(l)}}return!1}).length===0}function p(a){let c=a.arguments[1];if(c&&(c.type===ye.AST_NODE_TYPES.FunctionExpression||c.type===ye.AST_NODE_TYPES.ArrowFunctionExpression)&&c.body.type===ye.AST_NODE_TYPES.BlockStatement){let y=c.body.body;return y.length===0?"":y.map(l=>r.text.slice(l.range[0],l.range[1])).join(`
|
|
15
|
+
Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let T=a.acquire(f),C=new Set,A=null;{let I=T.upper;for(;I&&(C.add(I),I.type!=="function");)I=I.upper;if(!I)return;A=I}let w=Array.isArray;function O(I){if(!w(I.defs))return!1;let R=I.defs[0];if(R==null||R.node.type!=="VariableDeclarator")return!1;let P=R.node.init;if(P==null)return!1;for(;P.type==="TSAsExpression";)P=P.expression;let N=R.node.parent;if(N==null&&(Pt(A.block,R.node.id),N=R.node.parent,N==null))return!1;if(N.kind==="const"&&P.type==="Literal"&&(typeof P.value=="string"||typeof P.value=="number"||P.value===null))return!0;if(P.type!=="CallExpression")return!1;let j=P.callee;if(j.type==="MemberExpression"&&j.object.name==="React"&&j.property!=null&&!j.computed&&(j=j.property),j.type!=="Identifier")return!1;let D=R.node.id,{name:U}=j;if(U==="useRef"&&D.type==="Identifier")return!0;if(xi(j)&&D.type==="Identifier"){for(let z of I.references)z!==D&&h.add(z.identifier);return!0}else if(U==="useState"||U==="useReducer"){if(D.type==="ArrayPattern"&&D.elements.length===2&&w(I.identifiers)){if(D.elements[1]===I.identifiers[0]){if(U==="useState"){let z=I.references,Se=0;for(let Re=0;Re<z.length;Re++){if(z[Re].isWrite()&&Se++,Se>1)return!1;c.set(z[Re].identifier,D.elements[0])}}return!0}else if(D.elements[0]===I.identifiers[0]){if(U==="useState"){let z=I.references;for(let Se=0;Se<z.length;Se++)y.add(z[Se].identifier)}return!1}}}else if(U==="useTransition"&&D.type==="ArrayPattern"&&D.elements.length===2&&Array.isArray(I.identifiers)&&D.elements[1]===I.identifiers[0])return!0;return!1}function M(I){if(!w(I.defs))return!1;let R=I.defs[0];if(R==null||R.node==null||R.node.id==null)return!1;let P=R.node,N=A.childScopes,j=null,D;for(D=0;D<N.length;D++){let U=N[D],z=U.block;if(P.type==="FunctionDeclaration"&&z===P||P.type==="VariableDeclarator"&&z.parent===P){j=U;break}}if(j==null)return!1;for(D=0;D<j.through.length;D++){let U=j.through[D];if(U.resolved!=null&&C.has(U.resolved.scope)&&!K(U.resolved))return!1}return!0}let K=u(O,d),ee=u(M,l),oe=new Map;function le(I){let R=I.from,P=!1;for(;R.block!==f;)R.type==="function"&&(P=R.block.parent!=null&&R.block.parent.type==="ReturnStatement"),R=R.upper;return P}let Z=new Map,xe=new Map;Ve(T);function Ve(I){for(let R of I.references){if(!R.resolved||!C.has(R.resolved.scope))continue;let P=Pt(f,R.identifier),N=Vn(P),j=ke(N,xe);if(b&&N.type==="Identifier"&&(N.parent.type==="MemberExpression"||N.parent.type==="OptionalMemberExpression")&&!N.parent.computed&&N.parent.property.type==="Identifier"&&N.parent.property.name==="current"&&le(R)&&oe.set(j,{reference:R,dependencyNode:N}),N.parent.type==="TSTypeQuery"||N.parent.type==="TSTypeReference")continue;let D=R.resolved.defs[0];if(D!=null&&!(D.node!=null&&D.node.init===f.parent)&&D.type!=="TypeParameter")if(Z.has(j))Z.get(j).references.push(R);else{let U=R.resolved,z=K(U)||ee(U);Z.set(j,{isStable:z,references:[R]})}}for(let R of I.childScopes)Ve(R)}oe.forEach(({reference:I,dependencyNode:R},P)=>{let N=I.resolved.references,j=!1;for(let D=0;D<N.length;D++){let{identifier:U}=N[D],{parent:z}=U;if(z!=null&&z.type==="MemberExpression"&&!z.computed&&z.property.type==="Identifier"&&z.property.name==="current"&&z.parent.type==="AssignmentExpression"&&z.parent.left===z){j=!0;break}}j||p({node:R.parent.property,message:`The ref value '${P}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${P}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ce=new Set;function Oe(I,R){ce.has(R)||(ce.add(R),p({node:I,message:`Assignments to the '${R}' variable from inside React Hook ${r(x)} 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(x)}.`}))}let ge=new Set;if(Z.forEach(({isStable:I,references:R},P)=>{I&&ge.add(P),R.forEach(N=>{N.writeExpr&&Oe(N.writeExpr,P)})}),ce.size>0)return;if(!E){let I=null;if(Z.forEach(({isStable:R,references:P},N)=>{I||P.forEach(j=>{if(I)return;let D=j.identifier;if(!c.has(D))return;let z=j.from;for(;z.type!=="function";)z=z.upper;z.block===f&&(I=N)})}),I){let{suggestedDependencies:R}=kt({dependencies:Z,declaredDependencies:[],stableDependencies:ge,externalDependencies:new Set,isEffect:!0});p({node:x,message:`React Hook ${m} contains a call to '${I}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+R.join(", ")+`] as a second argument to the ${m} Hook.`,suggest:[{desc:`Add dependencies array: [${R.join(", ")}]`,fix(P){return P.insertTextAfter(f,`, [${R.join(", ")}]`)}}]})}return}let _e=[],Ge=new Set;E.type!=="ArrayExpression"?p({node:E,message:`React Hook ${r(x)} 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.`}):E.elements.forEach(I=>{if(I===null)return;if(I.type==="SpreadElement"){p({node:I,message:`React Hook ${r(x)} 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(I)&&p({node:I,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(I)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(I)}\``,fix(j){return j.removeRange(I.range)}}]});let R;try{R=ke(I,xe)}catch(j){if(/Unsupported node type/.test(j.message)){I.type==="Literal"?Z.has(I.value)?p({node:I,message:`The ${I.raw} literal is not a valid dependency because it never changes. Did you mean to include ${I.value} in the array instead?`}):p({node:I,message:`The ${I.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):p({node:I,message:`React Hook ${r(x)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw j}let P=I;for(;P.type==="MemberExpression"||P.type==="OptionalMemberExpression"||P.type==="ChainExpression";)P=P.object||P.expression.object;let N=!A.through.some(j=>j.identifier===P);_e.push({key:R,node:I}),N||Ge.add(R)});let{suggestedDependencies:Qr,unnecessaryDependencies:st,missingDependencies:Ne,duplicateDependencies:On}=kt({dependencies:Z,declaredDependencies:_e,stableDependencies:ge,externalDependencies:Ge,isEffect:b}),ot=Qr;if(On.size+Ne.size+st.size===0){if(t)return;Ti({declaredDependencies:_e,declaredDependenciesNode:E,componentScope:A,scope:T}).forEach(({construction:R,isUsedOutsideOfHook:P,depType:N})=>{let j=N==="function"?"useCallback":"useMemo",D=N==="function"?"definition":"initialization",U=`wrap the ${D} of '${R.name.name}' in its own ${j}() Hook.`,z=P?`To fix this, ${U}`:`Move it inside the ${m} callback. Alternatively, ${U}`,Se=N==="conditional"||N==="logical expression"?"could make":"makes",Re=`The '${R.name.name}' ${N} ${Se} the dependencies of ${m} Hook (at line ${E.loc.start.line}) change on every render. ${z}`,Nn;P&&R.type==="Variable"&&N==="function"&&(Nn=[{desc:`Wrap the ${D} of '${R.name.name}' in its own ${j}() Hook.`,fix(Dn){let[ti,ni]=j==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Dn.insertTextBefore(R.node.init,ti),Dn.insertTextAfter(R.node.init,ni)]}}]),p({node:R.node,message:Re,suggest:Nn})});return}!b&&Ne.size>0&&(ot=kt({dependencies:Z,declaredDependencies:[],stableDependencies:ge,externalDependencies:Ge,isEffect:b}).suggestedDependencies);function ei(){if(_e.length===0)return!0;let I=_e.map(P=>P.key),R=I.slice().sort();return I.join(",")===R.join(",")}ei()&&ot.sort();function Ct(I){let R=I.split("."),P="";for(let N=0;N<R.length;N++){if(N!==0){let j=R.slice(0,N+1).join("."),D=xe.get(j)===!0;P+=D?"?.":"."}P+=R[N]}return P}function It(I,R,P,N){return I.size===0?null:(I.size>1?"":R+" ")+P+" "+(I.size>1?"dependencies":"dependency")+": "+Ei(Array.from(I).sort().map(j=>"'"+Ct(j)+"'"))+`. Either ${N} ${I.size>1?"them":"it"} or remove the dependency array.`}let he="";if(st.size>0){let I=null;if(Array.from(st.keys()).forEach(R=>{I===null&&R.endsWith(".current")&&(I=R)}),I!==null)he=` Mutable values like '${I}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Ge.size>0){let R=Array.from(Ge)[0];T.set.has(R)||(he=` Outer scope values like '${R}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!he&&Ne.has("props")){let I=Z.get("props");if(I==null)return;let R=I.references;if(!Array.isArray(R))return;let P=!0;for(let N=0;N<R.length;N++){let j=R[N],D=Pt(A.block,j.identifier);if(!D){P=!1;break}let U=D.parent;if(U==null){P=!1;break}if(U.type!=="MemberExpression"&&U.type!=="OptionalMemberExpression"){P=!1;break}}P&&(he=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${m} call and refer to those specific props inside ${r(x)}.`)}if(!he&&Ne.size>0){let I=null;Ne.forEach(R=>{if(I)return;let P=A.set.get(R),N=Z.get(R);if(N.references[0].resolved!==P)return;let j=P.defs[0];if(j==null||j.name==null||j.type!=="Parameter")return;let D=!1,U;for(let z=0;z<N.references.length;z++)if(U=N.references[z].identifier,U!=null&&U.parent!=null&&(U.parent.type==="CallExpression"||U.parent.type==="OptionalCallExpression")&&U.parent.callee===U){D=!0;break}D&&(I=R)}),I!==null&&(he=` If '${I}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!he&&Ne.size>0){let I=null;if(Ne.forEach(R=>{if(I!==null)return;let N=Z.get(R).references,j,D;for(let U=0;U<N.length;U++){for(j=N[U].identifier,D=j.parent;D!=null&&D!==A.block;){if(D.type==="CallExpression"){let z=c.get(D.callee);if(z!=null){if(z.name===R)I={missingDep:R,setter:D.callee.name,form:"updater"};else if(y.has(j))I={missingDep:R,setter:D.callee.name,form:"reducer"};else{let Se=N[U].resolved;if(Se!=null){let Re=Se.defs[0];Re!=null&&Re.type==="Parameter"&&(I={missingDep:R,setter:D.callee.name,form:"inlineReducer"})}}break}}D=D.parent}if(I!==null)break}}),I!==null)switch(I.form){case"reducer":he=` You can also replace multiple useState variables with useReducer if '${I.setter}' needs the current value of '${I.missingDep}'.`;break;case"inlineReducer":he=` If '${I.setter}' needs the current value of '${I.missingDep}', you can also switch to useReducer instead of useState and read '${I.missingDep}' in the reducer.`;break;case"updater":he=` You can also do a functional update '${I.setter}(${I.missingDep.slice(0,1)} => ...)' if you only need '${I.missingDep}' in the '${I.setter}' call.`;break;default:throw new Error("Unknown case.")}}p({node:E,message:`React Hook ${r(x)} has `+(It(Ne,"a","missing","include")||It(st,"an","unnecessary","exclude")||It(On,"a","duplicate","omit"))+he,suggest:[{desc:`Update the dependencies array to be: [${ot.map(Ct).join(", ")}]`,fix(I){return I.replaceText(E,`[${ot.map(Ct).join(", ")}]`)}}]})}function g(f){let E=hi(f.callee,i);if(E===-1)return;let x=f.arguments[E],m=f.callee,b=Xn(m).name,T=f.arguments[E+1],C=/Effect($|[^a-z])/g.test(b);if(!x){p({node:m,message:`React Hook ${b} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!C)){if(!T&&!C){(b==="useMemo"||b==="useCallback")&&p({node:m,message:`React Hook ${b} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(x.type){case"FunctionExpression":case"ArrowFunctionExpression":S(x,T,m,b,C);return;case"Identifier":if(!T||T.elements&&T.elements.some(O=>O&&O.type==="Identifier"&&O.name===x.name))return;let A=n(f).set.get(x.name);if(A==null||A.defs==null)return;let w=A.defs[0];if(!w||!w.node||w.type!=="Variable"&&w.type!=="FunctionName")break;switch(w.node.type){case"FunctionDeclaration":S(w.node,T,m,b,C);return;case"VariableDeclarator":let O=w.node.init;if(!O)break;switch(O.type){case"ArrowFunctionExpression":case"FunctionExpression":S(O,T,m,b,C);return}break}break;default:p({node:m,message:`React Hook ${b} received a function whose dependencies are unknown. Pass an inline function instead.`});return}p({node:m,message:`React Hook ${b} has a missing dependency: '${x.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${x.name}]`,fix(A){return A.replaceText(T,`[${x.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let f of e.sourceCode.getAllComments())if(Si.test(f.value))return t=!0,{CallExpression:E=>g(E,!0)}}return{CallExpression:f=>g(f)}}};function kt({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:s}){let o=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((S,g)=>{let f=p(o,g);f.isUsed=!0,a(o,g,E=>{E.isSubtreeUsed=!0})}),t.forEach(({key:S})=>{let g=p(o,S);g.isSatisfiedRecursively=!0}),r.forEach(S=>{let g=p(o,S);g.isSatisfiedRecursively=!0});function p(S,g){let f=g.split("."),E=S;for(let x of f){let m=E.children.get(x);m||(m=i(),E.children.set(x,m)),E=m}return E}function a(S,g,f){let E=g.split("."),x=S;for(let m of E){let b=x.children.get(m);if(!b)return;f(b),x=b}}let c=new Set,y=new Set;d(o,c,y,S=>S);function d(S,g,f,E){S.children.forEach((x,m)=>{let b=E(m);if(x.isSatisfiedRecursively){x.isSubtreeUsed&&f.add(b);return}if(x.isUsed){g.add(b);return}d(x,g,f,T=>b+"."+T)})}let l=[],h=new Set,u=new Set;return t.forEach(({key:S})=>{y.has(S)?l.indexOf(S)===-1?l.push(S):u.add(S):h.add(S)}),c.forEach(S=>{l.push(S)}),{suggestedDependencies:l,unnecessaryDependencies:h,duplicateDependencies:u,missingDependencies:c}}function je(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 je(e.consequent)!=null||je(e.alternate)!=null?"conditional":null;case"LogicalExpression":return je(e.left)!=null||je(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return je(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return je(e.expression);case"TSAsExpression":return je(e.expression)}return null}function Ti({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let s=e.map(({key:i})=>{let p=r.variables.find(c=>c.name===i);if(p==null)return null;let a=p.defs[0];if(a==null)return null;if(a.type==="Variable"&&a.node.type==="VariableDeclarator"&&a.node.id.type==="Identifier"&&a.node.init!=null){let c=je(a.node.init);if(c!=null)return[p,c]}return a.type==="FunctionName"&&a.node.type==="FunctionDeclaration"?[p,"function"]:a.type==="ClassName"&&a.node.type==="ClassDeclaration"?[p,"class"]:null}).filter(Boolean);function o(i){let p=!1;for(let a=0;a<i.references.length;a++){let c=i.references[a];if(c.writeExpr){if(p)return!0;p=!0;continue}let y=c.from;for(;y!==n&&y!=null;)y=y.upper;if(y!==n&&!Hn(t,c.identifier))return!0}return!1}return s.map(([i,p])=>({construction:i.defs[0],depType:p,isUsedOutsideOfHook:o(i)}))}function Vn(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)?Vn(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function vt(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function ke(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=ke(e.object,t),n=ke(e.property,null),s=`${r}.${n}`;return vt(e,t,s),s}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=ke(e.object,t),n=ke(e.property,null),s=`${r}.${n}`;return vt(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=ke(r.object,t),s=ke(r.property,null),o=`${n}.${s}`;return vt(r,t,o),o}else throw new Error(`Unsupported node type: ${e.type}`)}function Xn(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function hi(e,t){let r=Xn(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=ke(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 Pt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),bi(n,t))return n;if(Hn(n,t))for(let[s,o]of Object.entries(n))s!=="parent"&&(Wn(o)?(o.parent=n,r.push(o)):Array.isArray(o)&&o.forEach(i=>{Wn(i)&&(i.parent=n,r.push(i))}))}return null}function Ei(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 Wn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function bi(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 Hn(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function xi(e){return!1}var Q=require("@typescript-eslint/utils"),ie=Ee(require("typescript")),Zn=require("zod/v4");var Ft=require("@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*Ot(e){yield e,e.parent&&(yield*Ot(e.parent))}function Nt(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function Yn(e,t,r){let s=r.getDeclaredVariables(e).find(o=>o.name===t||o.identifiers[0]?.parent.type===Ft.AST_NODE_TYPES.Property&&o.identifiers[0].parent.key.type===Ft.AST_NODE_TYPES.Identifier&&o.identifiers[0].parent.key.name===t);return s?s.references.filter(o=>!o.init):[]}function Bn(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function Ci(e,t){return e[t]}function Le(e,t,r){let n=r.visitorKeys,s=new Set;function o(i){if(s.has(i))return!1;if(s.add(i),t(i)===!0)return!0;let a=n[i.type];if(a)for(let c of a){let y=Ci(i,c);if(y){if(Array.isArray(y)){for(let d of y)if(Bn(d)&&o(d))return!0}else if(Bn(y)&&o(y))return!0}}return!1}o(e)}var Ii=Q.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),qn="improved-no-unnecessary-condition",Ai=Zn.z.object({}),wi=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Ri=new Set(wi),Dt={name:qn,rule:Ii({name:qn,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".',unnecessaryStartsWithCondition:"This startsWith check is unnecessary as it always evaluates to true.",alwaysFalseStartsWithCondition:"This startsWith check will always be false.",unnecessaryEndsWithCondition:"This endsWith check is unnecessary as it always evaluates to true.",alwaysFalseEndsWithCondition:"This endsWith check will always be false.",unnecessaryIncludesCondition:"This includes check is unnecessary as it always evaluates to true.",alwaysFalseIncludesCondition:"This includes check will always be false.",unnecessaryLengthCondition:"This length comparison is unnecessary as it always evaluates to true.",alwaysFalseLengthCondition:"This length comparison will always be false."},schema:[L(Ai)]},defaultOptions:[{}],create(e){let t=Q.ESLintUtils.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(l){return l.type===Q.AST_NODE_TYPES.UnaryExpression&&l.operator==="typeof"}function s(l){return l.flags&ie.default.TypeFlags.Any||l.flags&ie.default.TypeFlags.Unknown?null:l.flags&ie.default.TypeFlags.StringLike?["string"]:l.flags&ie.default.TypeFlags.NumberLike?["number"]:l.flags&ie.default.TypeFlags.BigIntLike?["bigint"]:l.flags&ie.default.TypeFlags.BooleanLike?["boolean"]:l.flags&ie.default.TypeFlags.ESSymbolLike?["symbol"]:l.flags&ie.default.TypeFlags.Undefined||l.flags&ie.default.TypeFlags.Void?["undefined"]:l.flags&ie.default.TypeFlags.Null?["object"]:l.getCallSignatures().length>0?["function"]:l.flags&ie.default.TypeFlags.Object?l.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:l.flags&ie.default.TypeFlags.NonPrimitive?["object"]:l.flags&ie.default.TypeFlags.Never?["never"]:null}function o(l){if(!r)return null;let h=t.esTreeNodeToTSNodeMap.get(l),u=r.getTypeAtLocation(h.expression);if(u.flags&ie.default.TypeFlags.Any||u.flags&ie.default.TypeFlags.Unknown)return null;let S=[];if(u.isUnion()){for(let f of u.types){let E=s(f);if(E)S.push(...E);else return null}return S}let g=s(u);return g?(S.push(...g),S):null}function i(l){if(!(l.operator==="==="||l.operator==="!=="))return;let u=null,S=null;if(n(l.left)?(u=l.left,S=l.right.type===Q.AST_NODE_TYPES.Literal&&typeof l.right.value=="string"?l.right.value:null):n(l.right)&&(u=l.right,S=l.left.type===Q.AST_NODE_TYPES.Literal&&typeof l.left.value=="string"?l.left.value:null),!u||!S||!ki(S,Ri))return;let g=o(u);if(!g)return;let f=l.operator==="!==",E=g.includes(S);g.length===1?E&&!f?e.report({node:l,messageId:"unnecessaryTypeofCondition",data:{name:He(u,e),type:S}}):!E&&f?e.report({node:l,messageId:"unnecessaryTypeofCondition",data:{name:He(u,e),type:Array.from(g)[0]}}):!E&&!f?e.report({node:l,messageId:"alwaysFalseTypeofCondition",data:{name:He(u,e),actualType:lt(g),conditionType:S}}):E&&f&&e.report({node:l,messageId:"alwaysFalseTypeofCondition",data:{name:He(u,e),actualType:lt(g),conditionType:S}}):!E&&!f?e.report({node:l,messageId:"alwaysFalseTypeofCondition",data:{name:He(u,e),actualType:lt(g),conditionType:S}}):!E&&f&&e.report({node:l,messageId:"unnecessaryTypeofCondition",data:{name:He(u,e),type:lt(g)}})}function p(l){if(l.flags&ie.default.TypeFlags.Any||l.flags&ie.default.TypeFlags.Unknown)return null;if(l.isUnion()){let h=[];for(let u of l.types)if(u.flags&ie.default.TypeFlags.StringLiteral){let S=u.value;h.push(S)}else return null;return h}return l.flags&ie.default.TypeFlags.StringLiteral?[l.value]:null}function a(l){if(!r)return null;let h=t.esTreeNodeToTSNodeMap.get(l),u=r.getTypeAtLocation(h),S=p(u);if(S)return S;let g=r.getSymbolAtLocation(h);if(g){let f=r.getTypeOfSymbolAtLocation(g,h),E=p(f);if(E)return E}return null}function c(l){let h=e.sourceCode.ast,u=null;return Le(h,S=>{if(S.type===Q.AST_NODE_TYPES.VariableDeclarator&&S.id.type===Q.AST_NODE_TYPES.Identifier&&S.id.name===l.name&&S.id.typeAnnotation){let g=S.id.typeAnnotation.typeAnnotation;if(g.type===Q.AST_NODE_TYPES.TSUnionType){let f=[];for(let E of g.types)if(E.type===Q.AST_NODE_TYPES.TSLiteralType&&E.literal.type===Q.AST_NODE_TYPES.Literal&&typeof E.literal.value=="string")f.push(E.literal.value);else return!0;return u=f,!0}if(g.type===Q.AST_NODE_TYPES.TSLiteralType&&g.literal.type===Q.AST_NODE_TYPES.Literal&&typeof g.literal.value=="string")return u=[g.literal.value],!0}return!1},e.sourceCode),u}function y(l){if(l.callee.type!==Q.AST_NODE_TYPES.MemberExpression||l.callee.property.type!==Q.AST_NODE_TYPES.Identifier||l.callee.computed)return;let h=l.callee.property.name;if(h!=="startsWith"&&h!=="endsWith"&&h!=="includes"||l.arguments.length!==1)return;let[u]=l.arguments;if(!u||u.type!==Q.AST_NODE_TYPES.Literal||typeof u.value!="string")return;let S=l.callee.object,g=a(S);if(!g&&S.type===Q.AST_NODE_TYPES.Identifier&&(g=c(S)),!g||g.length===0)return;let f=u.value;if(h==="includes"&&g.length>1)return;let E=0,x=0;for(let m of g)if((h==="startsWith"?m.startsWith(f):h==="endsWith"?m.endsWith(f):m.includes(f))?E++:x++,E>0&&x>0)return;if(E>0&&x===0){let m=h==="startsWith"?"unnecessaryStartsWithCondition":h==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:l,messageId:m})}else if(x>0&&E===0){let m=h==="startsWith"?"alwaysFalseStartsWithCondition":h==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:l,messageId:m})}}function d(l){if(!new Set(["===","!==",">",">=","<","<="]).has(l.operator))return;function u(b){if(b.type!==Q.AST_NODE_TYPES.MemberExpression||b.computed||b.property.type!==Q.AST_NODE_TYPES.Identifier||b.property.name!=="length")return null;let T=b.object,C=a(T);if(!C||C.length===0)return null;let A=[];for(let w of C)A.push(w.length);return{values:A}}let S=u(l.left),g=u(l.right),f=null,E=null;if(S?l.right.type===Q.AST_NODE_TYPES.Literal&&typeof l.right.value=="number"&&(f=S.values,E=l.right.value):g&&l.left.type===Q.AST_NODE_TYPES.Literal&&typeof l.left.value=="number"&&(f=g.values,E=l.left.value),!f||E===null)return;let x=0,m=0;for(let b of f){let T=!1;if(l.operator==="==="?T=b===E:l.operator==="!=="?T=b!==E:l.operator===">"?T=b>E:l.operator===">="?T=b>=E:l.operator==="<"?T=b<E:l.operator==="<="&&(T=b<=E),T?x++:m++,x>0&&m>0)return}x>0&&m===0?e.report({node:l,messageId:"unnecessaryLengthCondition"}):m>0&&x===0&&e.report({node:l,messageId:"alwaysFalseLengthCondition"})}return{BinaryExpression(l){i(l),d(l)},CallExpression:y}}})};function lt(e){return Array.from(new Set(e)).join(" | ")||"never"}function He(e,t){let r=e.argument;return r.type===Q.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function ki(e,t){return t.has(e)}var ct=require("@typescript-eslint/utils"),pt=require("zod/v4");var vi=ct.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Gn="no-call-with-explicit-generics",Pi=pt.z.object({functions:pt.z.array(pt.z.string())}),Fi=vi({name:Gn,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[L(Pi)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:s}=n;s.type===ct.AST_NODE_TYPES.Identifier&&r.has(s.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:s.name}})}}}}),jt={name:Gn,rule:Fi};var Ue=require("@typescript-eslint/utils"),Oi=Ue.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Kn="no-call-with-inferred-generics",Ni=Oi({name:Kn,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!==Ue.AST_NODE_TYPES.Identifier)return;let o=r.get(s.name);if(!o)return;let{minGenerics:i=1,allowAny:p,disallowTypes:a=t.disallowTypes}=o;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:s.name,minGenerics:i||0}}),!(p&&!a)&&n.typeArguments?.params.some(y=>!p&&y.type===Ue.AST_NODE_TYPES.TSAnyKeyword||a&&y.type===Ue.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===Ue.AST_NODE_TYPES.Identifier&&a.includes(y.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:s.name}})}}}}),Lt={name:Kn,rule:Ni};var tr=require("@typescript-eslint/utils"),Di=tr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nr="no-commented-out-code",ji=["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:"],Li=/^\s*return\s+/,Mi=/\w=("|'|`)/,$i=/\w+:\s*('|"|`)/,_i=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,Ui=/\w+-\w+:/,zi=/\w+_\w+:/,Wi=/\?\s+\w/,Ji=/:\s+\w/,Vi=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,Xi=/^\s*\d+[,}]/,Hi=/^\s*\[[^\]]*\][,}]/,Bi=/^\s*\{[^}]*\}[,}]/,Yi=/\.\w+\(/,qi=/\[\w+\]/,Zi=/^\s*(['"`]).+?\1\s*:/,Gi=/^<[A-Z]\w*(\s|>|\/)/,Ki=/^<[a-z]+(\s|>|\/)/,Qi=/<[A-Z]\w*(\s.*)?>/,es=/<\/[A-Z]\w*>/,ts=/<[a-z]+(\s.*)?>/,ns=/<\/[a-z]+>/,rs=/^\s*[*\s]*$/,is=/^[a-zA-Z]/,ss=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,os=/```[\s\S]*?```/g,as=/`[^`]*`/g,Qn=/[a-zA-Z0-9]/,ls=/\.[A-Za-z_][A-Za-z0-9_]*\(/,ps=/[{}[\]()`=<>]/,cs=/:\s*(['"`[{(]|\w+\s*=>)/,us=/\bif\s*\(|\belse\b|=>/,te={returnStatement:Li,stringAssignment:Mi,objectPropertyWithQuotes:$i,computedPropertyAssignment:_i,kebabCaseProperty:Ui,snakeCaseProperty:zi,ternaryOperator:Wi,colonWithWord:Ji,quotedString:Vi,numberWithComma:Xi,arrayWithComma:Hi,objectWithComma:Bi,methodCall:Yi,arrayAccess:qi,quotedPropertyKey:Zi,jsxSelfClosing:Gi,jsxElement:Ki,jsxOpeningTag:Qi,jsxClosingTag:es,htmlOpeningTag:ts,htmlClosingTag:ns,jsdocComment:rs};function fs(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&is.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||ls.test(t)||ps.test(t)||cs.test(t)||us.test(t)?!1:!!(t.includes(":")&&ss.test(t))}var ms=[") {","return;",te.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",te.stringAssignment,");",te.objectPropertyWithQuotes,te.computedPropertyAssignment,te.kebabCaseProperty,te.snakeCaseProperty,"&&","||","()",te.ternaryOperator,te.colonWithWord,te.quotedString,te.numberWithComma,te.arrayWithComma,te.objectWithComma,te.methodCall,te.arrayAccess,"?.(","??","=>",te.quotedPropertyKey],ys=["/>","</",te.jsxSelfClosing,te.jsxElement,te.jsxOpeningTag,te.jsxClosingTag,te.htmlOpeningTag,te.htmlClosingTag],er=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],ds=Di({name:nr,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 o=n.trimStart();if(n.startsWith("*")||o.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")||te.jsdocComment.test(n))return!1;for(let i of er)if(o.startsWith(i))return!1;if(n.includes("https://")||fs(o))return!1;if(s==="Block"){for(let i of ys)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of ji)if(o.startsWith(i))return{wrongPattern:i};for(let i of ms)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,s){let o=n,i=o.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return o;if(s==="Block"&&o.includes("```")){let c=o.split(os);c.some(d=>Qn.test(d))&&(o=c.join(""))}if(!o.includes("`"))return o;let p=o.split(as);return p.some(c=>Qn.test(c))?p.join(""):o}return{Program(){let s=e.sourceCode.getAllComments();for(let o of s){let i=r(o.value,o.type),p=t(i,o.type);p&&e.report({node:o,messageId:"commentedOutCode",data:{wrongPattern:p.wrongPattern,allowedPrefixes:er.join(", ")}})}}}}}),Mt={name:nr,rule:ds};var ut=require("@typescript-eslint/utils"),gs=ut.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),rr="no-default-export",Ss=gs({name:rr,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===ut.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),$t={name:rr,rule:Ss};var ir=require("@typescript-eslint/utils"),Ts=ir.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),sr="no-leaked-text-in-jsx",hs=[",",";","[","]","(",")"],Es=Ts({name:sr,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(t){let r=t.value.trim();if(!r)return;let n="";hs.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),_t={name:sr,rule:Es};var Me=require("@typescript-eslint/utils"),bs=Me.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ar="no-non-camel-case-functions",xs=/^(\$?[a-z][a-zA-Z0-9]*)$/;function or(e){if(e.typeName.type!==Me.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Me.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var Cs=bs({name:ar,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&&!xs.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Me.AST_NODE_TYPES.TSTypeReference?or(r):r.type===Me.AST_NODE_TYPES.TSUnionType&&r.types.some(s=>s.type===Me.AST_NODE_TYPES.TSTypeReference&&or(s))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),Ut={name:ar,rule:Cs};var B=require("@typescript-eslint/utils");var Is=B.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),lr="no-optional-root-props",As=Is({name:lr,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 o=e.sourceCode.getDeclaredVariables(n)[0];if(!o||o.references.length!==1)return!1;let i=o.references[0];if(!i)return!1;for(let p of Ot(i.identifier)){if("returnType"in p||p.type===B.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let a=p.parent;if(!a)return!1;if(a.type===B.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&a.parent.type===B.TSESTree.AST_NODE_TYPES.TSTypeReference&&a.parent.typeName.type===B.TSESTree.AST_NODE_TYPES.Identifier&&a.parent.typeName.name==="FC"){let y=Xe(a.parent.parent,B.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!y)return!1;let d=ft(y,e.sourceCode);return d?!(d.parent.type===B.TSESTree.AST_NODE_TYPES.CallExpression&&d.parent.callee.type===B.TSESTree.AST_NODE_TYPES.Identifier&&d.parent.callee.name==="memo"):!1}if(p.type===B.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(a.type===B.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let c=Xe(a,B.TSESTree.AST_NODE_TYPES.VariableDeclaration);return c?!!ft(c,e.sourceCode):!1}if(a.type===B.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!ft(a,e.sourceCode)}return!1}function r(n){n.key.type!==B.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 o=Xe(n,B.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!o)return null;let i=e.sourceCode.getText(o);return s.replaceText(o,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===B.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(mt(n)||!t(n)))for(let s of n.typeAnnotation.members)s.type===B.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSInterfaceDeclaration(n){if(!(mt(n)||!t(n)))for(let s of n.body.body)s.type===B.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSTypeReference(n){if(n.typeName.type!==B.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let s=n.typeArguments.params[0];if(s.type!==B.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let o=Xe(n.parent,B.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!o)return;let i=ft(o,e.sourceCode);if(!(!i||i.parent.type===B.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===B.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let a of s.members)a.type===B.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(a)}}}});function mt(e){return e?e.parent?.type===B.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===B.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function ft(e,t){if(mt(e))return;let r;if(e.type===B.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===B.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===B.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let s=n.variables.find(i=>i.identifiers.includes(r));if(!s)return;let o=s.references.filter(i=>i.identifier!==r);if(!(o.length!==1||!o[0])&&!mt(o[0].identifier.parent.parent))return o[0].identifier}var zt={name:lr,rule:As};var Ke=require("@typescript-eslint/utils");var Qe=$({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let t=new Set;function r(n){return n?n.type===Ke.AST_NODE_TYPES.Identifier?t.has(n.name):n.type===Ke.AST_NODE_TYPES.MemberExpression?r(n.object):!1:!1}return{ImportDeclaration(n){for(let s of n.specifiers)t.add(s.local.name)},ExportNamedDeclaration(n){if(n.source){e.report({node:n,messageId:"noReexport"});return}if(n.declaration?.type===Ke.AST_NODE_TYPES.VariableDeclaration)for(let s of n.declaration.declarations)r(s.init)&&e.report({node:n,messageId:"noReexport"});n.specifiers.length>0&&e.report({node:n,messageId:"noReexport"})},ExportDefaultDeclaration(n){n.declaration.type===Ke.AST_NODE_TYPES.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});var pr=require("@typescript-eslint/utils"),yt=Ee(require("path")),ve=require("zod/v4");var ws=pr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cr="no-relative-imports",Rs=ve.z.object({find:ve.z.string(),replacement:ve.z.string()}),ks=ve.z.object({aliases:ve.z.array(Rs),rootDir:ve.z.string().optional(),allowNotFoundAliases:ve.z.boolean().optional(),_dev_simulateFileName:ve.z.string().optional()}),vs=ws({name:cr,meta:{type:"problem",fixable:"code",docs:{description:"Prevent relative imports and auto-fix them using configured aliases"},messages:{noRelativeImports:"Relative imports are not allowed. Use one of the valid aliases in tsconfig.json instead.",noRelativeImportsWithAlias:'Relative imports are not allowed. Use the "{{ alias }}" alias instead.'},schema:[L(ks)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function s(i,p){let a=yt.default.dirname(p);return yt.default.resolve(a,i)}function o(i){let p=t.rootDir??process.cwd(),a=yt.default.relative(p,i);if(a.startsWith("."))return null;a.startsWith("/")||(a=`/${a}`);for(let{find:c,replacement:y}of t.aliases)if(a.startsWith(y)){let d=a.replace(y,c);return{alias:c,newPath:d}}return null}return{ImportDeclaration(i){let p=i.source.value;if(!n(p))return;let a=s(p,r),c=o(a);!c&&t.allowNotFoundAliases||e.report({node:i,messageId:c?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:c?.alias},fix:c?y=>y.replaceText(i.source,`'${c.newPath}'`):void 0})}}}}),Wt={name:cr,rule:vs};var ne=require("@typescript-eslint/utils"),Jt=require("zod/v4");var Ps=Jt.z.object({customMessage:Jt.z.string().optional()}),Vt=$({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[L(Ps)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case ne.AST_NODE_TYPES.Literal:return!0;case ne.AST_NODE_TYPES.ObjectExpression:return n.properties.every(s=>s.type===ne.AST_NODE_TYPES.Property?s.computed||s.value.type===ne.AST_NODE_TYPES.Identifier&&s.key.type===ne.AST_NODE_TYPES.Identifier&&s.key.name===s.value.name?!1:r(s.value):!1);case ne.AST_NODE_TYPES.ArrayExpression:return n.elements.every(s=>s?s.type===ne.AST_NODE_TYPES.SpreadElement?!1:r(s):!0);case ne.AST_NODE_TYPES.TemplateLiteral:return n.expressions.length===0;case ne.AST_NODE_TYPES.ConditionalExpression:case ne.AST_NODE_TYPES.LogicalExpression:case ne.AST_NODE_TYPES.BinaryExpression:case ne.AST_NODE_TYPES.UnaryExpression:case ne.AST_NODE_TYPES.CallExpression:case ne.AST_NODE_TYPES.MemberExpression:case ne.AST_NODE_TYPES.Identifier:case ne.AST_NODE_TYPES.ArrowFunctionExpression:case ne.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===ne.AST_NODE_TYPES.JSXIdentifier&&n.name.name==="style"&&n.value){let s=null;n.value.type===ne.AST_NODE_TYPES.JSXExpressionContainer?n.value.expression.type!==ne.AST_NODE_TYPES.JSXEmptyExpression&&(s=n.value.expression):n.value.type===ne.AST_NODE_TYPES.Literal&&(s=n.value),s&&r(s)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var et=require("@typescript-eslint/utils"),ze=Ee(require("zod/v4"));var Fs=ze.object({alternativeMsgs:ze.object({inArrayFind:ze.string().optional(),inArrayFilter:ze.string().optional()}).optional(),__dev_simulateFileName:ze.string().optional()});function Os(e){return e.typeAnnotation.type!==et.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var Ns=/(typeGuards|type-guards)\.(ts|tsx)$/;function Ds(e){return Ns.test(e)}function js(e){let t=e.parent;for(;t;){if(t.type===et.AST_NODE_TYPES.CallExpression&&t.callee.type===et.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===et.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var Xt=$({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[L(Fs)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(Ds(r))return{};function n(s){if(!Os(s))return;let o=js(s);if(t.alternativeMsgs&&o){let i=o.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let p=o.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:s,messageId:p,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 Ls="no-unnecessary-async-on-jsx-props";function Ms(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 Ht=$({name:Ls,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){Ms(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let s=e.sourceCode,o=[],i=s.getFirstToken(r,a=>a.value==="async");if(i){let a=s.getTokenAfter(i);a?o.push(n.replaceTextRange([i.range[0],a.range[0]],"")):o.push(n.remove(i))}function p(a){if(a.type===We.AST_NODE_TYPES.AwaitExpression){let c=s.getFirstToken(a);if(c&&c.value==="await"){let y=s.getTokenAfter(c);y?o.push(n.replaceTextRange([c.range[0],y.range[0]],"")):o.push(n.remove(c))}}if(a.type===We.AST_NODE_TYPES.BlockStatement)for(let c of a.body)p(c);else a.type===We.AST_NODE_TYPES.ExpressionStatement&&p(a.expression)}return p(r.body),o}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var Pe=require("@typescript-eslint/utils"),Bt=Ee(require("typescript")),Be=Ee(require("zod/v4"));var $s=Pe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ur="no-unnecessary-casting",_s=Be.default.object({additionalCastFunctions:Be.default.array(Be.default.object({name:Be.default.string(),expectedType:Be.default.enum(["string","number"])})).optional()}),Yt={name:ur,rule:$s({name:ur,meta:{type:"suggestion",docs:{description:"Prevents unnecessary Number and String castings"},messages:{unnecessaryNumberCasting:"Unnecessary Number() casting on a value already of number type",unnecessaryStringCasting:"Unnecessary String() casting on a value already of string type",unnecessaryCustomCasting:"Unnecessary {{name}}() casting on a value already of {{type}} type"},schema:[L(_s)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],s=Pe.ESLintUtils.getParserServices(e,!0),o=s.program?.getTypeChecker();if(!o||!s.program)throw new Error("TypeScript services or program not available");function i(y,d){switch(y.type){case Pe.AST_NODE_TYPES.Literal:return d==="number"?typeof y.value=="number":typeof y.value=="string";case Pe.AST_NODE_TYPES.TemplateLiteral:return d==="string";case Pe.AST_NODE_TYPES.UnaryExpression:return d==="number"?y.operator==="+"||y.operator==="-"||y.operator==="~":!1;default:return!1}}function p(y,d){return d==="number"?!!(y.flags&Bt.TypeFlags.NumberLike):!!(y.flags&Bt.TypeFlags.StringLike)}function a(y,d){return l=>l.replaceText(y,e.sourceCode.getText(d))}function c(y){if(!o||y.arguments.length!==1)return;let d=y.arguments[0];if(!d||d.type===Pe.AST_NODE_TYPES.SpreadElement)return;let{callee:l}=y;if(l.type!==Pe.AST_NODE_TYPES.Identifier)return;let h=l.name,u=n.find(g=>g.name===h);if(!u)return;if(i(d,u.expectedType)||p(o.getTypeAtLocation(s.esTreeNodeToTSNodeMap.get(d)),u.expectedType)){let g,f;h==="Number"?g="unnecessaryNumberCasting":h==="String"?g="unnecessaryStringCasting":(g="unnecessaryCustomCasting",f={name:u.name,type:u.expectedType}),e.report({node:y,messageId:g,...f?{data:f}:{},fix:a(y,d)})}}return{CallExpression:c}}})};var ye=require("@typescript-eslint/utils"),dt=Ee(require("zod/v4"));var Us=dt.object({ignoreWithDescription:dt.string().optional()}),qt=$({name:"no-unnecessary-describe",meta:{type:"suggestion",docs:{description:"Disallow unnecessary describe blocks that wrap all tests in a file"},messages:{unnecessaryDescribe:"Describe blocks that solely wrap all tests in the file are unnecessary, they just add unnecessary nesting to the code. The file itself should be enough to group tests. Remove it.",removeDescribe:"Remove the describe block"},hasSuggestions:!0,schema:[L(Us)]},defaultOptions:[{}],create(e,[t]){let r=e.getSourceCode(),n=r.ast;function s(a){let c=a.arguments[0];return c&&c.type===ye.AST_NODE_TYPES.Literal&&typeof c.value=="string"?c.value:null}function o(a){return!a||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(a)}function i(a){return a.length!==1?!1:n.body.filter(y=>{if(y.type===ye.AST_NODE_TYPES.ExpressionStatement){let d=y.expression;if(d.type===ye.AST_NODE_TYPES.CallExpression&&d.callee.type===ye.AST_NODE_TYPES.Identifier){let l=d.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(l)}}return!1}).length===0}function p(a){let c=a.arguments[1];if(c&&(c.type===ye.AST_NODE_TYPES.FunctionExpression||c.type===ye.AST_NODE_TYPES.ArrowFunctionExpression)&&c.body.type===ye.AST_NODE_TYPES.BlockStatement){let y=c.body.body;return y.length===0?"":y.map(l=>r.text.slice(l.range[0],l.range[1])).join(`
|
|
16
16
|
|
|
17
|
-
`)}return""}return{Program(){let a=[];for(let l of n.body)l.type===ye.AST_NODE_TYPES.ExpressionStatement&&l.expression.type===ye.AST_NODE_TYPES.CallExpression&&l.expression.callee.type===ye.AST_NODE_TYPES.Identifier&&l.expression.callee.name==="describe"&&l.expression.arguments.length===2&&a.push(l.expression);if(!i(a))return;let[c]=a;if(!c)return;let y=s(c);if(o(y))return;let S=n.body.find(l=>l.type===ye.AST_NODE_TYPES.ExpressionStatement&&l.expression===c);!S||S.type!==ye.AST_NODE_TYPES.ExpressionStatement||e.report({node:c,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(l){let m=p(c);return m?l.replaceText(S,m):null}}]})}}}});var tt=require("@typescript-eslint/utils"),Ce=Ee(require("zod/v4"));var zs=Ce.object({methods:Ce.union([Ce.array(Ce.string()),Ce.literal("array")])}),Zt=M({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[L(zs)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function s(p){return Array.isArray(r)?r.includes(p):n.has(p)}function o(p){let{callee:a}=p;if(a.type===tt.AST_NODE_TYPES.MemberExpression){let c=a.property;if(c.type===tt.AST_NODE_TYPES.Identifier)return c.name}return null}function i(p,a){if(p.type!==tt.AST_NODE_TYPES.Identifier||!p.typeAnnotation)return;let c=a.parent;if(c.type===tt.AST_NODE_TYPES.CallExpression){let y=o(c);y&&s(y)&&c.arguments.indexOf(a)===0&&e.report({node:p.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(l){return p.typeAnnotation?l.remove(p.typeAnnotation):null}})}}return{ArrowFunctionExpression(p){for(let a of p.params)i(a,p)},FunctionExpression(p){for(let a of p.params)i(a,p)}}}});var me=require("@typescript-eslint/utils");var Gt=M({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===me.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==me.AST_NODE_TYPES.ObjectExpression||t.id.type===me.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===me.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===me.AST_NODE_TYPES.Property&&i.key.type===me.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==me.AST_NODE_TYPES.Identifier)return;let n=Ws(t,e.sourceCode);if(n.length===0)return;let s=t.init.properties.some(i=>i.type!==me.AST_NODE_TYPES.Property?!1:i.value.type===me.AST_NODE_TYPES.FunctionExpression),o=new Set;for(let i of n){if(i.identifier.parent.type!==me.AST_NODE_TYPES.MemberExpression)return;let p=i.identifier.parent;if(p.object!==i.identifier)return;if(p.computed)if(p.property.type===me.AST_NODE_TYPES.Literal&&typeof p.property.value=="string")o.add(p.property.value);else return;else{if(p.property.type!==me.AST_NODE_TYPES.Identifier)return;o.add(p.property.name)}if(p.parent.type===me.AST_NODE_TYPES.CallExpression&&s)return}for(let[i,p]of r)o.has(i)||e.report({node:p,messageId:"unusedObjectProperty",data:{name:i}})}}}});function Ws(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"),Kt=require("zod/v4");var Js=Kt.z.object({ignoreArgsMatching:Kt.z.string().optional()}),Qt=M({name:"no-unused-optional-args",meta:{type:"problem",docs:{description:"Detect unused optional function arguments in non-exported functions"},messages:{unusedOptionalArg:"Optional parameter '{{name}}' is never used",unusedOptionalProp:"Optional prop '{{name}}' is never provided"},schema:[L(Js)]},defaultOptions:[{}],create(e,[t]){let r=[];function n(i){return t.ignoreArgsMatching?new RegExp(t.ignoreArgsMatching).test(i):!1}function s(i){return i.type===W.AST_NODE_TYPES.ExportNamedDeclaration||i.type===W.AST_NODE_TYPES.ExportDefaultDeclaration||i.parent?.type===W.AST_NODE_TYPES.ExportNamedDeclaration||i.parent?.type===W.AST_NODE_TYPES.ExportDefaultDeclaration}function o(i){let p=[];for(let a=0;a<i.length;a++){let c=i[a];if(!c||c.type!==W.AST_NODE_TYPES.Identifier)continue;let y=c.name;if(!n(y)){if(c.optional&&c.typeAnnotation&&c.typeAnnotation.typeAnnotation.type===W.AST_NODE_TYPES.TSTypeLiteral){let S=c.typeAnnotation.typeAnnotation,l=[];for(let m of S.members)m.type===W.AST_NODE_TYPES.TSPropertySignature&&m.key.type===W.AST_NODE_TYPES.Identifier&&l.push({name:m.key.name,optional:m.optional===!0});l.some(m=>m.optional)?p.push({param:c,index:a,name:y,isObjectParam:!0,objectProps:l}):p.push({param:c,index:a,name:y,isObjectParam:!1})}else if(c.optional)p.push({param:c,index:a,name:y,isObjectParam:!1});else if(c.typeAnnotation&&c.typeAnnotation.typeAnnotation.type===W.AST_NODE_TYPES.TSTypeLiteral){let S=c.typeAnnotation.typeAnnotation,l=[];for(let m of S.members)m.type===W.AST_NODE_TYPES.TSPropertySignature&&m.key.type===W.AST_NODE_TYPES.Identifier&&l.push({name:m.key.name,optional:m.optional===!0});l.some(m=>m.optional)&&p.push({param:c,index:a,name:y,isObjectParam:!0,objectProps:l})}}}return p}return{FunctionDeclaration(i){if(s(i))return;let p=o(i.params);p.length!==0&&r.push({node:i,declarationNode:i,optionalParams:p})},VariableDeclarator(i){if(i.id.type!==W.AST_NODE_TYPES.Identifier||!i.init||i.init.type!==W.AST_NODE_TYPES.ArrowFunctionExpression&&i.init.type!==W.AST_NODE_TYPES.FunctionExpression||s(i.parent.parent))return;let a=[...o(i.init.params)];if(i.id.typeAnnotation&&i.id.typeAnnotation.typeAnnotation.type===W.AST_NODE_TYPES.TSTypeReference){let c=i.id.typeAnnotation.typeAnnotation;if(c.typeName.type===W.AST_NODE_TYPES.Identifier&&c.typeName.name==="FC"){let y=c.typeArguments;if(y&&y.params.length===1){let S=y.params[0];if(S&&S.type===W.AST_NODE_TYPES.TSTypeLiteral){let l=[];for(let m of S.members)m.type===W.AST_NODE_TYPES.TSPropertySignature&&m.key.type===W.AST_NODE_TYPES.Identifier&&l.push({name:m.key.name,optional:m.optional===!0});l.some(m=>m.optional)&&a.push({param:i.id,index:0,name:"props",isObjectParam:!0,objectProps:l})}}}}a.length!==0&&r.push({node:i.init,declarationNode:i,optionalParams:a})},"Program:exit"(){for(let i of r){let a=e.sourceCode.getDeclaredVariables(i.declarationNode)[0];if(!a)continue;let c=a.references.filter(l=>l.identifier!==a.identifiers[0]);if(c.length===0)continue;let y=!1;for(let l of c){let m=l.identifier.parent;if(m.type===W.AST_NODE_TYPES.CallExpression&&l.identifier.type===W.AST_NODE_TYPES.Identifier&&m.arguments.includes(l.identifier)){y=!0;break}if(m.type===W.AST_NODE_TYPES.ReturnStatement){y=!0;break}if(m.type===W.AST_NODE_TYPES.Property&&m.parent.type===W.AST_NODE_TYPES.ObjectExpression&&m.parent.parent.type===W.AST_NODE_TYPES.ReturnStatement){y=!0;break}if(m.type===W.AST_NODE_TYPES.JSXExpressionContainer){y=!0;break}}if(y)continue;let S=[];for(let l of c){let m=l.identifier.parent;if(m.type===W.AST_NODE_TYPES.CallExpression&&m.callee===l.identifier){let f=m.arguments.length,T=m.arguments.some(u=>u.type===W.AST_NODE_TYPES.SpreadElement);if(T){y=!0;break}let h={argCount:f,hasSpread:T};for(let u of i.optionalParams)if(u.isObjectParam&&u.index<f){let E=m.arguments[u.index];if(E?.type===W.AST_NODE_TYPES.ObjectExpression){let x={};for(let d of E.properties)d.type===W.AST_NODE_TYPES.Property&&d.key.type===W.AST_NODE_TYPES.Identifier&&(x[d.key.name]=!0);h.objectArgs||(h.objectArgs=[]),h.objectArgs[u.index]=x}else if(E){y=!0;break}}S.push(h)}else if(m.type===W.AST_NODE_TYPES.JSXOpeningElement&&m.name===l.identifier){let f=m.attributes.some(h=>h.type===W.AST_NODE_TYPES.JSXSpreadAttribute);if(f){y=!0;break}let T={argCount:1,hasSpread:f};for(let h of i.optionalParams)if(h.isObjectParam&&h.index===0){let u={};for(let E of m.attributes)E.type===W.AST_NODE_TYPES.JSXAttribute&&E.name.type===W.AST_NODE_TYPES.JSXIdentifier&&(u[E.name.name]=!0);T.objectArgs||(T.objectArgs=[]),T.objectArgs[0]=u}S.push(T)}}if(!(y||S.length===0))for(let l of i.optionalParams)if(l.isObjectParam&&l.objectProps)for(let m of l.objectProps){if(!m.optional)continue;let f=!1;for(let T of S)if(T.objectArgs&&T.objectArgs[l.index]){let h=T.objectArgs[l.index];if(h&&h[m.name]){f=!0;break}}f||e.report({node:l.param,messageId:"unusedOptionalProp",data:{name:m.name}})}else{let m=!1;for(let f of S)if(f.argCount>l.index){m=!0;break}m||e.report({node:l.param,messageId:"unusedOptionalArg",data:{name:l.name}})}}}}}});var Y=require("@typescript-eslint/utils"),$e=require("zod/v4");var Vs=$e.z.object({selectors:$e.z.array($e.z.object({name:$e.z.string(),selectorProp:$e.z.string().optional(),selectorArgPos:$e.z.number().optional(),returnProp:$e.z.string().optional()}))}),Xs=Y.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),fr="no-unused-selected-values",en={name:fr,rule:Xs({name:fr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[L(Vs)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(s=>[s.name,s]));return{VariableDeclarator(s){let o=null;if(s.init?.type===Y.AST_NODE_TYPES.CallExpression&&(o=s.init),!o)return;let i=Bs(o);if(!i)return;let p=n.get(i);if(!p)return;let a=Hs(o,p.selectorArgPos??0,p.selectorProp);if(!a)return;let c=Ys(a);if(!c)return;let y=mr(c.properties,void 0);if(!y)return;if(s.id.type===Y.AST_NODE_TYPES.ObjectPattern){let m=mr(s.id.properties,p.returnProp);if(!m)return;for(let[f,T]of y)m.has(f)||e.report({node:T,messageId:"unusedSelectedValue",data:{name:f}});return}if(s.id.type!==Y.AST_NODE_TYPES.Identifier||p.returnProp)return;let S=qs(s,e.sourceCode);if(S.length===0)return;let l=new Set;for(let m of S){if(m.identifier.parent.type!==Y.AST_NODE_TYPES.MemberExpression)return;let f=m.identifier.parent.property;if(f.type!==Y.AST_NODE_TYPES.Identifier)return;l.add(f.name)}for(let[m,f]of y)l.has(m)||e.report({node:f,messageId:"unusedSelectedValue",data:{name:m}})}}}})};function Hs(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===Y.AST_NODE_TYPES.ArrowFunctionExpression||n.type===Y.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===Y.AST_NODE_TYPES.ObjectExpression){let s=n.properties.find(i=>i.type===Y.AST_NODE_TYPES.Property&&i.key.type===Y.AST_NODE_TYPES.Identifier&&i.key.name===r);if(s?.type!==Y.AST_NODE_TYPES.Property)return null;let o=s.value;if(o.type===Y.AST_NODE_TYPES.ArrowFunctionExpression||o.type===Y.AST_NODE_TYPES.FunctionExpression)return o}return null}function Bs(e){return e.callee.type===Y.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===Y.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===Y.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Ys(e){if(e.body.type===Y.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===Y.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===Y.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==Y.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function mr(e,t){let r=e;if(t){let s=e.find(o=>o.type===Y.AST_NODE_TYPES.Property&&o.key.type===Y.AST_NODE_TYPES.Identifier&&o.key.name===t);if(s?.type!==Y.AST_NODE_TYPES.Property||s.value.type!==Y.AST_NODE_TYPES.ObjectPattern)return null;r=s.value.properties}let n=new Map;for(let s of r){if(s.type!==Y.AST_NODE_TYPES.Property||s.key.type!==Y.AST_NODE_TYPES.Identifier)return null;n.set(s.key.name,s)}return n.size>0?n:null}function qs(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 q=require("@typescript-eslint/utils");var tn=M({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(o=>o.type===q.AST_NODE_TYPES.ImportDeclaration&&o.source.value==="t-state-form"))return{};let n=null,s=!1;return{CallExpression(o){if(s)return;if(!n){let p=Zs(o);p&&(n=p);return}let i=Gs(o,e.sourceCode);if(i){s=!0;for(let p of i)n.delete(p);if(n.size!==0)for(let[p,a]of n)e.report({node:a,messageId:"unusedField",data:{name:p}})}}}}});function Zs(e){if(!(e.callee.type===q.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==q.AST_NODE_TYPES.ObjectExpression)return null;let n=Nt(r.properties,o=>o.type!==q.AST_NODE_TYPES.Property||o.key.type!==q.AST_NODE_TYPES.Identifier||o.key.name!=="initialConfig"?null:o.value.type===q.AST_NODE_TYPES.ObjectExpression?o.value:o.value.type===q.AST_NODE_TYPES.ArrowFunctionExpression||o.value.type===q.AST_NODE_TYPES.FunctionExpression?Ks(o.value):null);if(!n)return null;let s=new Map;for(let o of n.properties)o.type===q.AST_NODE_TYPES.Property&&o.key.type===q.AST_NODE_TYPES.Identifier&&s.set(o.key.name,o);return s}function Gs(e,t){if(!(e.callee.type===q.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==q.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==q.AST_NODE_TYPES.ObjectPattern||!Nt(e.parent.id.properties,i=>i.type===q.AST_NODE_TYPES.Property&&i.key.type===q.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let s=Yn(e.parent,"formFields",t),o=new Set;for(let{identifier:i}of s){if(i.type!==q.AST_NODE_TYPES.Identifier||i.parent.type===q.AST_NODE_TYPES.Property&&i.parent.parent.type===q.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===q.AST_NODE_TYPES.ReturnStatement||i.parent.type===q.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===q.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==q.AST_NODE_TYPES.Identifier||i.parent.property.type!==q.AST_NODE_TYPES.Identifier)return null;o.add(i.parent.property.name)}}return o}function Ks(e){if(e.body.type===q.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===q.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===q.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==q.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var H=require("@typescript-eslint/utils"),nt=require("zod/v4");var Qs=H.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function yr(e){let t=[];for(let r of e.members)r.type===H.AST_NODE_TYPES.TSPropertySignature&&r.key.type===H.AST_NODE_TYPES.Identifier&&t.push([r.key.name,r]);return t}function dr(e,...t){for(let r of t)e.set(...r);return e}var eo=nt.z.object({forceCheckOnFCPropTypesWithName:nt.z.array(nt.z.string()).optional(),alwaysCheckFunctionOptionTypes:nt.z.boolean().optional()}),gr="no-unused-type-props-in-args",nn=null,to=Qs({name:gr,meta:{type:"problem",docs:{description:"Disallow unused undestructured object type properties"},messages:{unusedObjectTypeProperty:"Object type property '{{ propertyName }}' is defined but never used",missingComponentParam:"Component has declared props but no props are used"},schema:[L(eo)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!nn&&(nn=r.map(a=>new RegExp(a)));function s(a,c,y,S,l=!0,m=!1){let f=y.name,T=e.sourceCode.getScope(c).references.find(d=>d.identifier.name===f)?.resolved,h=a&&nn?.some(d=>d.test(f)),u=m&&n;if(!T||!h&&T.references.filter(d=>d.isTypeReference).length>1||!T.defs[0])return;let E=T.defs[0].node,x=E.parent?.type===H.AST_NODE_TYPES.ExportNamedDeclaration;if(!(l&&x&&!u)){if(E.type===H.AST_NODE_TYPES.TSTypeAliasDeclaration){o(a,c,S,E.typeAnnotation,!0,m);return}if(E.type===H.AST_NODE_TYPES.TSInterfaceDeclaration){o(a,c,S,E.body,!0,m);return}}}function o(a,c,y,S,l,m=!1){if(S.type===H.AST_NODE_TYPES.TSInterfaceBody){for(let f of S.body)f.type===H.AST_NODE_TYPES.TSPropertySignature&&f.key.type===H.AST_NODE_TYPES.Identifier&&y.set(f.key.name,f);return}if(S.type===H.AST_NODE_TYPES.TSTypeLiteral){dr(y,...yr(S));return}if(S.type===H.AST_NODE_TYPES.TSIntersectionType){for(let f of S.types)o(a,c,y,f,!0,m);return}l||S.type===H.AST_NODE_TYPES.TSTypeReference&&S.typeName.type===H.AST_NODE_TYPES.Identifier&&s(a,c,S.typeName,y,!0,m)}function i(a,c,y,S=!1){for(let l of y)if(l.type===H.AST_NODE_TYPES.ObjectPattern&&l.typeAnnotation){let m=new Map;if(o(a,c,m,l.typeAnnotation.typeAnnotation,!1,S),m.size===0)continue;p(l,m)}else l.type===H.AST_NODE_TYPES.AssignmentPattern&&l.left.type===H.AST_NODE_TYPES.ObjectPattern&&i(a,c,[l.left],S)}function p(a,c){let y=[];if(a.properties.at(-1)?.type===H.AST_NODE_TYPES.RestElement)return;for(let f of a.properties)f.type===H.AST_NODE_TYPES.Property&&f.key.type===H.AST_NODE_TYPES.Identifier&&y.push(f.key.name);let l=[],m=[];for(let[f,T]of c)y.includes(f)||(m.push(f),l.push({node:T,messageId:"unusedObjectTypeProperty",data:{propertyName:f}}));for(let[f,T]of l.entries())e.report({...T,fix:f===l.length-1?h=>{let u=a.properties.at(-1),E=m.join(", ");return u?u.type===H.AST_NODE_TYPES.RestElement?null:h.insertTextAfter(u,`, ${E}`):h.insertTextBeforeRange([a.range[0]+1,a.range[1]],E)}:void 0})}return{VariableDeclaration(a){let c=a.declarations[0],y=new Map,S=c.id.type===H.AST_NODE_TYPES.Identifier&&c.id.typeAnnotation?.typeAnnotation.type===H.AST_NODE_TYPES.TSTypeReference&&c.id.typeAnnotation.typeAnnotation.typeName.type===H.AST_NODE_TYPES.Identifier&&c.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&c.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(S){if(S.type===H.AST_NODE_TYPES.TSTypeReference&&S.typeName.type===H.AST_NODE_TYPES.Identifier)s(!0,a,S.typeName,y,!1);else if(S.type===H.AST_NODE_TYPES.TSTypeLiteral)dr(y,...yr(S));else if(S.type===H.AST_NODE_TYPES.TSIntersectionType)for(let l of S.types)l.type===H.AST_NODE_TYPES.TSTypeReference&&l.typeName.type===H.AST_NODE_TYPES.Identifier?s(!0,a,l.typeName,y,!1):o(!0,a,y,l,!0);if(y.size!==0&&c.init?.type===H.AST_NODE_TYPES.ArrowFunctionExpression){let l=c.init.params[0];if(!l){e.report({node:c.init,messageId:"missingComponentParam"});return}l.type===H.AST_NODE_TYPES.ObjectPattern&&p(l,y)}}},FunctionDeclaration(a){i(!1,a,a.params,n)},ArrowFunctionExpression(a){i(!1,a,a.params,n)}}}}),rn={name:gr,rule:to};var Te=require("@typescript-eslint/utils");var sn=M({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===Te.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===Te.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===Te.AST_NODE_TYPES.Identifier&&n.callee.property.type===Te.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===Te.AST_NODE_TYPES.ImportSpecifier&&s.imported.type===Te.AST_NODE_TYPES.Identifier&&s.imported.name==="useRef"&&t.add(s.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===Te.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===Te.AST_NODE_TYPES.Identifier){let o=e.sourceCode.getScope(n).set.get(n.id.name);if(o){let i=!1;for(let p of o.references){let c=p.identifier.parent;if(c!==n&&!(c.type===Te.AST_NODE_TYPES.JSXExpressionContainer&&c.parent.type===Te.AST_NODE_TYPES.JSXAttribute&&c.parent.name.type===Te.AST_NODE_TYPES.JSXIdentifier&&c.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var Ye=require("@typescript-eslint/utils"),no=Ye.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Tr="prefer-named-functions",Sr=new Map,ro=no({name:Tr,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=Sr.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),Sr.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===Ye.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===Ye.AST_NODE_TYPES.Identifier){let s=n.id.name;if(n.id.typeAnnotation||r&&r.test(s)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==Ye.AST_NODE_TYPES.BlockStatement)return;let o=n.parent,i=n.init.params,p=n.init.body,a=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:s,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:c=>c.replaceText(o,`${a.async?"async ":""}function ${s}(${i.map(y=>e.sourceCode.getText(y)).join(", ")||""}) ${e.sourceCode.getText(p)}`)}]})}}}}}),on={name:Tr,rule:ro};var $=require("@typescript-eslint/utils"),Ie=require("zod/v4");var io=Ie.z.object({disallowedFunctions:Ie.z.array(Ie.z.object({name:Ie.z.string(),allowUsingWithArgs:Ie.z.boolean().optional(),hookAlternative:Ie.z.string().optional(),message:Ie.z.string().optional(),allowUseInside:Ie.z.array(Ie.z.string()).optional()}))}),so=/^use[A-Z]/,oo=/^[A-Z]/;function gt(e){return so.test(e)}function hr(e){return oo.test(e)}function ao(e){return e.type===$.AST_NODE_TYPES.Identifier?gt(e.name):e.type===$.AST_NODE_TYPES.MemberExpression&&e.property.type===$.AST_NODE_TYPES.Identifier?gt(e.property.name):!1}function Er(e,t){return e.type===$.AST_NODE_TYPES.Identifier?e.name===t:e.type===$.AST_NODE_TYPES.MemberExpression&&e.object.type===$.AST_NODE_TYPES.Identifier&&e.property.type===$.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function br(e){return!!(e.parent&&e.parent.type===$.AST_NODE_TYPES.CallExpression&&Er(e.parent.callee,"forwardRef"))}function xr(e){return!!(e.parent&&e.parent.type===$.AST_NODE_TYPES.CallExpression&&Er(e.parent.callee,"memo"))}function an(e){if(e.type===$.AST_NODE_TYPES.FunctionDeclaration||e.type===$.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===$.AST_NODE_TYPES.FunctionExpression||e.type===$.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===$.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===$.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===$.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===$.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function lo(e){let t=e.parent,r=!1;for(;t;){if(t.type===$.AST_NODE_TYPES.FunctionDeclaration||t.type===$.AST_NODE_TYPES.FunctionExpression||t.type===$.AST_NODE_TYPES.ArrowFunctionExpression){let n=an(t);if(n&&n.type===$.AST_NODE_TYPES.Identifier){if(hr(n.name)||gt(n.name))return!r;r=!0}else{if(br(t)||xr(t))return!r;if(t.parent.type===$.AST_NODE_TYPES.CallExpression){let s=t.parent;ao(s.callee)||(r=!0)}else t.parent.type===$.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Cr(e){return e.callee.type===$.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===$.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===$.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function po(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===$.AST_NODE_TYPES.FunctionDeclaration||r.type===$.AST_NODE_TYPES.FunctionExpression||r.type===$.AST_NODE_TYPES.ArrowFunctionExpression){let n=an(r);if(n&&n.type===$.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===$.AST_NODE_TYPES.CallExpression){let n=Cr(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function co(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===$.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function uo(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===$.AST_NODE_TYPES.FunctionDeclaration||n.type===$.AST_NODE_TYPES.FunctionExpression||n.type===$.AST_NODE_TYPES.ArrowFunctionExpression){let s=an(n);if(s&&s.type===$.AST_NODE_TYPES.Identifier){if(hr(s.name)||gt(s.name)){r=!0;break}}else if(br(n)||xr(n)){r=!0;break}}n=n.parent}return r?t.length===0?lo(e):!po(e,t):!1}var ln=M({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[L(io)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(s=>[s.name,s]));return{CallExpression(s){let o=Cr(s);if(!o)return;let i=n.get(o);if(!i||i.allowUsingWithArgs&&co(s))return;let p=i.allowUseInside||[];uo(s,p)&&e.report({node:s,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:a=>{let c=i.hookAlternative;return c?s.callee.type===$.AST_NODE_TYPES.Identifier?a.replaceText(s.callee,c):s.callee.type===$.AST_NODE_TYPES.MemberExpression&&s.callee.property.type===$.AST_NODE_TYPES.Identifier?a.replaceText(s.callee.property,c):null:null}}]:[]})}}}});var G=require("@typescript-eslint/utils"),St=Ee(require("zod/v4"));var fo=G.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ar="prefer-single-line-if",mo=St.default.object({maxLineLength:St.default.number().optional(),maxNonSimpleConditionLength:St.default.number().optional()}),yo=fo({name:Ar,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[L(mo)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==G.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 o=n.consequent.body[0];if(!o)return;if(o.type===G.AST_NODE_TYPES.ReturnStatement){if(!Rr(o))return}else if(!(o.type===G.AST_NODE_TYPES.ContinueStatement||o.type===G.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===G.AST_NODE_TYPES.LogicalExpression||n.test.type===G.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let S=Ir(n.test);if(!S&&n.test.type===G.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let l=n.test.argument;Ir(l)&&(S=!0)}if(S&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let p=r.getText(o);if(i.includes(`
|
|
18
|
-
`))return;let a=r.getTokenAfter(n);if(a&&a.type===G.AST_TOKEN_TYPES.Punctuator&&a.value==="}"){let
|
|
17
|
+
`)}return""}return{Program(){let a=[];for(let l of n.body)l.type===ye.AST_NODE_TYPES.ExpressionStatement&&l.expression.type===ye.AST_NODE_TYPES.CallExpression&&l.expression.callee.type===ye.AST_NODE_TYPES.Identifier&&l.expression.callee.name==="describe"&&l.expression.arguments.length===2&&a.push(l.expression);if(!i(a))return;let[c]=a;if(!c)return;let y=s(c);if(o(y))return;let d=n.body.find(l=>l.type===ye.AST_NODE_TYPES.ExpressionStatement&&l.expression===c);!d||d.type!==ye.AST_NODE_TYPES.ExpressionStatement||e.report({node:c,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(l){let h=p(c);return h?l.replaceText(d,h):null}}]})}}}});var tt=require("@typescript-eslint/utils"),Ce=Ee(require("zod/v4"));var zs=Ce.object({methods:Ce.union([Ce.array(Ce.string()),Ce.literal("array")])}),Zt=$({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[L(zs)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function s(p){return Array.isArray(r)?r.includes(p):n.has(p)}function o(p){let{callee:a}=p;if(a.type===tt.AST_NODE_TYPES.MemberExpression){let c=a.property;if(c.type===tt.AST_NODE_TYPES.Identifier)return c.name}return null}function i(p,a){if(p.type!==tt.AST_NODE_TYPES.Identifier||!p.typeAnnotation)return;let c=a.parent;if(c.type===tt.AST_NODE_TYPES.CallExpression){let y=o(c);y&&s(y)&&c.arguments.indexOf(a)===0&&e.report({node:p.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(l){return p.typeAnnotation?l.remove(p.typeAnnotation):null}})}}return{ArrowFunctionExpression(p){for(let a of p.params)i(a,p)},FunctionExpression(p){for(let a of p.params)i(a,p)}}}});var me=require("@typescript-eslint/utils");var Gt=$({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===me.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==me.AST_NODE_TYPES.ObjectExpression||t.id.type===me.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===me.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===me.AST_NODE_TYPES.Property&&i.key.type===me.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==me.AST_NODE_TYPES.Identifier)return;let n=Ws(t,e.sourceCode);if(n.length===0)return;let s=t.init.properties.some(i=>i.type!==me.AST_NODE_TYPES.Property?!1:i.value.type===me.AST_NODE_TYPES.FunctionExpression),o=new Set;for(let i of n){if(i.identifier.parent.type!==me.AST_NODE_TYPES.MemberExpression)return;let p=i.identifier.parent;if(p.object!==i.identifier)return;if(p.computed)if(p.property.type===me.AST_NODE_TYPES.Literal&&typeof p.property.value=="string")o.add(p.property.value);else return;else{if(p.property.type!==me.AST_NODE_TYPES.Identifier)return;o.add(p.property.name)}if(p.parent.type===me.AST_NODE_TYPES.CallExpression&&s)return}for(let[i,p]of r)o.has(i)||e.report({node:p,messageId:"unusedObjectProperty",data:{name:i}})}}}});function Ws(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"),Kt=require("zod/v4");var Js=Kt.z.object({ignoreArgsMatching:Kt.z.string().optional()}),Qt=$({name:"no-unused-optional-args",meta:{type:"problem",docs:{description:"Detect unused optional function arguments in non-exported functions"},messages:{unusedOptionalArg:"Optional parameter '{{name}}' is never used",unusedOptionalProp:"Optional prop '{{name}}' is never provided"},schema:[L(Js)]},defaultOptions:[{}],create(e,[t]){let r=[];function n(i){return t.ignoreArgsMatching?new RegExp(t.ignoreArgsMatching).test(i):!1}function s(i){return i.type===W.AST_NODE_TYPES.ExportNamedDeclaration||i.type===W.AST_NODE_TYPES.ExportDefaultDeclaration||i.parent?.type===W.AST_NODE_TYPES.ExportNamedDeclaration||i.parent?.type===W.AST_NODE_TYPES.ExportDefaultDeclaration}function o(i){let p=[];for(let a=0;a<i.length;a++){let c=i[a];if(!c||c.type!==W.AST_NODE_TYPES.Identifier)continue;let y=c.name;if(!n(y)){if(c.optional&&c.typeAnnotation&&c.typeAnnotation.typeAnnotation.type===W.AST_NODE_TYPES.TSTypeLiteral){let d=c.typeAnnotation.typeAnnotation,l=[];for(let h of d.members)h.type===W.AST_NODE_TYPES.TSPropertySignature&&h.key.type===W.AST_NODE_TYPES.Identifier&&l.push({name:h.key.name,optional:h.optional===!0});l.some(h=>h.optional)?p.push({param:c,index:a,name:y,isObjectParam:!0,objectProps:l}):p.push({param:c,index:a,name:y,isObjectParam:!1})}else if(c.optional)p.push({param:c,index:a,name:y,isObjectParam:!1});else if(c.typeAnnotation&&c.typeAnnotation.typeAnnotation.type===W.AST_NODE_TYPES.TSTypeLiteral){let d=c.typeAnnotation.typeAnnotation,l=[];for(let h of d.members)h.type===W.AST_NODE_TYPES.TSPropertySignature&&h.key.type===W.AST_NODE_TYPES.Identifier&&l.push({name:h.key.name,optional:h.optional===!0});l.some(h=>h.optional)&&p.push({param:c,index:a,name:y,isObjectParam:!0,objectProps:l})}}}return p}return{FunctionDeclaration(i){if(s(i))return;let p=o(i.params);p.length!==0&&r.push({node:i,declarationNode:i,optionalParams:p})},VariableDeclarator(i){if(i.id.type!==W.AST_NODE_TYPES.Identifier||!i.init||i.init.type!==W.AST_NODE_TYPES.ArrowFunctionExpression&&i.init.type!==W.AST_NODE_TYPES.FunctionExpression||s(i.parent.parent))return;let a=[...o(i.init.params)];if(i.id.typeAnnotation&&i.id.typeAnnotation.typeAnnotation.type===W.AST_NODE_TYPES.TSTypeReference){let c=i.id.typeAnnotation.typeAnnotation;if(c.typeName.type===W.AST_NODE_TYPES.Identifier&&c.typeName.name==="FC"){let y=c.typeArguments;if(y&&y.params.length===1){let d=y.params[0];if(d&&d.type===W.AST_NODE_TYPES.TSTypeLiteral){let l=[];for(let h of d.members)h.type===W.AST_NODE_TYPES.TSPropertySignature&&h.key.type===W.AST_NODE_TYPES.Identifier&&l.push({name:h.key.name,optional:h.optional===!0});l.some(h=>h.optional)&&a.push({param:i.id,index:0,name:"props",isObjectParam:!0,objectProps:l})}}}}a.length!==0&&r.push({node:i.init,declarationNode:i,optionalParams:a})},"Program:exit"(){for(let i of r){let a=e.sourceCode.getDeclaredVariables(i.declarationNode)[0];if(!a)continue;let c=a.references.filter(l=>l.identifier!==a.identifiers[0]);if(c.length===0)continue;let y=!1;for(let l of c){let h=l.identifier.parent;if(h.type===W.AST_NODE_TYPES.CallExpression&&l.identifier.type===W.AST_NODE_TYPES.Identifier&&h.arguments.includes(l.identifier)){y=!0;break}if(h.type===W.AST_NODE_TYPES.ReturnStatement){y=!0;break}if(h.type===W.AST_NODE_TYPES.Property&&h.parent.type===W.AST_NODE_TYPES.ObjectExpression&&h.parent.parent.type===W.AST_NODE_TYPES.ReturnStatement){y=!0;break}if(h.type===W.AST_NODE_TYPES.JSXExpressionContainer){y=!0;break}}if(y)continue;let d=[];for(let l of c){let h=l.identifier.parent;if(h.type===W.AST_NODE_TYPES.CallExpression&&h.callee===l.identifier){let u=h.arguments.length,S=h.arguments.some(f=>f.type===W.AST_NODE_TYPES.SpreadElement);if(S){y=!0;break}let g={argCount:u,hasSpread:S};for(let f of i.optionalParams)if(f.isObjectParam&&f.index<u){let E=h.arguments[f.index];if(E?.type===W.AST_NODE_TYPES.ObjectExpression){let x={};for(let m of E.properties)m.type===W.AST_NODE_TYPES.Property&&m.key.type===W.AST_NODE_TYPES.Identifier&&(x[m.key.name]=!0);g.objectArgs||(g.objectArgs=[]),g.objectArgs[f.index]=x}else if(E){y=!0;break}}d.push(g)}else if(h.type===W.AST_NODE_TYPES.JSXOpeningElement&&h.name===l.identifier){let u=h.attributes.some(g=>g.type===W.AST_NODE_TYPES.JSXSpreadAttribute);if(u){y=!0;break}let S={argCount:1,hasSpread:u};for(let g of i.optionalParams)if(g.isObjectParam&&g.index===0){let f={};for(let E of h.attributes)E.type===W.AST_NODE_TYPES.JSXAttribute&&E.name.type===W.AST_NODE_TYPES.JSXIdentifier&&(f[E.name.name]=!0);S.objectArgs||(S.objectArgs=[]),S.objectArgs[0]=f}d.push(S)}}if(!(y||d.length===0))for(let l of i.optionalParams)if(l.isObjectParam&&l.objectProps)for(let h of l.objectProps){if(!h.optional)continue;let u=!1;for(let S of d)if(S.objectArgs&&S.objectArgs[l.index]){let g=S.objectArgs[l.index];if(g&&g[h.name]){u=!0;break}}u||e.report({node:l.param,messageId:"unusedOptionalProp",data:{name:h.name}})}else{let h=!1;for(let u of d)if(u.argCount>l.index){h=!0;break}h||e.report({node:l.param,messageId:"unusedOptionalArg",data:{name:l.name}})}}}}}});var Y=require("@typescript-eslint/utils"),$e=require("zod/v4");var Vs=$e.z.object({selectors:$e.z.array($e.z.object({name:$e.z.string(),selectorProp:$e.z.string().optional(),selectorArgPos:$e.z.number().optional(),returnProp:$e.z.string().optional()}))}),Xs=Y.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),fr="no-unused-selected-values",en={name:fr,rule:Xs({name:fr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[L(Vs)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(s=>[s.name,s]));return{VariableDeclarator(s){let o=null;if(s.init?.type===Y.AST_NODE_TYPES.CallExpression&&(o=s.init),!o)return;let i=Bs(o);if(!i)return;let p=n.get(i);if(!p)return;let a=Hs(o,p.selectorArgPos??0,p.selectorProp);if(!a)return;let c=Ys(a);if(!c)return;let y=mr(c.properties,void 0);if(!y)return;if(s.id.type===Y.AST_NODE_TYPES.ObjectPattern){let h=mr(s.id.properties,p.returnProp);if(!h)return;for(let[u,S]of y)h.has(u)||e.report({node:S,messageId:"unusedSelectedValue",data:{name:u}});return}if(s.id.type!==Y.AST_NODE_TYPES.Identifier||p.returnProp)return;let d=qs(s,e.sourceCode);if(d.length===0)return;let l=new Set;for(let h of d){if(h.identifier.parent.type!==Y.AST_NODE_TYPES.MemberExpression)return;let u=h.identifier.parent.property;if(u.type!==Y.AST_NODE_TYPES.Identifier)return;l.add(u.name)}for(let[h,u]of y)l.has(h)||e.report({node:u,messageId:"unusedSelectedValue",data:{name:h}})}}}})};function Hs(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===Y.AST_NODE_TYPES.ArrowFunctionExpression||n.type===Y.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===Y.AST_NODE_TYPES.ObjectExpression){let s=n.properties.find(i=>i.type===Y.AST_NODE_TYPES.Property&&i.key.type===Y.AST_NODE_TYPES.Identifier&&i.key.name===r);if(s?.type!==Y.AST_NODE_TYPES.Property)return null;let o=s.value;if(o.type===Y.AST_NODE_TYPES.ArrowFunctionExpression||o.type===Y.AST_NODE_TYPES.FunctionExpression)return o}return null}function Bs(e){return e.callee.type===Y.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===Y.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===Y.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Ys(e){if(e.body.type===Y.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===Y.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===Y.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==Y.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function mr(e,t){let r=e;if(t){let s=e.find(o=>o.type===Y.AST_NODE_TYPES.Property&&o.key.type===Y.AST_NODE_TYPES.Identifier&&o.key.name===t);if(s?.type!==Y.AST_NODE_TYPES.Property||s.value.type!==Y.AST_NODE_TYPES.ObjectPattern)return null;r=s.value.properties}let n=new Map;for(let s of r){if(s.type!==Y.AST_NODE_TYPES.Property||s.key.type!==Y.AST_NODE_TYPES.Identifier)return null;n.set(s.key.name,s)}return n.size>0?n:null}function qs(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 q=require("@typescript-eslint/utils");var tn=$({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(o=>o.type===q.AST_NODE_TYPES.ImportDeclaration&&o.source.value==="t-state-form"))return{};let n=null,s=!1;return{CallExpression(o){if(s)return;if(!n){let p=Zs(o);p&&(n=p);return}let i=Gs(o,e.sourceCode);if(i){s=!0;for(let p of i)n.delete(p);if(n.size!==0)for(let[p,a]of n)e.report({node:a,messageId:"unusedField",data:{name:p}})}}}}});function Zs(e){if(!(e.callee.type===q.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==q.AST_NODE_TYPES.ObjectExpression)return null;let n=Nt(r.properties,o=>o.type!==q.AST_NODE_TYPES.Property||o.key.type!==q.AST_NODE_TYPES.Identifier||o.key.name!=="initialConfig"?null:o.value.type===q.AST_NODE_TYPES.ObjectExpression?o.value:o.value.type===q.AST_NODE_TYPES.ArrowFunctionExpression||o.value.type===q.AST_NODE_TYPES.FunctionExpression?Ks(o.value):null);if(!n)return null;let s=new Map;for(let o of n.properties)o.type===q.AST_NODE_TYPES.Property&&o.key.type===q.AST_NODE_TYPES.Identifier&&s.set(o.key.name,o);return s}function Gs(e,t){if(!(e.callee.type===q.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==q.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==q.AST_NODE_TYPES.ObjectPattern||!Nt(e.parent.id.properties,i=>i.type===q.AST_NODE_TYPES.Property&&i.key.type===q.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let s=Yn(e.parent,"formFields",t),o=new Set;for(let{identifier:i}of s){if(i.type!==q.AST_NODE_TYPES.Identifier||i.parent.type===q.AST_NODE_TYPES.Property&&i.parent.parent.type===q.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===q.AST_NODE_TYPES.ReturnStatement||i.parent.type===q.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===q.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==q.AST_NODE_TYPES.Identifier||i.parent.property.type!==q.AST_NODE_TYPES.Identifier)return null;o.add(i.parent.property.name)}}return o}function Ks(e){if(e.body.type===q.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===q.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===q.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==q.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var H=require("@typescript-eslint/utils"),nt=require("zod/v4");var Qs=H.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function yr(e){let t=[];for(let r of e.members)r.type===H.AST_NODE_TYPES.TSPropertySignature&&r.key.type===H.AST_NODE_TYPES.Identifier&&t.push([r.key.name,r]);return t}function dr(e,...t){for(let r of t)e.set(...r);return e}var eo=nt.z.object({forceCheckOnFCPropTypesWithName:nt.z.array(nt.z.string()).optional(),alwaysCheckFunctionOptionTypes:nt.z.boolean().optional()}),gr="no-unused-type-props-in-args",nn=null,to=Qs({name:gr,meta:{type:"problem",docs:{description:"Disallow unused undestructured object type properties"},messages:{unusedObjectTypeProperty:"Object type property '{{ propertyName }}' is defined but never used",missingComponentParam:"Component has declared props but no props are used"},schema:[L(eo)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!nn&&(nn=r.map(a=>new RegExp(a)));function s(a,c,y,d,l=!0,h=!1){let u=y.name,S=e.sourceCode.getScope(c).references.find(m=>m.identifier.name===u)?.resolved,g=a&&nn?.some(m=>m.test(u)),f=h&&n;if(!S||!g&&S.references.filter(m=>m.isTypeReference).length>1||!S.defs[0])return;let E=S.defs[0].node,x=E.parent?.type===H.AST_NODE_TYPES.ExportNamedDeclaration;if(!(l&&x&&!f)){if(E.type===H.AST_NODE_TYPES.TSTypeAliasDeclaration){o(a,c,d,E.typeAnnotation,!0,h);return}if(E.type===H.AST_NODE_TYPES.TSInterfaceDeclaration){o(a,c,d,E.body,!0,h);return}}}function o(a,c,y,d,l,h=!1){if(d.type===H.AST_NODE_TYPES.TSInterfaceBody){for(let u of d.body)u.type===H.AST_NODE_TYPES.TSPropertySignature&&u.key.type===H.AST_NODE_TYPES.Identifier&&y.set(u.key.name,u);return}if(d.type===H.AST_NODE_TYPES.TSTypeLiteral){dr(y,...yr(d));return}if(d.type===H.AST_NODE_TYPES.TSIntersectionType){for(let u of d.types)o(a,c,y,u,!0,h);return}l||d.type===H.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===H.AST_NODE_TYPES.Identifier&&s(a,c,d.typeName,y,!0,h)}function i(a,c,y,d=!1){for(let l of y)if(l.type===H.AST_NODE_TYPES.ObjectPattern&&l.typeAnnotation){let h=new Map;if(o(a,c,h,l.typeAnnotation.typeAnnotation,!1,d),h.size===0)continue;p(l,h)}else l.type===H.AST_NODE_TYPES.AssignmentPattern&&l.left.type===H.AST_NODE_TYPES.ObjectPattern&&i(a,c,[l.left],d)}function p(a,c){let y=[];if(a.properties.at(-1)?.type===H.AST_NODE_TYPES.RestElement)return;for(let u of a.properties)u.type===H.AST_NODE_TYPES.Property&&u.key.type===H.AST_NODE_TYPES.Identifier&&y.push(u.key.name);let l=[],h=[];for(let[u,S]of c)y.includes(u)||(h.push(u),l.push({node:S,messageId:"unusedObjectTypeProperty",data:{propertyName:u}}));for(let[u,S]of l.entries())e.report({...S,fix:u===l.length-1?g=>{let f=a.properties.at(-1),E=h.join(", ");return f?f.type===H.AST_NODE_TYPES.RestElement?null:g.insertTextAfter(f,`, ${E}`):g.insertTextBeforeRange([a.range[0]+1,a.range[1]],E)}:void 0})}return{VariableDeclaration(a){let c=a.declarations[0],y=new Map,d=c.id.type===H.AST_NODE_TYPES.Identifier&&c.id.typeAnnotation?.typeAnnotation.type===H.AST_NODE_TYPES.TSTypeReference&&c.id.typeAnnotation.typeAnnotation.typeName.type===H.AST_NODE_TYPES.Identifier&&c.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&c.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(d){if(d.type===H.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===H.AST_NODE_TYPES.Identifier)s(!0,a,d.typeName,y,!1);else if(d.type===H.AST_NODE_TYPES.TSTypeLiteral)dr(y,...yr(d));else if(d.type===H.AST_NODE_TYPES.TSIntersectionType)for(let l of d.types)l.type===H.AST_NODE_TYPES.TSTypeReference&&l.typeName.type===H.AST_NODE_TYPES.Identifier?s(!0,a,l.typeName,y,!1):o(!0,a,y,l,!0);if(y.size!==0&&c.init?.type===H.AST_NODE_TYPES.ArrowFunctionExpression){let l=c.init.params[0];if(!l){e.report({node:c.init,messageId:"missingComponentParam"});return}l.type===H.AST_NODE_TYPES.ObjectPattern&&p(l,y)}}},FunctionDeclaration(a){i(!1,a,a.params,n)},ArrowFunctionExpression(a){i(!1,a,a.params,n)}}}}),rn={name:gr,rule:to};var Te=require("@typescript-eslint/utils");var sn=$({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===Te.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===Te.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===Te.AST_NODE_TYPES.Identifier&&n.callee.property.type===Te.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===Te.AST_NODE_TYPES.ImportSpecifier&&s.imported.type===Te.AST_NODE_TYPES.Identifier&&s.imported.name==="useRef"&&t.add(s.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===Te.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===Te.AST_NODE_TYPES.Identifier){let o=e.sourceCode.getScope(n).set.get(n.id.name);if(o){let i=!1;for(let p of o.references){let c=p.identifier.parent;if(c!==n&&!(c.type===Te.AST_NODE_TYPES.JSXExpressionContainer&&c.parent.type===Te.AST_NODE_TYPES.JSXAttribute&&c.parent.name.type===Te.AST_NODE_TYPES.JSXIdentifier&&c.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var Ye=require("@typescript-eslint/utils"),no=Ye.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Tr="prefer-named-functions",Sr=new Map,ro=no({name:Tr,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=Sr.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),Sr.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===Ye.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===Ye.AST_NODE_TYPES.Identifier){let s=n.id.name;if(n.id.typeAnnotation||r&&r.test(s)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==Ye.AST_NODE_TYPES.BlockStatement)return;let o=n.parent,i=n.init.params,p=n.init.body,a=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:s,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:c=>c.replaceText(o,`${a.async?"async ":""}function ${s}(${i.map(y=>e.sourceCode.getText(y)).join(", ")||""}) ${e.sourceCode.getText(p)}`)}]})}}}}}),on={name:Tr,rule:ro};var _=require("@typescript-eslint/utils"),Ie=require("zod/v4");var io=Ie.z.object({disallowedFunctions:Ie.z.array(Ie.z.object({name:Ie.z.string(),allowUsingWithArgs:Ie.z.boolean().optional(),hookAlternative:Ie.z.string().optional(),message:Ie.z.string().optional(),allowUseInside:Ie.z.array(Ie.z.string()).optional()}))}),so=/^use[A-Z]/,oo=/^[A-Z]/;function gt(e){return so.test(e)}function hr(e){return oo.test(e)}function ao(e){return e.type===_.AST_NODE_TYPES.Identifier?gt(e.name):e.type===_.AST_NODE_TYPES.MemberExpression&&e.property.type===_.AST_NODE_TYPES.Identifier?gt(e.property.name):!1}function Er(e,t){return e.type===_.AST_NODE_TYPES.Identifier?e.name===t:e.type===_.AST_NODE_TYPES.MemberExpression&&e.object.type===_.AST_NODE_TYPES.Identifier&&e.property.type===_.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function br(e){return!!(e.parent&&e.parent.type===_.AST_NODE_TYPES.CallExpression&&Er(e.parent.callee,"forwardRef"))}function xr(e){return!!(e.parent&&e.parent.type===_.AST_NODE_TYPES.CallExpression&&Er(e.parent.callee,"memo"))}function an(e){if(e.type===_.AST_NODE_TYPES.FunctionDeclaration||e.type===_.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===_.AST_NODE_TYPES.FunctionExpression||e.type===_.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===_.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===_.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===_.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===_.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function lo(e){let t=e.parent,r=!1;for(;t;){if(t.type===_.AST_NODE_TYPES.FunctionDeclaration||t.type===_.AST_NODE_TYPES.FunctionExpression||t.type===_.AST_NODE_TYPES.ArrowFunctionExpression){let n=an(t);if(n&&n.type===_.AST_NODE_TYPES.Identifier){if(hr(n.name)||gt(n.name))return!r;r=!0}else{if(br(t)||xr(t))return!r;if(t.parent.type===_.AST_NODE_TYPES.CallExpression){let s=t.parent;ao(s.callee)||(r=!0)}else t.parent.type===_.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Cr(e){return e.callee.type===_.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===_.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===_.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function po(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===_.AST_NODE_TYPES.FunctionDeclaration||r.type===_.AST_NODE_TYPES.FunctionExpression||r.type===_.AST_NODE_TYPES.ArrowFunctionExpression){let n=an(r);if(n&&n.type===_.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===_.AST_NODE_TYPES.CallExpression){let n=Cr(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function co(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===_.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function uo(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===_.AST_NODE_TYPES.FunctionDeclaration||n.type===_.AST_NODE_TYPES.FunctionExpression||n.type===_.AST_NODE_TYPES.ArrowFunctionExpression){let s=an(n);if(s&&s.type===_.AST_NODE_TYPES.Identifier){if(hr(s.name)||gt(s.name)){r=!0;break}}else if(br(n)||xr(n)){r=!0;break}}n=n.parent}return r?t.length===0?lo(e):!po(e,t):!1}var ln=$({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[L(io)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(s=>[s.name,s]));return{CallExpression(s){let o=Cr(s);if(!o)return;let i=n.get(o);if(!i||i.allowUsingWithArgs&&co(s))return;let p=i.allowUseInside||[];uo(s,p)&&e.report({node:s,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:a=>{let c=i.hookAlternative;return c?s.callee.type===_.AST_NODE_TYPES.Identifier?a.replaceText(s.callee,c):s.callee.type===_.AST_NODE_TYPES.MemberExpression&&s.callee.property.type===_.AST_NODE_TYPES.Identifier?a.replaceText(s.callee.property,c):null:null}}]:[]})}}}});var G=require("@typescript-eslint/utils"),St=Ee(require("zod/v4"));var fo=G.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ar="prefer-single-line-if",mo=St.default.object({maxLineLength:St.default.number().optional(),maxNonSimpleConditionLength:St.default.number().optional()}),yo=fo({name:Ar,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[L(mo)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==G.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 o=n.consequent.body[0];if(!o)return;if(o.type===G.AST_NODE_TYPES.ReturnStatement){if(!Rr(o))return}else if(!(o.type===G.AST_NODE_TYPES.ContinueStatement||o.type===G.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===G.AST_NODE_TYPES.LogicalExpression||n.test.type===G.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let d=Ir(n.test);if(!d&&n.test.type===G.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let l=n.test.argument;Ir(l)&&(d=!0)}if(d&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let p=r.getText(o);if(i.includes(`
|
|
18
|
+
`))return;let a=r.getTokenAfter(n);if(a&&a.type===G.AST_TOKEN_TYPES.Punctuator&&a.value==="}"){let d=r.getTokenAfter(a);if(d&&d.type===G.AST_TOKEN_TYPES.Keyword&&(d.value==="else"||d.value==="catch"))return}let c=go(r,n),y=`if (${i}) ${p}`;t.maxLineLength&&y.length+c.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:d=>d.replaceText(n,y)})}}}});function Ir(e){return e.type===G.AST_NODE_TYPES.CallExpression||e.type===G.AST_NODE_TYPES.BinaryExpression||e.type===G.AST_NODE_TYPES.MemberExpression&&wr(e)}function wr(e){return e.object.type===G.AST_NODE_TYPES.MemberExpression?wr(e.object):e.object.type!==G.AST_NODE_TYPES.Identifier}function go(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Rr(e){if(!e.argument)return!0;let t=e.argument;return t.type===G.AST_NODE_TYPES.ArrayExpression&&t.elements.length===0||t.type===G.AST_NODE_TYPES.ObjectExpression&&t.properties.length===0||t.type===G.AST_NODE_TYPES.Literal||t.type===G.AST_NODE_TYPES.Identifier||t.type===G.AST_NODE_TYPES.TemplateLiteral||t.type===G.AST_NODE_TYPES.TaggedTemplateExpression?!0:t.type===G.AST_NODE_TYPES.CallExpression?t.arguments.length===0:t.type===G.AST_NODE_TYPES.UnaryExpression?Rr(t):!1}var pn={name:Ar,rule:yo};var F=require("@typescript-eslint/utils"),un=require("zod/v4");var So=F.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Fr="react-compiler-extra",To=un.z.object({runOnlyWithEnableCompilerDirective:un.z.boolean().optional()}),ho=/eslint +react-compiler\/react-compiler: +\["error/;function Or(e){return e.type===F.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):!1}function Eo(e){return e.type===F.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===F.AST_NODE_TYPES.MemberExpression&&e.property.type===F.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}function Ae(e){if(!e)return!1;switch(e.type){case F.AST_NODE_TYPES.JSXElement:case F.AST_NODE_TYPES.JSXFragment:return!0;case F.AST_NODE_TYPES.ConditionalExpression:return Ae(e.consequent)||Ae(e.alternate);case F.AST_NODE_TYPES.LogicalExpression:return e.operator==="&&"?Ae(e.right):e.operator==="||"?Ae(e.left)||Ae(e.right):!1;case F.AST_NODE_TYPES.CallExpression:if(e.callee.type===F.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===F.AST_NODE_TYPES.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===F.AST_NODE_TYPES.Identifier&&e.callee.property.name==="createElement")return!0;for(let t of e.arguments)if(t.type!==F.AST_NODE_TYPES.SpreadElement&&Ae(t))return!0;return!1;default:return!1}}function bo(e){let t=e.typeAnnotation;if(t.type===F.AST_NODE_TYPES.TSTypeReference){if(t.typeName.type===F.AST_NODE_TYPES.Identifier)return t.typeName.name==="FC";if(t.typeName.type===F.AST_NODE_TYPES.TSQualifiedName&&t.typeName.left.type===F.AST_NODE_TYPES.Identifier&&t.typeName.right.type===F.AST_NODE_TYPES.Identifier)return t.typeName.left.name==="React"&&t.typeName.right.name==="FC"}return!1}var xo=/^[A-Z][a-zA-Z0-9]*$/;function it(e){return xo.test(e)}function fn(e){return e.startsWith("use")&&e.length>3}function mn(e,t,r,n){if(r&&bo(r))return t?it(t.name):e.type===F.AST_NODE_TYPES.FunctionDeclaration&&e.id?it(e.id.name):!0;if(t&&fn(t.name)||e.type===F.AST_NODE_TYPES.FunctionDeclaration&&e.id&&fn(e.id.name))return!0;if(n){let s=t?.name||e.type===F.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;if(s&&it(s)&&Nr(e.body,n).containsJSX)return!0}return!1}function rt(e){if(e.body.type===F.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===F.AST_NODE_TYPES.ExpressionStatement&&t.expression.type===F.AST_NODE_TYPES.Literal&&typeof t.expression.value=="string"&&t.expression.value==="use memo")return!0}return!1}function Nr(e,t){let r={containsJSX:!1,containsHookCalls:!1};return Le(e,n=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(n.type){case F.AST_NODE_TYPES.JSXElement:case F.AST_NODE_TYPES.JSXFragment:r.containsJSX=!0;break;case F.AST_NODE_TYPES.CallExpression:Or(n.callee)&&(r.containsHookCalls=!0),Ae(n)&&(r.containsJSX=!0);break;case F.AST_NODE_TYPES.ReturnStatement:n.argument&&Ae(n.argument)&&(r.containsJSX=!0);break;case F.AST_NODE_TYPES.VariableDeclarator:n.init&&Ae(n.init)&&(r.containsJSX=!0);break;case F.AST_NODE_TYPES.AssignmentExpression:Ae(n.right)&&(r.containsJSX=!0);break}},t),r}function kr(e,t){let r=e.body,n=Nr(r,t);return n.containsJSX||n.containsHookCalls}var Co=/\bthis[.[]/;function vr(e){return Co.test(e)}function Io(e,t){let r={containsJSX:!1,containsHookCalls:!1};return Le(e,n=>{if(r.containsHookCalls||(n.type===F.AST_NODE_TYPES.FunctionDeclaration||n.type===F.AST_NODE_TYPES.FunctionExpression||n.type===F.AST_NODE_TYPES.ArrowFunctionExpression)&&n!==e)return!0;n.type===F.AST_NODE_TYPES.CallExpression&&Eo(n.callee)&&(r.containsHookCalls=!0)},t),r}function Pr(e){return it(e)||fn(e)}function cn(e,t,r,n){if(!Io(e.body,t).containsHookCalls)return!1;let o=mn(e,r,n,t);if(!o&&n){let i=r?.name||e.type===F.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;i&&it(i)&&(o=!0)}return!o}var Ao=So({name:Fr,meta:{type:"suggestion",fixable:"code",docs:{description:"Extra rules to enforce best practices when using the React compiler"},messages:{objectMethodIsNotSupported:"Object methods such as `{ method() {} }` have limited support to optimizations in the React compiler, use a function expression `{ method: () => {} }` instead.",replaceWithFunctionExpression:"Replace with function expression",thisKeywordInMethod:"Object method uses `this` keyword which would have different behavior if converted to an arrow function. Fix this manually.",fcComponentShouldReturnJsx:'React components and hooks should create JSX elements, call other hooks or use the "use memo" directive for optimal React compiler detection.',addUseMemoDirective:'Add "use memo" directive to opt into React compiler memoization',functionCallingHooksMustBeComponent:'Functions calling hooks must be React components (PascalCase with FC type) or hooks (start with "use").',useMemoDirectiveNaming:'Functions using "use memo" directive must follow React naming conventions (PascalCase for components or start with "use" for hooks).'},hasSuggestions:!0,schema:[L(To)]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let o of e.sourceCode.getAllComments())if(ho.test(o.value)){r=!0;break}if(!r)return{}}function n(o){for(let i of o.properties)if(i.type===F.AST_NODE_TYPES.Property&&i.method&&i.value.type===F.AST_NODE_TYPES.FunctionExpression){let p=e.sourceCode,a=p.getText(i.key),c=i.value,y=p.getText(c.body);if(vr(y))e.report({node:i,messageId:"thisKeywordInMethod"});else{let d=c.params.map(h=>p.getText(h)).join(", "),l="";c.generator?l=`${a}: function* (${d}) ${y}`:l=`${a}: (${d}) => ${y}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:h=>h.replaceText(i,l)})}}}function s(o){for(let i of o.properties)if(i.type===F.AST_NODE_TYPES.Property&&i.value.type===F.AST_NODE_TYPES.ObjectExpression){for(let p of i.value.properties)if(p.type===F.AST_NODE_TYPES.Property&&p.method&&p.value.type===F.AST_NODE_TYPES.FunctionExpression){let c=e.sourceCode.getText(p.value.body);vr(c)&&e.report({node:p,messageId:"thisKeywordInMethod"})}}}return{CallExpression(o){if(Or(o.callee))for(let i of o.arguments){if(i.type===F.AST_NODE_TYPES.ObjectExpression&&(n(i),s(i)),i.type===F.AST_NODE_TYPES.ArrowFunctionExpression&&(i.body.type===F.AST_NODE_TYPES.ObjectExpression&&(n(i.body),s(i.body)),i.body.type===F.AST_NODE_TYPES.BlockStatement))for(let p of i.body.body)p.type===F.AST_NODE_TYPES.ReturnStatement&&p.argument?.type===F.AST_NODE_TYPES.ObjectExpression&&(n(p.argument),s(p.argument));if(i.type===F.AST_NODE_TYPES.FunctionExpression)for(let p of i.body.body)p.type===F.AST_NODE_TYPES.ReturnStatement&&p.argument?.type===F.AST_NODE_TYPES.ObjectExpression&&(n(p.argument),s(p.argument))}},VariableDeclarator(o){if(o.id.type===F.AST_NODE_TYPES.Identifier&&o.init&&(o.init.type===F.AST_NODE_TYPES.ArrowFunctionExpression||o.init.type===F.AST_NODE_TYPES.FunctionExpression)){let i=o.init,p=o.id,a=o.id.typeAnnotation;if(rt(i)&&!Pr(p.name)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(cn(i,e.sourceCode,p,a)){e.report({node:i,messageId:"functionCallingHooksMustBeComponent"});return}if(mn(i,p,a,e.sourceCode)){let c=kr(i,e.sourceCode),y=rt(i);!c&&!y&&e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(d){if(i.body.type===F.AST_NODE_TYPES.BlockStatement){let l=i.body.range[0]+1;return d.insertTextAfterRange([l,l],`
|
|
19
19
|
"use memo"
|
|
20
20
|
`)}return null}}]})}}},FunctionDeclaration(o){if(o.id&&rt(o)&&!Pr(o.id.name)){e.report({node:o,messageId:"useMemoDirectiveNaming"});return}if(cn(o,e.sourceCode)){e.report({node:o,messageId:"functionCallingHooksMustBeComponent"});return}if(mn(o,void 0,void 0,e.sourceCode)){let i=kr(o,e.sourceCode),p=rt(o);!i&&!p&&e.report({node:o,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(a){let c=o.body.range[0]+1;return a.insertTextAfterRange([c,c],`
|
|
21
21
|
"use memo"
|
|
22
|
-
`)}}]})}},FunctionExpression(o){if(rt(o)){e.report({node:o,messageId:"useMemoDirectiveNaming"});return}cn(o,e.sourceCode)&&e.report({node:o,messageId:"functionCallingHooksMustBeComponent"})}}}}),yn={name:Fr,rule:Ao};var ue=require("@typescript-eslint/utils"),be=require("zod/v4");var wo=ue.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Dr="react-compiler-migration",Ro=be.z.object({disallowHooks:be.z.array(be.z.object({name:be.z.string(),replacement:be.z.string()})).optional(),disallowMethods:be.z.array(be.z.object({name:be.z.string(),replacement:be.z.string().optional(),requireTrueProp:be.z.string().optional()})).optional()}),ko=/eslint +react-compiler\/react-compiler: +\["error/;function vo(e){return e.type===ue.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===ue.AST_NODE_TYPES.MemberExpression&&e.property.type===ue.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var Po=wo({name:Dr,meta:{type:"suggestion",fixable:"code",docs:{description:"Rules to help migrate to the new React compiler"},messages:{disallowedFunctionOrMethod:"{{functionOrMethod}} is not supported in react compiler. Use {{replacement}} instead.",replace:"Replace with safe alternative {{replacement}}",disallowedMethodWithMissingRequireTrueProp:"{{method}} is should have a prop named {{requireTrueProp}} set to true when used in react compiler."},hasSuggestions:!0,schema:[L(Ro)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(ko.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let s=null,o=null;if(n.callee.type===ue.AST_NODE_TYPES.Identifier?(s=n.callee.name,o=n.callee):n.callee.type===ue.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===ue.AST_NODE_TYPES.Identifier&&(s=n.callee.property.name,o=n.callee.property),s){let i=t.disallowHooks.find(p=>p.name===s);i&&o&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:p=>p.replaceText(o,i.replacement)}]})}}if(t.disallowMethods?.length&&vo(n.callee)){for(let s of n.arguments)if(s.type===ue.AST_NODE_TYPES.ObjectExpression){for(let o of s.properties)if(o.type===ue.AST_NODE_TYPES.Property&&o.key.type===ue.AST_NODE_TYPES.Identifier){let i=o.key.name,p=t.disallowMethods.find(a=>a.name===i);if(p){if(p.requireTrueProp){let a=p.requireTrueProp,c=!1;for(let y of s.properties)if(y.type===ue.AST_NODE_TYPES.Property&&y.key.type===ue.AST_NODE_TYPES.Identifier&&y.key.name===a&&y.value.type===ue.AST_NODE_TYPES.Literal&&y.value.value===!0){c=!0;break}if(!c){e.report({node:o,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:p.name,requireTrueProp:a}});continue}}p.replacement&&e.report({node:o,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:p.name,replacement:p.replacement},suggest:[{messageId:"replace",data:{replacement:p.replacement},fix:a=>p.replacement?a.replaceText(o.key,p.replacement):null}]})}}}}}}:{}}}),dn={name:Dr,rule:Po};var v=require("@typescript-eslint/utils"),Sn=require("zod");var Fo=Sn.z.object({runOnlyWithEnableCompilerDirective:Sn.z.boolean().optional()}),Oo=/eslint +react-compiler\/react-compiler: +\["error/,No=/^\d+$/,Do=/[\s_-]+/,jo=/[a-z][A-Z]/,Lo=/^(.+?)([A-Z][a-z]+s?)$/,Mo=/^[a-z][a-zA-Z]*$/;function jr(e,t){let r=[];if(e.type===v.AST_NODE_TYPES.JSXElement){for(let n of e.openingElement.attributes)if(n.type===v.AST_NODE_TYPES.JSXAttribute&&n.name.type===v.AST_NODE_TYPES.JSXIdentifier&&n.value?.type===v.AST_NODE_TYPES.JSXExpressionContainer&&n.value.expression.type!==v.AST_NODE_TYPES.JSXEmptyExpression){let s=n.name.name,o=n.value.expression,i=!1;Le(o,p=>{switch(p.type){case v.AST_NODE_TYPES.ObjectExpression:case v.AST_NODE_TYPES.ArrowFunctionExpression:case v.AST_NODE_TYPES.FunctionExpression:case v.AST_NODE_TYPES.ArrayExpression:return i=!0,!0}return!1},t),i&&r.push(s)}}return{hasUnstable:r.length>0,problematicProps:r}}function $o(e){if(e.body.type===v.AST_NODE_TYPES.JSXElement||e.body.type===v.AST_NODE_TYPES.JSXFragment)return!0;if(e.body.type===v.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===v.AST_NODE_TYPES.ReturnStatement&&t.argument&&(t.argument.type===v.AST_NODE_TYPES.JSXElement||t.argument.type===v.AST_NODE_TYPES.JSXFragment))return!0}return!1}function _o(e,t){let r=e.callee;if(r.type===v.AST_NODE_TYPES.MemberExpression){let n=r.object;if(n.type===v.AST_NODE_TYPES.Identifier){let s=n.name,o=Uo(s);if(o!==s)return Tn(o)}}if(t.length>0){let n=t[0];if(n&&n.type===v.AST_NODE_TYPES.Identifier)return Tn(n.name)}return"ListItem"}function Uo(e){let r={people:"person",children:"child",feet:"foot",teeth:"tooth",mice:"mouse",men:"man",women:"woman"}[e.toLowerCase()];if(r)return r;if(e.match(jo)){let n=e.match(Lo);if(n){let s=n[1],o=n[2];if(!s||!o)return gn(e);let i=gn(o);if(i!==o)return s+i}}return gn(e)}function gn(e){return e.endsWith("ies")?`${e.slice(0,-3)}y`:e.endsWith("es")&&e.length>3?e.slice(0,-2):e.endsWith("s")&&e.length>1?e.slice(0,-1):e}function Tn(e){return e.match(Mo)?e.charAt(0).toUpperCase()+e.slice(1):e.split(Do).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function Lr(e,t,r){let n=[],s=new Set,o=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Le(e,i=>{if(i.type===v.AST_NODE_TYPES.Identifier&&!t.includes(i.name)&&!o.has(i.name)&&!No.test(i.name)){let p=i.parent;if(p.type===v.AST_NODE_TYPES.Property&&p.key===i||p.type===v.AST_NODE_TYPES.MemberExpression&&p.property===i&&!p.computed||p.type===v.AST_NODE_TYPES.JSXOpeningElement||p.type===v.AST_NODE_TYPES.JSXClosingElement||p.type===v.AST_NODE_TYPES.JSXAttribute&&p.name.type===v.AST_NODE_TYPES.JSXIdentifier&&p.name.name===i.name)return!1;s.add(i.name)}return!1},r);for(let i of s)t.includes(i)||n.push({name:i,type:"unknown"});return n}function Mr(e,t,r,n,s){let i=[...r.map(
|
|
23
|
-
`),a=i.map(
|
|
22
|
+
`)}}]})}},FunctionExpression(o){if(rt(o)){e.report({node:o,messageId:"useMemoDirectiveNaming"});return}cn(o,e.sourceCode)&&e.report({node:o,messageId:"functionCallingHooksMustBeComponent"})}}}}),yn={name:Fr,rule:Ao};var ue=require("@typescript-eslint/utils"),be=require("zod/v4");var wo=ue.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Dr="react-compiler-migration",Ro=be.z.object({disallowHooks:be.z.array(be.z.object({name:be.z.string(),replacement:be.z.string()})).optional(),disallowMethods:be.z.array(be.z.object({name:be.z.string(),replacement:be.z.string().optional(),requireTrueProp:be.z.string().optional()})).optional()}),ko=/eslint +react-compiler\/react-compiler: +\["error/;function vo(e){return e.type===ue.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===ue.AST_NODE_TYPES.MemberExpression&&e.property.type===ue.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var Po=wo({name:Dr,meta:{type:"suggestion",fixable:"code",docs:{description:"Rules to help migrate to the new React compiler"},messages:{disallowedFunctionOrMethod:"{{functionOrMethod}} is not supported in react compiler. Use {{replacement}} instead.",replace:"Replace with safe alternative {{replacement}}",disallowedMethodWithMissingRequireTrueProp:"{{method}} is should have a prop named {{requireTrueProp}} set to true when used in react compiler."},hasSuggestions:!0,schema:[L(Ro)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(ko.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let s=null,o=null;if(n.callee.type===ue.AST_NODE_TYPES.Identifier?(s=n.callee.name,o=n.callee):n.callee.type===ue.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===ue.AST_NODE_TYPES.Identifier&&(s=n.callee.property.name,o=n.callee.property),s){let i=t.disallowHooks.find(p=>p.name===s);i&&o&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:p=>p.replaceText(o,i.replacement)}]})}}if(t.disallowMethods?.length&&vo(n.callee)){for(let s of n.arguments)if(s.type===ue.AST_NODE_TYPES.ObjectExpression){for(let o of s.properties)if(o.type===ue.AST_NODE_TYPES.Property&&o.key.type===ue.AST_NODE_TYPES.Identifier){let i=o.key.name,p=t.disallowMethods.find(a=>a.name===i);if(p){if(p.requireTrueProp){let a=p.requireTrueProp,c=!1;for(let y of s.properties)if(y.type===ue.AST_NODE_TYPES.Property&&y.key.type===ue.AST_NODE_TYPES.Identifier&&y.key.name===a&&y.value.type===ue.AST_NODE_TYPES.Literal&&y.value.value===!0){c=!0;break}if(!c){e.report({node:o,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:p.name,requireTrueProp:a}});continue}}p.replacement&&e.report({node:o,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:p.name,replacement:p.replacement},suggest:[{messageId:"replace",data:{replacement:p.replacement},fix:a=>p.replacement?a.replaceText(o.key,p.replacement):null}]})}}}}}}:{}}}),dn={name:Dr,rule:Po};var v=require("@typescript-eslint/utils"),Sn=require("zod");var Fo=Sn.z.object({runOnlyWithEnableCompilerDirective:Sn.z.boolean().optional()}),Oo=/eslint +react-compiler\/react-compiler: +\["error/,No=/^\d+$/,Do=/[\s_-]+/,jo=/[a-z][A-Z]/,Lo=/^(.+?)([A-Z][a-z]+s?)$/,Mo=/^[a-z][a-zA-Z]*$/;function jr(e,t){let r=[];if(e.type===v.AST_NODE_TYPES.JSXElement){for(let n of e.openingElement.attributes)if(n.type===v.AST_NODE_TYPES.JSXAttribute&&n.name.type===v.AST_NODE_TYPES.JSXIdentifier&&n.value?.type===v.AST_NODE_TYPES.JSXExpressionContainer&&n.value.expression.type!==v.AST_NODE_TYPES.JSXEmptyExpression){let s=n.name.name,o=n.value.expression,i=!1;Le(o,p=>{switch(p.type){case v.AST_NODE_TYPES.ObjectExpression:case v.AST_NODE_TYPES.ArrowFunctionExpression:case v.AST_NODE_TYPES.FunctionExpression:case v.AST_NODE_TYPES.ArrayExpression:return i=!0,!0}return!1},t),i&&r.push(s)}}return{hasUnstable:r.length>0,problematicProps:r}}function $o(e){if(e.body.type===v.AST_NODE_TYPES.JSXElement||e.body.type===v.AST_NODE_TYPES.JSXFragment)return!0;if(e.body.type===v.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===v.AST_NODE_TYPES.ReturnStatement&&t.argument&&(t.argument.type===v.AST_NODE_TYPES.JSXElement||t.argument.type===v.AST_NODE_TYPES.JSXFragment))return!0}return!1}function _o(e,t){let r=e.callee;if(r.type===v.AST_NODE_TYPES.MemberExpression){let n=r.object;if(n.type===v.AST_NODE_TYPES.Identifier){let s=n.name,o=Uo(s);if(o!==s)return Tn(o)}}if(t.length>0){let n=t[0];if(n&&n.type===v.AST_NODE_TYPES.Identifier)return Tn(n.name)}return"ListItem"}function Uo(e){let r={people:"person",children:"child",feet:"foot",teeth:"tooth",mice:"mouse",men:"man",women:"woman"}[e.toLowerCase()];if(r)return r;if(e.match(jo)){let n=e.match(Lo);if(n){let s=n[1],o=n[2];if(!s||!o)return gn(e);let i=gn(o);if(i!==o)return s+i}}return gn(e)}function gn(e){return e.endsWith("ies")?`${e.slice(0,-3)}y`:e.endsWith("es")&&e.length>3?e.slice(0,-2):e.endsWith("s")&&e.length>1?e.slice(0,-1):e}function Tn(e){return e.match(Mo)?e.charAt(0).toUpperCase()+e.slice(1):e.split(Do).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function Lr(e,t,r){let n=[],s=new Set,o=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Le(e,i=>{if(i.type===v.AST_NODE_TYPES.Identifier&&!t.includes(i.name)&&!o.has(i.name)&&!No.test(i.name)){let p=i.parent;if(p.type===v.AST_NODE_TYPES.Property&&p.key===i||p.type===v.AST_NODE_TYPES.MemberExpression&&p.property===i&&!p.computed||p.type===v.AST_NODE_TYPES.JSXOpeningElement||p.type===v.AST_NODE_TYPES.JSXClosingElement||p.type===v.AST_NODE_TYPES.JSXAttribute&&p.name.type===v.AST_NODE_TYPES.JSXIdentifier&&p.name.name===i.name)return!1;s.add(i.name)}return!1},r);for(let i of s)t.includes(i)||n.push({name:i,type:"unknown"});return n}function Mr(e,t,r,n,s){let i=[...r.map(d=>d.type===v.AST_NODE_TYPES.Identifier?d.name:"item").map((d,l)=>({name:d,type:l===0?`${e}Type`:l===1?"number":"unknown"})),...n],p=i.map(d=>{let l=d.type;return d.name.includes("on")&&l==="any"&&(l="unknown"),` ${d.name}: ${l};`}).join(`
|
|
23
|
+
`),a=i.map(d=>d.name).join(", "),c=s.getText(t),y=`${e}Props`;return`type ${y} = {
|
|
24
24
|
${p}
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -28,19 +28,19 @@ const ${e}: FC<${y}> = ({ ${a} }) => {
|
|
|
28
28
|
return (
|
|
29
29
|
${c}
|
|
30
30
|
);
|
|
31
|
-
};`}function zo(e,t,r,n){let s=t.map(i=>i.type===v.AST_NODE_TYPES.Identifier?i.name:"item"),o=[n?`key={${n}}`:`key={${s[0]}.id}`,...s.map(i=>`${i}={${i}}`),...r.map(i=>`${i.name}={${i.name}}`)].filter(Boolean);return`<${e} ${o.join(" ")} />`}function Wo(e){if(e.type===v.AST_NODE_TYPES.JSXElement&&e.openingElement.name.type===v.AST_NODE_TYPES.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return Tn(t)}return"ListItem"}function Jo(e,t,r){let n=[r?`key={${r}}`:"",...t.map(s=>`${s.name}={${s.name}}`)].filter(Boolean);return`<${e}${n.length>0?` ${n.join(" ")}`:""} />`}function $r(e,t){for(let r of e.openingElement.attributes)if(r.type===v.AST_NODE_TYPES.JSXAttribute&&r.name.type===v.AST_NODE_TYPES.JSXIdentifier&&r.name.name==="key"&&r.value&&r.value.type===v.AST_NODE_TYPES.JSXExpressionContainer&&r.value.expression.type!==v.AST_NODE_TYPES.JSXEmptyExpression)return t.getText(r.value.expression);return null}var hn
|
|
31
|
+
};`}function zo(e,t,r,n){let s=t.map(i=>i.type===v.AST_NODE_TYPES.Identifier?i.name:"item"),o=[n?`key={${n}}`:`key={${s[0]}.id}`,...s.map(i=>`${i}={${i}}`),...r.map(i=>`${i.name}={${i.name}}`)].filter(Boolean);return`<${e} ${o.join(" ")} />`}function Wo(e){if(e.type===v.AST_NODE_TYPES.JSXElement&&e.openingElement.name.type===v.AST_NODE_TYPES.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return Tn(t)}return"ListItem"}function Jo(e,t,r){let n=[r?`key={${r}}`:"",...t.map(s=>`${s.name}={${s.name}}`)].filter(Boolean);return`<${e}${n.length>0?` ${n.join(" ")}`:""} />`}function $r(e,t){for(let r of e.openingElement.attributes)if(r.type===v.AST_NODE_TYPES.JSXAttribute&&r.name.type===v.AST_NODE_TYPES.JSXIdentifier&&r.name.name==="key"&&r.value&&r.value.type===v.AST_NODE_TYPES.JSXExpressionContainer&&r.value.expression.type!==v.AST_NODE_TYPES.JSXEmptyExpression)return t.getText(r.value.expression);return null}var hn=$({name:"react-optimized-collections",meta:{type:"suggestion",docs:{description:"Detect unstable values in map renders that prevent React Compiler optimization"},messages:{unstableValueInMap:"Unstable values in {{problematicProps}} prevent React Compiler from optimizing individual list items. Extract the problematic props to outside the loop or extract the item to a separate component.",extractComponent:"Extract to {{componentName}} component"},schema:[L(Fo)],hasSuggestions:!0},defaultOptions:[{runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let{sourceCode:r}=e;if(t.runOnlyWithEnableCompilerDirective){let n=!1;for(let s of r.getAllComments())if(Oo.test(s.value)){n=!0;break}if(!n)return{}}return{CallExpression(n){n.callee.type===v.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===v.AST_NODE_TYPES.Identifier&&(n.callee.property.name==="map"||n.callee.property.name==="push")&&(n.callee.property.name==="map"?Vo(n,r,e):Xo(n,r,e))}}}});function Vo(e,t,r){let n=e.arguments[0];if(!n||n.type!==v.AST_NODE_TYPES.ArrowFunctionExpression&&n.type!==v.AST_NODE_TYPES.FunctionExpression||!$o(n))return;let s=null;if(n.body.type===v.AST_NODE_TYPES.JSXElement||n.body.type===v.AST_NODE_TYPES.JSXFragment?s=n.body:n.body.type===v.AST_NODE_TYPES.BlockStatement&&n.body.body[0]?.type===v.AST_NODE_TYPES.ReturnStatement&&n.body.body[0].argument&&(n.body.body[0].argument.type===v.AST_NODE_TYPES.JSXElement||n.body.body[0].argument.type===v.AST_NODE_TYPES.JSXFragment)&&(s=n.body.body[0].argument),!s)return;let o=jr(s,t);if(!o.hasUnstable)return;let i=_o(e,n.params),p=n.params.map(d=>d.type===v.AST_NODE_TYPES.Identifier?d.name:"item"),a=Lr(s,p,t),c=s.type===v.AST_NODE_TYPES.JSXElement?$r(s,t):null,y=o.problematicProps.length===1?`prop "${o.problematicProps[0]}"`:`props "${o.problematicProps.join('", "')}"`;r.report({node:s,messageId:"unstableValueInMap",data:{problematicProps:y},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:d=>{let l=Mr(i,s,n.params,a,t),h=zo(i,n.params,a,c),u=e;for(;u.parent.type!==v.AST_NODE_TYPES.Program&&!(u.type===v.AST_NODE_TYPES.FunctionDeclaration||u.type===v.AST_NODE_TYPES.VariableDeclarator&&u.init&&(u.init.type===v.AST_NODE_TYPES.ArrowFunctionExpression||u.init.type===v.AST_NODE_TYPES.FunctionExpression));)u=u.parent;let S=[];return S.push(d.insertTextAfter(u,`
|
|
32
32
|
|
|
33
|
-
${l}`)),
|
|
33
|
+
${l}`)),S.push(d.replaceText(s,h)),S}}]})}function Xo(e,t,r){let n=e.arguments[0];if(!n||n.type!==v.AST_NODE_TYPES.JSXElement&&n.type!==v.AST_NODE_TYPES.JSXFragment)return;let s=n,o=jr(s,t);if(!o.hasUnstable)return;let i=Wo(s),p=Lr(s,[],t),a=s.type===v.AST_NODE_TYPES.JSXElement?$r(s,t):null,c=o.problematicProps.length===1?`prop "${o.problematicProps[0]}"`:`props "${o.problematicProps.join('", "')}"`;r.report({node:s,messageId:"unstableValueInMap",data:{problematicProps:c},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:y=>{let d=Mr(i,s,[],p,t),l=Jo(i,p,a),h=e;for(;h.parent.type!==v.AST_NODE_TYPES.Program&&!(h.type===v.AST_NODE_TYPES.FunctionDeclaration||h.type===v.AST_NODE_TYPES.VariableDeclarator&&h.init&&(h.init.type===v.AST_NODE_TYPES.ArrowFunctionExpression||h.init.type===v.AST_NODE_TYPES.FunctionExpression));)h=h.parent;let u=[];return u.push(y.insertTextAfter(h,`
|
|
34
34
|
|
|
35
|
-
${S}`)),f.push(y.replaceText(s,l)),f}}]})}var Tt=require("@typescript-eslint/utils"),Ho=Tt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_r="require-description",Bo=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Yo=/^eslint-disable-(next-)?line$/u,qo=Ho({name:_r,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 o=Zo(s);o!=null&&(n.has(o.kind)||o.description||e.report({loc:Qo(s.loc),messageId:"missingDescription"}))}}}}}),Ur={name:_r,rule:qo};function Zo(e){let{text:t,description:r}=Ko(e.value);if(!t)return null;let n=Bo.exec(t);if(!n)return null;let s=n[1];if(!s)return null;let o=Yo.test(s);if(e.type===Tt.TSESTree.AST_TOKEN_TYPES.Line&&!o||o&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+s.length);return{kind:s,value:i.trim(),description:r}}var Go=/\s-{2,}\s/u;function Ko(e){let t=e.split(Go);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Qo(e){return{start:{line:e.start.line,column:-1},end:e.end}}var J=require("@typescript-eslint/utils"),we=require("zod/v4");var ea=we.z.object({varsToCheck:we.z.array(we.z.object({selector:we.z.string().optional(),fromFnCall:we.z.string().optional(),prop:we.z.string().or(we.z.array(we.z.string())),errorMsg:we.z.string().optional()}))}),En=M({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[L(ea)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,p,a,c){let y=new Set;for(let l of i.properties)l.type===J.AST_NODE_TYPES.Property&&l.key.type===J.AST_NODE_TYPES.Identifier&&y.add(l.key.name);let S=p.filter(l=>!y.has(l));if(S.length>0)if(S.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:S[0],fnName:c,customMsg:a||""}});else{let l=S.map(m=>`"${m}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:l,fnName:c,customMsg:a||""}})}}function s(i){if(i.init?.type===J.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===J.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===J.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===J.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===J.AST_NODE_TYPES.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"}let o={};for(let i of t.varsToCheck)i.selector&&(o[i.selector]=p=>{if(p.type===J.AST_NODE_TYPES.VariableDeclarator&&p.id.type===J.AST_NODE_TYPES.Identifier&&r.set(p.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:p.id,fnName:s(p)}),p.type===J.AST_NODE_TYPES.VariableDeclarator&&p.id.type===J.AST_NODE_TYPES.ObjectPattern){let a=Array.isArray(i.prop)?i.prop:[i.prop];n(p.id,a,i.errorMsg,s(p))}});for(let i of t.varsToCheck)if(i.fromFnCall){let p=i.fromFnCall;if(p.startsWith("*.")){let c=`VariableDeclarator > CallExpression > MemberExpression[property.name="${p.slice(2)}"]`;o[c]=y=>{if(y.type!==J.AST_NODE_TYPES.MemberExpression||y.parent.type!==J.AST_NODE_TYPES.CallExpression)return;let S=y.parent;if(S.parent.type!==J.AST_NODE_TYPES.VariableDeclarator)return;let l=S.parent;if(l.id.type===J.AST_NODE_TYPES.Identifier)r.set(l.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:l.id,fnName:i.fromFnCall||"unknown function"});else if(l.id.type===J.AST_NODE_TYPES.ObjectPattern){let m=Array.isArray(i.prop)?i.prop:[i.prop];n(l.id,m,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(p.includes(".")){let[a,c]=p.split("."),y=`VariableDeclarator > CallExpression > MemberExpression[object.name="${a}"][property.name="${c}"]`;o[y]=S=>{if(S.type!==J.AST_NODE_TYPES.MemberExpression||S.parent.type!==J.AST_NODE_TYPES.CallExpression)return;let l=S.parent;if(l.parent.type!==J.AST_NODE_TYPES.VariableDeclarator)return;let m=l.parent;if(m.id.type===J.AST_NODE_TYPES.Identifier)r.set(m.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:m.id,fnName:i.fromFnCall||"unknown function"});else if(m.id.type===J.AST_NODE_TYPES.ObjectPattern){let f=Array.isArray(i.prop)?i.prop:[i.prop];n(m.id,f,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let a=`VariableDeclarator > CallExpression > Identifier[name="${p}"]`;o[a]=c=>{if(c.type!==J.AST_NODE_TYPES.Identifier||c.parent.type!==J.AST_NODE_TYPES.CallExpression)return;let y=c.parent;if(y.parent.type!==J.AST_NODE_TYPES.VariableDeclarator)return;let S=y.parent;if(S.id.type===J.AST_NODE_TYPES.Identifier)r.set(S.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:S.id,fnName:i.fromFnCall||"unknown function"});else if(S.id.type===J.AST_NODE_TYPES.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(S.id,l,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...o,"Program:exit"(){for(let[i,{props:p,errorMsg:a,node:c,fnName:y}]of r){let l=e.sourceCode.getScope(c).set.get(i);if(l){let m=new Set(p);for(let f of l.references){let T=f.identifier,h=T.parent;if(!(h.type===J.AST_NODE_TYPES.VariableDeclarator&&h.id===T)){if(h.type===J.AST_NODE_TYPES.MemberExpression&&h.object===T&&h.property.type===J.AST_NODE_TYPES.Identifier&&m.has(h.property.name)){if(m.delete(h.property.name),m.size===0)break;continue}if(h.type===J.AST_NODE_TYPES.VariableDeclarator&&h.init===T&&h.id.type===J.AST_NODE_TYPES.ObjectPattern){for(let u of h.id.properties)u.type===J.AST_NODE_TYPES.Property&&u.key.type===J.AST_NODE_TYPES.Identifier&&m.has(u.key.name)&&m.delete(u.key.name);if(m.size===0)break;continue}if(!(h.type===J.AST_NODE_TYPES.MemberExpression&&h.object===T&&h.property.type===J.AST_NODE_TYPES.Identifier&&!p.includes(h.property.name))){m.clear();break}}}if(m.size>0){let f=Array.from(m);if(f.length===1)e.report({node:c,messageId:"propNotRead",data:{prop:f[0],fnName:y,customMsg:a||""}});else{let T=f.map(h=>`"${h}"`).join(", ");e.report({node:c,messageId:"propsNotRead",data:{props:T,fnName:y,customMsg:a||""}})}}}}}}}});function Jr(e){return/^use[A-Z0-9]/.test(e)}function ht(e){return e.type==="Identifier"?Jr(e.name):e.type==="MemberExpression"&&!e.computed&&ht(e.property)?e.object.type==="Identifier":!1}function Vr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Xr(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Hr(e){return!!(e.parent&&e.parent.callee&&Xr(e.parent.callee,"forwardRef"))}function Br(e){return!!(e.parent&&e.parent.callee&&Xr(e.parent.callee,"memo"))}function bn(e){for(;e;){let t=qr(e);if(t&&(Vr(t)||ht(t))||Hr(e)||Br(e))return!0;e=e.parent}return!1}function zr(e){return!1}function xn(e){return!1}var ta=/eslint +react-compiler\/react-compiler: +\["error/,Yr={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let a of e.sourceCode.getAllComments())if(ta.test(a.value))return{CallExpression(c){let y=null;c.callee.name==="useMemo"?y="useMemo":c.callee.name==="useCallback"&&(y="useCallback"),y&&e.report({node:c,message:`"${y}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?a=>t(a):a=>e.sourceCode.getText(a),r=typeof e.getScope=="function"?()=>r():a=>e.sourceCode.getScope(a),n=null,s=[],o=[],i=new WeakSet;function p(a){for(let c of a.references){let y=c.identifier.parent;if(y.type==="VariableDeclarator"&&y.init&&y.init.type==="CallExpression"&&y.init.callee&&zr(y.init.callee))for(let S of c.resolved.references)S!==c&&i.add(S.identifier)}}return{onCodePathSegmentStart:a=>o.push(a),onCodePathSegmentEnd:()=>o.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(a,c){let y=s.pop();if(y.size===0)return;let S=new Set;function l(d,b){let{cache:g}=l,C=g.get(d.id),A=new Set(b);if(A.has(d.id)){let w=[...A],O=w.slice(w.indexOf(d.id)+1);for(let _ of O)S.add(_);return BigInt("0")}if(A.add(d.id),C!==void 0)return C;if(a.thrownSegments.includes(d))C=BigInt("0");else if(d.prevSegments.length===0)C=BigInt("1");else{C=BigInt("0");for(let w of d.prevSegments)C+=l(w,A)}return d.reachable&&C===BigInt("0")?g.delete(d.id):g.set(d.id,C),C}function m(d,b){let{cache:g}=m,C=g.get(d.id),A=new Set(b);if(A.has(d.id)){let w=Array.from(A),O=w.slice(w.indexOf(d.id)+1);for(let _ of O)S.add(_);return BigInt("0")}if(A.add(d.id),C!==void 0)return C;if(a.thrownSegments.includes(d))C=BigInt("0");else if(d.nextSegments.length===0)C=BigInt("1");else{C=BigInt("0");for(let w of d.nextSegments)C+=m(w,A)}return g.set(d.id,C),C}function f(d){let{cache:b}=f,g=b.get(d.id);if(g===null)return 1/0;if(g!==void 0)return g;if(b.set(d.id,null),d.prevSegments.length===0)g=1;else{g=1/0;for(let C of d.prevSegments){let A=f(C);A<g&&(g=A)}g+=1}return b.set(d.id,g),g}l.cache=new Map,m.cache=new Map,f.cache=new Map;let T=m(a.initialSegment),h=qr(c),u=bn(c),E=h?Vr(h)||ht(h):Hr(c)||Br(c),x=1/0;for(let d of a.finalSegments){if(!d.reachable)continue;let b=f(d);b<x&&(x=b)}for(let[d,b]of y){if(!d.reachable)continue;let g=d.nextSegments.length===0?x<=f(d):x<f(d),C=l(d)*m(d),A=S.has(d.id);for(let w of b)if(A&&!xn(w)&&e.report({node:w,message:`React Hook "${t(w)}" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.`}),E){if(c.async&&e.report({node:w,message:`React Hook "${t(w)}" cannot be called in an async function.`}),!A&&C!==T&&!xn(w)){let _=`React Hook "${t(w)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(g?" Did you accidentally call a React Hook after an early return?":"");e.report({node:w,message:_})}}else if(c.parent&&(c.parent.type==="MethodDefinition"||c.parent.type==="ClassProperty")&&c.parent.value===c){let O=`React Hook "${t(w)}" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:w,message:O})}else if(h){let O=`React Hook "${t(w)}" is called in function "${t(h)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:w,message:O})}else if(c.type==="Program"){let O=`React Hook "${t(w)}" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:w,message:O})}else if(u&&!xn(w)){if(c.parent.type==="CallExpression"&&c.parent.callee.type==="Identifier"&&c.parent.callee.name==="useCallback"){let _=c.parent;if(_.parent.type==="VariableDeclarator"&&Jr(_.parent.id.name))return}let O=`React Hook "${t(w)}" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:w,message:O})}}},CallExpression(a){if(ht(a.callee)){let c=Wr(s),y=Wr(o),S=c.get(y);S||(S=[],c.set(y,S)),S.push(a.callee)}a.callee.type==="Identifier"&&(a.callee.name==="useEffect"||zr(a.callee))&&a.arguments.length>0&&(n=a)},Identifier(a){n==null&&i.has(a)&&a.parent.type!=="CallExpression"&&e.report({node:a,message:`\`${t(a)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(a){a===n&&(n=null)},FunctionDeclaration(a){bn(a)&&p(r(a))},ArrowFunctionExpression(a){bn(a)&&p(r(a))}}}};function qr(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 Wr(e){return e[e.length-1]}var se=require("@typescript-eslint/utils"),fe=Ee(require("zod/v4"));var na=/^\s+$/,Cn=/\r?\n/,ra=/^(\s*)/,ia=/^(\s*)\S/,sa=/\r?\n/,oa=fe.object({indent:fe.union([fe.string().regex(na),fe.number().int().min(1)]).optional(),tags:fe.array(fe.string()).optional(),functions:fe.array(fe.string()).optional(),comments:fe.array(fe.string()).optional()}),In=M({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[L(oa)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:s=["outdent","dedent","gql","sql","html","styled"],indent:o}=e.options[0],i=r.map(u=>u.toLowerCase());function p(u){let E=u.split(Cn),x=E.filter(b=>b.trim()!=="");if(x.length===0)return u;let d=Number.POSITIVE_INFINITY;for(let b of x){let g=b.match(ra);g&&(d=Math.min(d,g[1]?.length??0))}return!isFinite(d)||d===0?u:E.map(b=>b.slice(d)).join(`
|
|
36
|
-
`)}function a(
|
|
37
|
-
`)}function c(
|
|
35
|
+
${d}`)),u.push(y.replaceText(s,l)),u}}]})}var Tt=require("@typescript-eslint/utils"),Ho=Tt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_r="require-description",Bo=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Yo=/^eslint-disable-(next-)?line$/u,qo=Ho({name:_r,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 o=Zo(s);o!=null&&(n.has(o.kind)||o.description||e.report({loc:Qo(s.loc),messageId:"missingDescription"}))}}}}}),Ur={name:_r,rule:qo};function Zo(e){let{text:t,description:r}=Ko(e.value);if(!t)return null;let n=Bo.exec(t);if(!n)return null;let s=n[1];if(!s)return null;let o=Yo.test(s);if(e.type===Tt.TSESTree.AST_TOKEN_TYPES.Line&&!o||o&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+s.length);return{kind:s,value:i.trim(),description:r}}var Go=/\s-{2,}\s/u;function Ko(e){let t=e.split(Go);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Qo(e){return{start:{line:e.start.line,column:-1},end:e.end}}var J=require("@typescript-eslint/utils"),we=require("zod/v4");var ea=we.z.object({varsToCheck:we.z.array(we.z.object({selector:we.z.string().optional(),fromFnCall:we.z.string().optional(),prop:we.z.string().or(we.z.array(we.z.string())),errorMsg:we.z.string().optional()}))}),En=$({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[L(ea)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,p,a,c){let y=new Set;for(let l of i.properties)l.type===J.AST_NODE_TYPES.Property&&l.key.type===J.AST_NODE_TYPES.Identifier&&y.add(l.key.name);let d=p.filter(l=>!y.has(l));if(d.length>0)if(d.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:d[0],fnName:c,customMsg:a||""}});else{let l=d.map(h=>`"${h}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:l,fnName:c,customMsg:a||""}})}}function s(i){if(i.init?.type===J.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===J.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===J.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===J.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===J.AST_NODE_TYPES.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"}let o={};for(let i of t.varsToCheck)i.selector&&(o[i.selector]=p=>{if(p.type===J.AST_NODE_TYPES.VariableDeclarator&&p.id.type===J.AST_NODE_TYPES.Identifier&&r.set(p.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:p.id,fnName:s(p)}),p.type===J.AST_NODE_TYPES.VariableDeclarator&&p.id.type===J.AST_NODE_TYPES.ObjectPattern){let a=Array.isArray(i.prop)?i.prop:[i.prop];n(p.id,a,i.errorMsg,s(p))}});for(let i of t.varsToCheck)if(i.fromFnCall){let p=i.fromFnCall;if(p.startsWith("*.")){let c=`VariableDeclarator > CallExpression > MemberExpression[property.name="${p.slice(2)}"]`;o[c]=y=>{if(y.type!==J.AST_NODE_TYPES.MemberExpression||y.parent.type!==J.AST_NODE_TYPES.CallExpression)return;let d=y.parent;if(d.parent.type!==J.AST_NODE_TYPES.VariableDeclarator)return;let l=d.parent;if(l.id.type===J.AST_NODE_TYPES.Identifier)r.set(l.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:l.id,fnName:i.fromFnCall||"unknown function"});else if(l.id.type===J.AST_NODE_TYPES.ObjectPattern){let h=Array.isArray(i.prop)?i.prop:[i.prop];n(l.id,h,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(p.includes(".")){let[a,c]=p.split("."),y=`VariableDeclarator > CallExpression > MemberExpression[object.name="${a}"][property.name="${c}"]`;o[y]=d=>{if(d.type!==J.AST_NODE_TYPES.MemberExpression||d.parent.type!==J.AST_NODE_TYPES.CallExpression)return;let l=d.parent;if(l.parent.type!==J.AST_NODE_TYPES.VariableDeclarator)return;let h=l.parent;if(h.id.type===J.AST_NODE_TYPES.Identifier)r.set(h.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:h.id,fnName:i.fromFnCall||"unknown function"});else if(h.id.type===J.AST_NODE_TYPES.ObjectPattern){let u=Array.isArray(i.prop)?i.prop:[i.prop];n(h.id,u,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let a=`VariableDeclarator > CallExpression > Identifier[name="${p}"]`;o[a]=c=>{if(c.type!==J.AST_NODE_TYPES.Identifier||c.parent.type!==J.AST_NODE_TYPES.CallExpression)return;let y=c.parent;if(y.parent.type!==J.AST_NODE_TYPES.VariableDeclarator)return;let d=y.parent;if(d.id.type===J.AST_NODE_TYPES.Identifier)r.set(d.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:d.id,fnName:i.fromFnCall||"unknown function"});else if(d.id.type===J.AST_NODE_TYPES.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(d.id,l,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...o,"Program:exit"(){for(let[i,{props:p,errorMsg:a,node:c,fnName:y}]of r){let l=e.sourceCode.getScope(c).set.get(i);if(l){let h=new Set(p);for(let u of l.references){let S=u.identifier,g=S.parent;if(!(g.type===J.AST_NODE_TYPES.VariableDeclarator&&g.id===S)){if(g.type===J.AST_NODE_TYPES.MemberExpression&&g.object===S&&g.property.type===J.AST_NODE_TYPES.Identifier&&h.has(g.property.name)){if(h.delete(g.property.name),h.size===0)break;continue}if(g.type===J.AST_NODE_TYPES.VariableDeclarator&&g.init===S&&g.id.type===J.AST_NODE_TYPES.ObjectPattern){for(let f of g.id.properties)f.type===J.AST_NODE_TYPES.Property&&f.key.type===J.AST_NODE_TYPES.Identifier&&h.has(f.key.name)&&h.delete(f.key.name);if(h.size===0)break;continue}if(!(g.type===J.AST_NODE_TYPES.MemberExpression&&g.object===S&&g.property.type===J.AST_NODE_TYPES.Identifier&&!p.includes(g.property.name))){h.clear();break}}}if(h.size>0){let u=Array.from(h);if(u.length===1)e.report({node:c,messageId:"propNotRead",data:{prop:u[0],fnName:y,customMsg:a||""}});else{let S=u.map(g=>`"${g}"`).join(", ");e.report({node:c,messageId:"propsNotRead",data:{props:S,fnName:y,customMsg:a||""}})}}}}}}}});function Jr(e){return/^use[A-Z0-9]/.test(e)}function ht(e){return e.type==="Identifier"?Jr(e.name):e.type==="MemberExpression"&&!e.computed&&ht(e.property)?e.object.type==="Identifier":!1}function Vr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Xr(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Hr(e){return!!(e.parent&&e.parent.callee&&Xr(e.parent.callee,"forwardRef"))}function Br(e){return!!(e.parent&&e.parent.callee&&Xr(e.parent.callee,"memo"))}function bn(e){for(;e;){let t=qr(e);if(t&&(Vr(t)||ht(t))||Hr(e)||Br(e))return!0;e=e.parent}return!1}function zr(e){return!1}function xn(e){return!1}var ta=/eslint +react-compiler\/react-compiler: +\["error/,Yr={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let a of e.sourceCode.getAllComments())if(ta.test(a.value))return{CallExpression(c){let y=null;c.callee.name==="useMemo"?y="useMemo":c.callee.name==="useCallback"&&(y="useCallback"),y&&e.report({node:c,message:`"${y}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?a=>t(a):a=>e.sourceCode.getText(a),r=typeof e.getScope=="function"?()=>r():a=>e.sourceCode.getScope(a),n=null,s=[],o=[],i=new WeakSet;function p(a){for(let c of a.references){let y=c.identifier.parent;if(y.type==="VariableDeclarator"&&y.init&&y.init.type==="CallExpression"&&y.init.callee&&zr(y.init.callee))for(let d of c.resolved.references)d!==c&&i.add(d.identifier)}}return{onCodePathSegmentStart:a=>o.push(a),onCodePathSegmentEnd:()=>o.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(a,c){let y=s.pop();if(y.size===0)return;let d=new Set;function l(m,b){let{cache:T}=l,C=T.get(m.id),A=new Set(b);if(A.has(m.id)){let w=[...A],O=w.slice(w.indexOf(m.id)+1);for(let M of O)d.add(M);return BigInt("0")}if(A.add(m.id),C!==void 0)return C;if(a.thrownSegments.includes(m))C=BigInt("0");else if(m.prevSegments.length===0)C=BigInt("1");else{C=BigInt("0");for(let w of m.prevSegments)C+=l(w,A)}return m.reachable&&C===BigInt("0")?T.delete(m.id):T.set(m.id,C),C}function h(m,b){let{cache:T}=h,C=T.get(m.id),A=new Set(b);if(A.has(m.id)){let w=Array.from(A),O=w.slice(w.indexOf(m.id)+1);for(let M of O)d.add(M);return BigInt("0")}if(A.add(m.id),C!==void 0)return C;if(a.thrownSegments.includes(m))C=BigInt("0");else if(m.nextSegments.length===0)C=BigInt("1");else{C=BigInt("0");for(let w of m.nextSegments)C+=h(w,A)}return T.set(m.id,C),C}function u(m){let{cache:b}=u,T=b.get(m.id);if(T===null)return 1/0;if(T!==void 0)return T;if(b.set(m.id,null),m.prevSegments.length===0)T=1;else{T=1/0;for(let C of m.prevSegments){let A=u(C);A<T&&(T=A)}T+=1}return b.set(m.id,T),T}l.cache=new Map,h.cache=new Map,u.cache=new Map;let S=h(a.initialSegment),g=qr(c),f=bn(c),E=g?Vr(g)||ht(g):Hr(c)||Br(c),x=1/0;for(let m of a.finalSegments){if(!m.reachable)continue;let b=u(m);b<x&&(x=b)}for(let[m,b]of y){if(!m.reachable)continue;let T=m.nextSegments.length===0?x<=u(m):x<u(m),C=l(m)*h(m),A=d.has(m.id);for(let w of b)if(A&&!xn(w)&&e.report({node:w,message:`React Hook "${t(w)}" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.`}),E){if(c.async&&e.report({node:w,message:`React Hook "${t(w)}" cannot be called in an async function.`}),!A&&C!==S&&!xn(w)){let M=`React Hook "${t(w)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(T?" Did you accidentally call a React Hook after an early return?":"");e.report({node:w,message:M})}}else if(c.parent&&(c.parent.type==="MethodDefinition"||c.parent.type==="ClassProperty")&&c.parent.value===c){let O=`React Hook "${t(w)}" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:w,message:O})}else if(g){let O=`React Hook "${t(w)}" is called in function "${t(g)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:w,message:O})}else if(c.type==="Program"){let O=`React Hook "${t(w)}" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:w,message:O})}else if(f&&!xn(w)){if(c.parent.type==="CallExpression"&&c.parent.callee.type==="Identifier"&&c.parent.callee.name==="useCallback"){let M=c.parent;if(M.parent.type==="VariableDeclarator"&&Jr(M.parent.id.name))return}let O=`React Hook "${t(w)}" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:w,message:O})}}},CallExpression(a){if(ht(a.callee)){let c=Wr(s),y=Wr(o),d=c.get(y);d||(d=[],c.set(y,d)),d.push(a.callee)}a.callee.type==="Identifier"&&(a.callee.name==="useEffect"||zr(a.callee))&&a.arguments.length>0&&(n=a)},Identifier(a){n==null&&i.has(a)&&a.parent.type!=="CallExpression"&&e.report({node:a,message:`\`${t(a)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(a){a===n&&(n=null)},FunctionDeclaration(a){bn(a)&&p(r(a))},ArrowFunctionExpression(a){bn(a)&&p(r(a))}}}};function qr(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 Wr(e){return e[e.length-1]}var se=require("@typescript-eslint/utils"),fe=Ee(require("zod/v4"));var na=/^\s+$/,Cn=/\r?\n/,ra=/^(\s*)/,ia=/^(\s*)\S/,sa=/\r?\n/,oa=fe.object({indent:fe.union([fe.string().regex(na),fe.number().int().min(1)]).optional(),tags:fe.array(fe.string()).optional(),functions:fe.array(fe.string()).optional(),comments:fe.array(fe.string()).optional()}),In=$({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[L(oa)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:s=["outdent","dedent","gql","sql","html","styled"],indent:o}=e.options[0],i=r.map(f=>f.toLowerCase());function p(f){let E=f.split(Cn),x=E.filter(b=>b.trim()!=="");if(x.length===0)return f;let m=Number.POSITIVE_INFINITY;for(let b of x){let T=b.match(ra);T&&(m=Math.min(m,T[1]?.length??0))}return!isFinite(m)||m===0?f:E.map(b=>b.slice(m)).join(`
|
|
36
|
+
`)}function a(f,E,x){return f.split(Cn).map(b=>b.trim()===""?b:x.repeat(E)+b).join(`
|
|
37
|
+
`)}function c(f){if(f.type===se.AST_NODE_TYPES.Identifier)return f.name;if(f.type===se.AST_NODE_TYPES.MemberExpression){let E=f.object.type===se.AST_NODE_TYPES.Identifier?f.object.name:null,x=f.property.type===se.AST_NODE_TYPES.Identifier?f.property.name:null;return E&&x?`${E}.${x}`:x}return null}function y(f,E){if(!f)return!1;for(let x of E)if(x.includes(".")){let m=x.split(".");if(f.type===se.AST_NODE_TYPES.MemberExpression&&f.object.type===se.AST_NODE_TYPES.Identifier&&f.property.type===se.AST_NODE_TYPES.Identifier&&f.object.name===m[0]&&f.property.name===m[1])return!0}else if(f.type===se.AST_NODE_TYPES.Identifier&&f.name===x)return!0;return!1}function d(f,E){let x=f.parent;if(x.type!==se.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let m=c(x.tag);return m?E.includes(m):!1}function l(f,E){if(!f||f.type!==se.AST_NODE_TYPES.CallExpression)return!1;let{method:x,argumentsLength:m,optionalCall:b=!0,optionalMember:T=!0}=E;return m!==void 0&&f.arguments.length!==m||!b&&f.optional||f.callee.type!==se.AST_NODE_TYPES.MemberExpression||!T&&f.callee.optional||f.callee.property.type!==se.AST_NODE_TYPES.Identifier?!1:f.callee.property.name===x}function h(f,E){if(!f||f.type!==se.AST_NODE_TYPES.CallExpression)return!1;let{name:x,argumentsLength:m,optionalCall:b=!0}=E;return m!==void 0&&f.arguments.length!==m||!b&&f.optional||f.callee.type!==se.AST_NODE_TYPES.Identifier?!1:f.callee.name===x}function u(f){return l(f.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&f.parent.type===se.AST_NODE_TYPES.CallExpression&&f.parent.arguments[0]===f&&h(f.parent.callee.type===se.AST_NODE_TYPES.MemberExpression?f.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function S(f){if(i.length>0){let E=t.getTokenBefore(f,{includeComments:!0});if(E?.type===se.AST_TOKEN_TYPES.Block&&i.includes(E.value.trim().toLowerCase()))return!0}return!!(u(f)||s.length>0&&d(f,s)||n.length>0&&f.parent.type===se.AST_NODE_TYPES.CallExpression&&f.parent.arguments.includes(f)&&y(f.parent.callee,n))}function g(f){let E=`__PLACEHOLDER__${Math.random()}`,x=f.quasis.map(Z=>t.getText(Z).slice(1,Z.tail?-1:-2)).join(E),m=x.match(sa);if(!m)return;let b=m[0],T=t.lines[t.getLocFromIndex(f.range[0]).line-1];if(!T)return;let A=T.match(ia)?.[1]??"",w;typeof o=="string"?w=o:typeof o=="number"?w=" ".repeat(o):w=A.startsWith(" ")?" ":" ";let M=p(x).replace(new RegExp(`^${b}|${b}[ ]*$`,"g"),""),K=b+a(M,1,A+w)+b+A,ee=x.includes(`\r
|
|
38
38
|
`)?`\r
|
|
39
39
|
`:`
|
|
40
|
-
`,oe=x.split(Cn),
|
|
40
|
+
`,oe=x.split(Cn),le=oe.map((Z,xe)=>xe!==oe.length-1&&Z===w+A?"":Z).join(ee);if(K!==le)return{node:f,messageId:"improperlyIndented",fix:Z=>K.split(E).map((xe,Ve)=>{let ce=f.quasis[Ve];return ce?Z.replaceTextRange([ce.range[0]+1,ce.range[1]-(ce.tail?1:2)],xe):[]}).flat()}}return{TemplateLiteral(f){if(!S(f))return;let E=g(f);if(E)return e.report(E)}}}});var An=require("@typescript-eslint/utils");function aa(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function la(e){let t=e.parent;return t?.type===An.AST_NODE_TYPES.NewExpression&&t.callee.type===An.AST_NODE_TYPES.Identifier&&t.callee.name==="RegExp"}var wn=$({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){aa(r)||la(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var ae=require("@typescript-eslint/utils"),qe=require("zod/v4");var pa=qe.z.object({checkOnly:qe.z.array(qe.z.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:qe.z.array(qe.z.string()).optional()}),Rn=$({name:"use-types-directly-above-usage",meta:{type:"suggestion",docs:{description:"Require type definitions to be placed directly above their first usage for better readability"},fixable:"code",schema:[L(pa)],messages:{moveTypeAboveUsage:"Type definition should be placed directly above its first usage."}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=new Map,s=[];function o(u){for(let S of s)if(u.range[0]>=S.range[0]&&u.range[1]<=S.range[1])return S;return null}function i(u){let S=u.parent;for(;S;){if(S.type===ae.AST_NODE_TYPES.FunctionDeclaration||S.type===ae.AST_NODE_TYPES.FunctionExpression||S.type===ae.AST_NODE_TYPES.ArrowFunctionExpression){let g=S.params;for(let f of g)if(u.range[0]>=f.range[0]&&u.range[1]<=f.range[1])return!0;break}S=S.parent}return!1}function p(u){let S=u.parent;for(;S;){if(S.type===ae.AST_NODE_TYPES.TSTypeParameterInstantiation){let g=S.parent;if(g.type===ae.AST_NODE_TYPES.TSTypeReference&&g.typeName.type===ae.AST_NODE_TYPES.Identifier&&(g.typeName.name==="FC"||g.typeName.name==="React.FC")||g.type===ae.AST_NODE_TYPES.TSTypeReference&&g.typeName.type===ae.AST_NODE_TYPES.TSQualifiedName&&g.typeName.right.name==="FC")return!0}S=S.parent}return!1}function a(u){let S=u.parent;for(;S;){if(S.type===ae.AST_NODE_TYPES.TSTypeParameterInstantiation){let g=S.parent;if(g.type===ae.AST_NODE_TYPES.CallExpression||g.type===ae.AST_NODE_TYPES.NewExpression)return!0}S=S.parent}return!1}function c(u){let S=u.parent;for(;S;){if(S.type===ae.AST_NODE_TYPES.TSTypeAliasDeclaration||S.type===ae.AST_NODE_TYPES.TSInterfaceDeclaration)return!0;S=S.parent}return!1}function y(u){return u.parent.type===ae.AST_NODE_TYPES.TSIndexedAccessType&&u.parent.objectType===u}let d=[];function l(u){let S=[],g=new Map;for(let{typeName:E,firstUsage:x}of u){let m=g.get(x)||[];m.push(E),g.set(x,m)}for(let{typeName:E,firstUsage:x,firstUsagePosition:m,firstUsageInFunctionArgs:b}of u){let T=n.get(E);if(!T||T.statement===x)continue;let C=s.indexOf(T.statement),A=s.indexOf(x);if(C===-1||A===-1)continue;let w=!!(t.checkOnly&&t.checkOnly.includes("function-args")&&b),M=(g.get(x)||[]).length>1;(w||M?C>A:C>A||C!==A-1)&&S.push({typeName:E,typeDef:T,targetStatement:x,firstUsagePosition:m})}if(S.length===0)return;S.sort((E,x)=>{let m=E.firstUsagePosition-x.firstUsagePosition;if(m!==0)return m;let b=s.indexOf(E.typeDef.statement),T=s.indexOf(x.typeDef.statement);return b-T});let f=S[0];f&&e.report({node:f.typeDef.node,messageId:"moveTypeAboveUsage",fix:h(S)})}function h(u){return function*(S){let g=new Map;for(let f of u){let E=g.get(f.targetStatement)||[];E.push(f),g.set(f.targetStatement,E)}for(let[,f]of g)f.sort((E,x)=>{let m=E.firstUsagePosition-x.firstUsagePosition;if(m!==0)return m;let b=s.indexOf(E.typeDef.statement),T=s.indexOf(x.typeDef.statement);return b-T});for(let f of u){let{typeDef:E}=f,x=E.statement,m=r.getCommentsBefore(x),b=x.range[0],T=x.range[1];m.length>0&&m[0]&&(b=m[0].range[0]),yield S.removeRange([b,T])}for(let[f,E]of g){let x=r.getCommentsBefore(f),m=x.length>0&&x[0]?x[0].range[0]:f.range[0],b=[];for(let T of E){let C=T.typeDef.statement,A=r.getText(C),w=r.getCommentsBefore(C),O=A;w.length>0&&(O=`${w.map(K=>r.getText(K)).join(`
|
|
41
41
|
`)}
|
|
42
|
-
${
|
|
42
|
+
${A}`),b.push(O)}yield S.insertTextBeforeRange([m,m],`${b.join(`
|
|
43
43
|
|
|
44
44
|
`)}
|
|
45
45
|
|
|
46
|
-
`)}}}return{Program(m){s.push(...m.body)},TSTypeAliasDeclaration(m){if(s.some(T=>T.type===pe.AST_NODE_TYPES.ExportNamedDeclaration&&T.declaration===m?!0:T===m)){let T=o(m);T&&n.set(m.id.name,{node:m,name:m.id.name,statement:T})}},TSInterfaceDeclaration(m){if(s.some(T=>T.type===pe.AST_NODE_TYPES.ExportNamedDeclaration&&T.declaration===m?!0:T===m)){let T=o(m);T&&n.set(m.id.name,{node:m,name:m.id.name,statement:T})}},TSTypeReference(m){if(m.typeName.type===pe.AST_NODE_TYPES.Identifier){let f=i(m),T=p(m),h=a(m);y.push({typeName:m.typeName.name,node:m,inFunctionArgs:f,inFCProps:T,inGenericArgAtFunctionCall:h,usagePosition:m.range[0]})}},"Program:exit"(){let m=new Map;function f(h){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let u of t.checkOnly)if(u==="function-args"&&h.inFunctionArgs||u==="FC"&&h.inFCProps||u==="generic-args-at-fn-calls"&&h.inGenericArgAtFunctionCall)return!0;return!1}for(let h of y){let{typeName:u,node:E}=h;if(!n.has(u)||!f(h))continue;let x=o(E),d=n.get(u);if(!x||!d||x===d.statement)continue;m.has(u)||m.set(u,[]);let b=m.get(u);if(!b)return;b.includes(x)||b.push(x)}let T=[];for(let[h,u]of m)if(u.length>0){if(u.length===0)continue;let E=u[0];if(!E)continue;let x=Number.MAX_SAFE_INTEGER,d=!1;for(let g of u)g.range[0]<E.range[0]&&(E=g);for(let g of y)f(g)&&g.typeName===h&&o(g.node)===E&&g.usagePosition<x&&(x=g.usagePosition,d=g.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let g=Number.MAX_SAFE_INTEGER;for(let A of y){if(A.typeName!==h)continue;let w=o(A.node);if(!w)continue;let O=s.indexOf(w);O!==-1&&O<g&&(g=O)}let C=s.indexOf(E);if(g!==Number.MAX_SAFE_INTEGER&&C!==-1&&g<C)continue}else{let g=Number.MAX_SAFE_INTEGER;for(let A of y){if(A.typeName!==h||c(A.node))continue;let w=o(A.node);if(!w)continue;let O=s.indexOf(w);O!==-1&&O<g&&(g=O)}let C=s.indexOf(E);if(g!==Number.MAX_SAFE_INTEGER&&C!==-1&&g<C)continue}T.push({typeName:h,firstUsage:E,firstUsagePosition:x,firstUsageInFunctionArgs:d})}T.length>0&&S(T)}}}});var X=require("@typescript-eslint/utils"),Ze=Ee(require("zod/v4"));var ca=["tsx"],ua=/^[A-Z][A-Za-z0-9]*$/,fa=Ze.object({extensions:Ze.array(Ze.string()).optional()}),kn=M({name:"react-single-export",meta:{type:"problem",docs:{description:"Enforces only one export per React component file to support fast refresh"},messages:{multipleExports:"React component files should have only one export to support fast refresh, if you want to export multiple components, use a separate file for each component. Type-only exports are allowed."},schema:[L(fa)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??ca,s=!1;for(let d of n)if(r.endsWith(d)){s=!0;break}if(!s)return{};let o=e.sourceCode,i=new Set,p=new Map;function a(d){return ua.test(d)}function c(d){if(d.type!==X.AST_NODE_TYPES.CallExpression)return!1;let b=d.callee;return b.type===X.AST_NODE_TYPES.Identifier?b.name==="memo"||b.name==="forwardRef":b.type===X.AST_NODE_TYPES.MemberExpression&&b.property.type===X.AST_NODE_TYPES.Identifier?b.property.name==="memo"||b.property.name==="forwardRef":!1}function y(d){if(d.type===X.AST_NODE_TYPES.JSXElement||d.type===X.AST_NODE_TYPES.JSXFragment)return!0;if(d.type===X.AST_NODE_TYPES.ArrayExpression){for(let b of d.elements)if(b&&(b.type===X.AST_NODE_TYPES.JSXElement||b.type===X.AST_NODE_TYPES.JSXFragment))return!0}return!1}function S(d){if(d.type!==X.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let b=d.body;if(b.type===X.AST_NODE_TYPES.ArrowFunctionExpression){let g=b.body;if(y(g))return!0}return!1}function l(d){if(d.id.type!==X.AST_NODE_TYPES.Identifier)return;let b=d.id.name,g=d.init;if(g){if(a(b)&&(g.type===X.AST_NODE_TYPES.ArrowFunctionExpression||g.type===X.AST_NODE_TYPES.FunctionExpression||c(g))){i.add(b);return}g.type===X.AST_NODE_TYPES.Identifier&&p.set(b,g.name),a(b)||S(g)&&i.add(b)}}function m(d){if(d.type===X.AST_NODE_TYPES.VariableDeclaration){for(let b of d.declarations)l(b);return}if(d.type===X.AST_NODE_TYPES.FunctionDeclaration&&d.id){a(d.id.name)&&i.add(d.id.name);return}if(d.type===X.AST_NODE_TYPES.ExportNamedDeclaration&&d.declaration){let b=d.declaration;if(b.type===X.AST_NODE_TYPES.VariableDeclaration){for(let g of b.declarations)l(g);return}if(b.type===X.AST_NODE_TYPES.FunctionDeclaration&&b.id){a(b.id.name)&&i.add(b.id.name);return}}}for(let d of o.ast.body)m(d);function f(d,b=new Set){if(i.has(d))return!0;if(b.has(d))return!1;b.add(d);let g=p.get(d);return g?f(g,b):!1}let T=[];function h(d,b,g){T.push({node:d,isType:b,isComponent:g})}for(let d of o.ast.body){if(d.type===X.AST_NODE_TYPES.ExportNamedDeclaration){let b=d.exportKind==="type";if(d.declaration){let g=d.declaration;if(g.type===X.AST_NODE_TYPES.TSTypeAliasDeclaration||g.type===X.AST_NODE_TYPES.TSInterfaceDeclaration){h(g,!0,!1);continue}if(g.type===X.AST_NODE_TYPES.VariableDeclaration){for(let C of g.declarations){if(C.id.type!==X.AST_NODE_TYPES.Identifier)continue;let A=C.id.name,w=f(A);h(C,b,w)}continue}if(g.type===X.AST_NODE_TYPES.FunctionDeclaration){let C=g.id?.name,A=C?f(C)||a(C):!1;h(g,b,A);continue}h(g,b,!1);continue}if(d.specifiers.length>0)for(let g of d.specifiers){if(g.local.type!==X.AST_NODE_TYPES.Identifier)continue;let C=g.local.name,A=f(C);h(g,b,A)}continue}if(d.type===X.AST_NODE_TYPES.ExportDefaultDeclaration){let b=d.declaration;if(b.type===X.AST_NODE_TYPES.Identifier){let g=f(b.name)||a(b.name);h(d,!1,g);continue}if(b.type===X.AST_NODE_TYPES.FunctionDeclaration||b.type===X.AST_NODE_TYPES.ArrowFunctionExpression||b.type===X.AST_NODE_TYPES.FunctionExpression||b.type===X.AST_NODE_TYPES.CallExpression){h(d,!1,!0);continue}h(d,!1,!1);continue}}let u=!1;for(let d of T)if(!d.isType&&d.isComponent){u=!0;break}if(!u)return{};let E=[];for(let d of T)d.isType||E.push(d);let x=-1;for(let[d,b]of E.entries())if(b.isComponent){x=d;break}if(x===-1)return{};for(let[d,b]of E.entries())if(d!==x){e.report({node:b.node,messageId:"multipleExports"});break}return{}}});var Fe=require("@typescript-eslint/utils"),Et=require("zod/v4");function bt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ma(e){return e.callee.type===Fe.AST_NODE_TYPES.Identifier?e.callee.name==="useState":e.callee.type===Fe.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===Fe.AST_NODE_TYPES.Identifier&&e.callee.property.type===Fe.AST_NODE_TYPES.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var ya=Et.z.object({ignorePrefixes:Et.z.array(Et.z.string()).optional()});function Zr(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function da(e){return`set${bt(e)}`}var vn=M({name:"use-state-setter-naming",meta:{type:"problem",docs:{description:"Enforce consistent naming convention for useState destructuring where setter should be set{Value}"},messages:{incorrectSetterName:'useState setter should follow the pattern "set{{expectedName}}" with a "set" prefix but got "{{actualName}}"',useSuggestedName:'Use "{{expectedSetterName}}" instead'},hasSuggestions:!0,schema:[L(ya)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==Fe.AST_NODE_TYPES.CallExpression||!ma(r.init)||r.id.type!==Fe.AST_NODE_TYPES.ArrayPattern||r.id.elements.length!==2)return;let[n,s]=r.id.elements;if(!n||!s||n.type!==Fe.AST_NODE_TYPES.Identifier||s.type!==Fe.AST_NODE_TYPES.Identifier)return;let o=n.name,i=s.name,p=t.ignorePrefixes||[],a=Zr(o,p),c=Zr(i,p);if(a===""){if(!c.startsWith("set")){let S=`set${bt(o)}`;e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:bt(o),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:S},fix:l=>l.replaceText(s,S)}]})}return}let y=da(a);c!==y&&e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:bt(a),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:y},fix:S=>S.replaceText(s,y)}]})}}}});var re=require("@typescript-eslint/utils"),Je=require("zod/v4");var ga=Je.z.object({name:Je.z.string(),defaults:Je.z.array(Je.z.unknown())}),Sa=Je.z.object({functions:Je.z.array(ga)});function xt(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0)return e===t;if(typeof e!=typeof t||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,o)=>xt(s,t[o]));let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let s of r){if(!n.includes(s))return!1;let o=Object.getOwnPropertyDescriptor(e,s),i=Object.getOwnPropertyDescriptor(t,s);if(!o||!i)return!1;let p=o.value,a=i.value;if(!xt(p,a))return!1}return!0}function Ta(e,t){let r=new Set;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return r;for(let n in e){if(!(n in t))continue;let s=Object.getOwnPropertyDescriptor(e,n),o=Object.getOwnPropertyDescriptor(t,n);s&&o&&xt(s.value,o.value)&&r.add(n)}return r}function Gr(e){if(e.type===re.AST_NODE_TYPES.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case re.AST_NODE_TYPES.Literal:return e.value;case re.AST_NODE_TYPES.ObjectExpression:{let t={};for(let r of e.properties)r.type===re.AST_NODE_TYPES.Property&&r.key.type===re.AST_NODE_TYPES.Identifier&&!r.computed&&(r.value.type===re.AST_NODE_TYPES.Literal?t[r.key.name]=r.value.value:r.value.type===re.AST_NODE_TYPES.ObjectExpression?t[r.key.name]=Gr(r.value):t[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case re.AST_NODE_TYPES.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===re.AST_NODE_TYPES.SpreadElement))return t.type===re.AST_NODE_TYPES.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function ha(e){return e.type===re.AST_NODE_TYPES.Identifier?e.name:e.type===re.AST_NODE_TYPES.MemberExpression&&e.property.type===re.AST_NODE_TYPES.Identifier&&!e.computed?e.property.name:null}var Pn=M({name:"no-redundant-function-params",meta:{type:"suggestion",docs:{description:"Disallow calling functions with redundant default parameters"},messages:{redundantParams:"Function call has redundant parameters matching its default values and can be removed: {{details}}"},fixable:"code",schema:[L(Sa)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map;for(let n of t.functions)r.set(n.name,n.defaults);return{CallExpression(n){let s=ha(n.callee);if(!s)return;let o=r.get(s);if(!o)return;let i=n.arguments;if(i.length===0)return;let p=-1,a=!1,c=new Map,y=new Set,S=new Map,l=[];for(let f=0;f<i.length;f++){if(f>=o.length){p=f;continue}let T=o[f],h=i[f];if(!h||h.type===re.AST_NODE_TYPES.SpreadElement){p=f;continue}let u=Gr(h);if(T===void 0){p=f;continue}if(xt(u,T)){h.type===re.AST_NODE_TYPES.ObjectExpression?(y.add(f),l.push({type:"object",position:f+1})):(S.set(f,u),l.push({type:"simple",position:f+1,value:u}));continue}if(h.type===re.AST_NODE_TYPES.ObjectExpression&&h.properties.length===0&&typeof T=="object"&&T!==null&&Object.keys(T).length>0){y.add(f),l.push({type:"object",position:f+1});continue}let E=Ta(u,T);if(E.size>0){let x=typeof T=="object"&&T!==null?Object.keys(T).length:0;if(h.type===re.AST_NODE_TYPES.ObjectExpression&&h.properties.length===E.size&&h.properties.length===x){y.add(f),l.push({type:"object",position:f+1});continue}else a=!0,c.set(f,E),l.push({type:"partialObject",position:f+1,redundantProperties:Array.from(E)}),p=f}else p=f}if(p<i.length-1||a||y.size>0){let f=function(){let h=[];for(let u of l)if(u.type==="simple")h.push(`Param ${u.position} with value ${JSON.stringify(u.value)}`);else if(u.type==="object")h.push(`Param ${u.position} (object)`);else{let E=u.redundantProperties||[],x=o?o[u.position-1]:void 0;if(typeof x=="object"&&x!==null){let d=x;for(let b of E)if(b in d){let g=Object.getOwnPropertyDescriptor(d,b);g&&h.push(`Param ${u.position} property "${b}" with value ${JSON.stringify(g.value)}`)}}}return{messageId:"redundantParams",data:{details:h.join(", ")}}};var m=f;let T=f();e.report({node:n,messageId:T.messageId,data:T.data,fix(h){let u=[];if(a)for(let[x,d]of c){let b=i[x];if(b&&b.type===re.AST_NODE_TYPES.ObjectExpression){let g=[];for(let A of b.properties)A.type===re.AST_NODE_TYPES.Property&&A.key.type===re.AST_NODE_TYPES.Identifier&&!A.computed&&d.has(A.key.name)||g.push(A);let C=g.map(A=>e.sourceCode.getText(A));u.push(h.replaceText(b,`{ ${C.join(", ")} }`))}}let E=-1;for(let x=i.length-1;x>=0;x--)if(!y.has(x)&&x<=p){E=x;break}if(E<i.length-1)if(E===-1){let x=e.sourceCode.getTokenAfter(n.callee),d=e.sourceCode.getLastToken(n);x&&d&&u.push(h.replaceTextRange([x.range[1],d.range[0]],""))}else{let x=i[E],d=e.sourceCode.getLastToken(n);d&&x&&u.push(h.replaceTextRange([x.range[1],d.range[0]],""))}return u.length>0?u:null}})}}}}});var de=require("@typescript-eslint/utils");function Ea(e){let t=e.parent;for(;t;){if(t.type===de.AST_NODE_TYPES.AwaitExpression||t.type===de.AST_NODE_TYPES.MemberExpression&&t.object===e&&t.property.type===de.AST_NODE_TYPES.Identifier&&t.property.name==="then"||t.type===de.AST_NODE_TYPES.ArrowFunctionExpression&&t.body===e)return!0;if(t.type===de.AST_NODE_TYPES.ArrayExpression&&t.parent.type===de.AST_NODE_TYPES.CallExpression){let r=t.parent;if(r.callee.type===de.AST_NODE_TYPES.MemberExpression&&r.callee.object.type===de.AST_NODE_TYPES.Identifier&&r.callee.object.name==="Promise"&&r.callee.property.type===de.AST_NODE_TYPES.Identifier&&["all","allSettled","race"].includes(r.callee.property.name))return!0}if(t.parent)t=t.parent;else break}return!1}function ba(e){let{callee:t}=e;return t.type===de.AST_NODE_TYPES.Identifier&&t.name==="require"||t.type===de.AST_NODE_TYPES.MemberExpression&&t.object.type===de.AST_NODE_TYPES.Identifier&&t.object.name==="require"}var Fn=M({name:"no-sync-dynamic-import",meta:{type:"problem",docs:{description:"Disallow synchronous dynamic imports and require statements, only allow async dynamic imports with await"},messages:{syncDynamicImport:"Synchronous dynamic import() is not allowed. Use regular import statement or await import() for dynamic imports.",requireNotAllowed:"require() statements are not allowed. Use ES6 import statements instead."},schema:[]},defaultOptions:[],create(e){return{ImportExpression(t){Ea(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){ba(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});var Kr={[rn.name]:rn.rule,[Mt.name]:Mt.rule,[Lt.name]:Lt.rule,"rules-of-hooks":Yr,"exhaustive-deps":Jn,"require-description":Ur.rule,[$t.name]:$t.rule,[Ut.name]:Ut.rule,[on.name]:on.rule,[At.name]:At.rule,[jt.name]:jt.rule,[Wt.name]:Wt.rule,[Qe.name]:Qe.rule,[pn.name]:pn.rule,[zt.name]:zt.rule,[_t.name]:_t.rule,[Vt.name]:Vt.rule,[Rt.name]:Rt.rule,[dn.name]:dn.rule,[yn.name]:yn.rule,[hn.name]:hn.rule,[Dt.name]:Dt.rule,[Yt.name]:Yt.rule,[qt.name]:qt.rule,[Zt.name]:Zt.rule,[en.name]:en.rule,[tn.name]:tn.rule,[Gt.name]:Gt.rule,[Qt.name]:Qt.rule,[ln.name]:ln.rule,[Ht.name]:Ht.rule,[Xt.name]:Xt.rule,[wn.name]:wn.rule,[sn.name]:sn.rule,[En.name]:En.rule,[In.name]:In.rule,[Rn.name]:Rn.rule,[kn.name]:kn.rule,[vn.name]:vn.rule,[Pn.name]:Pn.rule,[Fn.name]:Fn.rule,[Qe.name]:Qe.rule};var xa={rules:Kr};0&&(module.exports={extendedLintPlugin});
|
|
46
|
+
`)}}}return{Program(u){s.push(...u.body)},TSTypeAliasDeclaration(u){if(s.some(g=>g.type===ae.AST_NODE_TYPES.ExportNamedDeclaration&&g.declaration===u?!0:g===u)){let g=o(u);g&&n.set(u.id.name,{node:u,name:u.id.name,statement:g})}},TSInterfaceDeclaration(u){if(s.some(g=>g.type===ae.AST_NODE_TYPES.ExportNamedDeclaration&&g.declaration===u?!0:g===u)){let g=o(u);g&&n.set(u.id.name,{node:u,name:u.id.name,statement:g})}},TSTypeReference(u){if(u.typeName.type===ae.AST_NODE_TYPES.Identifier){if(y(u))return;let S=i(u),g=p(u),f=a(u);d.push({typeName:u.typeName.name,node:u,inFunctionArgs:S,inFCProps:g,inGenericArgAtFunctionCall:f,usagePosition:u.range[0]})}},"Program:exit"(){let u=new Map;function S(f){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let E of t.checkOnly)if(E==="function-args"&&f.inFunctionArgs||E==="FC"&&f.inFCProps||E==="generic-args-at-fn-calls"&&f.inGenericArgAtFunctionCall)return!0;return!1}for(let f of d){let{typeName:E,node:x}=f;if(!n.has(E)||!S(f))continue;let m=o(x),b=n.get(E);if(!m||!b||m===b.statement)continue;u.has(E)||u.set(E,[]);let T=u.get(E);if(!T)return;T.includes(m)||T.push(m)}let g=[];for(let[f,E]of u)if(E.length>0){if(E.length===0)continue;let x=E[0];if(!x)continue;let m=Number.MAX_SAFE_INTEGER,b=!1;for(let C of E)C.range[0]<x.range[0]&&(x=C);for(let C of d)S(C)&&C.typeName===f&&o(C.node)===x&&C.usagePosition<m&&(m=C.usagePosition,b=C.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let C=Number.MAX_SAFE_INTEGER;for(let w of d){if(w.typeName!==f)continue;let O=o(w.node);if(!O)continue;let M=s.indexOf(O);M!==-1&&M<C&&(C=M)}let A=s.indexOf(x);if(C!==Number.MAX_SAFE_INTEGER&&A!==-1&&C<A)continue}else{let C=Number.MAX_SAFE_INTEGER;for(let w of d){if(w.typeName!==f||c(w.node))continue;let O=o(w.node);if(!O)continue;let M=s.indexOf(O);M!==-1&&M<C&&(C=M)}let A=s.indexOf(x);if(C!==Number.MAX_SAFE_INTEGER&&A!==-1&&C<A)continue}g.push({typeName:f,firstUsage:x,firstUsagePosition:m,firstUsageInFunctionArgs:b})}g.length>0&&l(g)}}}});var X=require("@typescript-eslint/utils"),Ze=Ee(require("zod/v4"));var ca=["tsx"],ua=/^[A-Z][A-Za-z0-9]*$/,fa=Ze.object({extensions:Ze.array(Ze.string()).optional()}),kn=$({name:"react-single-export",meta:{type:"problem",docs:{description:"Enforces only one export per React component file to support fast refresh"},messages:{multipleExports:"React component files should have only one export to support fast refresh, if you want to export multiple components, use a separate file for each component. Type-only exports are allowed."},schema:[L(fa)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??ca,s=!1;for(let m of n)if(r.endsWith(m)){s=!0;break}if(!s)return{};let o=e.sourceCode,i=new Set,p=new Map;function a(m){return ua.test(m)}function c(m){if(m.type!==X.AST_NODE_TYPES.CallExpression)return!1;let b=m.callee;return b.type===X.AST_NODE_TYPES.Identifier?b.name==="memo"||b.name==="forwardRef":b.type===X.AST_NODE_TYPES.MemberExpression&&b.property.type===X.AST_NODE_TYPES.Identifier?b.property.name==="memo"||b.property.name==="forwardRef":!1}function y(m){if(m.type===X.AST_NODE_TYPES.JSXElement||m.type===X.AST_NODE_TYPES.JSXFragment)return!0;if(m.type===X.AST_NODE_TYPES.ArrayExpression){for(let b of m.elements)if(b&&(b.type===X.AST_NODE_TYPES.JSXElement||b.type===X.AST_NODE_TYPES.JSXFragment))return!0}return!1}function d(m){if(m.type!==X.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let b=m.body;if(b.type===X.AST_NODE_TYPES.ArrowFunctionExpression){let T=b.body;if(y(T))return!0}return!1}function l(m){if(m.id.type!==X.AST_NODE_TYPES.Identifier)return;let b=m.id.name,T=m.init;if(T){if(a(b)&&(T.type===X.AST_NODE_TYPES.ArrowFunctionExpression||T.type===X.AST_NODE_TYPES.FunctionExpression||c(T))){i.add(b);return}T.type===X.AST_NODE_TYPES.Identifier&&p.set(b,T.name),a(b)||d(T)&&i.add(b)}}function h(m){if(m.type===X.AST_NODE_TYPES.VariableDeclaration){for(let b of m.declarations)l(b);return}if(m.type===X.AST_NODE_TYPES.FunctionDeclaration&&m.id){a(m.id.name)&&i.add(m.id.name);return}if(m.type===X.AST_NODE_TYPES.ExportNamedDeclaration&&m.declaration){let b=m.declaration;if(b.type===X.AST_NODE_TYPES.VariableDeclaration){for(let T of b.declarations)l(T);return}if(b.type===X.AST_NODE_TYPES.FunctionDeclaration&&b.id){a(b.id.name)&&i.add(b.id.name);return}}}for(let m of o.ast.body)h(m);function u(m,b=new Set){if(i.has(m))return!0;if(b.has(m))return!1;b.add(m);let T=p.get(m);return T?u(T,b):!1}let S=[];function g(m,b,T){S.push({node:m,isType:b,isComponent:T})}for(let m of o.ast.body){if(m.type===X.AST_NODE_TYPES.ExportNamedDeclaration){let b=m.exportKind==="type";if(m.declaration){let T=m.declaration;if(T.type===X.AST_NODE_TYPES.TSTypeAliasDeclaration||T.type===X.AST_NODE_TYPES.TSInterfaceDeclaration){g(T,!0,!1);continue}if(T.type===X.AST_NODE_TYPES.VariableDeclaration){for(let C of T.declarations){if(C.id.type!==X.AST_NODE_TYPES.Identifier)continue;let A=C.id.name,w=u(A);g(C,b,w)}continue}if(T.type===X.AST_NODE_TYPES.FunctionDeclaration){let C=T.id?.name,A=C?u(C)||a(C):!1;g(T,b,A);continue}g(T,b,!1);continue}if(m.specifiers.length>0)for(let T of m.specifiers){if(T.local.type!==X.AST_NODE_TYPES.Identifier)continue;let C=T.local.name,A=u(C);g(T,b,A)}continue}if(m.type===X.AST_NODE_TYPES.ExportDefaultDeclaration){let b=m.declaration;if(b.type===X.AST_NODE_TYPES.Identifier){let T=u(b.name)||a(b.name);g(m,!1,T);continue}if(b.type===X.AST_NODE_TYPES.FunctionDeclaration||b.type===X.AST_NODE_TYPES.ArrowFunctionExpression||b.type===X.AST_NODE_TYPES.FunctionExpression||b.type===X.AST_NODE_TYPES.CallExpression){g(m,!1,!0);continue}g(m,!1,!1);continue}}let f=!1;for(let m of S)if(!m.isType&&m.isComponent){f=!0;break}if(!f)return{};let E=[];for(let m of S)m.isType||E.push(m);let x=-1;for(let[m,b]of E.entries())if(b.isComponent){x=m;break}if(x===-1)return{};for(let[m,b]of E.entries())if(m!==x){e.report({node:b.node,messageId:"multipleExports"});break}return{}}});var Fe=require("@typescript-eslint/utils"),Et=require("zod/v4");function bt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ma(e){return e.callee.type===Fe.AST_NODE_TYPES.Identifier?e.callee.name==="useState":e.callee.type===Fe.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===Fe.AST_NODE_TYPES.Identifier&&e.callee.property.type===Fe.AST_NODE_TYPES.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var ya=Et.z.object({ignorePrefixes:Et.z.array(Et.z.string()).optional()});function Zr(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function da(e){return`set${bt(e)}`}var vn=$({name:"use-state-setter-naming",meta:{type:"problem",docs:{description:"Enforce consistent naming convention for useState destructuring where setter should be set{Value}"},messages:{incorrectSetterName:'useState setter should follow the pattern "set{{expectedName}}" with a "set" prefix but got "{{actualName}}"',useSuggestedName:'Use "{{expectedSetterName}}" instead'},hasSuggestions:!0,schema:[L(ya)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==Fe.AST_NODE_TYPES.CallExpression||!ma(r.init)||r.id.type!==Fe.AST_NODE_TYPES.ArrayPattern||r.id.elements.length!==2)return;let[n,s]=r.id.elements;if(!n||!s||n.type!==Fe.AST_NODE_TYPES.Identifier||s.type!==Fe.AST_NODE_TYPES.Identifier)return;let o=n.name,i=s.name,p=t.ignorePrefixes||[],a=Zr(o,p),c=Zr(i,p);if(a===""){if(!c.startsWith("set")){let d=`set${bt(o)}`;e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:bt(o),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:d},fix:l=>l.replaceText(s,d)}]})}return}let y=da(a);c!==y&&e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:bt(a),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:y},fix:d=>d.replaceText(s,y)}]})}}}});var re=require("@typescript-eslint/utils"),Je=require("zod/v4");var ga=Je.z.object({name:Je.z.string(),defaults:Je.z.array(Je.z.unknown())}),Sa=Je.z.object({functions:Je.z.array(ga)});function xt(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0)return e===t;if(typeof e!=typeof t||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,o)=>xt(s,t[o]));let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let s of r){if(!n.includes(s))return!1;let o=Object.getOwnPropertyDescriptor(e,s),i=Object.getOwnPropertyDescriptor(t,s);if(!o||!i)return!1;let p=o.value,a=i.value;if(!xt(p,a))return!1}return!0}function Ta(e,t){let r=new Set;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return r;for(let n in e){if(!(n in t))continue;let s=Object.getOwnPropertyDescriptor(e,n),o=Object.getOwnPropertyDescriptor(t,n);s&&o&&xt(s.value,o.value)&&r.add(n)}return r}function Gr(e){if(e.type===re.AST_NODE_TYPES.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case re.AST_NODE_TYPES.Literal:return e.value;case re.AST_NODE_TYPES.ObjectExpression:{let t={};for(let r of e.properties)r.type===re.AST_NODE_TYPES.Property&&r.key.type===re.AST_NODE_TYPES.Identifier&&!r.computed&&(r.value.type===re.AST_NODE_TYPES.Literal?t[r.key.name]=r.value.value:r.value.type===re.AST_NODE_TYPES.ObjectExpression?t[r.key.name]=Gr(r.value):t[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case re.AST_NODE_TYPES.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===re.AST_NODE_TYPES.SpreadElement))return t.type===re.AST_NODE_TYPES.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function ha(e){return e.type===re.AST_NODE_TYPES.Identifier?e.name:e.type===re.AST_NODE_TYPES.MemberExpression&&e.property.type===re.AST_NODE_TYPES.Identifier&&!e.computed?e.property.name:null}var Pn=$({name:"no-redundant-function-params",meta:{type:"suggestion",docs:{description:"Disallow calling functions with redundant default parameters"},messages:{redundantParams:"Function call has redundant parameters matching its default values and can be removed: {{details}}"},fixable:"code",schema:[L(Sa)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map;for(let n of t.functions)r.set(n.name,n.defaults);return{CallExpression(n){let s=ha(n.callee);if(!s)return;let o=r.get(s);if(!o)return;let i=n.arguments;if(i.length===0)return;let p=-1,a=!1,c=new Map,y=new Set,d=new Map,l=[];for(let u=0;u<i.length;u++){if(u>=o.length){p=u;continue}let S=o[u],g=i[u];if(!g||g.type===re.AST_NODE_TYPES.SpreadElement){p=u;continue}let f=Gr(g);if(S===void 0){p=u;continue}if(xt(f,S)){g.type===re.AST_NODE_TYPES.ObjectExpression?(y.add(u),l.push({type:"object",position:u+1})):(d.set(u,f),l.push({type:"simple",position:u+1,value:f}));continue}if(g.type===re.AST_NODE_TYPES.ObjectExpression&&g.properties.length===0&&typeof S=="object"&&S!==null&&Object.keys(S).length>0){y.add(u),l.push({type:"object",position:u+1});continue}let E=Ta(f,S);if(E.size>0){let x=typeof S=="object"&&S!==null?Object.keys(S).length:0;if(g.type===re.AST_NODE_TYPES.ObjectExpression&&g.properties.length===E.size&&g.properties.length===x){y.add(u),l.push({type:"object",position:u+1});continue}else a=!0,c.set(u,E),l.push({type:"partialObject",position:u+1,redundantProperties:Array.from(E)}),p=u}else p=u}if(p<i.length-1||a||y.size>0){let u=function(){let g=[];for(let f of l)if(f.type==="simple")g.push(`Param ${f.position} with value ${JSON.stringify(f.value)}`);else if(f.type==="object")g.push(`Param ${f.position} (object)`);else{let E=f.redundantProperties||[],x=o?o[f.position-1]:void 0;if(typeof x=="object"&&x!==null){let m=x;for(let b of E)if(b in m){let T=Object.getOwnPropertyDescriptor(m,b);T&&g.push(`Param ${f.position} property "${b}" with value ${JSON.stringify(T.value)}`)}}}return{messageId:"redundantParams",data:{details:g.join(", ")}}};var h=u;let S=u();e.report({node:n,messageId:S.messageId,data:S.data,fix(g){let f=[];if(a)for(let[x,m]of c){let b=i[x];if(b&&b.type===re.AST_NODE_TYPES.ObjectExpression){let T=[];for(let A of b.properties)A.type===re.AST_NODE_TYPES.Property&&A.key.type===re.AST_NODE_TYPES.Identifier&&!A.computed&&m.has(A.key.name)||T.push(A);let C=T.map(A=>e.sourceCode.getText(A));f.push(g.replaceText(b,`{ ${C.join(", ")} }`))}}let E=-1;for(let x=i.length-1;x>=0;x--)if(!y.has(x)&&x<=p){E=x;break}if(E<i.length-1)if(E===-1){let x=e.sourceCode.getTokenAfter(n.callee),m=e.sourceCode.getLastToken(n);x&&m&&f.push(g.replaceTextRange([x.range[1],m.range[0]],""))}else{let x=i[E],m=e.sourceCode.getLastToken(n);m&&x&&f.push(g.replaceTextRange([x.range[1],m.range[0]],""))}return f.length>0?f:null}})}}}}});var de=require("@typescript-eslint/utils");function Ea(e){let t=e.parent;for(;t;){if(t.type===de.AST_NODE_TYPES.AwaitExpression||t.type===de.AST_NODE_TYPES.MemberExpression&&t.object===e&&t.property.type===de.AST_NODE_TYPES.Identifier&&t.property.name==="then"||t.type===de.AST_NODE_TYPES.ArrowFunctionExpression&&t.body===e)return!0;if(t.type===de.AST_NODE_TYPES.ArrayExpression&&t.parent.type===de.AST_NODE_TYPES.CallExpression){let r=t.parent;if(r.callee.type===de.AST_NODE_TYPES.MemberExpression&&r.callee.object.type===de.AST_NODE_TYPES.Identifier&&r.callee.object.name==="Promise"&&r.callee.property.type===de.AST_NODE_TYPES.Identifier&&["all","allSettled","race"].includes(r.callee.property.name))return!0}if(t.parent)t=t.parent;else break}return!1}function ba(e){let{callee:t}=e;return t.type===de.AST_NODE_TYPES.Identifier&&t.name==="require"||t.type===de.AST_NODE_TYPES.MemberExpression&&t.object.type===de.AST_NODE_TYPES.Identifier&&t.object.name==="require"}var Fn=$({name:"no-sync-dynamic-import",meta:{type:"problem",docs:{description:"Disallow synchronous dynamic imports and require statements, only allow async dynamic imports with await"},messages:{syncDynamicImport:"Synchronous dynamic import() is not allowed. Use regular import statement or await import() for dynamic imports.",requireNotAllowed:"require() statements are not allowed. Use ES6 import statements instead."},schema:[]},defaultOptions:[],create(e){return{ImportExpression(t){Ea(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){ba(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});var Kr={[rn.name]:rn.rule,[Mt.name]:Mt.rule,[Lt.name]:Lt.rule,"rules-of-hooks":Yr,"exhaustive-deps":Jn,"require-description":Ur.rule,[$t.name]:$t.rule,[Ut.name]:Ut.rule,[on.name]:on.rule,[At.name]:At.rule,[jt.name]:jt.rule,[Wt.name]:Wt.rule,[Qe.name]:Qe.rule,[pn.name]:pn.rule,[zt.name]:zt.rule,[_t.name]:_t.rule,[Vt.name]:Vt.rule,[Rt.name]:Rt.rule,[dn.name]:dn.rule,[yn.name]:yn.rule,[hn.name]:hn.rule,[Dt.name]:Dt.rule,[Yt.name]:Yt.rule,[qt.name]:qt.rule,[Zt.name]:Zt.rule,[en.name]:en.rule,[tn.name]:tn.rule,[Gt.name]:Gt.rule,[Qt.name]:Qt.rule,[ln.name]:ln.rule,[Ht.name]:Ht.rule,[Xt.name]:Xt.rule,[wn.name]:wn.rule,[sn.name]:sn.rule,[En.name]:En.rule,[In.name]:In.rule,[Rn.name]:Rn.rule,[kn.name]:kn.rule,[vn.name]:vn.rule,[Pn.name]:Pn.rule,[Fn.name]:Fn.rule,[Qe.name]:Qe.rule};var xa={rules:Kr};0&&(module.exports={extendedLintPlugin});
|