@ls-stack/extended-lint 0.90.1 → 0.90.3

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.
@@ -12,14 +12,14 @@ 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 w=l.acquire(I),N=new Set,k=null;{let v=w.upper;for(;v&&(N.add(v),v.type!=="function");)v=v.upper;if(!v)return;k=v}let O=Array.isArray;function f(v){if(!O(v.defs))return!1;let L=v.defs[0];if(L==null||L.node.type!=="VariableDeclarator")return!1;let J=L.node.init;if(J==null)return!1;for(;J.type==="TSAsExpression";)J=J.expression;let X=L.node.parent;if(X==null&&(Ut(k.block,L.node.id),X=L.node.parent,X==null))return!1;if(X.kind==="const"&&J.type==="Literal"&&(typeof J.value=="string"||typeof J.value=="number"||J.value===null))return!0;if(J.type!=="CallExpression")return!1;let Y=J.callee;if(Y.type==="MemberExpression"&&Y.object.name==="React"&&Y.property!=null&&!Y.computed&&(Y=Y.property),Y.type!=="Identifier")return!1;let W=L.node.id,{name:G}=Y;if(G==="useRef"&&W.type==="Identifier")return!0;if(Qi(Y)&&W.type==="Identifier"){for(let Q of v.references)Q!==W&&d.add(Q.identifier);return!0}else if(G==="useState"||G==="useReducer"){if(W.type==="ArrayPattern"&&W.elements.length===2&&O(v.identifiers)){if(W.elements[1]===v.identifiers[0]){if(G==="useState"){let Q=v.references,Fe=0;for(let Ue=0;Ue<Q.length;Ue++){if(Q[Ue].isWrite()&&Fe++,Fe>1)return!1;p.set(Q[Ue].identifier,W.elements[0])}}return!0}else if(W.elements[0]===v.identifiers[0]){if(G==="useState"){let Q=v.references;for(let Fe=0;Fe<Q.length;Fe++)m.add(Q[Fe].identifier)}return!1}}}else if(G==="useTransition"&&W.type==="ArrayPattern"&&W.elements.length===2&&Array.isArray(v.identifiers)&&W.elements[1]===v.identifiers[0])return!0;return!1}function x(v){if(!O(v.defs))return!1;let L=v.defs[0];if(L==null||L.node==null||L.node.id==null)return!1;let J=L.node,X=k.childScopes,Y=null,W;for(W=0;W<X.length;W++){let G=X[W],Q=G.block;if(J.type==="FunctionDeclaration"&&Q===J||J.type==="VariableDeclarator"&&Q.parent===J){Y=G;break}}if(Y==null)return!1;for(W=0;W<Y.through.length;W++){let G=Y.through[W];if(G.resolved!=null&&N.has(G.resolved.scope)&&!E(G.resolved))return!1}return!0}let E=c(f,y),F=c(x,u),R=new Map;function M(v){let L=v.from,J=!1;for(;L.block!==I;)L.type==="function"&&(J=L.block.parent!=null&&L.block.parent.type==="ReturnStatement"),L=L.upper;return J}let P=new Map,ee=new Map;Z(w);function Z(v){for(let L of v.references){if(!L.resolved||!N.has(L.resolved.scope))continue;let J=Ut(I,L.identifier),X=pr(J),Y=ze(X,ee);if(C&&X.type==="Identifier"&&(X.parent.type==="MemberExpression"||X.parent.type==="OptionalMemberExpression")&&!X.parent.computed&&X.parent.property.type==="Identifier"&&X.parent.property.name==="current"&&M(L)&&R.set(Y,{reference:L,dependencyNode:X}),X.parent.type==="TSTypeQuery"||X.parent.type==="TSTypeReference")continue;let W=L.resolved.defs[0];if(W!=null&&!(W.node!=null&&W.node.init===I.parent)&&W.type!=="TypeParameter")if(P.has(Y))P.get(Y).references.push(L);else{let G=L.resolved,Q=E(G)||F(G);P.set(Y,{isStable:Q,references:[L]})}}for(let L of v.childScopes)Z(L)}R.forEach(({reference:v,dependencyNode:L},J)=>{let X=v.resolved.references,Y=!1;for(let W=0;W<X.length;W++){let{identifier:G}=X[W],{parent:Q}=G;if(Q!=null&&Q.type==="MemberExpression"&&!Q.computed&&Q.property.type==="Identifier"&&Q.property.name==="current"&&Q.parent.type==="AssignmentExpression"&&Q.parent.left===Q){Y=!0;break}}Y||a({node:L.parent.property,message:`The ref value '${J}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${J}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let D=new Set;function q(v,L){D.has(L)||(D.add(L),a({node:v,message:`Assignments to the '${L}' variable from inside React Hook ${r(T)} 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(T)}.`}))}let B=new Set;if(P.forEach(({isStable:v,references:L},J)=>{v&&B.add(J),L.forEach(X=>{X.writeExpr&&q(X.writeExpr,J)})}),D.size>0)return;if(!A){let v=null;if(P.forEach(({isStable:L,references:J},X)=>{v||J.forEach(Y=>{if(v)return;let W=Y.identifier;if(!p.has(W))return;let Q=Y.from;for(;Q.type!=="function";)Q=Q.upper;Q.block===I&&(v=X)})}),v){let{suggestedDependencies:L}=$t({dependencies:P,declaredDependencies:[],stableDependencies:B,externalDependencies:new Set,isEffect:!0});a({node:T,message:`React Hook ${b} contains a call to '${v}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+L.join(", ")+`] as a second argument to the ${b} Hook.`,suggest:[{desc:`Add dependencies array: [${L.join(", ")}]`,fix(J){return J.insertTextAfter(I,`, [${L.join(", ")}]`)}}]})}return}let ae=[],fe=new Set;A.type!=="ArrayExpression"?a({node:A,message:`React Hook ${r(T)} 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.`}):A.elements.forEach(v=>{if(v===null)return;if(v.type==="SpreadElement"){a({node:v,message:`React Hook ${r(T)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}d.has(v)&&a({node:v,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(v)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(v)}\``,fix(Y){return Y.removeRange(v.range)}}]});let L;try{L=ze(v,ee)}catch(Y){if(/Unsupported node type/.test(Y.message)){v.type==="Literal"?P.has(v.value)?a({node:v,message:`The ${v.raw} literal is not a valid dependency because it never changes. Did you mean to include ${v.value} in the array instead?`}):a({node:v,message:`The ${v.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):a({node:v,message:`React Hook ${r(T)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw Y}let J=v;for(;J.type==="MemberExpression"||J.type==="OptionalMemberExpression"||J.type==="ChainExpression";)J=J.object||J.expression.object;let X=!k.through.some(Y=>Y.identifier===J);ae.push({key:L,node:v}),X||fe.add(L)});let{suggestedDependencies:Re,unnecessaryDependencies:Be,missingDependencies:Ee,duplicateDependencies:ut}=$t({dependencies:P,declaredDependencies:ae,stableDependencies:B,externalDependencies:fe,isEffect:C}),rt=Re;if(ut.size+Ee.size+Be.size===0){let v=or(T),L=v&&sr(v);if(t&&!L)return;qi({declaredDependencies:ae,declaredDependenciesNode:A,componentScope:k,scope:w}).forEach(({construction:X,isUsedOutsideOfHook:Y,depType:W})=>{let G=W==="function"?"useCallback":"useMemo",Q=W==="function"?"definition":"initialization",Fe=`wrap the ${Q} of '${X.name.name}' in its own ${G}() Hook.`,Ue=Y?`To fix this, ${Fe}`:`Move it inside the ${b} callback. Alternatively, ${Fe}`,Li=W==="conditional"||W==="logical expression"?"could make":"makes",ji=`The '${X.name.name}' ${W} ${Li} the dependencies of ${b} Hook (at line ${A.loc.start.line}) change on every render. ${Ue}`,Gn;Y&&X.type==="Variable"&&W==="function"&&(Gn=[{desc:`Wrap the ${Q} of '${X.name.name}' in its own ${G}() Hook.`,fix(Kn){let[Mi,$i]=G==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Kn.insertTextBefore(X.node.init,Mi),Kn.insertTextAfter(X.node.init,$i)]}}]),a({node:X.node,message:ji,suggest:Gn})});return}!C&&Ee.size>0&&(rt=$t({dependencies:P,declaredDependencies:[],stableDependencies:B,externalDependencies:fe,isEffect:C}).suggestedDependencies);function Ce(){if(ae.length===0)return!0;let v=ae.map(J=>J.key),L=v.slice().sort();return v.join(",")===L.join(",")}Ce()&&rt.sort();function Ae(v){let L=v.split("."),J="";for(let X=0;X<L.length;X++){if(X!==0){let Y=L.slice(0,X+1).join("."),W=ee.get(Y)===!0;J+=W?"?.":"."}J+=L[X]}return J}function Dt(v,L,J,X){return v.size===0?null:(v.size>1?"":L+" ")+J+" "+(v.size>1?"dependencies":"dependency")+": "+Gi(Array.from(v).sort().map(Y=>"'"+Ae(Y)+"'"))+`. Either ${X} ${v.size>1?"them":"it"} or remove the dependency array.`}let De="";if(Be.size>0){let v=null;if(Array.from(Be.keys()).forEach(L=>{v===null&&L.endsWith(".current")&&(v=L)}),v!==null)De=` Mutable values like '${v}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(fe.size>0){let L=Array.from(fe)[0];w.set.has(L)||(De=` Outer scope values like '${L}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!De&&Ee.has("props")){let v=P.get("props");if(v==null)return;let L=v.references;if(!Array.isArray(L))return;let J=!0;for(let X=0;X<L.length;X++){let Y=L[X],W=Ut(k.block,Y.identifier);if(!W){J=!1;break}let G=W.parent;if(G==null){J=!1;break}if(G.type!=="MemberExpression"&&G.type!=="OptionalMemberExpression"){J=!1;break}}J&&(De=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${b} call and refer to those specific props inside ${r(T)}.`)}if(!De&&Ee.size>0){let v=null;Ee.forEach(L=>{if(v)return;let J=k.set.get(L),X=P.get(L);if(X.references[0].resolved!==J)return;let Y=J.defs[0];if(Y==null||Y.name==null||Y.type!=="Parameter")return;let W=!1,G;for(let Q=0;Q<X.references.length;Q++)if(G=X.references[Q].identifier,G!=null&&G.parent!=null&&(G.parent.type==="CallExpression"||G.parent.type==="OptionalCallExpression")&&G.parent.callee===G){W=!0;break}W&&(v=L)}),v!==null&&(De=` If '${v}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!De&&Ee.size>0){let v=null;if(Ee.forEach(L=>{if(v!==null)return;let X=P.get(L).references,Y,W;for(let G=0;G<X.length;G++){for(Y=X[G].identifier,W=Y.parent;W!=null&&W!==k.block;){if(W.type==="CallExpression"){let Q=p.get(W.callee);if(Q!=null){if(Q.name===L)v={missingDep:L,setter:W.callee.name,form:"updater"};else if(m.has(Y))v={missingDep:L,setter:W.callee.name,form:"reducer"};else{let Fe=X[G].resolved;if(Fe!=null){let Ue=Fe.defs[0];Ue!=null&&Ue.type==="Parameter"&&(v={missingDep:L,setter:W.callee.name,form:"inlineReducer"})}}break}}W=W.parent}if(v!==null)break}}),v!==null)switch(v.form){case"reducer":De=` You can also replace multiple useState variables with useReducer if '${v.setter}' needs the current value of '${v.missingDep}'.`;break;case"inlineReducer":De=` If '${v.setter}' needs the current value of '${v.missingDep}', you can also switch to useReducer instead of useState and read '${v.missingDep}' in the reducer.`;break;case"updater":De=` You can also do a functional update '${v.setter}(${v.missingDep.slice(0,1)} => ...)' if you only need '${v.missingDep}' in the '${v.setter}' call.`;break;default:throw new Error("Unknown case.")}}a({node:A,message:`React Hook ${r(T)} has `+(Dt(Ee,"a","missing","include")||Dt(Be,"an","unnecessary","exclude")||Dt(ut,"a","duplicate","omit"))+De,suggest:[{desc:`Update the dependencies array to be: [${rt.map(Ae).join(", ")}]`,fix(v){return v.replaceText(A,`[${rt.map(Ae).join(", ")}]`)}}]})}function h(I){let A=Zi(I.callee,i);if(A===-1)return;let T=I.arguments[A],b=I.callee,C=cr(b).name,w=I.arguments[A+1],N=/Effect($|[^a-z])/g.test(C);if(!T){a({node:b,message:`React Hook ${C} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(t&&!N){let k=or(b);if(!(k&&sr(k)))return}if(!w&&!N){(C==="useMemo"||C==="useCallback")&&a({node:b,message:`React Hook ${C} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(T.type){case"FunctionExpression":case"ArrowFunctionExpression":g(T,w,b,C,N);return;case"Identifier":if(!w||w.elements&&w.elements.some(f=>f&&f.type==="Identifier"&&f.name===T.name))return;let k=n(I).set.get(T.name);if(k==null||k.defs==null)return;let O=k.defs[0];if(!O||!O.node||O.type!=="Variable"&&O.type!=="FunctionName")break;switch(O.node.type){case"FunctionDeclaration":g(O.node,w,b,C,N);return;case"VariableDeclarator":let f=O.node.init;if(!f)break;switch(f.type){case"ArrowFunctionExpression":case"FunctionExpression":g(f,w,b,C,N);return}break}break;default:a({node:b,message:`React Hook ${C} received a function whose dependencies are unknown. Pass an inline function instead.`});return}a({node:b,message:`React Hook ${C} has a missing dependency: '${T.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${T.name}]`,fix(k){return k.replaceText(w,`[${T.name}]`)}}]})}if(!!e.options[0]?.reactCompilerIsEnabled)return t=!0,{CallExpression:I=>h(I)};if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let I of e.sourceCode.getAllComments())if(Yi.test(I.value))return t=!0,{CallExpression:A=>h(A)}}return{CallExpression:I=>h(I)}}};function $t({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((g,h)=>{let S=a(o,h);S.isUsed=!0,l(o,h,I=>{I.isSubtreeUsed=!0})}),t.forEach(({key:g})=>{let h=a(o,g);h.isSatisfiedRecursively=!0}),r.forEach(g=>{let h=a(o,g);h.isSatisfiedRecursively=!0});function a(g,h){let S=h.split("."),I=g;for(let A of S){let T=I.children.get(A);T||(T=i(),I.children.set(A,T)),I=T}return I}function l(g,h,S){let I=h.split("."),A=g;for(let T of I){let b=A.children.get(T);if(!b)return;S(b),A=b}}let p=new Set,m=new Set;y(o,p,m,g=>g);function y(g,h,S,I){g.children.forEach((A,T)=>{let b=I(T);if(A.isSatisfiedRecursively){A.isSubtreeUsed&&S.add(b);return}if(A.isUsed){h.add(b);return}y(A,h,S,C=>b+"."+C)})}let u=[],d=new Set,c=new Set;return t.forEach(({key:g})=>{m.has(g)?u.indexOf(g)===-1?u.push(g):c.add(g):d.add(g)}),p.forEach(g=>{u.push(g)}),{suggestedDependencies:u,unnecessaryDependencies:d,duplicateDependencies:c,missingDependencies:p}}function He(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 He(e.consequent)!=null||He(e.alternate)!=null?"conditional":null;case"LogicalExpression":return He(e.left)!=null||He(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return He(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return He(e.expression);case"TSAsExpression":return He(e.expression)}return null}function qi({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let s=e.map(({key:i})=>{let a=r.variables.find(p=>p.name===i);if(a==null)return null;let l=a.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let p=He(l.node.init);if(p!=null)return[a,p]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[a,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[a,"class"]:null}).filter(Boolean);function o(i){let a=!1;for(let l=0;l<i.references.length;l++){let p=i.references[l];if(p.writeExpr){if(a)return!0;a=!0;continue}let m=p.from;for(;m!==n&&m!=null;)m=m.upper;if(m!==n&&!ur(t,p.identifier))return!0}return!1}return s.map(([i,a])=>({construction:i.defs[0],depType:a,isUsedOutsideOfHook:o(i)}))}function pr(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)?pr(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function _t(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function ze(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=ze(e.object,t),n=ze(e.property,null),s=`${r}.${n}`;return _t(e,t,s),s}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=ze(e.object,t),n=ze(e.property,null),s=`${r}.${n}`;return _t(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=ze(r.object,t),s=ze(r.property,null),o=`${n}.${s}`;return _t(r,t,o),o}else throw new Error(`Unsupported node type: ${e.type}`)}function cr(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Zi(e,t){let r=cr(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=ze(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 Ut(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),Ki(n,t))return n;if(ur(n,t))for(let[s,o]of Object.entries(n))s!=="parent"&&(ar(o)?(o.parent=n,r.push(o)):Array.isArray(o)&&o.forEach(i=>{ar(i)&&(i.parent=n,r.push(i))}))}return null}function Gi(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 ar(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Ki(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 ur(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function Qi(e){return!1}import{AST_NODE_TYPES as ue,ESLintUtils as Tr}from"@typescript-eslint/utils";import H from"typescript";import{z as dr}from"zod/v4";import{AST_NODE_TYPES as fr}from"@typescript-eslint/utils";function it(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:it(e.parent,t,r===1/0?r:r-1)}function*zt(e){yield e,e.parent&&(yield*zt(e.parent))}function Vt(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function yr(e,t,r){let s=r.getDeclaredVariables(e).find(o=>o.name===t||o.identifiers[0]?.parent.type===fr.Property&&o.identifiers[0].parent.key.type===fr.Identifier&&o.identifiers[0].parent.key.name===t);return s?s.references.filter(o=>!o.init):[]}function mr(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function es(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 l=n[i.type];if(l)for(let p of l){let m=es(i,p);if(m){if(Array.isArray(m)){for(let y of m)if(mr(y)&&o(y))return!0}else if(mr(m)&&o(m))return!0}}return!1}o(e)}var ts=Tr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),gr="improved-no-unnecessary-condition",ns=dr.object({alternativeForInCondition:dr.string().optional().describe("Alternative to appear in the error for `in` condition")}),Sr={object:"Array",property:"isArray"},rs=["string","number","bigint","boolean","symbol","undefined","object","function","never"],is=new Set(rs),Wt={name:gr,rule:ts({name:gr,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".',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.",unnecessaryArrayIsArrayCondition:"This Array.isArray check is unnecessary as it always evaluates to true.",alwaysFalseArrayIsArrayCondition:"This Array.isArray 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.",unnecessaryInCondition:'This in check is unnecessary. Property "{{property}}" always exists on type "{{type}}".{{alternative}}',alwaysFalseInCondition:'This in check will always be false. Property "{{property}}" does not exist on type "{{type}}".{{alternative}}'},schema:[_(ns)]},defaultOptions:[{}],create(e,[t]){let r=Tr.getParserServices(e,!0),n=r.program?.getTypeChecker();if(!n||!r.program)throw new Error("TypeScript services or program not available");function s(f){return f.type===ue.UnaryExpression&&f.operator==="typeof"}function o(f){return f.flags&H.TypeFlags.Any||f.flags&H.TypeFlags.Unknown?null:f.flags&H.TypeFlags.StringLike?["string"]:f.flags&H.TypeFlags.NumberLike?["number"]:f.flags&H.TypeFlags.BigIntLike?["bigint"]:f.flags&H.TypeFlags.BooleanLike?["boolean"]:f.flags&H.TypeFlags.ESSymbolLike?["symbol"]:f.flags&H.TypeFlags.Undefined||f.flags&H.TypeFlags.Void?["undefined"]:f.flags&H.TypeFlags.Null?["object"]:f.getCallSignatures().length>0?["function"]:f.flags&H.TypeFlags.Object?f.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:f.flags&H.TypeFlags.NonPrimitive?["object"]:f.flags&H.TypeFlags.Never?["never"]:null}function i(f){if(!n)return null;let x=r.esTreeNodeToTSNodeMap.get(f),E=n.getTypeAtLocation(x.expression);if(E.flags&H.TypeFlags.Any||E.flags&H.TypeFlags.Unknown)return null;let F=[];if(E.isUnion()){for(let M of E.types){let P=o(M);if(P)F.push(...P);else return null}return F}let R=o(E);return R?(F.push(...R),F):null}function a(f){if(!(f.operator==="==="||f.operator==="!=="))return;let E=null,F=null;if(s(f.left)?(E=f.left,F=f.right.type===ue.Literal&&typeof f.right.value=="string"?f.right.value:null):s(f.right)&&(E=f.right,F=f.left.type===ue.Literal&&typeof f.left.value=="string"?f.left.value:null),!E||!F||!ss(F,is))return;let R=i(E);if(!R)return;let M=f.operator==="!==",P=R.includes(F);R.length===1?P&&!M?e.report({node:f,messageId:"unnecessaryTypeofCondition",data:{name:st(E,e),type:F}}):!P&&M?e.report({node:f,messageId:"unnecessaryTypeofCondition",data:{name:st(E,e),type:Array.from(R)[0]}}):!P&&!M?e.report({node:f,messageId:"alwaysFalseTypeofCondition",data:{name:st(E,e),actualType:bt(R),conditionType:F}}):P&&M&&e.report({node:f,messageId:"alwaysFalseTypeofCondition",data:{name:st(E,e),actualType:bt(R),conditionType:F}}):!P&&!M?e.report({node:f,messageId:"alwaysFalseTypeofCondition",data:{name:st(E,e),actualType:bt(R),conditionType:F}}):!P&&M&&e.report({node:f,messageId:"unnecessaryTypeofCondition",data:{name:st(E,e),type:bt(R)}})}function l(f){if(f.flags&H.TypeFlags.Any||f.flags&H.TypeFlags.Unknown)return null;if(f.isUnion()){let x=[];for(let E of f.types)if(E.flags&H.TypeFlags.StringLiteral){let F=E.value;x.push(F)}else return null;return x}return f.flags&H.TypeFlags.StringLiteral?[f.value]:null}function p(f){if(!n)return null;let x=r.esTreeNodeToTSNodeMap.get(f),E=n.getTypeAtLocation(x),F=l(E);if(F)return F;let R=n.getSymbolAtLocation(x);if(R){let M=n.getTypeOfSymbolAtLocation(R,x),P=l(M);if(P)return P}return null}function m(f){let x=e.sourceCode.ast,E=null;return Le(x,F=>{if(F.type===ue.VariableDeclarator&&F.id.type===ue.Identifier&&F.id.name===f.name&&F.id.typeAnnotation){let R=F.id.typeAnnotation.typeAnnotation;if(R.type===ue.TSUnionType){let M=[];for(let P of R.types)if(P.type===ue.TSLiteralType&&P.literal.type===ue.Literal&&typeof P.literal.value=="string")M.push(P.literal.value);else return!0;return E=M,!0}if(R.type===ue.TSLiteralType&&R.literal.type===ue.Literal&&typeof R.literal.value=="string")return E=[R.literal.value],!0}return!1},e.sourceCode),E}function y(f){return f==="Array"||f==="ReadonlyArray"?!0:f.endsWith(".Array")||f.endsWith(".ReadonlyArray")}function u(f){if(!n)return!1;if(n.isArrayType(f)||n.isTupleType(f))return!0;let x=n.getApparentType(f);if(x!==f&&(n.isArrayType(x)||n.isTupleType(x)))return!0;if(f.aliasSymbol){let F=n.getFullyQualifiedName(f.aliasSymbol);if(y(F))return!0}let E=f.getSymbol();if(E){let F=n.getFullyQualifiedName(E);if(y(F))return!0}return!1}function d(f){return n?f.getProperties().length===0&&n.getIndexInfosOfType(f).length===0&&f.getCallSignatures().length===0&&f.getConstructSignatures().length===0:!1}function c(f){return n?!!(f.flags&H.TypeFlags.StringLike||f.flags&H.TypeFlags.NumberLike||f.flags&H.TypeFlags.BigIntLike||f.flags&H.TypeFlags.BooleanLike||f.flags&H.TypeFlags.ESSymbolLike||f.flags&H.TypeFlags.EnumLike||f.flags&H.TypeFlags.Null||f.flags&H.TypeFlags.Undefined||f.flags&H.TypeFlags.Void||f.flags&H.TypeFlags.Never||f.flags&H.TypeFlags.Object&&!f.isClassOrInterface()&&!u(f)&&!d(f)):!1}function g(f){if(f.flags&H.TypeFlags.Any||f.flags&H.TypeFlags.Unknown)return"unknown";if(f.isUnion()){let x=!0,E=!0;for(let F of f.types){let R=g(F);if(R==="unknown")return"unknown";R!=="alwaysTrue"&&(x=!1),R!=="alwaysFalse"&&(E=!1)}return x?"alwaysTrue":E?"alwaysFalse":"unknown"}return u(f)?"alwaysTrue":c(f)?"alwaysFalse":"unknown"}function h(f){return!f.computed&&f.object.type===ue.Identifier&&f.object.name===Sr.object&&f.property.type===ue.Identifier&&f.property.name===Sr.property}function S(f){if(!n||f.callee.type!==ue.MemberExpression||!h(f.callee)||f.arguments.length===0)return;let[x]=f.arguments;if(!x||x.type===ue.SpreadElement)return;let E=r.esTreeNodeToTSNodeMap.get(x),F=n.getTypeAtLocation(E),R=g(F);R==="alwaysTrue"?e.report({node:f,messageId:"unnecessaryArrayIsArrayCondition"}):R==="alwaysFalse"&&e.report({node:f,messageId:"alwaysFalseArrayIsArrayCondition"})}function I(f){if(f.callee.type!==ue.MemberExpression||f.callee.property.type!==ue.Identifier||f.callee.computed)return;let x=f.callee.property.name;if(x!=="startsWith"&&x!=="endsWith"&&x!=="includes"||f.arguments.length!==1)return;let[E]=f.arguments;if(!E||E.type!==ue.Literal||typeof E.value!="string")return;let F=f.callee.object,R=p(F);if(!R&&F.type===ue.Identifier&&(R=m(F)),!R||R.length===0)return;let M=E.value;if(x==="includes"&&R.length>1)return;let P=0,ee=0;for(let Z of R)if((x==="startsWith"?Z.startsWith(M):x==="endsWith"?Z.endsWith(M):Z.includes(M))?P++:ee++,P>0&&ee>0)return;if(P>0&&ee===0){let Z=x==="startsWith"?"unnecessaryStartsWithCondition":x==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:f,messageId:Z})}else if(ee>0&&P===0){let Z=x==="startsWith"?"alwaysFalseStartsWithCondition":x==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:f,messageId:Z})}}function A(f){if(!new Set(["===","!==",">",">=","<","<="]).has(f.operator))return;function E(D){if(D.type!==ue.MemberExpression||D.computed||D.property.type!==ue.Identifier||D.property.name!=="length")return null;let q=D.object,B=p(q);if(!B||B.length===0)return null;let ae=[];for(let fe of B)ae.push(fe.length);return{values:ae}}let F=E(f.left),R=E(f.right),M=null,P=null;if(F?f.right.type===ue.Literal&&typeof f.right.value=="number"&&(M=F.values,P=f.right.value):R&&f.left.type===ue.Literal&&typeof f.left.value=="number"&&(M=R.values,P=f.left.value),!M||P===null)return;let ee=0,Z=0;for(let D of M){let q=!1;if(f.operator==="==="?q=D===P:f.operator==="!=="?q=D!==P:f.operator===">"?q=D>P:f.operator===">="?q=D>=P:f.operator==="<"?q=D<P:f.operator==="<="&&(q=D<=P),q?ee++:Z++,ee>0&&Z>0)return}ee>0&&Z===0?e.report({node:f,messageId:"unnecessaryLengthCondition"}):Z>0&&ee===0&&e.report({node:f,messageId:"alwaysFalseLengthCondition"})}function T(f){if(f.type===ue.Literal&&typeof f.value=="string")return f.value;let x=p(f);if(!x||x.length!==1)return null;let[E]=x;return E??null}function b(f){return(f.flags&H.TypeFlags.Intersection)!==0}function C(f){return(f.flags&H.TypeFlags.Object)!==0}function w(f){return!n||n.getIndexTypeOfType(f,H.IndexKind.String)?!0:!!n.getIndexTypeOfType(f,H.IndexKind.Number)}function N(f,x){if(!n||w(f)||f.getProperties().length===0)return"unknown";let E=n.getPropertyOfType(f,x);return E?E.flags&H.SymbolFlags.Optional?"optional":"required":"absent"}function k(f,x){if(f.flags&H.TypeFlags.Any||f.flags&H.TypeFlags.Unknown||f.flags&H.TypeFlags.Never||f.flags&H.TypeFlags.TypeParameter||f.flags&H.TypeFlags.IndexedAccess||f.flags&H.TypeFlags.StringLike||f.flags&H.TypeFlags.NumberLike||f.flags&H.TypeFlags.BigIntLike||f.flags&H.TypeFlags.BooleanLike||f.flags&H.TypeFlags.EnumLike||f.flags&H.TypeFlags.ESSymbolLike||f.flags&H.TypeFlags.NonPrimitive||f.flags&H.TypeFlags.Null||f.flags&H.TypeFlags.Undefined||f.flags&H.TypeFlags.Void)return"unknown";if(f.isUnion()){let E=!0,F=!0;for(let R of f.types){let M=k(R,x);if(M==="unknown"||(M!=="required"&&(E=!1),M!=="absent"&&(F=!1),M==="optional"))return"unknown"}return E?"required":F?"absent":"unknown"}if(b(f)){let E=f,F=!1,R=!1;for(let M of E.types){let P=k(M,x);if(P==="unknown")return"unknown";P==="required"?F=!0:P==="optional"&&(R=!0)}return F?"required":R?"optional":"absent"}return C(f)?N(f,x):"unknown"}function O(f){if(f.operator!=="in"||f.left.type===ue.PrivateIdentifier)return;let x=T(f.left);if(!x)return;let E=f.right,F=r.esTreeNodeToTSNodeMap.get(E);if(!n)return;let R=n.getTypeAtLocation(F),M=k(R,x);M==="required"?e.report({node:f,messageId:"unnecessaryInCondition",data:{property:x,type:n.typeToString(R),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}}):M==="absent"&&e.report({node:f,messageId:"alwaysFalseInCondition",data:{property:x,type:n.typeToString(R),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}})}return{BinaryExpression(f){a(f),A(f),O(f)},CallExpression(f){I(f),S(f)}}}})};function bt(e){return Array.from(new Set(e)).join(" | ")||"never"}function st(e,t){let r=e.argument;return r.type===ue.Identifier?r.name:t.sourceCode.getText(r)}function ss(e,t){return t.has(e)}import{AST_NODE_TYPES as xt}from"@typescript-eslint/utils";import{z as ot}from"zod/v4";var os=ot.object({functions:ot.array(ot.string().or(ot.object({name:ot.string(),message:ot.string()})))});function as(e){if(e.type===xt.Identifier)return e.name;if(e.type===xt.MemberExpression&&e.property.type===xt.Identifier&&e.object.type===xt.Identifier)return`${e.object.name}.${e.property.name}`}var Jt=z({name:"no-call-with-explicit-generics",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)",noExplicitGenericsCustom:"{{ message }}"},schema:[_(os)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map,n=new Map;for(let o of t.functions){let i=typeof o=="string"?o:o.name,a=typeof o=="string"?void 0:o.message;i.startsWith("*.")?n.set(i.slice(2),a):r.set(i,a)}function s(o){if(r.has(o))return{message:r.get(o)};let i=o.indexOf(".");if(i!==-1){let a=o.slice(i+1);if(n.has(a))return{message:n.get(a)}}}return{CallExpression(o){let i=as(o.callee);if(!i||!o.typeArguments)return;let a=s(i);a&&(a.message?e.report({node:o,messageId:"noExplicitGenericsCustom",data:{message:a.message}}):e.report({node:o,messageId:"noExplicitGenerics",data:{functionName:i}}))}}}});import{AST_NODE_TYPES as Ve,ESLintUtils as ls}from"@typescript-eslint/utils";var ps=ls.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Er="no-call-with-inferred-generics",cs=ps({name:Er,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",typeOfUsedInGenerics:"Function '{{ functionName }}' should not be called with 'typeof' in generics",unknownUsedInGenerics:"Function '{{ functionName }}' should not be called with 'unknown' 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"}},disallowTypeOf:{type:"boolean"},disallowUnknown:{type:"boolean"}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(o=>[o.name,o])),n=t.functions.some(o=>o.disallowTypeOf),s=new Set;return{...n&&{TSTypeAliasDeclaration(o){o.typeAnnotation.type===Ve.TSTypeQuery&&s.add(o.id.name)}},CallExpression(o){let{callee:i}=o;if(i.type!==Ve.Identifier)return;let a=r.get(i.name);if(!a)return;let{minGenerics:l=1,allowAny:p,disallowTypes:m=t.disallowTypes,disallowTypeOf:y,disallowUnknown:u}=a;(o.typeArguments?.params.length||0)<(l||0)&&e.report({node:o,messageId:"missingGenericDeclaration",data:{functionName:i.name,minGenerics:l||0}}),!(p&&!m)&&(o.typeArguments?.params.some(c=>!p&&c.type===Ve.TSAnyKeyword||m&&c.type===Ve.TSTypeReference&&c.typeName.type===Ve.Identifier&&m.includes(c.typeName.name))&&e.report({node:o,messageId:"anyUsedInGenerics",data:{functionName:i.name}}),u&&o.typeArguments?.params.some(c=>c.type===Ve.TSUnknownKeyword)&&e.report({node:o,messageId:"unknownUsedInGenerics",data:{functionName:i.name}}),y&&o.typeArguments?.params.some(c=>c.type===Ve.TSTypeQuery||c.type===Ve.TSTypeReference&&c.typeName.type===Ve.Identifier&&s.has(c.typeName.name))&&e.report({node:o,messageId:"typeOfUsedInGenerics",data:{functionName:i.name}}))}}}}),Xt={name:Er,rule:cs};import{ESLintUtils as us}from"@typescript-eslint/utils";var fs=us.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),xr="no-commented-out-code",ms=["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:"],ys=/^\s*return\s+/,ds=/\w=("|'|`)/,gs=/\w+:\s*('|"|`)/,Ss=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,Ts=/\w+-\w+:/,Es=/\w+_\w+:/,hs=/\?\s+\w/,bs=/:\s+\w/,xs=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,Cs=/^\s*\d+[,}]/,Is=/^\s*\[[^\]]*\][,}]/,As=/^\s*\{[^}]*\}[,}]/,ws=/\.\w+\(/,Fs=/\[\w+\]/,vs=/^\s*(['"`]).+?\1\s*:/,Rs=/^<[A-Z]\w*(\s|>|\/)/,Ns=/^<[a-z]+(\s|>|\/)/,ks=/<[A-Z]\w*(\s.*)?>/,Ps=/<\/[A-Z]\w*>/,Os=/<[a-z]+(\s.*)?>/,Ds=/<\/[a-z]+>/,Ls=/^\s*[*\s]*$/,js=/^[a-zA-Z]/,Ms=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,$s=/^[a-z][A-Za-z0-9_-]*:\s+[A-Za-z][\w'-]*(?:\s+[A-Za-z][\w'-]*){2,}/,_s=/```[\s\S]*?```/g,Us=/`[^`]*`/g,hr=/[a-zA-Z0-9]/,zs=/\.[A-Za-z_][A-Za-z0-9_]*\(/,Vs=/[{}[\]()`=<>]/,Ws=/:\s*(['"`[{(]|\w+\s*=>)/,Js=/\bif\s*\(|\belse\b|=>/,me={returnStatement:ys,stringAssignment:ds,objectPropertyWithQuotes:gs,computedPropertyAssignment:Ss,kebabCaseProperty:Ts,snakeCaseProperty:Es,ternaryOperator:hs,colonWithWord:bs,quotedString:xs,numberWithComma:Cs,arrayWithComma:Is,objectWithComma:As,methodCall:ws,arrayAccess:Fs,quotedPropertyKey:vs,jsxSelfClosing:Rs,jsxElement:Ns,jsxOpeningTag:ks,jsxClosingTag:Ps,htmlOpeningTag:Os,htmlClosingTag:Ds,jsdocComment:Ls};function Xs(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&js.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||zs.test(t)||Vs.test(t)||Ws.test(t)||Js.test(t)?!1:!!(t.includes(":")&&(Ms.test(t)||$s.test(t)))}var Bs=[") {","return;",me.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",me.stringAssignment,");",me.objectPropertyWithQuotes,me.computedPropertyAssignment,me.kebabCaseProperty,me.snakeCaseProperty,"&&","||","()",me.ternaryOperator,me.colonWithWord,me.quotedString,me.numberWithComma,me.arrayWithComma,me.objectWithComma,me.methodCall,me.arrayAccess,"?.(","??","=>",me.quotedPropertyKey],Hs=["/>","</",me.jsxSelfClosing,me.jsxElement,me.jsxOpeningTag,me.jsxClosingTag,me.htmlOpeningTag,me.htmlClosingTag],br=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint","cspell:","spell-checker:"],Ys=fs({name:xr,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function 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")||me.jsdocComment.test(n))return!1;for(let i of br)if(o.startsWith(i))return!1;if(n.includes("https://")||Xs(o))return!1;if(s==="Block"){for(let i of Hs)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 ms)if(o.startsWith(i))return{wrongPattern:i};for(let i of Bs)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 p=o.split(_s);p.some(y=>hr.test(y))&&(o=p.join(""))}if(!o.includes("`"))return o;let a=o.split(Us);return a.some(p=>hr.test(p))?a.join(""):o}return{Program(){let s=e.sourceCode.getAllComments();for(let o of s){let i=r(o.value,o.type),a=t(i,o.type);a&&e.report({node:o,messageId:"commentedOutCode",data:{wrongPattern:a.wrongPattern,allowedPrefixes:br.join(", ")}})}}}}}),Bt={name:xr,rule:Ys};import{ESLintUtils as qs,TSESTree as Zs}from"@typescript-eslint/utils";var Gs=qs.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cr="no-default-export",Ks=Gs({name:Cr,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let r of t.specifiers)r.exported.type===Zs.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),Ht={name:Cr,rule:Ks};import{ESLintUtils as Qs}from"@typescript-eslint/utils";var eo=Qs.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ir="no-leaked-text-in-jsx",to=[",",";","[","]","(",")"],no=eo({name:Ir,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="";to.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),Yt={name:Ir,rule:no};import{AST_NODE_TYPES as ft,ESLintUtils as ro}from"@typescript-eslint/utils";var io=ro.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),wr="no-non-camel-case-functions",so=/^(\$?[a-z][a-zA-Z0-9]*)$/;function Ar(e){if(e.typeName.type!==ft.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===ft.Identifier&&t.name==="JSX"&&r.name==="Element"}var oo=io({name:wr,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&&!so.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===ft.TSTypeReference?Ar(r):r.type===ft.TSUnionType&&r.types.some(s=>s.type===ft.TSTypeReference&&Ar(s))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),qt={name:wr,rule:oo};import{ESLintUtils as ao,TSESTree as le}from"@typescript-eslint/utils";var lo=ao.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Fr="no-optional-root-props",po=lo({name:Fr,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 a of zt(i.identifier)){if("returnType"in a||a.type===le.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=a.parent;if(!l)return!1;if(l.type===le.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===le.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===le.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let m=it(l.parent.parent,le.AST_NODE_TYPES.VariableDeclaration,4);if(!m)return!1;let y=Ct(m,e.sourceCode);return y?!(y.parent.type===le.AST_NODE_TYPES.CallExpression&&y.parent.callee.type===le.AST_NODE_TYPES.Identifier&&y.parent.callee.name==="memo"):!1}if(a.type===le.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===le.AST_NODE_TYPES.ArrowFunctionExpression){let p=it(l,le.AST_NODE_TYPES.VariableDeclaration);return p?!!Ct(p,e.sourceCode):!1}if(l.type===le.AST_NODE_TYPES.FunctionDeclaration)return!!Ct(l,e.sourceCode)}return!1}function r(n){n.key.type!==le.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=it(n,le.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===le.AST_NODE_TYPES.TSTypeLiteral&&!(It(n)||!t(n)))for(let s of n.typeAnnotation.members)s.type===le.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSInterfaceDeclaration(n){if(!(It(n)||!t(n)))for(let s of n.body.body)s.type===le.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSTypeReference(n){if(n.typeName.type!==le.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let s=n.typeArguments.params[0];if(s.type!==le.AST_NODE_TYPES.TSTypeLiteral)return;let o=it(n.parent,le.AST_NODE_TYPES.VariableDeclaration,4);if(!o)return;let i=Ct(o,e.sourceCode);if(!(!i||i.parent.type===le.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===le.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of s.members)l.type===le.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function It(e){return e?e.parent?.type===le.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===le.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Ct(e,t){if(It(e))return;let r;if(e.type===le.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===le.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===le.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])&&!It(o[0].identifier.parent.parent))return o[0].identifier}var Zt={name:Fr,rule:po};import{AST_NODE_TYPES as Ge}from"@typescript-eslint/utils";var mt=z({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(s){return s?s.type===Ge.Identifier?t.has(s.name):s.type===Ge.MemberExpression?r(s.object):!1:!1}function n(s){return s.type!==Ge.TSTypeReference||s.typeArguments?!1:s.typeName.type===Ge.Identifier&&t.has(s.typeName.name)}return{ImportDeclaration(s){for(let o of s.specifiers)t.add(o.local.name)},ExportNamedDeclaration(s){if(s.source){e.report({node:s,messageId:"noReexport"});return}if(s.declaration?.type===Ge.VariableDeclaration)for(let o of s.declaration.declarations)r(o.init)&&e.report({node:s,messageId:"noReexport"});s.declaration?.type===Ge.TSTypeAliasDeclaration&&n(s.declaration.typeAnnotation)&&e.report({node:s,messageId:"noReexport"}),s.specifiers.length>0&&e.report({node:s,messageId:"noReexport"})},ExportDefaultDeclaration(s){s.declaration.type===Ge.Identifier&&t.has(s.declaration.name)&&e.report({node:s,messageId:"noReexport"})},ExportAllDeclaration(s){e.report({node:s,messageId:"noReexport"})}}}});import{ESLintUtils as co}from"@typescript-eslint/utils";import Gt from"path";import{z as Ye}from"zod/v4";var uo=co.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),vr="no-relative-imports",fo=Ye.object({find:Ye.string(),replacement:Ye.string()}),mo=Ye.object({aliases:Ye.array(fo),rootDir:Ye.string().optional(),allowNotFoundAliases:Ye.boolean().optional(),_dev_simulateFileName:Ye.string().optional()}),yo=uo({name:vr,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:[_(mo)]},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,a){let l=Gt.dirname(a);return Gt.resolve(l,i)}function o(i){let a=t.rootDir??process.cwd(),l=Gt.relative(a,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:m}of t.aliases)if(l.startsWith(m)){let y=l.replace(m,p);return{alias:p,newPath:y}}return null}return{ImportDeclaration(i){let a=i.source.value;if(!n(a))return;let l=s(a,r),p=o(l);!p&&t.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?m=>m.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),Kt={name:vr,rule:yo};import{AST_NODE_TYPES as ye}from"@typescript-eslint/utils";import{z as Rr}from"zod/v4";var go=Rr.object({customMessage:Rr.string().optional()}),Qt=z({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[_(go)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case ye.Literal:return!0;case ye.ObjectExpression:return n.properties.every(s=>s.type===ye.Property?s.computed||s.value.type===ye.Identifier&&s.key.type===ye.Identifier&&s.key.name===s.value.name?!1:r(s.value):!1);case ye.ArrayExpression:return n.elements.every(s=>s?s.type===ye.SpreadElement?!1:r(s):!0);case ye.TemplateLiteral:return n.expressions.length===0;case ye.ConditionalExpression:case ye.LogicalExpression:case ye.BinaryExpression:case ye.UnaryExpression:case ye.CallExpression:case ye.MemberExpression:case ye.Identifier:case ye.ArrowFunctionExpression:case ye.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===ye.JSXIdentifier&&n.name.name==="style"&&n.value){let s=null;n.value.type===ye.JSXExpressionContainer?n.value.expression.type!==ye.JSXEmptyExpression&&(s=n.value.expression):n.value.type===ye.Literal&&(s=n.value),s&&r(s)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});import{AST_NODE_TYPES as At}from"@typescript-eslint/utils";import*as Ke from"zod/v4";var So=Ke.object({alternativeMsgs:Ke.object({inArrayFind:Ke.string().optional(),inArrayFilter:Ke.string().optional()}).optional(),__dev_simulateFileName:Ke.string().optional()});function To(e){return e.typeAnnotation.type!==At.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var Eo=/(typeGuards|type-guards)\.(ts|tsx)$/;function ho(e){return Eo.test(e)}function bo(e){let t=e.parent;for(;t;){if(t.type===At.CallExpression&&t.callee.type===At.MemberExpression&&t.callee.property.type===At.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var en=z({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:[_(So)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(ho(r))return{};function n(s){if(!To(s))return;let o=bo(s);if(t.alternativeMsgs&&o){let i=o.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let a=o.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:s,messageId:a,data:{message:i}});return}}e.report({node:s,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});import{AST_NODE_TYPES as at}from"@typescript-eslint/utils";var xo="no-unnecessary-async-on-jsx-props";function Co(e){if(e.body.type!==at.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let r=t[0];return!r||r.type!==at.ExpressionStatement?!1:r.expression.type===at.AwaitExpression}var tn=z({name:xo,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){Co(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let s=e.sourceCode,o=[],i=s.getFirstToken(r,l=>l.value==="async");if(i){let l=s.getTokenAfter(i);l?o.push(n.replaceTextRange([i.range[0],l.range[0]],"")):o.push(n.remove(i))}function a(l){if(l.type===at.AwaitExpression){let p=s.getFirstToken(l);if(p&&p.value==="await"){let m=s.getTokenAfter(p);m?o.push(n.replaceTextRange([p.range[0],m.range[0]],"")):o.push(n.remove(p))}}if(l.type===at.BlockStatement)for(let p of l.body)a(p);else l.type===at.ExpressionStatement&&a(l.expression)}return a(r.body),o}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});import{AST_NODE_TYPES as yt,ESLintUtils as kr}from"@typescript-eslint/utils";import*as nn from"typescript";import dt from"zod/v4";var Io=kr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nr="no-unnecessary-casting",Ao=dt.object({additionalCastFunctions:dt.array(dt.object({name:dt.string(),expectedType:dt.enum(["string","number"])})).optional()}),rn={name:Nr,rule:Io({name:Nr,meta:{type:"suggestion",docs:{description:"Prevents unnecessary Number and String castings"},deprecated:{message:"Use the strict-casting rule instead"},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:[_(Ao)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],s=kr.getParserServices(e,!0),o=s.program?.getTypeChecker();if(!o||!s.program)throw new Error("TypeScript services or program not available");function i(m,y){switch(m.type){case yt.Literal:return y==="number"?typeof m.value=="number":typeof m.value=="string";case yt.TemplateLiteral:return y==="string";case yt.UnaryExpression:return y==="number"?m.operator==="+"||m.operator==="-"||m.operator==="~":!1;default:return!1}}function a(m,y){return y==="number"?!!(m.flags&nn.TypeFlags.NumberLike):!!(m.flags&nn.TypeFlags.StringLike)}function l(m,y){return u=>u.replaceText(m,e.sourceCode.getText(y))}function p(m){if(!o||m.arguments.length!==1)return;let y=m.arguments[0];if(!y||y.type===yt.SpreadElement)return;let{callee:u}=m;if(u.type!==yt.Identifier)return;let d=u.name,c=n.find(h=>h.name===d);if(!c)return;if(i(y,c.expectedType)||a(o.getTypeAtLocation(s.esTreeNodeToTSNodeMap.get(y)),c.expectedType)){let h,S;d==="Number"?h="unnecessaryNumberCasting":d==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",S={name:c.name,type:c.expectedType}),e.report({node:m,messageId:h,...S?{data:S}:{},fix:l(m,y)})}}return{CallExpression:p}}})};import{AST_NODE_TYPES as Ne}from"@typescript-eslint/utils";import*as wt from"zod/v4";var wo=wt.object({ignoreWithDescription:wt.string().optional()}),sn=z({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:[_(wo)]},defaultOptions:[{}],create(e,[t]){let r=e.getSourceCode(),n=r.ast;function s(l){let p=l.arguments[0];return p&&p.type===Ne.Literal&&typeof p.value=="string"?p.value:null}function o(l){return!l||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(l)}function i(l){return l.length!==1?!1:n.body.filter(m=>{if(m.type===Ne.ExpressionStatement){let y=m.expression;if(y.type===Ne.CallExpression&&y.callee.type===Ne.Identifier){let u=y.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(u)}}return!1}).length===0}function a(l){let p=l.arguments[1];if(p&&(p.type===Ne.FunctionExpression||p.type===Ne.ArrowFunctionExpression)&&p.body.type===Ne.BlockStatement){let m=p.body.body;return m.length===0?"":m.map(u=>r.text.slice(u.range[0],u.range[1])).join(`
15
+ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let w=l.acquire(I),N=new Set,k=null;{let v=w.upper;for(;v&&(N.add(v),v.type!=="function");)v=v.upper;if(!v)return;k=v}let O=Array.isArray;function f(v){if(!O(v.defs))return!1;let L=v.defs[0];if(L==null||L.node.type!=="VariableDeclarator")return!1;let J=L.node.init;if(J==null)return!1;for(;J.type==="TSAsExpression";)J=J.expression;let X=L.node.parent;if(X==null&&(Ut(k.block,L.node.id),X=L.node.parent,X==null))return!1;if(X.kind==="const"&&J.type==="Literal"&&(typeof J.value=="string"||typeof J.value=="number"||J.value===null))return!0;if(J.type!=="CallExpression")return!1;let Y=J.callee;if(Y.type==="MemberExpression"&&Y.object.name==="React"&&Y.property!=null&&!Y.computed&&(Y=Y.property),Y.type!=="Identifier")return!1;let W=L.node.id,{name:G}=Y;if(G==="useRef"&&W.type==="Identifier")return!0;if(Qi(Y)&&W.type==="Identifier"){for(let Q of v.references)Q!==W&&d.add(Q.identifier);return!0}else if(G==="useState"||G==="useReducer"){if(W.type==="ArrayPattern"&&W.elements.length===2&&O(v.identifiers)){if(W.elements[1]===v.identifiers[0]){if(G==="useState"){let Q=v.references,Fe=0;for(let Ue=0;Ue<Q.length;Ue++){if(Q[Ue].isWrite()&&Fe++,Fe>1)return!1;p.set(Q[Ue].identifier,W.elements[0])}}return!0}else if(W.elements[0]===v.identifiers[0]){if(G==="useState"){let Q=v.references;for(let Fe=0;Fe<Q.length;Fe++)m.add(Q[Fe].identifier)}return!1}}}else if(G==="useTransition"&&W.type==="ArrayPattern"&&W.elements.length===2&&Array.isArray(v.identifiers)&&W.elements[1]===v.identifiers[0])return!0;return!1}function x(v){if(!O(v.defs))return!1;let L=v.defs[0];if(L==null||L.node==null||L.node.id==null)return!1;let J=L.node,X=k.childScopes,Y=null,W;for(W=0;W<X.length;W++){let G=X[W],Q=G.block;if(J.type==="FunctionDeclaration"&&Q===J||J.type==="VariableDeclarator"&&Q.parent===J){Y=G;break}}if(Y==null)return!1;for(W=0;W<Y.through.length;W++){let G=Y.through[W];if(G.resolved!=null&&N.has(G.resolved.scope)&&!E(G.resolved))return!1}return!0}let E=c(f,y),F=c(x,u),R=new Map;function M(v){let L=v.from,J=!1;for(;L.block!==I;)L.type==="function"&&(J=L.block.parent!=null&&L.block.parent.type==="ReturnStatement"),L=L.upper;return J}let P=new Map,ee=new Map;Z(w);function Z(v){for(let L of v.references){if(!L.resolved||!N.has(L.resolved.scope))continue;let J=Ut(I,L.identifier),X=pr(J),Y=ze(X,ee);if(C&&X.type==="Identifier"&&(X.parent.type==="MemberExpression"||X.parent.type==="OptionalMemberExpression")&&!X.parent.computed&&X.parent.property.type==="Identifier"&&X.parent.property.name==="current"&&M(L)&&R.set(Y,{reference:L,dependencyNode:X}),X.parent.type==="TSTypeQuery"||X.parent.type==="TSTypeReference")continue;let W=L.resolved.defs[0];if(W!=null&&!(W.node!=null&&W.node.init===I.parent)&&W.type!=="TypeParameter")if(P.has(Y))P.get(Y).references.push(L);else{let G=L.resolved,Q=E(G)||F(G);P.set(Y,{isStable:Q,references:[L]})}}for(let L of v.childScopes)Z(L)}R.forEach(({reference:v,dependencyNode:L},J)=>{let X=v.resolved.references,Y=!1;for(let W=0;W<X.length;W++){let{identifier:G}=X[W],{parent:Q}=G;if(Q!=null&&Q.type==="MemberExpression"&&!Q.computed&&Q.property.type==="Identifier"&&Q.property.name==="current"&&Q.parent.type==="AssignmentExpression"&&Q.parent.left===Q){Y=!0;break}}Y||a({node:L.parent.property,message:`The ref value '${J}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${J}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let D=new Set;function q(v,L){D.has(L)||(D.add(L),a({node:v,message:`Assignments to the '${L}' variable from inside React Hook ${r(T)} 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(T)}.`}))}let B=new Set;if(P.forEach(({isStable:v,references:L},J)=>{v&&B.add(J),L.forEach(X=>{X.writeExpr&&q(X.writeExpr,J)})}),D.size>0)return;if(!A){let v=null;if(P.forEach(({isStable:L,references:J},X)=>{v||J.forEach(Y=>{if(v)return;let W=Y.identifier;if(!p.has(W))return;let Q=Y.from;for(;Q.type!=="function";)Q=Q.upper;Q.block===I&&(v=X)})}),v){let{suggestedDependencies:L}=$t({dependencies:P,declaredDependencies:[],stableDependencies:B,externalDependencies:new Set,isEffect:!0});a({node:T,message:`React Hook ${b} contains a call to '${v}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+L.join(", ")+`] as a second argument to the ${b} Hook.`,suggest:[{desc:`Add dependencies array: [${L.join(", ")}]`,fix(J){return J.insertTextAfter(I,`, [${L.join(", ")}]`)}}]})}return}let ae=[],fe=new Set;A.type!=="ArrayExpression"?a({node:A,message:`React Hook ${r(T)} 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.`}):A.elements.forEach(v=>{if(v===null)return;if(v.type==="SpreadElement"){a({node:v,message:`React Hook ${r(T)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}d.has(v)&&a({node:v,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(v)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(v)}\``,fix(Y){return Y.removeRange(v.range)}}]});let L;try{L=ze(v,ee)}catch(Y){if(/Unsupported node type/.test(Y.message)){v.type==="Literal"?P.has(v.value)?a({node:v,message:`The ${v.raw} literal is not a valid dependency because it never changes. Did you mean to include ${v.value} in the array instead?`}):a({node:v,message:`The ${v.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):a({node:v,message:`React Hook ${r(T)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw Y}let J=v;for(;J.type==="MemberExpression"||J.type==="OptionalMemberExpression"||J.type==="ChainExpression";)J=J.object||J.expression.object;let X=!k.through.some(Y=>Y.identifier===J);ae.push({key:L,node:v}),X||fe.add(L)});let{suggestedDependencies:Re,unnecessaryDependencies:Be,missingDependencies:Ee,duplicateDependencies:ut}=$t({dependencies:P,declaredDependencies:ae,stableDependencies:B,externalDependencies:fe,isEffect:C}),rt=Re;if(ut.size+Ee.size+Be.size===0){let v=or(T),L=v&&sr(v);if(t&&!L)return;qi({declaredDependencies:ae,declaredDependenciesNode:A,componentScope:k,scope:w}).forEach(({construction:X,isUsedOutsideOfHook:Y,depType:W})=>{let G=W==="function"?"useCallback":"useMemo",Q=W==="function"?"definition":"initialization",Fe=`wrap the ${Q} of '${X.name.name}' in its own ${G}() Hook.`,Ue=Y?`To fix this, ${Fe}`:`Move it inside the ${b} callback. Alternatively, ${Fe}`,Li=W==="conditional"||W==="logical expression"?"could make":"makes",ji=`The '${X.name.name}' ${W} ${Li} the dependencies of ${b} Hook (at line ${A.loc.start.line}) change on every render. ${Ue}`,Gn;Y&&X.type==="Variable"&&W==="function"&&(Gn=[{desc:`Wrap the ${Q} of '${X.name.name}' in its own ${G}() Hook.`,fix(Kn){let[Mi,$i]=G==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Kn.insertTextBefore(X.node.init,Mi),Kn.insertTextAfter(X.node.init,$i)]}}]),a({node:X.node,message:ji,suggest:Gn})});return}!C&&Ee.size>0&&(rt=$t({dependencies:P,declaredDependencies:[],stableDependencies:B,externalDependencies:fe,isEffect:C}).suggestedDependencies);function Ce(){if(ae.length===0)return!0;let v=ae.map(J=>J.key),L=v.slice().sort();return v.join(",")===L.join(",")}Ce()&&rt.sort();function Ae(v){let L=v.split("."),J="";for(let X=0;X<L.length;X++){if(X!==0){let Y=L.slice(0,X+1).join("."),W=ee.get(Y)===!0;J+=W?"?.":"."}J+=L[X]}return J}function Dt(v,L,J,X){return v.size===0?null:(v.size>1?"":L+" ")+J+" "+(v.size>1?"dependencies":"dependency")+": "+Gi(Array.from(v).sort().map(Y=>"'"+Ae(Y)+"'"))+`. Either ${X} ${v.size>1?"them":"it"} or remove the dependency array.`}let De="";if(Be.size>0){let v=null;if(Array.from(Be.keys()).forEach(L=>{v===null&&L.endsWith(".current")&&(v=L)}),v!==null)De=` Mutable values like '${v}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(fe.size>0){let L=Array.from(fe)[0];w.set.has(L)||(De=` Outer scope values like '${L}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!De&&Ee.has("props")){let v=P.get("props");if(v==null)return;let L=v.references;if(!Array.isArray(L))return;let J=!0;for(let X=0;X<L.length;X++){let Y=L[X],W=Ut(k.block,Y.identifier);if(!W){J=!1;break}let G=W.parent;if(G==null){J=!1;break}if(G.type!=="MemberExpression"&&G.type!=="OptionalMemberExpression"){J=!1;break}}J&&(De=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${b} call and refer to those specific props inside ${r(T)}.`)}if(!De&&Ee.size>0){let v=null;Ee.forEach(L=>{if(v)return;let J=k.set.get(L),X=P.get(L);if(X.references[0].resolved!==J)return;let Y=J.defs[0];if(Y==null||Y.name==null||Y.type!=="Parameter")return;let W=!1,G;for(let Q=0;Q<X.references.length;Q++)if(G=X.references[Q].identifier,G!=null&&G.parent!=null&&(G.parent.type==="CallExpression"||G.parent.type==="OptionalCallExpression")&&G.parent.callee===G){W=!0;break}W&&(v=L)}),v!==null&&(De=` If '${v}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!De&&Ee.size>0){let v=null;if(Ee.forEach(L=>{if(v!==null)return;let X=P.get(L).references,Y,W;for(let G=0;G<X.length;G++){for(Y=X[G].identifier,W=Y.parent;W!=null&&W!==k.block;){if(W.type==="CallExpression"){let Q=p.get(W.callee);if(Q!=null){if(Q.name===L)v={missingDep:L,setter:W.callee.name,form:"updater"};else if(m.has(Y))v={missingDep:L,setter:W.callee.name,form:"reducer"};else{let Fe=X[G].resolved;if(Fe!=null){let Ue=Fe.defs[0];Ue!=null&&Ue.type==="Parameter"&&(v={missingDep:L,setter:W.callee.name,form:"inlineReducer"})}}break}}W=W.parent}if(v!==null)break}}),v!==null)switch(v.form){case"reducer":De=` You can also replace multiple useState variables with useReducer if '${v.setter}' needs the current value of '${v.missingDep}'.`;break;case"inlineReducer":De=` If '${v.setter}' needs the current value of '${v.missingDep}', you can also switch to useReducer instead of useState and read '${v.missingDep}' in the reducer.`;break;case"updater":De=` You can also do a functional update '${v.setter}(${v.missingDep.slice(0,1)} => ...)' if you only need '${v.missingDep}' in the '${v.setter}' call.`;break;default:throw new Error("Unknown case.")}}a({node:A,message:`React Hook ${r(T)} has `+(Dt(Ee,"a","missing","include")||Dt(Be,"an","unnecessary","exclude")||Dt(ut,"a","duplicate","omit"))+De,suggest:[{desc:`Update the dependencies array to be: [${rt.map(Ae).join(", ")}]`,fix(v){return v.replaceText(A,`[${rt.map(Ae).join(", ")}]`)}}]})}function h(I){let A=Zi(I.callee,i);if(A===-1)return;let T=I.arguments[A],b=I.callee,C=cr(b).name,w=I.arguments[A+1],N=/Effect($|[^a-z])/g.test(C);if(!T){a({node:b,message:`React Hook ${C} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(t&&!N){let k=or(b);if(!(k&&sr(k)))return}if(!w&&!N){(C==="useMemo"||C==="useCallback")&&a({node:b,message:`React Hook ${C} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(T.type){case"FunctionExpression":case"ArrowFunctionExpression":g(T,w,b,C,N);return;case"Identifier":if(!w||w.elements&&w.elements.some(f=>f&&f.type==="Identifier"&&f.name===T.name))return;let k=n(I).set.get(T.name);if(k==null||k.defs==null)return;let O=k.defs[0];if(!O||!O.node||O.type!=="Variable"&&O.type!=="FunctionName")break;switch(O.node.type){case"FunctionDeclaration":g(O.node,w,b,C,N);return;case"VariableDeclarator":let f=O.node.init;if(!f)break;switch(f.type){case"ArrowFunctionExpression":case"FunctionExpression":g(f,w,b,C,N);return}break}break;default:a({node:b,message:`React Hook ${C} received a function whose dependencies are unknown. Pass an inline function instead.`});return}a({node:b,message:`React Hook ${C} has a missing dependency: '${T.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${T.name}]`,fix(k){return k.replaceText(w,`[${T.name}]`)}}]})}if(!!e.options[0]?.reactCompilerIsEnabled)return t=!0,{CallExpression:I=>h(I)};if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let I of e.sourceCode.getAllComments())if(Yi.test(I.value))return t=!0,{CallExpression:A=>h(A)}}return{CallExpression:I=>h(I)}}};function $t({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((g,h)=>{let S=a(o,h);S.isUsed=!0,l(o,h,I=>{I.isSubtreeUsed=!0})}),t.forEach(({key:g})=>{let h=a(o,g);h.isSatisfiedRecursively=!0}),r.forEach(g=>{let h=a(o,g);h.isSatisfiedRecursively=!0});function a(g,h){let S=h.split("."),I=g;for(let A of S){let T=I.children.get(A);T||(T=i(),I.children.set(A,T)),I=T}return I}function l(g,h,S){let I=h.split("."),A=g;for(let T of I){let b=A.children.get(T);if(!b)return;S(b),A=b}}let p=new Set,m=new Set;y(o,p,m,g=>g);function y(g,h,S,I){g.children.forEach((A,T)=>{let b=I(T);if(A.isSatisfiedRecursively){A.isSubtreeUsed&&S.add(b);return}if(A.isUsed){h.add(b);return}y(A,h,S,C=>b+"."+C)})}let u=[],d=new Set,c=new Set;return t.forEach(({key:g})=>{m.has(g)?u.indexOf(g)===-1?u.push(g):c.add(g):d.add(g)}),p.forEach(g=>{u.push(g)}),{suggestedDependencies:u,unnecessaryDependencies:d,duplicateDependencies:c,missingDependencies:p}}function He(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 He(e.consequent)!=null||He(e.alternate)!=null?"conditional":null;case"LogicalExpression":return He(e.left)!=null||He(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return He(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return He(e.expression);case"TSAsExpression":return He(e.expression)}return null}function qi({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let s=e.map(({key:i})=>{let a=r.variables.find(p=>p.name===i);if(a==null)return null;let l=a.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let p=He(l.node.init);if(p!=null)return[a,p]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[a,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[a,"class"]:null}).filter(Boolean);function o(i){let a=!1;for(let l=0;l<i.references.length;l++){let p=i.references[l];if(p.writeExpr){if(a)return!0;a=!0;continue}let m=p.from;for(;m!==n&&m!=null;)m=m.upper;if(m!==n&&!ur(t,p.identifier))return!0}return!1}return s.map(([i,a])=>({construction:i.defs[0],depType:a,isUsedOutsideOfHook:o(i)}))}function pr(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)?pr(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function _t(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function ze(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=ze(e.object,t),n=ze(e.property,null),s=`${r}.${n}`;return _t(e,t,s),s}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=ze(e.object,t),n=ze(e.property,null),s=`${r}.${n}`;return _t(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=ze(r.object,t),s=ze(r.property,null),o=`${n}.${s}`;return _t(r,t,o),o}else throw new Error(`Unsupported node type: ${e.type}`)}function cr(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Zi(e,t){let r=cr(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=ze(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 Ut(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),Ki(n,t))return n;if(ur(n,t))for(let[s,o]of Object.entries(n))s!=="parent"&&(ar(o)?(o.parent=n,r.push(o)):Array.isArray(o)&&o.forEach(i=>{ar(i)&&(i.parent=n,r.push(i))}))}return null}function Gi(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 ar(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Ki(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 ur(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function Qi(e){return!1}import{AST_NODE_TYPES as ue,ESLintUtils as Tr}from"@typescript-eslint/utils";import H from"typescript";import{z as dr}from"zod/v4";import{AST_NODE_TYPES as fr}from"@typescript-eslint/utils";function it(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:it(e.parent,t,r===1/0?r:r-1)}function*zt(e){yield e,e.parent&&(yield*zt(e.parent))}function Vt(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function yr(e,t,r){let s=r.getDeclaredVariables(e).find(o=>o.name===t||o.identifiers[0]?.parent.type===fr.Property&&o.identifiers[0].parent.key.type===fr.Identifier&&o.identifiers[0].parent.key.name===t);return s?s.references.filter(o=>!o.init):[]}function mr(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function es(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 l=n[i.type];if(l)for(let p of l){let m=es(i,p);if(m){if(Array.isArray(m)){for(let y of m)if(mr(y)&&o(y))return!0}else if(mr(m)&&o(m))return!0}}return!1}o(e)}var ts=Tr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),gr="improved-no-unnecessary-condition",ns=dr.object({alternativeForInCondition:dr.string().optional().describe("Alternative to appear in the error for `in` condition")}),Sr={object:"Array",property:"isArray"},rs=["string","number","bigint","boolean","symbol","undefined","object","function","never"],is=new Set(rs),Wt={name:gr,rule:ts({name:gr,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".',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.",unnecessaryArrayIsArrayCondition:"This Array.isArray check is unnecessary as it always evaluates to true.",alwaysFalseArrayIsArrayCondition:"This Array.isArray 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.",unnecessaryInCondition:'This in check is unnecessary. Property "{{property}}" always exists on type "{{type}}".{{alternative}}',alwaysFalseInCondition:'This in check will always be false. Property "{{property}}" does not exist on type "{{type}}".{{alternative}}'},schema:[_(ns)]},defaultOptions:[{}],create(e,[t]){let r=Tr.getParserServices(e,!0),n=r.program?.getTypeChecker();if(!n||!r.program)throw new Error("TypeScript services or program not available");function s(f){return f.type===ue.UnaryExpression&&f.operator==="typeof"}function o(f){return f.flags&H.TypeFlags.Any||f.flags&H.TypeFlags.Unknown?null:f.flags&H.TypeFlags.StringLike?["string"]:f.flags&H.TypeFlags.NumberLike?["number"]:f.flags&H.TypeFlags.BigIntLike?["bigint"]:f.flags&H.TypeFlags.BooleanLike?["boolean"]:f.flags&H.TypeFlags.ESSymbolLike?["symbol"]:f.flags&H.TypeFlags.Undefined||f.flags&H.TypeFlags.Void?["undefined"]:f.flags&H.TypeFlags.Null?["object"]:f.getCallSignatures().length>0?["function"]:f.flags&H.TypeFlags.Object?f.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:f.flags&H.TypeFlags.NonPrimitive?["object"]:f.flags&H.TypeFlags.Never?["never"]:null}function i(f){if(!n)return null;let x=r.esTreeNodeToTSNodeMap.get(f),E=n.getTypeAtLocation(x.expression);if(E.flags&H.TypeFlags.Any||E.flags&H.TypeFlags.Unknown)return null;let F=[];if(E.isUnion()){for(let M of E.types){let P=o(M);if(P)F.push(...P);else return null}return F}let R=o(E);return R?(F.push(...R),F):null}function a(f){if(!(f.operator==="==="||f.operator==="!=="))return;let E=null,F=null;if(s(f.left)?(E=f.left,F=f.right.type===ue.Literal&&typeof f.right.value=="string"?f.right.value:null):s(f.right)&&(E=f.right,F=f.left.type===ue.Literal&&typeof f.left.value=="string"?f.left.value:null),!E||!F||!ss(F,is))return;let R=i(E);if(!R)return;let M=f.operator==="!==",P=R.includes(F);R.length===1?P&&!M?e.report({node:f,messageId:"unnecessaryTypeofCondition",data:{name:st(E,e),type:F}}):!P&&M?e.report({node:f,messageId:"unnecessaryTypeofCondition",data:{name:st(E,e),type:Array.from(R)[0]}}):!P&&!M?e.report({node:f,messageId:"alwaysFalseTypeofCondition",data:{name:st(E,e),actualType:bt(R),conditionType:F}}):P&&M&&e.report({node:f,messageId:"alwaysFalseTypeofCondition",data:{name:st(E,e),actualType:bt(R),conditionType:F}}):!P&&!M?e.report({node:f,messageId:"alwaysFalseTypeofCondition",data:{name:st(E,e),actualType:bt(R),conditionType:F}}):!P&&M&&e.report({node:f,messageId:"unnecessaryTypeofCondition",data:{name:st(E,e),type:bt(R)}})}function l(f){if(f.flags&H.TypeFlags.Any||f.flags&H.TypeFlags.Unknown)return null;if(f.isUnion()){let x=[];for(let E of f.types)if(E.flags&H.TypeFlags.StringLiteral){let F=E.value;x.push(F)}else return null;return x}return f.flags&H.TypeFlags.StringLiteral?[f.value]:null}function p(f){if(!n)return null;let x=r.esTreeNodeToTSNodeMap.get(f),E=n.getTypeAtLocation(x),F=l(E);if(F)return F;let R=n.getSymbolAtLocation(x);if(R){let M=n.getTypeOfSymbolAtLocation(R,x),P=l(M);if(P)return P}return null}function m(f){let x=e.sourceCode.ast,E=null;return Le(x,F=>{if(F.type===ue.VariableDeclarator&&F.id.type===ue.Identifier&&F.id.name===f.name&&F.id.typeAnnotation){let R=F.id.typeAnnotation.typeAnnotation;if(R.type===ue.TSUnionType){let M=[];for(let P of R.types)if(P.type===ue.TSLiteralType&&P.literal.type===ue.Literal&&typeof P.literal.value=="string")M.push(P.literal.value);else return!0;return E=M,!0}if(R.type===ue.TSLiteralType&&R.literal.type===ue.Literal&&typeof R.literal.value=="string")return E=[R.literal.value],!0}return!1},e.sourceCode),E}function y(f){return f==="Array"||f==="ReadonlyArray"?!0:f.endsWith(".Array")||f.endsWith(".ReadonlyArray")}function u(f){if(!n)return!1;if(n.isArrayType(f)||n.isTupleType(f))return!0;let x=n.getApparentType(f);if(x!==f&&(n.isArrayType(x)||n.isTupleType(x)))return!0;if(f.aliasSymbol){let F=n.getFullyQualifiedName(f.aliasSymbol);if(y(F))return!0}let E=f.getSymbol();if(E){let F=n.getFullyQualifiedName(E);if(y(F))return!0}return!1}function d(f){return n?f.getProperties().length===0&&n.getIndexInfosOfType(f).length===0&&f.getCallSignatures().length===0&&f.getConstructSignatures().length===0:!1}function c(f){return n?!!(f.flags&H.TypeFlags.StringLike||f.flags&H.TypeFlags.NumberLike||f.flags&H.TypeFlags.BigIntLike||f.flags&H.TypeFlags.BooleanLike||f.flags&H.TypeFlags.ESSymbolLike||f.flags&H.TypeFlags.EnumLike||f.flags&H.TypeFlags.Null||f.flags&H.TypeFlags.Undefined||f.flags&H.TypeFlags.Void||f.flags&H.TypeFlags.Never||f.flags&H.TypeFlags.Object&&!f.isClassOrInterface()&&!u(f)&&!d(f)):!1}function g(f){if(f.flags&H.TypeFlags.Any||f.flags&H.TypeFlags.Unknown)return"unknown";if(f.isUnion()){let x=!0,E=!0;for(let F of f.types){let R=g(F);if(R==="unknown")return"unknown";R!=="alwaysTrue"&&(x=!1),R!=="alwaysFalse"&&(E=!1)}return x?"alwaysTrue":E?"alwaysFalse":"unknown"}return u(f)?"alwaysTrue":c(f)?"alwaysFalse":"unknown"}function h(f){return!f.computed&&f.object.type===ue.Identifier&&f.object.name===Sr.object&&f.property.type===ue.Identifier&&f.property.name===Sr.property}function S(f){if(!n||f.callee.type!==ue.MemberExpression||!h(f.callee)||f.arguments.length===0)return;let[x]=f.arguments;if(!x||x.type===ue.SpreadElement)return;let E=r.esTreeNodeToTSNodeMap.get(x),F=n.getTypeAtLocation(E),R=g(F);R==="alwaysTrue"?e.report({node:f,messageId:"unnecessaryArrayIsArrayCondition"}):R==="alwaysFalse"&&e.report({node:f,messageId:"alwaysFalseArrayIsArrayCondition"})}function I(f){if(f.callee.type!==ue.MemberExpression||f.callee.property.type!==ue.Identifier||f.callee.computed)return;let x=f.callee.property.name;if(x!=="startsWith"&&x!=="endsWith"&&x!=="includes"||f.arguments.length!==1)return;let[E]=f.arguments;if(!E||E.type!==ue.Literal||typeof E.value!="string")return;let F=f.callee.object,R=p(F);if(!R&&F.type===ue.Identifier&&(R=m(F)),!R||R.length===0)return;let M=E.value;if(x==="includes"&&R.length>1)return;let P=0,ee=0;for(let Z of R)if((x==="startsWith"?Z.startsWith(M):x==="endsWith"?Z.endsWith(M):Z.includes(M))?P++:ee++,P>0&&ee>0)return;if(P>0&&ee===0){let Z=x==="startsWith"?"unnecessaryStartsWithCondition":x==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:f,messageId:Z})}else if(ee>0&&P===0){let Z=x==="startsWith"?"alwaysFalseStartsWithCondition":x==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:f,messageId:Z})}}function A(f){if(!new Set(["===","!==",">",">=","<","<="]).has(f.operator))return;function E(D){if(D.type!==ue.MemberExpression||D.computed||D.property.type!==ue.Identifier||D.property.name!=="length")return null;let q=D.object,B=p(q);if(!B||B.length===0)return null;let ae=[];for(let fe of B)ae.push(fe.length);return{values:ae}}let F=E(f.left),R=E(f.right),M=null,P=null;if(F?f.right.type===ue.Literal&&typeof f.right.value=="number"&&(M=F.values,P=f.right.value):R&&f.left.type===ue.Literal&&typeof f.left.value=="number"&&(M=R.values,P=f.left.value),!M||P===null)return;let ee=0,Z=0;for(let D of M){let q=!1;if(f.operator==="==="?q=D===P:f.operator==="!=="?q=D!==P:f.operator===">"?q=D>P:f.operator===">="?q=D>=P:f.operator==="<"?q=D<P:f.operator==="<="&&(q=D<=P),q?ee++:Z++,ee>0&&Z>0)return}ee>0&&Z===0?e.report({node:f,messageId:"unnecessaryLengthCondition"}):Z>0&&ee===0&&e.report({node:f,messageId:"alwaysFalseLengthCondition"})}function T(f){if(f.type===ue.Literal&&typeof f.value=="string")return f.value;let x=p(f);if(!x||x.length!==1)return null;let[E]=x;return E??null}function b(f){return(f.flags&H.TypeFlags.Intersection)!==0}function C(f){return(f.flags&H.TypeFlags.Object)!==0}function w(f){return!n||n.getIndexTypeOfType(f,H.IndexKind.String)?!0:!!n.getIndexTypeOfType(f,H.IndexKind.Number)}function N(f,x){if(!n||w(f)||f.getProperties().length===0)return"unknown";let E=n.getPropertyOfType(f,x);return E?E.flags&H.SymbolFlags.Optional?"optional":"required":"absent"}function k(f,x){if(f.flags&H.TypeFlags.Any||f.flags&H.TypeFlags.Unknown||f.flags&H.TypeFlags.Never||f.flags&H.TypeFlags.TypeParameter||f.flags&H.TypeFlags.IndexedAccess||f.flags&H.TypeFlags.StringLike||f.flags&H.TypeFlags.NumberLike||f.flags&H.TypeFlags.BigIntLike||f.flags&H.TypeFlags.BooleanLike||f.flags&H.TypeFlags.EnumLike||f.flags&H.TypeFlags.ESSymbolLike||f.flags&H.TypeFlags.NonPrimitive||f.flags&H.TypeFlags.Null||f.flags&H.TypeFlags.Undefined||f.flags&H.TypeFlags.Void)return"unknown";if(f.isUnion()){let E=!0,F=!0;for(let R of f.types){let M=k(R,x);if(M==="unknown"||(M!=="required"&&(E=!1),M!=="absent"&&(F=!1),M==="optional"))return"unknown"}return E?"required":F?"absent":"unknown"}if(b(f)){let E=f,F=!1,R=!1;for(let M of E.types){let P=k(M,x);if(P==="unknown")return"unknown";P==="required"?F=!0:P==="optional"&&(R=!0)}return F?"required":R?"optional":"absent"}return C(f)?N(f,x):"unknown"}function O(f){if(f.operator!=="in"||f.left.type===ue.PrivateIdentifier)return;let x=T(f.left);if(!x)return;let E=f.right,F=r.esTreeNodeToTSNodeMap.get(E);if(!n)return;let R=n.getTypeAtLocation(F),M=k(R,x);M==="required"?e.report({node:f,messageId:"unnecessaryInCondition",data:{property:x,type:n.typeToString(R),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}}):M==="absent"&&e.report({node:f,messageId:"alwaysFalseInCondition",data:{property:x,type:n.typeToString(R),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}})}return{BinaryExpression(f){a(f),A(f),O(f)},CallExpression(f){I(f),S(f)}}}})};function bt(e){return Array.from(new Set(e)).join(" | ")||"never"}function st(e,t){let r=e.argument;return r.type===ue.Identifier?r.name:t.sourceCode.getText(r)}function ss(e,t){return t.has(e)}import{AST_NODE_TYPES as xt}from"@typescript-eslint/utils";import{z as ot}from"zod/v4";var os=ot.object({functions:ot.array(ot.string().or(ot.object({name:ot.string(),message:ot.string()})))});function as(e){if(e.type===xt.Identifier)return e.name;if(e.type===xt.MemberExpression&&e.property.type===xt.Identifier&&e.object.type===xt.Identifier)return`${e.object.name}.${e.property.name}`}var Jt=z({name:"no-call-with-explicit-generics",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)",noExplicitGenericsCustom:"{{ message }}"},schema:[_(os)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map,n=new Map;for(let o of t.functions){let i=typeof o=="string"?o:o.name,a=typeof o=="string"?void 0:o.message;i.startsWith("*.")?n.set(i.slice(2),a):r.set(i,a)}function s(o){if(r.has(o))return{message:r.get(o)};let i=o.indexOf(".");if(i!==-1){let a=o.slice(i+1);if(n.has(a))return{message:n.get(a)}}}return{CallExpression(o){let i=as(o.callee);if(!i||!o.typeArguments)return;let a=s(i);a&&(a.message?e.report({node:o,messageId:"noExplicitGenericsCustom",data:{message:a.message}}):e.report({node:o,messageId:"noExplicitGenerics",data:{functionName:i}}))}}}});import{AST_NODE_TYPES as Ve,ESLintUtils as ls}from"@typescript-eslint/utils";var ps=ls.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Er="no-call-with-inferred-generics",cs=ps({name:Er,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",typeOfUsedInGenerics:"Function '{{ functionName }}' should not be called with 'typeof' in generics",unknownUsedInGenerics:"Function '{{ functionName }}' should not be called with 'unknown' 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"}},disallowTypeOf:{type:"boolean"},disallowUnknown:{type:"boolean"}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(o=>[o.name,o])),n=t.functions.some(o=>o.disallowTypeOf),s=new Set;return{...n&&{TSTypeAliasDeclaration(o){o.typeAnnotation.type===Ve.TSTypeQuery&&s.add(o.id.name)}},CallExpression(o){let{callee:i}=o;if(i.type!==Ve.Identifier)return;let a=r.get(i.name);if(!a)return;let{minGenerics:l=1,allowAny:p,disallowTypes:m=t.disallowTypes,disallowTypeOf:y,disallowUnknown:u}=a;(o.typeArguments?.params.length||0)<(l||0)&&e.report({node:o,messageId:"missingGenericDeclaration",data:{functionName:i.name,minGenerics:l||0}}),!(p&&!m)&&(o.typeArguments?.params.some(c=>!p&&c.type===Ve.TSAnyKeyword||m&&c.type===Ve.TSTypeReference&&c.typeName.type===Ve.Identifier&&m.includes(c.typeName.name))&&e.report({node:o,messageId:"anyUsedInGenerics",data:{functionName:i.name}}),u&&o.typeArguments?.params.some(c=>c.type===Ve.TSUnknownKeyword)&&e.report({node:o,messageId:"unknownUsedInGenerics",data:{functionName:i.name}}),y&&o.typeArguments?.params.some(c=>c.type===Ve.TSTypeQuery||c.type===Ve.TSTypeReference&&c.typeName.type===Ve.Identifier&&s.has(c.typeName.name))&&e.report({node:o,messageId:"typeOfUsedInGenerics",data:{functionName:i.name}}))}}}}),Xt={name:Er,rule:cs};import{ESLintUtils as us}from"@typescript-eslint/utils";var fs=us.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),xr="no-commented-out-code",ms=["function ","class ","interface ","enum ","namespace ","import ","export ","const ","let ","var ","return ","throw ","try {","catch (","finally {","async ","await ","case ","switch (","while (","for (","default:"],ys=/^\s*return\s+/,ds=/^\s*type\s+[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*\s*(?:=|<)/u,gs=/^\s*(?:break|continue)(?:;|\s+[A-Za-z_$][\w$]*;?)?\s*$/,Ss=/\w=("|'|`)/,Ts=/\w+:\s*('|"|`)/,Es=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,hs=/\w+-\w+:/,bs=/\w+_\w+:/,xs=/\?\s+\w/,Cs=/:\s+\w/,Is=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,As=/^\s*\d+[,}]/,ws=/^\s*\[[^\]]*\][,}]/,Fs=/^\s*\{[^}]*\}[,}]/,vs=/\.\w+\(/,Rs=/\[\w+\]/,Ns=/^\s*(['"`]).+?\1\s*:/,ks=/^<[A-Z]\w*(\s|>|\/)/,Ps=/^<[a-z]+(\s|>|\/)/,Os=/<[A-Z]\w*(\s.*)?>/,Ds=/<\/[A-Z]\w*>/,Ls=/<[a-z]+(\s.*)?>/,js=/<\/[a-z]+>/,Ms=/^\s*[*\s]*$/,$s=/^[a-zA-Z]/,_s=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,Us=/^[a-z][A-Za-z0-9_/-]*:\s+[A-Za-z][\w'-]*(?:\s+[A-Za-z][\w'-]*){2,}/,zs=/\s\([A-Za-z][\w\s,.'/-]*\)/g,Vs=/```[\s\S]*?```/g,Ws=/`[^`]*`/g,hr=/[a-zA-Z0-9]/,Js=/\.[A-Za-z_][A-Za-z0-9_]*\(/,Xs=/[{}[\]()`=<>]/,Bs=/:\s*(['"`[{(]|\w+\s*=>)/,Hs=/\bif\s*\(|\belse\b|=>/,me={returnStatement:ys,typeAliasDeclaration:ds,stringAssignment:Ss,objectPropertyWithQuotes:Ts,computedPropertyAssignment:Es,kebabCaseProperty:hs,snakeCaseProperty:bs,ternaryOperator:xs,colonWithWord:Cs,quotedString:Is,numberWithComma:As,arrayWithComma:ws,objectWithComma:Fs,methodCall:vs,arrayAccess:Rs,quotedPropertyKey:Ns,jsxSelfClosing:ks,jsxElement:Ps,jsxOpeningTag:Os,jsxClosingTag:Ds,htmlOpeningTag:Ls,htmlClosingTag:js,jsdocComment:Ms};function Ys(e){if(e.includes(":")){let n=e.split(":")[0]?.trim();if(n&&$s.test(n)&&n.includes(" "))return!0}let t=e.trim();if(t.length===0||Js.test(t))return!1;let r=t.includes("(")?t.replace(zs,""):t;return Xs.test(r)||Bs.test(t)||Hs.test(t)?!1:!!(t.includes(":")&&(_s.test(t)||Us.test(t)))}var qs=[") {","return;",me.returnStatement,me.typeAliasDeclaration,gs,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",me.stringAssignment,");",me.objectPropertyWithQuotes,me.computedPropertyAssignment,me.kebabCaseProperty,me.snakeCaseProperty,"&&","||","()",me.ternaryOperator,me.colonWithWord,me.quotedString,me.numberWithComma,me.arrayWithComma,me.objectWithComma,me.methodCall,me.arrayAccess,"?.(","??","=>",me.quotedPropertyKey],Zs=["/>","</",me.jsxSelfClosing,me.jsxElement,me.jsxOpeningTag,me.jsxClosingTag,me.htmlOpeningTag,me.htmlClosingTag],br=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint","cspell:","spell-checker:"],Gs=fs({name:xr,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function 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")||me.jsdocComment.test(n))return!1;for(let i of br)if(o.startsWith(i))return!1;if(n.includes("https://")||Ys(o))return!1;if(s==="Block"){for(let i of Zs)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 ms)if(o.startsWith(i))return{wrongPattern:i};for(let i of qs)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 p=o.split(Vs);p.some(y=>hr.test(y))&&(o=p.join(""))}if(!o.includes("`"))return o;let a=o.split(Ws);return a.some(p=>hr.test(p))?a.join(""):o}return{Program(){let s=e.sourceCode.getAllComments();for(let o of s){let i=r(o.value,o.type),a=t(i,o.type);a&&e.report({node:o,messageId:"commentedOutCode",data:{wrongPattern:a.wrongPattern,allowedPrefixes:br.join(", ")}})}}}}}),Bt={name:xr,rule:Gs};import{ESLintUtils as Ks,TSESTree as Qs}from"@typescript-eslint/utils";var eo=Ks.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cr="no-default-export",to=eo({name:Cr,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let r of t.specifiers)r.exported.type===Qs.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),Ht={name:Cr,rule:to};import{ESLintUtils as no}from"@typescript-eslint/utils";var ro=no.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ir="no-leaked-text-in-jsx",io=[",",";","[","]","(",")"],so=ro({name:Ir,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="";io.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),Yt={name:Ir,rule:so};import{AST_NODE_TYPES as ft,ESLintUtils as oo}from"@typescript-eslint/utils";var ao=oo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),wr="no-non-camel-case-functions",lo=/^(\$?[a-z][a-zA-Z0-9]*)$/;function Ar(e){if(e.typeName.type!==ft.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===ft.Identifier&&t.name==="JSX"&&r.name==="Element"}var po=ao({name:wr,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&&!lo.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===ft.TSTypeReference?Ar(r):r.type===ft.TSUnionType&&r.types.some(s=>s.type===ft.TSTypeReference&&Ar(s))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),qt={name:wr,rule:po};import{ESLintUtils as co,TSESTree as le}from"@typescript-eslint/utils";var uo=co.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Fr="no-optional-root-props",fo=uo({name:Fr,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 a of zt(i.identifier)){if("returnType"in a||a.type===le.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=a.parent;if(!l)return!1;if(l.type===le.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===le.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===le.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let m=it(l.parent.parent,le.AST_NODE_TYPES.VariableDeclaration,4);if(!m)return!1;let y=Ct(m,e.sourceCode);return y?!(y.parent.type===le.AST_NODE_TYPES.CallExpression&&y.parent.callee.type===le.AST_NODE_TYPES.Identifier&&y.parent.callee.name==="memo"):!1}if(a.type===le.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===le.AST_NODE_TYPES.ArrowFunctionExpression){let p=it(l,le.AST_NODE_TYPES.VariableDeclaration);return p?!!Ct(p,e.sourceCode):!1}if(l.type===le.AST_NODE_TYPES.FunctionDeclaration)return!!Ct(l,e.sourceCode)}return!1}function r(n){n.key.type!==le.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=it(n,le.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===le.AST_NODE_TYPES.TSTypeLiteral&&!(It(n)||!t(n)))for(let s of n.typeAnnotation.members)s.type===le.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSInterfaceDeclaration(n){if(!(It(n)||!t(n)))for(let s of n.body.body)s.type===le.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSTypeReference(n){if(n.typeName.type!==le.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let s=n.typeArguments.params[0];if(s.type!==le.AST_NODE_TYPES.TSTypeLiteral)return;let o=it(n.parent,le.AST_NODE_TYPES.VariableDeclaration,4);if(!o)return;let i=Ct(o,e.sourceCode);if(!(!i||i.parent.type===le.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===le.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of s.members)l.type===le.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function It(e){return e?e.parent?.type===le.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===le.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Ct(e,t){if(It(e))return;let r;if(e.type===le.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===le.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===le.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])&&!It(o[0].identifier.parent.parent))return o[0].identifier}var Zt={name:Fr,rule:fo};import{AST_NODE_TYPES as Ge}from"@typescript-eslint/utils";var mt=z({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(s){return s?s.type===Ge.Identifier?t.has(s.name):s.type===Ge.MemberExpression?r(s.object):!1:!1}function n(s){return s.type!==Ge.TSTypeReference||s.typeArguments?!1:s.typeName.type===Ge.Identifier&&t.has(s.typeName.name)}return{ImportDeclaration(s){for(let o of s.specifiers)t.add(o.local.name)},ExportNamedDeclaration(s){if(s.source){e.report({node:s,messageId:"noReexport"});return}if(s.declaration?.type===Ge.VariableDeclaration)for(let o of s.declaration.declarations)r(o.init)&&e.report({node:s,messageId:"noReexport"});s.declaration?.type===Ge.TSTypeAliasDeclaration&&n(s.declaration.typeAnnotation)&&e.report({node:s,messageId:"noReexport"}),s.specifiers.length>0&&e.report({node:s,messageId:"noReexport"})},ExportDefaultDeclaration(s){s.declaration.type===Ge.Identifier&&t.has(s.declaration.name)&&e.report({node:s,messageId:"noReexport"})},ExportAllDeclaration(s){e.report({node:s,messageId:"noReexport"})}}}});import{ESLintUtils as mo}from"@typescript-eslint/utils";import Gt from"path";import{z as Ye}from"zod/v4";var yo=mo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),vr="no-relative-imports",go=Ye.object({find:Ye.string(),replacement:Ye.string()}),So=Ye.object({aliases:Ye.array(go),rootDir:Ye.string().optional(),allowNotFoundAliases:Ye.boolean().optional(),_dev_simulateFileName:Ye.string().optional()}),To=yo({name:vr,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:[_(So)]},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,a){let l=Gt.dirname(a);return Gt.resolve(l,i)}function o(i){let a=t.rootDir??process.cwd(),l=Gt.relative(a,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:m}of t.aliases)if(l.startsWith(m)){let y=l.replace(m,p);return{alias:p,newPath:y}}return null}return{ImportDeclaration(i){let a=i.source.value;if(!n(a))return;let l=s(a,r),p=o(l);!p&&t.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?m=>m.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),Kt={name:vr,rule:To};import{AST_NODE_TYPES as ye}from"@typescript-eslint/utils";import{z as Rr}from"zod/v4";var Eo=Rr.object({customMessage:Rr.string().optional()}),Qt=z({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[_(Eo)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case ye.Literal:return!0;case ye.ObjectExpression:return n.properties.every(s=>s.type===ye.Property?s.computed||s.value.type===ye.Identifier&&s.key.type===ye.Identifier&&s.key.name===s.value.name?!1:r(s.value):!1);case ye.ArrayExpression:return n.elements.every(s=>s?s.type===ye.SpreadElement?!1:r(s):!0);case ye.TemplateLiteral:return n.expressions.length===0;case ye.ConditionalExpression:case ye.LogicalExpression:case ye.BinaryExpression:case ye.UnaryExpression:case ye.CallExpression:case ye.MemberExpression:case ye.Identifier:case ye.ArrowFunctionExpression:case ye.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===ye.JSXIdentifier&&n.name.name==="style"&&n.value){let s=null;n.value.type===ye.JSXExpressionContainer?n.value.expression.type!==ye.JSXEmptyExpression&&(s=n.value.expression):n.value.type===ye.Literal&&(s=n.value),s&&r(s)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});import{AST_NODE_TYPES as At}from"@typescript-eslint/utils";import*as Ke from"zod/v4";var ho=Ke.object({alternativeMsgs:Ke.object({inArrayFind:Ke.string().optional(),inArrayFilter:Ke.string().optional()}).optional(),__dev_simulateFileName:Ke.string().optional()});function bo(e){return e.typeAnnotation.type!==At.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var xo=/(typeGuards|type-guards)\.(ts|tsx)$/;function Co(e){return xo.test(e)}function Io(e){let t=e.parent;for(;t;){if(t.type===At.CallExpression&&t.callee.type===At.MemberExpression&&t.callee.property.type===At.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var en=z({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:[_(ho)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(Co(r))return{};function n(s){if(!bo(s))return;let o=Io(s);if(t.alternativeMsgs&&o){let i=o.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let a=o.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:s,messageId:a,data:{message:i}});return}}e.report({node:s,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});import{AST_NODE_TYPES as at}from"@typescript-eslint/utils";var Ao="no-unnecessary-async-on-jsx-props";function wo(e){if(e.body.type!==at.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let r=t[0];return!r||r.type!==at.ExpressionStatement?!1:r.expression.type===at.AwaitExpression}var tn=z({name:Ao,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){wo(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let s=e.sourceCode,o=[],i=s.getFirstToken(r,l=>l.value==="async");if(i){let l=s.getTokenAfter(i);l?o.push(n.replaceTextRange([i.range[0],l.range[0]],"")):o.push(n.remove(i))}function a(l){if(l.type===at.AwaitExpression){let p=s.getFirstToken(l);if(p&&p.value==="await"){let m=s.getTokenAfter(p);m?o.push(n.replaceTextRange([p.range[0],m.range[0]],"")):o.push(n.remove(p))}}if(l.type===at.BlockStatement)for(let p of l.body)a(p);else l.type===at.ExpressionStatement&&a(l.expression)}return a(r.body),o}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});import{AST_NODE_TYPES as yt,ESLintUtils as kr}from"@typescript-eslint/utils";import*as nn from"typescript";import dt from"zod/v4";var Fo=kr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nr="no-unnecessary-casting",vo=dt.object({additionalCastFunctions:dt.array(dt.object({name:dt.string(),expectedType:dt.enum(["string","number"])})).optional()}),rn={name:Nr,rule:Fo({name:Nr,meta:{type:"suggestion",docs:{description:"Prevents unnecessary Number and String castings"},deprecated:{message:"Use the strict-casting rule instead"},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:[_(vo)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],s=kr.getParserServices(e,!0),o=s.program?.getTypeChecker();if(!o||!s.program)throw new Error("TypeScript services or program not available");function i(m,y){switch(m.type){case yt.Literal:return y==="number"?typeof m.value=="number":typeof m.value=="string";case yt.TemplateLiteral:return y==="string";case yt.UnaryExpression:return y==="number"?m.operator==="+"||m.operator==="-"||m.operator==="~":!1;default:return!1}}function a(m,y){return y==="number"?!!(m.flags&nn.TypeFlags.NumberLike):!!(m.flags&nn.TypeFlags.StringLike)}function l(m,y){return u=>u.replaceText(m,e.sourceCode.getText(y))}function p(m){if(!o||m.arguments.length!==1)return;let y=m.arguments[0];if(!y||y.type===yt.SpreadElement)return;let{callee:u}=m;if(u.type!==yt.Identifier)return;let d=u.name,c=n.find(h=>h.name===d);if(!c)return;if(i(y,c.expectedType)||a(o.getTypeAtLocation(s.esTreeNodeToTSNodeMap.get(y)),c.expectedType)){let h,S;d==="Number"?h="unnecessaryNumberCasting":d==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",S={name:c.name,type:c.expectedType}),e.report({node:m,messageId:h,...S?{data:S}:{},fix:l(m,y)})}}return{CallExpression:p}}})};import{AST_NODE_TYPES as Ne}from"@typescript-eslint/utils";import*as wt from"zod/v4";var Ro=wt.object({ignoreWithDescription:wt.string().optional()}),sn=z({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:[_(Ro)]},defaultOptions:[{}],create(e,[t]){let r=e.getSourceCode(),n=r.ast;function s(l){let p=l.arguments[0];return p&&p.type===Ne.Literal&&typeof p.value=="string"?p.value:null}function o(l){return!l||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(l)}function i(l){return l.length!==1?!1:n.body.filter(m=>{if(m.type===Ne.ExpressionStatement){let y=m.expression;if(y.type===Ne.CallExpression&&y.callee.type===Ne.Identifier){let u=y.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(u)}}return!1}).length===0}function a(l){let p=l.arguments[1];if(p&&(p.type===Ne.FunctionExpression||p.type===Ne.ArrowFunctionExpression)&&p.body.type===Ne.BlockStatement){let m=p.body.body;return m.length===0?"":m.map(u=>r.text.slice(u.range[0],u.range[1])).join(`
16
16
 
17
- `)}return""}return{Program(){let l=[];for(let u of n.body)u.type===Ne.ExpressionStatement&&u.expression.type===Ne.CallExpression&&u.expression.callee.type===Ne.Identifier&&u.expression.callee.name==="describe"&&u.expression.arguments.length===2&&l.push(u.expression);if(!i(l))return;let[p]=l;if(!p)return;let m=s(p);if(o(m))return;let y=n.body.find(u=>u.type===Ne.ExpressionStatement&&u.expression===p);!y||y.type!==Ne.ExpressionStatement||e.report({node:p,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(u){let d=a(p);return d?u.replaceText(y,d):null}}]})}}}});import{AST_NODE_TYPES as Ft}from"@typescript-eslint/utils";import*as $e from"zod/v4";var Fo=$e.object({methods:$e.union([$e.array($e.string()),$e.literal("array")])}),on=z({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:[_(Fo)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function s(a){return Array.isArray(r)?r.includes(a):n.has(a)}function o(a){let{callee:l}=a;if(l.type===Ft.MemberExpression){let p=l.property;if(p.type===Ft.Identifier)return p.name}return null}function i(a,l){if(a.type!==Ft.Identifier||!a.typeAnnotation)return;let p=l.parent;if(p.type===Ft.CallExpression){let m=o(p);m&&s(m)&&p.arguments.indexOf(l)===0&&e.report({node:a.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(u){return a.typeAnnotation?u.remove(a.typeAnnotation):null}})}}return{ArrowFunctionExpression(a){for(let l of a.params)i(l,a)},FunctionExpression(a){for(let l of a.params)i(l,a)}}}});import{AST_NODE_TYPES as ve}from"@typescript-eslint/utils";var an=z({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===ve.ObjectPattern||!t.init||t.init.type!==ve.ObjectExpression||t.id.type===ve.Identifier&&t.id.typeAnnotation||t.parent.parent.type===ve.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===ve.Property&&i.key.type===ve.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==ve.Identifier)return;let n=vo(t,e.sourceCode);if(n.length===0)return;let s=t.init.properties.some(i=>i.type!==ve.Property?!1:i.value.type===ve.FunctionExpression),o=new Set;for(let i of n){if(i.identifier.parent.type!==ve.MemberExpression)return;let a=i.identifier.parent;if(a.object!==i.identifier)return;if(a.computed)if(a.property.type===ve.Literal&&typeof a.property.value=="string")o.add(a.property.value);else return;else{if(a.property.type!==ve.Identifier)return;o.add(a.property.name)}if(a.parent.type===ve.CallExpression&&s)return}for(let[i,a]of r)o.has(i)||e.report({node:a,messageId:"unusedObjectProperty",data:{name:i}})}}}});function vo(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):[]}import{AST_NODE_TYPES as te}from"@typescript-eslint/utils";import{z as Pr}from"zod/v4";var Ro=Pr.object({ignoreArgsMatching:Pr.string().optional()}),ln=z({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:[_(Ro)]},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===te.ExportNamedDeclaration||i.type===te.ExportDefaultDeclaration||i.parent?.type===te.ExportNamedDeclaration||i.parent?.type===te.ExportDefaultDeclaration}function o(i){let a=[];for(let l=0;l<i.length;l++){let p=i[l];if(!p||p.type!==te.Identifier)continue;let m=p.name;if(!n(m)){if(p.optional&&p.typeAnnotation&&p.typeAnnotation.typeAnnotation.type===te.TSTypeLiteral){let y=p.typeAnnotation.typeAnnotation,u=[];for(let d of y.members)d.type===te.TSPropertySignature&&d.key.type===te.Identifier&&u.push({name:d.key.name,optional:d.optional===!0});u.some(d=>d.optional)?a.push({param:p,index:l,name:m,isObjectParam:!0,objectProps:u}):a.push({param:p,index:l,name:m,isObjectParam:!1})}else if(p.optional)a.push({param:p,index:l,name:m,isObjectParam:!1});else if(p.typeAnnotation&&p.typeAnnotation.typeAnnotation.type===te.TSTypeLiteral){let y=p.typeAnnotation.typeAnnotation,u=[];for(let d of y.members)d.type===te.TSPropertySignature&&d.key.type===te.Identifier&&u.push({name:d.key.name,optional:d.optional===!0});u.some(d=>d.optional)&&a.push({param:p,index:l,name:m,isObjectParam:!0,objectProps:u})}}}return a}return{FunctionDeclaration(i){if(s(i))return;let a=o(i.params);a.length!==0&&r.push({node:i,declarationNode:i,optionalParams:a})},VariableDeclarator(i){if(i.id.type!==te.Identifier||!i.init||i.init.type!==te.ArrowFunctionExpression&&i.init.type!==te.FunctionExpression||s(i.parent.parent))return;let l=[...o(i.init.params)];if(i.id.typeAnnotation&&i.id.typeAnnotation.typeAnnotation.type===te.TSTypeReference){let p=i.id.typeAnnotation.typeAnnotation;if(p.typeName.type===te.Identifier&&p.typeName.name==="FC"){let m=p.typeArguments;if(m&&m.params.length===1){let y=m.params[0];if(y&&y.type===te.TSTypeLiteral){let u=[];for(let d of y.members)d.type===te.TSPropertySignature&&d.key.type===te.Identifier&&u.push({name:d.key.name,optional:d.optional===!0});u.some(d=>d.optional)&&l.push({param:i.id,index:0,name:"props",isObjectParam:!0,objectProps:u})}}}}l.length!==0&&r.push({node:i.init,declarationNode:i,optionalParams:l})},"Program:exit"(){for(let i of r){let l=e.sourceCode.getDeclaredVariables(i.declarationNode)[0];if(!l)continue;let p=l.references.filter(u=>u.identifier!==l.identifiers[0]);if(p.length===0)continue;let m=!1;for(let u of p){let d=u.identifier.parent;if(d.type===te.CallExpression&&u.identifier.type===te.Identifier&&d.arguments.includes(u.identifier)){m=!0;break}if(d.type===te.ReturnStatement){m=!0;break}if(d.type===te.Property&&d.parent.type===te.ObjectExpression&&d.parent.parent.type===te.ReturnStatement){m=!0;break}if(d.type===te.JSXExpressionContainer){m=!0;break}}if(m)continue;let y=[];for(let u of p){let d=u.identifier.parent;if(d.type===te.CallExpression&&d.callee===u.identifier){let c=d.arguments.length,g=d.arguments.some(S=>S.type===te.SpreadElement);if(g){m=!0;break}let h={argCount:c,hasSpread:g};for(let S of i.optionalParams)if(S.isObjectParam&&S.index<c){let I=d.arguments[S.index];if(I?.type===te.ObjectExpression){let A={};for(let T of I.properties)T.type===te.Property&&T.key.type===te.Identifier&&(A[T.key.name]=!0);h.objectArgs||(h.objectArgs=[]),h.objectArgs[S.index]=A}else if(I){m=!0;break}}y.push(h)}else if(d.type===te.JSXOpeningElement&&d.name===u.identifier){let c=d.attributes.some(h=>h.type===te.JSXSpreadAttribute);if(c){m=!0;break}let g={argCount:1,hasSpread:c};for(let h of i.optionalParams)if(h.isObjectParam&&h.index===0){let S={};for(let I of d.attributes)I.type===te.JSXAttribute&&I.name.type===te.JSXIdentifier&&(S[I.name.name]=!0);g.objectArgs||(g.objectArgs=[]),g.objectArgs[0]=S}y.push(g)}}if(!(m||y.length===0))for(let u of i.optionalParams)if(u.isObjectParam&&u.objectProps)for(let d of u.objectProps){if(!d.optional)continue;let c=!1;for(let g of y)if(g.objectArgs&&g.objectArgs[u.index]){let h=g.objectArgs[u.index];if(h&&h[d.name]){c=!0;break}}c||e.report({node:u.param,messageId:"unusedOptionalProp",data:{name:d.name}})}else{let d=!1;for(let c of y)if(c.argCount>u.index){d=!0;break}d||e.report({node:u.param,messageId:"unusedOptionalArg",data:{name:u.name}})}}}}}});import{AST_NODE_TYPES as ce,ESLintUtils as No}from"@typescript-eslint/utils";import{z as Qe}from"zod/v4";var ko=Qe.object({selectors:Qe.array(Qe.object({name:Qe.string(),selectorProp:Qe.string().optional(),selectorArgPos:Qe.number().optional(),returnProp:Qe.string().optional()}))}),Po=No.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Or="no-unused-selected-values",pn={name:Or,rule:Po({name:Or,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[_(ko)]},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===ce.CallExpression&&(o=s.init),!o)return;let i=Do(o);if(!i)return;let a=n.get(i);if(!a)return;let l=Oo(o,a.selectorArgPos??0,a.selectorProp);if(!l)return;let p=Lo(l);if(!p)return;let m=Dr(p.properties,void 0);if(!m)return;if(s.id.type===ce.ObjectPattern){let d=Dr(s.id.properties,a.returnProp);if(!d)return;for(let[c,g]of m)d.has(c)||e.report({node:g,messageId:"unusedSelectedValue",data:{name:c}});return}if(s.id.type!==ce.Identifier||a.returnProp)return;let y=jo(s,e.sourceCode);if(y.length===0)return;let u=new Set;for(let d of y){if(d.identifier.parent.type!==ce.MemberExpression)return;let c=d.identifier.parent.property;if(c.type!==ce.Identifier)return;u.add(c.name)}for(let[d,c]of m)u.has(d)||e.report({node:c,messageId:"unusedSelectedValue",data:{name:d}})}}}})};function Oo(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===ce.ArrowFunctionExpression||n.type===ce.FunctionExpression)return n;if(r&&n.type===ce.ObjectExpression){let s=n.properties.find(i=>i.type===ce.Property&&i.key.type===ce.Identifier&&i.key.name===r);if(s?.type!==ce.Property)return null;let o=s.value;if(o.type===ce.ArrowFunctionExpression||o.type===ce.FunctionExpression)return o}return null}function Do(e){return e.callee.type===ce.Identifier?e.callee.name:e.callee.type===ce.MemberExpression&&e.callee.property.type===ce.Identifier?e.callee.property.name:null}function Lo(e){if(e.body.type===ce.ObjectExpression)return e.body;if(e.body.type===ce.BlockStatement){let t=e.body.body.filter(r=>r.type===ce.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==ce.ObjectExpression?null:t[0].argument}return null}function Dr(e,t){let r=e;if(t){let s=e.find(o=>o.type===ce.Property&&o.key.type===ce.Identifier&&o.key.name===t);if(s?.type!==ce.Property||s.value.type!==ce.ObjectPattern)return null;r=s.value.properties}let n=new Map;for(let s of r){if(s.type!==ce.Property||s.key.type!==ce.Identifier)return null;n.set(s.key.name,s)}return n.size>0?n:null}function jo(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):[]}import{AST_NODE_TYPES as pe}from"@typescript-eslint/utils";var cn=z({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===pe.ImportDeclaration&&o.source.value==="t-state-form"))return{};let n=null,s=!1;return{CallExpression(o){if(s)return;if(!n){let a=Mo(o);a&&(n=a);return}let i=$o(o,e.sourceCode);if(i){s=!0;for(let a of i)n.delete(a);if(n.size!==0)for(let[a,l]of n)e.report({node:l,messageId:"unusedField",data:{name:a}})}}}}});function Mo(e){if(!(e.callee.type===pe.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==pe.ObjectExpression)return null;let n=Vt(r.properties,o=>o.type!==pe.Property||o.key.type!==pe.Identifier||o.key.name!=="initialConfig"?null:o.value.type===pe.ObjectExpression?o.value:o.value.type===pe.ArrowFunctionExpression||o.value.type===pe.FunctionExpression?_o(o.value):null);if(!n)return null;let s=new Map;for(let o of n.properties)o.type===pe.Property&&o.key.type===pe.Identifier&&s.set(o.key.name,o);return s}function $o(e,t){if(!(e.callee.type===pe.Identifier&&e.callee.name==="useFormState")||e.parent.type!==pe.VariableDeclarator||e.parent.id.type!==pe.ObjectPattern||!Vt(e.parent.id.properties,i=>i.type===pe.Property&&i.key.type===pe.Identifier&&i.key.name==="formFields"&&i))return null;let s=yr(e.parent,"formFields",t),o=new Set;for(let{identifier:i}of s){if(i.type!==pe.Identifier||i.parent.type===pe.Property&&i.parent.parent.type===pe.ObjectExpression&&i.parent.parent.parent.type===pe.ReturnStatement||i.parent.type===pe.ReturnStatement)return null;if(i.parent.type===pe.MemberExpression){if(i.parent.object.type!==pe.Identifier||i.parent.property.type!==pe.Identifier)return null;o.add(i.parent.property.name)}}return o}function _o(e){if(e.body.type===pe.ObjectExpression)return e.body;if(e.body.type===pe.BlockStatement){let t=e.body.body.filter(r=>r.type===pe.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==pe.ObjectExpression?null:t[0].argument}return null}import{AST_NODE_TYPES as se,ESLintUtils as Uo}from"@typescript-eslint/utils";import{z as vt}from"zod/v4";var zo=Uo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Lr(e){let t=[];for(let r of e.members)r.type===se.TSPropertySignature&&r.key.type===se.Identifier&&t.push([r.key.name,r]);return t}function jr(e,...t){for(let r of t)e.set(...r);return e}var Vo=vt.object({forceCheckOnFCPropTypesWithName:vt.array(vt.string()).optional(),alwaysCheckFunctionOptionTypes:vt.boolean().optional()}),Mr="no-unused-type-props-in-args",un=null,Wo=zo({name:Mr,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:[_(Vo)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!un&&(un=r.map(l=>new RegExp(l)));function s(l,p,m,y,u=!0,d=!1){let c=m.name,g=e.sourceCode.getScope(p).references.find(T=>T.identifier.name===c)?.resolved,h=l&&un?.some(T=>T.test(c)),S=d&&n;if(!g||!h&&g.references.filter(T=>T.isTypeReference).length>1||!g.defs[0])return;let I=g.defs[0].node,A=I.parent?.type===se.ExportNamedDeclaration;if(!(u&&A&&!S)){if(I.type===se.TSTypeAliasDeclaration){o(l,p,y,I.typeAnnotation,!0,d);return}if(I.type===se.TSInterfaceDeclaration){o(l,p,y,I.body,!0,d);return}}}function o(l,p,m,y,u,d=!1){if(y.type===se.TSInterfaceBody){for(let c of y.body)c.type===se.TSPropertySignature&&c.key.type===se.Identifier&&m.set(c.key.name,c);return}if(y.type===se.TSTypeLiteral){jr(m,...Lr(y));return}if(y.type===se.TSIntersectionType){for(let c of y.types)o(l,p,m,c,!0,d);return}u||y.type===se.TSTypeReference&&y.typeName.type===se.Identifier&&s(l,p,y.typeName,m,!0,d)}function i(l,p,m,y=!1){for(let u of m)if(u.type===se.ObjectPattern&&u.typeAnnotation){let d=new Map;if(o(l,p,d,u.typeAnnotation.typeAnnotation,!1,y),d.size===0)continue;a(u,d)}else u.type===se.AssignmentPattern&&u.left.type===se.ObjectPattern&&i(l,p,[u.left],y)}function a(l,p){let m=[];if(l.properties.at(-1)?.type===se.RestElement)return;for(let c of l.properties)c.type===se.Property&&c.key.type===se.Identifier&&m.push(c.key.name);let u=[],d=[];for(let[c,g]of p)m.includes(c)||(d.push(c),u.push({node:g,messageId:"unusedObjectTypeProperty",data:{propertyName:c}}));for(let[c,g]of u.entries())e.report({...g,fix:c===u.length-1?h=>{let S=l.properties.at(-1),I=d.join(", ");return S?S.type===se.RestElement?null:h.insertTextAfter(S,`, ${I}`):h.insertTextBeforeRange([l.range[0]+1,l.range[1]],I)}:void 0})}return{VariableDeclaration(l){let p=l.declarations[0],m=new Map,y=p.id.type===se.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===se.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===se.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(y){if(y.type===se.TSTypeReference&&y.typeName.type===se.Identifier)s(!0,l,y.typeName,m,!1);else if(y.type===se.TSTypeLiteral)jr(m,...Lr(y));else if(y.type===se.TSIntersectionType)for(let u of y.types)u.type===se.TSTypeReference&&u.typeName.type===se.Identifier?s(!0,l,u.typeName,m,!1):o(!0,l,m,u,!0);if(m.size!==0&&p.init?.type===se.ArrowFunctionExpression){let u=p.init.params[0];if(!u){e.report({node:p.init,messageId:"missingComponentParam"});return}u.type===se.ObjectPattern&&a(u,m)}}},FunctionDeclaration(l){i(!1,l,l.params,n)},ArrowFunctionExpression(l){i(!1,l,l.params,n)}}}}),fn={name:Mr,rule:Wo};import{AST_NODE_TYPES as je}from"@typescript-eslint/utils";var mn=z({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===je.Identifier?t.has(n.callee.name):n.callee.type===je.MemberExpression&&n.callee.object.type===je.Identifier&&n.callee.property.type===je.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let s of n.specifiers)s.type===je.ImportSpecifier&&s.imported.type===je.Identifier&&s.imported.name==="useRef"&&t.add(s.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===je.CallExpression&&r(n.init)&&n.id.type===je.Identifier){let o=e.sourceCode.getScope(n).set.get(n.id.name);if(o){let i=!1;for(let a of o.references){let p=a.identifier.parent;if(p!==n&&!(p.type===je.JSXExpressionContainer&&p.parent.type===je.JSXAttribute&&p.parent.name.type===je.JSXIdentifier&&p.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});import{AST_NODE_TYPES as yn,ESLintUtils as Jo}from"@typescript-eslint/utils";var Xo=Jo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_r="prefer-named-functions",$r=new Map,Bo=Xo({name:_r,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[t]){let r=null;if(t.ignoreRegex){let n=$r.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),$r.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===yn.ArrowFunctionExpression&&n.id.type===yn.Identifier){let s=n.id.name;if(n.id.typeAnnotation||r&&r.test(s)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==yn.BlockStatement)return;let o=n.parent,i=n.init.params,a=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:s,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(o,`${l.async?"async ":""}function ${s}(${i.map(m=>e.sourceCode.getText(m)).join(", ")||""}) ${e.sourceCode.getText(a)}`)}]})}}}}}),dn={name:_r,rule:Bo};import{AST_NODE_TYPES as K}from"@typescript-eslint/utils";import{z as We}from"zod/v4";var Ho=We.object({disallowedFunctions:We.array(We.object({name:We.string(),allowUsingWithArgs:We.boolean().optional(),hookAlternative:We.string().optional(),message:We.string().optional(),allowUseInside:We.array(We.string()).optional()}))}),Yo=/^use[A-Z]/,qo=/^[A-Z]/;function Rt(e){return Yo.test(e)}function Ur(e){return qo.test(e)}function Zo(e){return e.type===K.Identifier?Rt(e.name):e.type===K.MemberExpression&&e.property.type===K.Identifier?Rt(e.property.name):!1}function zr(e,t){return e.type===K.Identifier?e.name===t:e.type===K.MemberExpression&&e.object.type===K.Identifier&&e.property.type===K.Identifier?e.object.name==="React"&&e.property.name===t:!1}function Vr(e){return!!(e.parent&&e.parent.type===K.CallExpression&&zr(e.parent.callee,"forwardRef"))}function Wr(e){return!!(e.parent&&e.parent.type===K.CallExpression&&zr(e.parent.callee,"memo"))}function gn(e){if(e.type===K.FunctionDeclaration||e.type===K.FunctionExpression&&e.id)return e.id||void 0;if(e.type===K.FunctionExpression||e.type===K.ArrowFunctionExpression){if(e.parent.type===K.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===K.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===K.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===K.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Go(e){let t=e.parent,r=!1;for(;t;){if(t.type===K.FunctionDeclaration||t.type===K.FunctionExpression||t.type===K.ArrowFunctionExpression){let n=gn(t);if(n&&n.type===K.Identifier){if(Ur(n.name)||Rt(n.name))return!r;r=!0}else{if(Vr(t)||Wr(t))return!r;if(t.parent.type===K.CallExpression){let s=t.parent;Zo(s.callee)||(r=!0)}else t.parent.type===K.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Jr(e){return e.callee.type===K.Identifier?e.callee.name:e.callee.type===K.MemberExpression&&e.callee.property.type===K.Identifier?e.callee.property.name:null}function Ko(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===K.FunctionDeclaration||r.type===K.FunctionExpression||r.type===K.ArrowFunctionExpression){let n=gn(r);if(n&&n.type===K.Identifier&&t.includes(n.name))return!0}else if(r.type===K.CallExpression){let n=Jr(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function Qo(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===K.Identifier&&t.name==="undefined")}function ea(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===K.FunctionDeclaration||n.type===K.FunctionExpression||n.type===K.ArrowFunctionExpression){let s=gn(n);if(s&&s.type===K.Identifier){if(Ur(s.name)||Rt(s.name)){r=!0;break}}else if(Vr(n)||Wr(n)){r=!0;break}}n=n.parent}return r?t.length===0?Go(e):!Ko(e,t):!1}var Sn=z({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:[_(Ho)],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=Jr(s);if(!o)return;let i=n.get(o);if(!i||i.allowUsingWithArgs&&Qo(s))return;let a=i.allowUseInside||[];ea(s,a)&&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:l=>{let p=i.hookAlternative;return p?s.callee.type===K.Identifier?l.replaceText(s.callee,p):s.callee.type===K.MemberExpression&&s.callee.property.type===K.Identifier?l.replaceText(s.callee.property,p):null:null}}]:[]})}}}});import{AST_NODE_TYPES as ge,AST_TOKEN_TYPES as Xr,ESLintUtils as ta}from"@typescript-eslint/utils";import Tn from"zod/v4";var na=ta.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Hr="prefer-single-line-if",ra=Tn.object({maxLineLength:Tn.number().optional(),maxNonSimpleConditionLength:Tn.number().optional()}),ia=na({name:Hr,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:[_(ra)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==ge.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===ge.ReturnStatement){if(!qr(o))return}else if(!(o.type===ge.ContinueStatement||o.type===ge.BreakStatement))return;if(n.test.type===ge.LogicalExpression||n.test.type===ge.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let y=Br(n.test);if(!y&&n.test.type===ge.UnaryExpression&&n.test.operator==="!"){let u=n.test.argument;Br(u)&&(y=!0)}if(y&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let a=r.getText(o);if(i.includes(`
18
- `))return;let l=r.getTokenAfter(n);if(l&&l.type===Xr.Punctuator&&l.value==="}"){let y=r.getTokenAfter(l);if(y&&y.type===Xr.Keyword&&(y.value==="else"||y.value==="catch"))return}let p=sa(r,n),m=`if (${i}) ${a}`;t.maxLineLength&&m.length+p.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:y=>y.replaceText(n,m)})}}}});function Br(e){return e.type===ge.CallExpression||e.type===ge.BinaryExpression||e.type===ge.MemberExpression&&Yr(e)}function Yr(e){return e.object.type===ge.MemberExpression?Yr(e.object):e.object.type!==ge.Identifier}function sa(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function qr(e){if(!e.argument)return!0;let t=e.argument;return t.type===ge.ArrayExpression&&t.elements.length===0||t.type===ge.ObjectExpression&&t.properties.length===0||t.type===ge.Literal||t.type===ge.Identifier||t.type===ge.TemplateLiteral||t.type===ge.TaggedTemplateExpression?!0:t.type===ge.CallExpression?t.arguments.length===0:t.type===ge.UnaryExpression?qr(t):!1}var En={name:Hr,rule:ia};import{AST_NODE_TYPES as j,ESLintUtils as oa}from"@typescript-eslint/utils";import{z as Zr}from"zod/v4";var aa=oa.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ti="react-compiler-extra",la=Zr.object({runOnlyWithEnableCompilerDirective:Zr.boolean().optional()}),pa=/eslint +react-compiler\/react-compiler: +\["error/;function lt(e){let t=null;if((e.type===j.FunctionDeclaration||e.type===j.FunctionExpression||e.type===j.ArrowFunctionExpression&&e.body.type===j.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r?r.type===j.ExpressionStatement&&r.expression.type===j.Literal&&r.expression.value==="use no memo":!1}function Gr(e){let t=e.parent;for(;t;){if(t.type===j.FunctionDeclaration||t.type===j.FunctionExpression||t.type===j.ArrowFunctionExpression)return t;t=t.parent}return null}function ca(e){return e.type===j.Identifier?e.name.startsWith("use"):!1}function ni(e){return e.type===j.Identifier?e.name.startsWith("use"):e.type===j.MemberExpression&&e.property.type===j.Identifier?e.property.name.startsWith("use"):!1}function _e(e){if(!e)return!1;switch(e.type){case j.JSXElement:case j.JSXFragment:return!0;case j.ConditionalExpression:return _e(e.consequent)||_e(e.alternate);case j.LogicalExpression:return e.operator==="&&"?_e(e.right):e.operator==="||"?_e(e.left)||_e(e.right):!1;case j.CallExpression:if(e.callee.type===j.MemberExpression&&e.callee.object.type===j.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===j.Identifier&&e.callee.property.name==="createElement")return!0;for(let t of e.arguments)if(t.type!==j.SpreadElement&&_e(t))return!0;return!1;default:return!1}}function ua(e){let t=e.typeAnnotation;if(t.type===j.TSTypeReference){if(t.typeName.type===j.Identifier)return t.typeName.name==="FC";if(t.typeName.type===j.TSQualifiedName&&t.typeName.left.type===j.Identifier&&t.typeName.right.type===j.Identifier)return t.typeName.left.name==="React"&&t.typeName.right.name==="FC"}return!1}var fa=/^[A-Z][a-zA-Z0-9]*$/;function St(e){return fa.test(e)}function Nt(e){return e.startsWith("use")&&e.length>3}function bn(e,t,r,n){if(r&&ua(r))return t?St(t.name):e.type===j.FunctionDeclaration&&e.id?St(e.id.name):!0;if(t&&Nt(t.name)||e.type===j.FunctionDeclaration&&e.id&&Nt(e.id.name))return!0;if(n){let s=t?.name||e.type===j.FunctionDeclaration&&e.id?.name;if(s&&St(s)&&ri(e.body,n).containsJSX)return!0}return!1}function gt(e){if(e.body.type===j.BlockStatement){for(let t of e.body.body)if(t.type===j.ExpressionStatement&&t.expression.type===j.Literal&&typeof t.expression.value=="string"&&t.expression.value==="use memo")return!0}return!1}function ri(e,t){let r={containsJSX:!1,containsHookCalls:!1};return Le(e,n=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(n.type){case j.JSXElement:case j.JSXFragment:r.containsJSX=!0;break;case j.CallExpression:ca(n.callee)&&(r.containsHookCalls=!0),_e(n)&&(r.containsJSX=!0);break;case j.ReturnStatement:n.argument&&_e(n.argument)&&(r.containsJSX=!0);break;case j.VariableDeclarator:n.init&&_e(n.init)&&(r.containsJSX=!0);break;case j.AssignmentExpression:_e(n.right)&&(r.containsJSX=!0);break}},t),r}function Kr(e,t){let r=e.body,n=ri(r,t);return n.containsJSX||n.containsHookCalls}var ma=/\bthis[.[]/;function Qr(e){return ma.test(e)}function ya(e,t){let r={containsJSX:!1,containsHookCalls:!1};return Le(e,n=>{if(r.containsHookCalls||(n.type===j.FunctionDeclaration||n.type===j.FunctionExpression||n.type===j.ArrowFunctionExpression)&&n!==e)return!0;n.type===j.CallExpression&&ni(n.callee)&&(r.containsHookCalls=!0)},t),r}function ei(e){return St(e)||Nt(e)}function hn(e,t,r,n){if(!ya(e.body,t).containsHookCalls)return!1;let o=bn(e,r,n,t);if(!o&&n){let i=r?.name||e.type===j.FunctionDeclaration&&e.id?.name;i&&St(i)&&(o=!0)}return!o}var da=aa({name:ti,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:[_(la)]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let i of e.sourceCode.getAllComments())if(pa.test(i.value)){r=!0;break}if(!r)return{}}function n(i){for(let a of i.properties)if(a.type===j.Property&&a.method&&a.value.type===j.FunctionExpression){let l=e.sourceCode,p=l.getText(a.key),m=a.value,y=l.getText(m.body);if(Qr(y))e.report({node:a,messageId:"thisKeywordInMethod"});else{let u=m.params.map(c=>l.getText(c)).join(", "),d="";m.generator?d=`${p}: function* (${u}) ${y}`:m.async?d=`${p}: async (${u}) => ${y}`:d=`${p}: (${u}) => ${y}`,e.report({node:a,messageId:"objectMethodIsNotSupported",fix:c=>c.replaceText(a,d)})}}}function s(i){for(let a of i.properties)if(a.type===j.Property&&a.value.type===j.ObjectExpression){for(let l of a.value.properties)if(l.type===j.Property&&l.method&&l.value.type===j.FunctionExpression){let m=e.sourceCode.getText(l.value.body);Qr(m)&&e.report({node:l,messageId:"thisKeywordInMethod"})}}}function o(i){let a=Gr(i);return a!==null&&lt(a)}return{CallExpression(i){if(ni(i.callee))for(let a of i.arguments){if(a.type===j.ObjectExpression){if(o(i))return;n(a),s(a)}if(a.type===j.ArrowFunctionExpression){if(a.body.type===j.ObjectExpression){if(o(i))return;n(a.body),s(a.body)}if(a.body.type===j.BlockStatement){for(let l of a.body.body)if(l.type===j.ReturnStatement&&l.argument?.type===j.ObjectExpression){if(o(i))return;n(l.argument),s(l.argument)}}}if(a.type===j.FunctionExpression){for(let l of a.body.body)if(l.type===j.ReturnStatement&&l.argument?.type===j.ObjectExpression){if(o(i))return;n(l.argument),s(l.argument)}}}},VariableDeclarator(i){if(i.id.type===j.Identifier&&i.init&&(i.init.type===j.ArrowFunctionExpression||i.init.type===j.FunctionExpression)){let a=i.init,l=i.id,p=i.id.typeAnnotation;if(gt(a)&&!ei(l.name)){e.report({node:a,messageId:"useMemoDirectiveNaming"});return}if(hn(a,e.sourceCode,l,p)){if(lt(a))return;e.report({node:a,messageId:"functionCallingHooksMustBeComponent"});return}if(bn(a,l,p,e.sourceCode)){let m=Kr(a,e.sourceCode),y=gt(a);if(!m&&!y){if(lt(a))return;e.report({node:a,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(u){if(a.body.type===j.BlockStatement){let d=a.body.range[0]+1;return u.insertTextAfterRange([d,d],`
17
+ `)}return""}return{Program(){let l=[];for(let u of n.body)u.type===Ne.ExpressionStatement&&u.expression.type===Ne.CallExpression&&u.expression.callee.type===Ne.Identifier&&u.expression.callee.name==="describe"&&u.expression.arguments.length===2&&l.push(u.expression);if(!i(l))return;let[p]=l;if(!p)return;let m=s(p);if(o(m))return;let y=n.body.find(u=>u.type===Ne.ExpressionStatement&&u.expression===p);!y||y.type!==Ne.ExpressionStatement||e.report({node:p,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(u){let d=a(p);return d?u.replaceText(y,d):null}}]})}}}});import{AST_NODE_TYPES as Ft}from"@typescript-eslint/utils";import*as $e from"zod/v4";var No=$e.object({methods:$e.union([$e.array($e.string()),$e.literal("array")])}),on=z({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:[_(No)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function s(a){return Array.isArray(r)?r.includes(a):n.has(a)}function o(a){let{callee:l}=a;if(l.type===Ft.MemberExpression){let p=l.property;if(p.type===Ft.Identifier)return p.name}return null}function i(a,l){if(a.type!==Ft.Identifier||!a.typeAnnotation)return;let p=l.parent;if(p.type===Ft.CallExpression){let m=o(p);m&&s(m)&&p.arguments.indexOf(l)===0&&e.report({node:a.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(u){return a.typeAnnotation?u.remove(a.typeAnnotation):null}})}}return{ArrowFunctionExpression(a){for(let l of a.params)i(l,a)},FunctionExpression(a){for(let l of a.params)i(l,a)}}}});import{AST_NODE_TYPES as ve}from"@typescript-eslint/utils";var an=z({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===ve.ObjectPattern||!t.init||t.init.type!==ve.ObjectExpression||t.id.type===ve.Identifier&&t.id.typeAnnotation||t.parent.parent.type===ve.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===ve.Property&&i.key.type===ve.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==ve.Identifier)return;let n=ko(t,e.sourceCode);if(n.length===0)return;let s=t.init.properties.some(i=>i.type!==ve.Property?!1:i.value.type===ve.FunctionExpression),o=new Set;for(let i of n){if(i.identifier.parent.type!==ve.MemberExpression)return;let a=i.identifier.parent;if(a.object!==i.identifier)return;if(a.computed)if(a.property.type===ve.Literal&&typeof a.property.value=="string")o.add(a.property.value);else return;else{if(a.property.type!==ve.Identifier)return;o.add(a.property.name)}if(a.parent.type===ve.CallExpression&&s)return}for(let[i,a]of r)o.has(i)||e.report({node:a,messageId:"unusedObjectProperty",data:{name:i}})}}}});function ko(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):[]}import{AST_NODE_TYPES as te}from"@typescript-eslint/utils";import{z as Pr}from"zod/v4";var Po=Pr.object({ignoreArgsMatching:Pr.string().optional()}),ln=z({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:[_(Po)]},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===te.ExportNamedDeclaration||i.type===te.ExportDefaultDeclaration||i.parent?.type===te.ExportNamedDeclaration||i.parent?.type===te.ExportDefaultDeclaration}function o(i){let a=[];for(let l=0;l<i.length;l++){let p=i[l];if(!p||p.type!==te.Identifier)continue;let m=p.name;if(!n(m)){if(p.optional&&p.typeAnnotation&&p.typeAnnotation.typeAnnotation.type===te.TSTypeLiteral){let y=p.typeAnnotation.typeAnnotation,u=[];for(let d of y.members)d.type===te.TSPropertySignature&&d.key.type===te.Identifier&&u.push({name:d.key.name,optional:d.optional===!0});u.some(d=>d.optional)?a.push({param:p,index:l,name:m,isObjectParam:!0,objectProps:u}):a.push({param:p,index:l,name:m,isObjectParam:!1})}else if(p.optional)a.push({param:p,index:l,name:m,isObjectParam:!1});else if(p.typeAnnotation&&p.typeAnnotation.typeAnnotation.type===te.TSTypeLiteral){let y=p.typeAnnotation.typeAnnotation,u=[];for(let d of y.members)d.type===te.TSPropertySignature&&d.key.type===te.Identifier&&u.push({name:d.key.name,optional:d.optional===!0});u.some(d=>d.optional)&&a.push({param:p,index:l,name:m,isObjectParam:!0,objectProps:u})}}}return a}return{FunctionDeclaration(i){if(s(i))return;let a=o(i.params);a.length!==0&&r.push({node:i,declarationNode:i,optionalParams:a})},VariableDeclarator(i){if(i.id.type!==te.Identifier||!i.init||i.init.type!==te.ArrowFunctionExpression&&i.init.type!==te.FunctionExpression||s(i.parent.parent))return;let l=[...o(i.init.params)];if(i.id.typeAnnotation&&i.id.typeAnnotation.typeAnnotation.type===te.TSTypeReference){let p=i.id.typeAnnotation.typeAnnotation;if(p.typeName.type===te.Identifier&&p.typeName.name==="FC"){let m=p.typeArguments;if(m&&m.params.length===1){let y=m.params[0];if(y&&y.type===te.TSTypeLiteral){let u=[];for(let d of y.members)d.type===te.TSPropertySignature&&d.key.type===te.Identifier&&u.push({name:d.key.name,optional:d.optional===!0});u.some(d=>d.optional)&&l.push({param:i.id,index:0,name:"props",isObjectParam:!0,objectProps:u})}}}}l.length!==0&&r.push({node:i.init,declarationNode:i,optionalParams:l})},"Program:exit"(){for(let i of r){let l=e.sourceCode.getDeclaredVariables(i.declarationNode)[0];if(!l)continue;let p=l.references.filter(u=>u.identifier!==l.identifiers[0]);if(p.length===0)continue;let m=!1;for(let u of p){let d=u.identifier.parent;if(d.type===te.CallExpression&&u.identifier.type===te.Identifier&&d.arguments.includes(u.identifier)){m=!0;break}if(d.type===te.ReturnStatement){m=!0;break}if(d.type===te.Property&&d.parent.type===te.ObjectExpression&&d.parent.parent.type===te.ReturnStatement){m=!0;break}if(d.type===te.JSXExpressionContainer){m=!0;break}}if(m)continue;let y=[];for(let u of p){let d=u.identifier.parent;if(d.type===te.CallExpression&&d.callee===u.identifier){let c=d.arguments.length,g=d.arguments.some(S=>S.type===te.SpreadElement);if(g){m=!0;break}let h={argCount:c,hasSpread:g};for(let S of i.optionalParams)if(S.isObjectParam&&S.index<c){let I=d.arguments[S.index];if(I?.type===te.ObjectExpression){let A={};for(let T of I.properties)T.type===te.Property&&T.key.type===te.Identifier&&(A[T.key.name]=!0);h.objectArgs||(h.objectArgs=[]),h.objectArgs[S.index]=A}else if(I){m=!0;break}}y.push(h)}else if(d.type===te.JSXOpeningElement&&d.name===u.identifier){let c=d.attributes.some(h=>h.type===te.JSXSpreadAttribute);if(c){m=!0;break}let g={argCount:1,hasSpread:c};for(let h of i.optionalParams)if(h.isObjectParam&&h.index===0){let S={};for(let I of d.attributes)I.type===te.JSXAttribute&&I.name.type===te.JSXIdentifier&&(S[I.name.name]=!0);g.objectArgs||(g.objectArgs=[]),g.objectArgs[0]=S}y.push(g)}}if(!(m||y.length===0))for(let u of i.optionalParams)if(u.isObjectParam&&u.objectProps)for(let d of u.objectProps){if(!d.optional)continue;let c=!1;for(let g of y)if(g.objectArgs&&g.objectArgs[u.index]){let h=g.objectArgs[u.index];if(h&&h[d.name]){c=!0;break}}c||e.report({node:u.param,messageId:"unusedOptionalProp",data:{name:d.name}})}else{let d=!1;for(let c of y)if(c.argCount>u.index){d=!0;break}d||e.report({node:u.param,messageId:"unusedOptionalArg",data:{name:u.name}})}}}}}});import{AST_NODE_TYPES as ce,ESLintUtils as Oo}from"@typescript-eslint/utils";import{z as Qe}from"zod/v4";var Do=Qe.object({selectors:Qe.array(Qe.object({name:Qe.string(),selectorProp:Qe.string().optional(),selectorArgPos:Qe.number().optional(),returnProp:Qe.string().optional()}))}),Lo=Oo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Or="no-unused-selected-values",pn={name:Or,rule:Lo({name:Or,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[_(Do)]},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===ce.CallExpression&&(o=s.init),!o)return;let i=Mo(o);if(!i)return;let a=n.get(i);if(!a)return;let l=jo(o,a.selectorArgPos??0,a.selectorProp);if(!l)return;let p=$o(l);if(!p)return;let m=Dr(p.properties,void 0);if(!m)return;if(s.id.type===ce.ObjectPattern){let d=Dr(s.id.properties,a.returnProp);if(!d)return;for(let[c,g]of m)d.has(c)||e.report({node:g,messageId:"unusedSelectedValue",data:{name:c}});return}if(s.id.type!==ce.Identifier||a.returnProp)return;let y=_o(s,e.sourceCode);if(y.length===0)return;let u=new Set;for(let d of y){if(d.identifier.parent.type!==ce.MemberExpression)return;let c=d.identifier.parent.property;if(c.type!==ce.Identifier)return;u.add(c.name)}for(let[d,c]of m)u.has(d)||e.report({node:c,messageId:"unusedSelectedValue",data:{name:d}})}}}})};function jo(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===ce.ArrowFunctionExpression||n.type===ce.FunctionExpression)return n;if(r&&n.type===ce.ObjectExpression){let s=n.properties.find(i=>i.type===ce.Property&&i.key.type===ce.Identifier&&i.key.name===r);if(s?.type!==ce.Property)return null;let o=s.value;if(o.type===ce.ArrowFunctionExpression||o.type===ce.FunctionExpression)return o}return null}function Mo(e){return e.callee.type===ce.Identifier?e.callee.name:e.callee.type===ce.MemberExpression&&e.callee.property.type===ce.Identifier?e.callee.property.name:null}function $o(e){if(e.body.type===ce.ObjectExpression)return e.body;if(e.body.type===ce.BlockStatement){let t=e.body.body.filter(r=>r.type===ce.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==ce.ObjectExpression?null:t[0].argument}return null}function Dr(e,t){let r=e;if(t){let s=e.find(o=>o.type===ce.Property&&o.key.type===ce.Identifier&&o.key.name===t);if(s?.type!==ce.Property||s.value.type!==ce.ObjectPattern)return null;r=s.value.properties}let n=new Map;for(let s of r){if(s.type!==ce.Property||s.key.type!==ce.Identifier)return null;n.set(s.key.name,s)}return n.size>0?n:null}function _o(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):[]}import{AST_NODE_TYPES as pe}from"@typescript-eslint/utils";var cn=z({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===pe.ImportDeclaration&&o.source.value==="t-state-form"))return{};let n=null,s=!1;return{CallExpression(o){if(s)return;if(!n){let a=Uo(o);a&&(n=a);return}let i=zo(o,e.sourceCode);if(i){s=!0;for(let a of i)n.delete(a);if(n.size!==0)for(let[a,l]of n)e.report({node:l,messageId:"unusedField",data:{name:a}})}}}}});function Uo(e){if(!(e.callee.type===pe.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==pe.ObjectExpression)return null;let n=Vt(r.properties,o=>o.type!==pe.Property||o.key.type!==pe.Identifier||o.key.name!=="initialConfig"?null:o.value.type===pe.ObjectExpression?o.value:o.value.type===pe.ArrowFunctionExpression||o.value.type===pe.FunctionExpression?Vo(o.value):null);if(!n)return null;let s=new Map;for(let o of n.properties)o.type===pe.Property&&o.key.type===pe.Identifier&&s.set(o.key.name,o);return s}function zo(e,t){if(!(e.callee.type===pe.Identifier&&e.callee.name==="useFormState")||e.parent.type!==pe.VariableDeclarator||e.parent.id.type!==pe.ObjectPattern||!Vt(e.parent.id.properties,i=>i.type===pe.Property&&i.key.type===pe.Identifier&&i.key.name==="formFields"&&i))return null;let s=yr(e.parent,"formFields",t),o=new Set;for(let{identifier:i}of s){if(i.type!==pe.Identifier||i.parent.type===pe.Property&&i.parent.parent.type===pe.ObjectExpression&&i.parent.parent.parent.type===pe.ReturnStatement||i.parent.type===pe.ReturnStatement)return null;if(i.parent.type===pe.MemberExpression){if(i.parent.object.type!==pe.Identifier||i.parent.property.type!==pe.Identifier)return null;o.add(i.parent.property.name)}}return o}function Vo(e){if(e.body.type===pe.ObjectExpression)return e.body;if(e.body.type===pe.BlockStatement){let t=e.body.body.filter(r=>r.type===pe.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==pe.ObjectExpression?null:t[0].argument}return null}import{AST_NODE_TYPES as se,ESLintUtils as Wo}from"@typescript-eslint/utils";import{z as vt}from"zod/v4";var Jo=Wo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Lr(e){let t=[];for(let r of e.members)r.type===se.TSPropertySignature&&r.key.type===se.Identifier&&t.push([r.key.name,r]);return t}function jr(e,...t){for(let r of t)e.set(...r);return e}var Xo=vt.object({forceCheckOnFCPropTypesWithName:vt.array(vt.string()).optional(),alwaysCheckFunctionOptionTypes:vt.boolean().optional()}),Mr="no-unused-type-props-in-args",un=null,Bo=Jo({name:Mr,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:[_(Xo)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!un&&(un=r.map(l=>new RegExp(l)));function s(l,p,m,y,u=!0,d=!1){let c=m.name,g=e.sourceCode.getScope(p).references.find(T=>T.identifier.name===c)?.resolved,h=l&&un?.some(T=>T.test(c)),S=d&&n;if(!g||!h&&g.references.filter(T=>T.isTypeReference).length>1||!g.defs[0])return;let I=g.defs[0].node,A=I.parent?.type===se.ExportNamedDeclaration;if(!(u&&A&&!S)){if(I.type===se.TSTypeAliasDeclaration){o(l,p,y,I.typeAnnotation,!0,d);return}if(I.type===se.TSInterfaceDeclaration){o(l,p,y,I.body,!0,d);return}}}function o(l,p,m,y,u,d=!1){if(y.type===se.TSInterfaceBody){for(let c of y.body)c.type===se.TSPropertySignature&&c.key.type===se.Identifier&&m.set(c.key.name,c);return}if(y.type===se.TSTypeLiteral){jr(m,...Lr(y));return}if(y.type===se.TSIntersectionType){for(let c of y.types)o(l,p,m,c,!0,d);return}u||y.type===se.TSTypeReference&&y.typeName.type===se.Identifier&&s(l,p,y.typeName,m,!0,d)}function i(l,p,m,y=!1){for(let u of m)if(u.type===se.ObjectPattern&&u.typeAnnotation){let d=new Map;if(o(l,p,d,u.typeAnnotation.typeAnnotation,!1,y),d.size===0)continue;a(u,d)}else u.type===se.AssignmentPattern&&u.left.type===se.ObjectPattern&&i(l,p,[u.left],y)}function a(l,p){let m=[];if(l.properties.at(-1)?.type===se.RestElement)return;for(let c of l.properties)c.type===se.Property&&c.key.type===se.Identifier&&m.push(c.key.name);let u=[],d=[];for(let[c,g]of p)m.includes(c)||(d.push(c),u.push({node:g,messageId:"unusedObjectTypeProperty",data:{propertyName:c}}));for(let[c,g]of u.entries())e.report({...g,fix:c===u.length-1?h=>{let S=l.properties.at(-1),I=d.join(", ");return S?S.type===se.RestElement?null:h.insertTextAfter(S,`, ${I}`):h.insertTextBeforeRange([l.range[0]+1,l.range[1]],I)}:void 0})}return{VariableDeclaration(l){let p=l.declarations[0],m=new Map,y=p.id.type===se.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===se.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===se.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(y){if(y.type===se.TSTypeReference&&y.typeName.type===se.Identifier)s(!0,l,y.typeName,m,!1);else if(y.type===se.TSTypeLiteral)jr(m,...Lr(y));else if(y.type===se.TSIntersectionType)for(let u of y.types)u.type===se.TSTypeReference&&u.typeName.type===se.Identifier?s(!0,l,u.typeName,m,!1):o(!0,l,m,u,!0);if(m.size!==0&&p.init?.type===se.ArrowFunctionExpression){let u=p.init.params[0];if(!u){e.report({node:p.init,messageId:"missingComponentParam"});return}u.type===se.ObjectPattern&&a(u,m)}}},FunctionDeclaration(l){i(!1,l,l.params,n)},ArrowFunctionExpression(l){i(!1,l,l.params,n)}}}}),fn={name:Mr,rule:Bo};import{AST_NODE_TYPES as je}from"@typescript-eslint/utils";var mn=z({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===je.Identifier?t.has(n.callee.name):n.callee.type===je.MemberExpression&&n.callee.object.type===je.Identifier&&n.callee.property.type===je.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let s of n.specifiers)s.type===je.ImportSpecifier&&s.imported.type===je.Identifier&&s.imported.name==="useRef"&&t.add(s.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===je.CallExpression&&r(n.init)&&n.id.type===je.Identifier){let o=e.sourceCode.getScope(n).set.get(n.id.name);if(o){let i=!1;for(let a of o.references){let p=a.identifier.parent;if(p!==n&&!(p.type===je.JSXExpressionContainer&&p.parent.type===je.JSXAttribute&&p.parent.name.type===je.JSXIdentifier&&p.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});import{AST_NODE_TYPES as yn,ESLintUtils as Ho}from"@typescript-eslint/utils";var Yo=Ho.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_r="prefer-named-functions",$r=new Map,qo=Yo({name:_r,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[t]){let r=null;if(t.ignoreRegex){let n=$r.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),$r.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===yn.ArrowFunctionExpression&&n.id.type===yn.Identifier){let s=n.id.name;if(n.id.typeAnnotation||r&&r.test(s)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==yn.BlockStatement)return;let o=n.parent,i=n.init.params,a=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:s,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(o,`${l.async?"async ":""}function ${s}(${i.map(m=>e.sourceCode.getText(m)).join(", ")||""}) ${e.sourceCode.getText(a)}`)}]})}}}}}),dn={name:_r,rule:qo};import{AST_NODE_TYPES as K}from"@typescript-eslint/utils";import{z as We}from"zod/v4";var Zo=We.object({disallowedFunctions:We.array(We.object({name:We.string(),allowUsingWithArgs:We.boolean().optional(),hookAlternative:We.string().optional(),message:We.string().optional(),allowUseInside:We.array(We.string()).optional()}))}),Go=/^use[A-Z]/,Ko=/^[A-Z]/;function Rt(e){return Go.test(e)}function Ur(e){return Ko.test(e)}function Qo(e){return e.type===K.Identifier?Rt(e.name):e.type===K.MemberExpression&&e.property.type===K.Identifier?Rt(e.property.name):!1}function zr(e,t){return e.type===K.Identifier?e.name===t:e.type===K.MemberExpression&&e.object.type===K.Identifier&&e.property.type===K.Identifier?e.object.name==="React"&&e.property.name===t:!1}function Vr(e){return!!(e.parent&&e.parent.type===K.CallExpression&&zr(e.parent.callee,"forwardRef"))}function Wr(e){return!!(e.parent&&e.parent.type===K.CallExpression&&zr(e.parent.callee,"memo"))}function gn(e){if(e.type===K.FunctionDeclaration||e.type===K.FunctionExpression&&e.id)return e.id||void 0;if(e.type===K.FunctionExpression||e.type===K.ArrowFunctionExpression){if(e.parent.type===K.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===K.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===K.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===K.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function ea(e){let t=e.parent,r=!1;for(;t;){if(t.type===K.FunctionDeclaration||t.type===K.FunctionExpression||t.type===K.ArrowFunctionExpression){let n=gn(t);if(n&&n.type===K.Identifier){if(Ur(n.name)||Rt(n.name))return!r;r=!0}else{if(Vr(t)||Wr(t))return!r;if(t.parent.type===K.CallExpression){let s=t.parent;Qo(s.callee)||(r=!0)}else t.parent.type===K.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Jr(e){return e.callee.type===K.Identifier?e.callee.name:e.callee.type===K.MemberExpression&&e.callee.property.type===K.Identifier?e.callee.property.name:null}function ta(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===K.FunctionDeclaration||r.type===K.FunctionExpression||r.type===K.ArrowFunctionExpression){let n=gn(r);if(n&&n.type===K.Identifier&&t.includes(n.name))return!0}else if(r.type===K.CallExpression){let n=Jr(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function na(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===K.Identifier&&t.name==="undefined")}function ra(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===K.FunctionDeclaration||n.type===K.FunctionExpression||n.type===K.ArrowFunctionExpression){let s=gn(n);if(s&&s.type===K.Identifier){if(Ur(s.name)||Rt(s.name)){r=!0;break}}else if(Vr(n)||Wr(n)){r=!0;break}}n=n.parent}return r?t.length===0?ea(e):!ta(e,t):!1}var Sn=z({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:[_(Zo)],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=Jr(s);if(!o)return;let i=n.get(o);if(!i||i.allowUsingWithArgs&&na(s))return;let a=i.allowUseInside||[];ra(s,a)&&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:l=>{let p=i.hookAlternative;return p?s.callee.type===K.Identifier?l.replaceText(s.callee,p):s.callee.type===K.MemberExpression&&s.callee.property.type===K.Identifier?l.replaceText(s.callee.property,p):null:null}}]:[]})}}}});import{AST_NODE_TYPES as ge,AST_TOKEN_TYPES as Xr,ESLintUtils as ia}from"@typescript-eslint/utils";import Tn from"zod/v4";var sa=ia.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Hr="prefer-single-line-if",oa=Tn.object({maxLineLength:Tn.number().optional(),maxNonSimpleConditionLength:Tn.number().optional()}),aa=sa({name:Hr,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:[_(oa)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==ge.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===ge.ReturnStatement){if(!qr(o))return}else if(!(o.type===ge.ContinueStatement||o.type===ge.BreakStatement))return;if(n.test.type===ge.LogicalExpression||n.test.type===ge.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let y=Br(n.test);if(!y&&n.test.type===ge.UnaryExpression&&n.test.operator==="!"){let u=n.test.argument;Br(u)&&(y=!0)}if(y&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let a=r.getText(o);if(i.includes(`
18
+ `))return;let l=r.getTokenAfter(n);if(l&&l.type===Xr.Punctuator&&l.value==="}"){let y=r.getTokenAfter(l);if(y&&y.type===Xr.Keyword&&(y.value==="else"||y.value==="catch"))return}let p=la(r,n),m=`if (${i}) ${a}`;t.maxLineLength&&m.length+p.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:y=>y.replaceText(n,m)})}}}});function Br(e){return e.type===ge.CallExpression||e.type===ge.BinaryExpression||e.type===ge.MemberExpression&&Yr(e)}function Yr(e){return e.object.type===ge.MemberExpression?Yr(e.object):e.object.type!==ge.Identifier}function la(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function qr(e){if(!e.argument)return!0;let t=e.argument;return t.type===ge.ArrayExpression&&t.elements.length===0||t.type===ge.ObjectExpression&&t.properties.length===0||t.type===ge.Literal||t.type===ge.Identifier||t.type===ge.TemplateLiteral||t.type===ge.TaggedTemplateExpression?!0:t.type===ge.CallExpression?t.arguments.length===0:t.type===ge.UnaryExpression?qr(t):!1}var En={name:Hr,rule:aa};import{AST_NODE_TYPES as j,ESLintUtils as pa}from"@typescript-eslint/utils";import{z as Zr}from"zod/v4";var ca=pa.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ti="react-compiler-extra",ua=Zr.object({runOnlyWithEnableCompilerDirective:Zr.boolean().optional()}),fa=/eslint +react-compiler\/react-compiler: +\["error/;function lt(e){let t=null;if((e.type===j.FunctionDeclaration||e.type===j.FunctionExpression||e.type===j.ArrowFunctionExpression&&e.body.type===j.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r?r.type===j.ExpressionStatement&&r.expression.type===j.Literal&&r.expression.value==="use no memo":!1}function Gr(e){let t=e.parent;for(;t;){if(t.type===j.FunctionDeclaration||t.type===j.FunctionExpression||t.type===j.ArrowFunctionExpression)return t;t=t.parent}return null}function ma(e){return e.type===j.Identifier?e.name.startsWith("use"):!1}function ni(e){return e.type===j.Identifier?e.name.startsWith("use"):e.type===j.MemberExpression&&e.property.type===j.Identifier?e.property.name.startsWith("use"):!1}function _e(e){if(!e)return!1;switch(e.type){case j.JSXElement:case j.JSXFragment:return!0;case j.ConditionalExpression:return _e(e.consequent)||_e(e.alternate);case j.LogicalExpression:return e.operator==="&&"?_e(e.right):e.operator==="||"?_e(e.left)||_e(e.right):!1;case j.CallExpression:if(e.callee.type===j.MemberExpression&&e.callee.object.type===j.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===j.Identifier&&e.callee.property.name==="createElement")return!0;for(let t of e.arguments)if(t.type!==j.SpreadElement&&_e(t))return!0;return!1;default:return!1}}function ya(e){let t=e.typeAnnotation;if(t.type===j.TSTypeReference){if(t.typeName.type===j.Identifier)return t.typeName.name==="FC";if(t.typeName.type===j.TSQualifiedName&&t.typeName.left.type===j.Identifier&&t.typeName.right.type===j.Identifier)return t.typeName.left.name==="React"&&t.typeName.right.name==="FC"}return!1}var da=/^[A-Z][a-zA-Z0-9]*$/;function St(e){return da.test(e)}function Nt(e){return e.startsWith("use")&&e.length>3}function bn(e,t,r,n){if(r&&ya(r))return t?St(t.name):e.type===j.FunctionDeclaration&&e.id?St(e.id.name):!0;if(t&&Nt(t.name)||e.type===j.FunctionDeclaration&&e.id&&Nt(e.id.name))return!0;if(n){let s=t?.name||e.type===j.FunctionDeclaration&&e.id?.name;if(s&&St(s)&&ri(e.body,n).containsJSX)return!0}return!1}function gt(e){if(e.body.type===j.BlockStatement){for(let t of e.body.body)if(t.type===j.ExpressionStatement&&t.expression.type===j.Literal&&typeof t.expression.value=="string"&&t.expression.value==="use memo")return!0}return!1}function ri(e,t){let r={containsJSX:!1,containsHookCalls:!1};return Le(e,n=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(n.type){case j.JSXElement:case j.JSXFragment:r.containsJSX=!0;break;case j.CallExpression:ma(n.callee)&&(r.containsHookCalls=!0),_e(n)&&(r.containsJSX=!0);break;case j.ReturnStatement:n.argument&&_e(n.argument)&&(r.containsJSX=!0);break;case j.VariableDeclarator:n.init&&_e(n.init)&&(r.containsJSX=!0);break;case j.AssignmentExpression:_e(n.right)&&(r.containsJSX=!0);break}},t),r}function Kr(e,t){let r=e.body,n=ri(r,t);return n.containsJSX||n.containsHookCalls}var ga=/\bthis[.[]/;function Qr(e){return ga.test(e)}function Sa(e,t){let r={containsJSX:!1,containsHookCalls:!1};return Le(e,n=>{if(r.containsHookCalls||(n.type===j.FunctionDeclaration||n.type===j.FunctionExpression||n.type===j.ArrowFunctionExpression)&&n!==e)return!0;n.type===j.CallExpression&&ni(n.callee)&&(r.containsHookCalls=!0)},t),r}function ei(e){return St(e)||Nt(e)}function hn(e,t,r,n){if(!Sa(e.body,t).containsHookCalls)return!1;let o=bn(e,r,n,t);if(!o&&n){let i=r?.name||e.type===j.FunctionDeclaration&&e.id?.name;i&&St(i)&&(o=!0)}return!o}var Ta=ca({name:ti,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:[_(ua)]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let i of e.sourceCode.getAllComments())if(fa.test(i.value)){r=!0;break}if(!r)return{}}function n(i){for(let a of i.properties)if(a.type===j.Property&&a.method&&a.value.type===j.FunctionExpression){let l=e.sourceCode,p=l.getText(a.key),m=a.value,y=l.getText(m.body);if(Qr(y))e.report({node:a,messageId:"thisKeywordInMethod"});else{let u=m.params.map(c=>l.getText(c)).join(", "),d="";m.generator?d=`${p}: function* (${u}) ${y}`:m.async?d=`${p}: async (${u}) => ${y}`:d=`${p}: (${u}) => ${y}`,e.report({node:a,messageId:"objectMethodIsNotSupported",fix:c=>c.replaceText(a,d)})}}}function s(i){for(let a of i.properties)if(a.type===j.Property&&a.value.type===j.ObjectExpression){for(let l of a.value.properties)if(l.type===j.Property&&l.method&&l.value.type===j.FunctionExpression){let m=e.sourceCode.getText(l.value.body);Qr(m)&&e.report({node:l,messageId:"thisKeywordInMethod"})}}}function o(i){let a=Gr(i);return a!==null&&lt(a)}return{CallExpression(i){if(ni(i.callee))for(let a of i.arguments){if(a.type===j.ObjectExpression){if(o(i))return;n(a),s(a)}if(a.type===j.ArrowFunctionExpression){if(a.body.type===j.ObjectExpression){if(o(i))return;n(a.body),s(a.body)}if(a.body.type===j.BlockStatement){for(let l of a.body.body)if(l.type===j.ReturnStatement&&l.argument?.type===j.ObjectExpression){if(o(i))return;n(l.argument),s(l.argument)}}}if(a.type===j.FunctionExpression){for(let l of a.body.body)if(l.type===j.ReturnStatement&&l.argument?.type===j.ObjectExpression){if(o(i))return;n(l.argument),s(l.argument)}}}},VariableDeclarator(i){if(i.id.type===j.Identifier&&i.init&&(i.init.type===j.ArrowFunctionExpression||i.init.type===j.FunctionExpression)){let a=i.init,l=i.id,p=i.id.typeAnnotation;if(gt(a)&&!ei(l.name)){e.report({node:a,messageId:"useMemoDirectiveNaming"});return}if(hn(a,e.sourceCode,l,p)){if(lt(a))return;e.report({node:a,messageId:"functionCallingHooksMustBeComponent"});return}if(bn(a,l,p,e.sourceCode)){let m=Kr(a,e.sourceCode),y=gt(a);if(!m&&!y){if(lt(a))return;e.report({node:a,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(u){if(a.body.type===j.BlockStatement){let d=a.body.range[0]+1;return u.insertTextAfterRange([d,d],`
19
19
  "use memo"
20
20
  `)}return null}}]})}}}},FunctionDeclaration(i){if(i.id&&gt(i)&&!ei(i.id.name)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(hn(i,e.sourceCode)){if(lt(i))return;e.report({node:i,messageId:"functionCallingHooksMustBeComponent"});return}if(bn(i,void 0,void 0,e.sourceCode)){let a=Kr(i,e.sourceCode),l=gt(i);if(!a&&!l){if(lt(i))return;e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(p){let m=i.body.range[0]+1;return p.insertTextAfterRange([m,m],`
21
21
  "use memo"
22
- `)}}]})}}},FunctionExpression(i){if(gt(i)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(hn(i,e.sourceCode)){if(lt(i))return;e.report({node:i,messageId:"functionCallingHooksMustBeComponent"})}},ReturnStatement(i){if(i.argument?.type!==j.ObjectExpression)return;let a=Gr(i);if(!a)return;let l;a.type===j.FunctionDeclaration&&a.id?l=a.id.name:(a.type===j.ArrowFunctionExpression||a.type===j.FunctionExpression)&&a.parent.type===j.VariableDeclarator&&a.parent.id.type===j.Identifier&&(l=a.parent.id.name),l&&Nt(l)&&(o(i)||(n(i.argument),s(i.argument)))}}}}),xn={name:ti,rule:da};import{AST_NODE_TYPES as de,ESLintUtils as ga}from"@typescript-eslint/utils";import{z as Me}from"zod/v4";var Sa=ga.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ii="react-compiler-migration",Ta=Me.object({disallowHooks:Me.array(Me.object({name:Me.string(),replacement:Me.string()})).optional(),disallowMethods:Me.array(Me.object({name:Me.string(),replacement:Me.string().optional(),requireTrueProp:Me.string().optional()})).optional(),runOnlyWithEnableCompilerDirective:Me.boolean().optional()}),Ea=/eslint +react-compiler\/react-compiler: +\["error/;function ha(e){let t=null;if((e.type===de.FunctionDeclaration||e.type===de.FunctionExpression||e.type===de.ArrowFunctionExpression&&e.body.type===de.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r?r.type===de.ExpressionStatement&&r.expression.type===de.Literal&&r.expression.value==="use no memo":!1}function ba(e){let t=e.parent;for(;t;){if(t.type===de.FunctionDeclaration||t.type===de.FunctionExpression||t.type===de.ArrowFunctionExpression)return t;t=t.parent}return null}function xa(e){return e.type===de.Identifier?e.name.startsWith("use"):e.type===de.MemberExpression&&e.property.type===de.Identifier?e.property.name.startsWith("use"):!1}var Ca=Sa({name:ii,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:[_(Ta)]},defaultOptions:[{disallowHooks:[],disallowMethods:[],runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let r=!0;if(t.runOnlyWithEnableCompilerDirective){r=!1;for(let s of e.sourceCode.getAllComments())if(Ea.test(s.value)){r=!0;break}}if(!r)return{};function n(s){let o=ba(s);return o!==null&&ha(o)}return{CallExpression(s){if(t.disallowHooks?.length){let o=null,i=null;if(s.callee.type===de.Identifier?(o=s.callee.name,i=s.callee):s.callee.type===de.MemberExpression&&s.callee.property.type===de.Identifier&&(o=s.callee.property.name,i=s.callee.property),o){let a=t.disallowHooks.find(l=>l.name===o);if(a&&i){if(n(s))return;e.report({node:s,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:a.name,replacement:a.replacement},suggest:[{messageId:"replace",data:{replacement:a.replacement},fix:l=>l.replaceText(i,a.replacement)}]})}}}if(t.disallowMethods?.length&&xa(s.callee)){for(let o of s.arguments)if(o.type===de.ObjectExpression){for(let i of o.properties)if(i.type===de.Property&&i.key.type===de.Identifier){let a=i.key.name,l=t.disallowMethods.find(p=>p.name===a);if(l){if(n(s))return;if(l.requireTrueProp){let p=l.requireTrueProp,m=!1;for(let y of o.properties)if(y.type===de.Property&&y.key.type===de.Identifier&&y.key.name===p&&y.value.type===de.Literal&&y.value.value===!0){m=!0;break}if(!m){e.report({node:i,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:l.name,requireTrueProp:p}});continue}}l.replacement&&e.report({node:i,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:l.name,replacement:l.replacement},suggest:[{messageId:"replace",data:{replacement:l.replacement},fix:p=>l.replacement?p.replaceText(i.key,l.replacement):null}]})}}}}}}}}),Cn={name:ii,rule:Ca};import{AST_NODE_TYPES as ie}from"@typescript-eslint/utils";import{z as si}from"zod/v4";var Ia=/\.(tsx|jsx)$/,Aa=/^[A-Z][A-Za-z0-9]*$/,wa=/^[A-Z][A-Z0-9_]*$/,oi=80,Fa=si.object({ignoreConstCaseVarRegex:si.string().optional()}),An=z({name:"react-no-module-level-single-use-values",meta:{type:"problem",docs:{description:"Disallow module-level allocated data values and long strings that are only used in one React component, excluding functions, inferable aliases, regex values, and class instantiations except Set/Map"},schema:[_(Fa)],messages:{moveValueInsideComponent:"Module-level `{{valueName}}` is only used in React component `{{componentName}}`. Move it inside the component to improve memory usage."}},defaultOptions:[{}],create(e,[t]){if(!Ia.test(e.filename))return{};let r=e.sourceCode,n=_a(t.ignoreConstCaseVarRegex),s=va(r.ast.body);return s.length===0?{}:{VariableDeclarator(o){if(o.id.type!==ie.Identifier||!Ra(o)||!Pa(o.init))return;let i=o.id.name;if(n&&$a(i)&&n.test(i))return;let l=r.getDeclaredVariables(o).find(d=>d.name===i);if(!l)return;let p=new Set,m=!1,y=!1;for(let d of l.references){if(d.init)continue;y=!0;let c=Na(d.identifier,s);if(!c){m=!0;break}if(p.add(c),p.size>1)break}if(!y||m||p.size!==1)return;let[u]=Array.from(p);u&&e.report({node:o.id,messageId:"moveValueInsideComponent",data:{valueName:i,componentName:u}})}}}});function va(e){let t=[],r=new Set;function n(o,i){Aa.test(o)&&(r.has(o)||(r.add(o),t.push({name:o,range:i.range})))}function s(o){for(let i of o.declarations){if(i.id.type!==ie.Identifier)continue;let a=ai(i.init);a&&n(i.id.name,a)}}for(let o of e){if(o.type===ie.VariableDeclaration){s(o);continue}if(o.type===ie.FunctionDeclaration){n(o.id.name,o);continue}o.type===ie.ExportNamedDeclaration&&o.declaration&&(o.declaration.type===ie.VariableDeclaration?s(o.declaration):o.declaration.type===ie.FunctionDeclaration&&o.declaration.id&&n(o.declaration.id.name,o.declaration))}return t}function Ra(e){return e.parent.parent.type===ie.Program}function Na(e,t){let r=null;for(let n of t){if(!(e.range[0]>=n.range[0]&&e.range[1]<=n.range[1]))continue;if(!r){r=n;continue}let o=r.range[1]-r.range[0];n.range[1]-n.range[0]<o&&(r=n)}return r?.name??null}function ai(e){if(!e)return null;let t=In(e);if(t.type===ie.ArrowFunctionExpression||t.type===ie.FunctionExpression)return t;if(t.type!==ie.CallExpression||!ka(t.callee))return null;let r=t.arguments[0];if(!r||r.type===ie.SpreadElement)return null;if(r.type===ie.CallExpression)return ai(r);let n=In(r);return n.type===ie.ArrowFunctionExpression||n.type===ie.FunctionExpression?n:null}function ka(e){return e.type===ie.Identifier?e.name==="memo"||e.name==="forwardRef":e.type===ie.MemberExpression?e.property.type===ie.Identifier&&(e.property.name==="memo"||e.property.name==="forwardRef"):!1}function In(e){let t=e;for(;;){if(t.type===ie.TSAsExpression){t=t.expression;continue}if(t.type===ie.TSSatisfiesExpression){t=t.expression;continue}if(t.type===ie.TSNonNullExpression){t=t.expression;continue}return t}}function Pa(e){if(!e)return!1;let t=In(e);return Oa(t)?!1:Da(t)?!0:La(t)}function Oa(e){return e.type===ie.Identifier||e.type===ie.MemberExpression}function Da(e){if(e.type===ie.Literal)return typeof e.value=="string"&&e.value.length>=oi;if(e.type===ie.TemplateLiteral){if(e.expressions.length>0)return!1;let t=e.quasis[0];return t?t.value.cooked.length>=oi:!1}return!1}function La(e){return e.type===ie.ArrayExpression||e.type===ie.ObjectExpression||e.type===ie.ClassExpression?!0:e.type===ie.NewExpression?ja(e):!1}function ja(e){let t=Ma(e.callee);return t==="Set"||t==="Map"}function Ma(e){return e.type===ie.Identifier?e.name:e.type===ie.MemberExpression?e.computed||e.property.type!==ie.Identifier?null:e.property.name:null}function $a(e){return wa.test(e)}function _a(e){if(!e)return null;try{return new RegExp(e)}catch{return null}}import{AST_NODE_TYPES as V}from"@typescript-eslint/utils";import{z as li}from"zod";var Ua=li.object({runOnlyWithEnableCompilerDirective:li.boolean().optional()}),za=/eslint +react-compiler\/react-compiler: +\["error/,Va=/^\d+$/,Wa=/[\s_-]+/,Ja=/[a-z][A-Z]/,Xa=/^(.+?)([A-Z][a-z]+s?)$/,Ba=/^[a-z][a-zA-Z]*$/;function pi(e,t){let r=[];if(e.type===V.JSXElement){for(let n of e.openingElement.attributes)if(n.type===V.JSXAttribute&&n.name.type===V.JSXIdentifier&&n.value?.type===V.JSXExpressionContainer&&n.value.expression.type!==V.JSXEmptyExpression){let s=n.name.name,o=n.value.expression,i=!1;Le(o,a=>{switch(a.type){case V.ObjectExpression:case V.ArrowFunctionExpression:case V.FunctionExpression:case V.ArrayExpression:return i=!0,!0}return!1},t),i&&r.push(s)}}return{hasUnstable:r.length>0,problematicProps:r}}function Ha(e){if(e.body.type===V.JSXElement||e.body.type===V.JSXFragment)return!0;if(e.body.type===V.BlockStatement){for(let t of e.body.body)if(t.type===V.ReturnStatement&&t.argument&&(t.argument.type===V.JSXElement||t.argument.type===V.JSXFragment))return!0}return!1}function Ya(e,t){let r=e.callee;if(r.type===V.MemberExpression){let n=r.object;if(n.type===V.Identifier){let s=n.name,o=qa(s);if(o!==s)return Fn(o)}}if(t.length>0){let n=t[0];if(n&&n.type===V.Identifier)return Fn(n.name)}return"ListItem"}function qa(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(Ja)){let n=e.match(Xa);if(n){let s=n[1],o=n[2];if(!s||!o)return wn(e);let i=wn(o);if(i!==o)return s+i}}return wn(e)}function wn(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 Fn(e){return e.match(Ba)?e.charAt(0).toUpperCase()+e.slice(1):e.split(Wa).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function ci(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.Identifier&&!t.includes(i.name)&&!o.has(i.name)&&!Va.test(i.name)){let a=i.parent;if(a.type===V.Property&&a.key===i||a.type===V.MemberExpression&&a.property===i&&!a.computed||a.type===V.JSXOpeningElement||a.type===V.JSXClosingElement||a.type===V.JSXAttribute&&a.name.type===V.JSXIdentifier&&a.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 ui(e,t,r,n,s){let i=[...r.map(y=>y.type===V.Identifier?y.name:"item").map((y,u)=>({name:y,type:u===0?`${e}Type`:u===1?"number":"unknown"})),...n],a=i.map(y=>{let u=y.type;return y.name.includes("on")&&u==="any"&&(u="unknown"),` ${y.name}: ${u};`}).join(`
22
+ `)}}]})}}},FunctionExpression(i){if(gt(i)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(hn(i,e.sourceCode)){if(lt(i))return;e.report({node:i,messageId:"functionCallingHooksMustBeComponent"})}},ReturnStatement(i){if(i.argument?.type!==j.ObjectExpression)return;let a=Gr(i);if(!a)return;let l;a.type===j.FunctionDeclaration&&a.id?l=a.id.name:(a.type===j.ArrowFunctionExpression||a.type===j.FunctionExpression)&&a.parent.type===j.VariableDeclarator&&a.parent.id.type===j.Identifier&&(l=a.parent.id.name),l&&Nt(l)&&(o(i)||(n(i.argument),s(i.argument)))}}}}),xn={name:ti,rule:Ta};import{AST_NODE_TYPES as de,ESLintUtils as Ea}from"@typescript-eslint/utils";import{z as Me}from"zod/v4";var ha=Ea.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ii="react-compiler-migration",ba=Me.object({disallowHooks:Me.array(Me.object({name:Me.string(),replacement:Me.string()})).optional(),disallowMethods:Me.array(Me.object({name:Me.string(),replacement:Me.string().optional(),requireTrueProp:Me.string().optional()})).optional(),runOnlyWithEnableCompilerDirective:Me.boolean().optional()}),xa=/eslint +react-compiler\/react-compiler: +\["error/;function Ca(e){let t=null;if((e.type===de.FunctionDeclaration||e.type===de.FunctionExpression||e.type===de.ArrowFunctionExpression&&e.body.type===de.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r?r.type===de.ExpressionStatement&&r.expression.type===de.Literal&&r.expression.value==="use no memo":!1}function Ia(e){let t=e.parent;for(;t;){if(t.type===de.FunctionDeclaration||t.type===de.FunctionExpression||t.type===de.ArrowFunctionExpression)return t;t=t.parent}return null}function Aa(e){return e.type===de.Identifier?e.name.startsWith("use"):e.type===de.MemberExpression&&e.property.type===de.Identifier?e.property.name.startsWith("use"):!1}var wa=ha({name:ii,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:[_(ba)]},defaultOptions:[{disallowHooks:[],disallowMethods:[],runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let r=!0;if(t.runOnlyWithEnableCompilerDirective){r=!1;for(let s of e.sourceCode.getAllComments())if(xa.test(s.value)){r=!0;break}}if(!r)return{};function n(s){let o=Ia(s);return o!==null&&Ca(o)}return{CallExpression(s){if(t.disallowHooks?.length){let o=null,i=null;if(s.callee.type===de.Identifier?(o=s.callee.name,i=s.callee):s.callee.type===de.MemberExpression&&s.callee.property.type===de.Identifier&&(o=s.callee.property.name,i=s.callee.property),o){let a=t.disallowHooks.find(l=>l.name===o);if(a&&i){if(n(s))return;e.report({node:s,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:a.name,replacement:a.replacement},suggest:[{messageId:"replace",data:{replacement:a.replacement},fix:l=>l.replaceText(i,a.replacement)}]})}}}if(t.disallowMethods?.length&&Aa(s.callee)){for(let o of s.arguments)if(o.type===de.ObjectExpression){for(let i of o.properties)if(i.type===de.Property&&i.key.type===de.Identifier){let a=i.key.name,l=t.disallowMethods.find(p=>p.name===a);if(l){if(n(s))return;if(l.requireTrueProp){let p=l.requireTrueProp,m=!1;for(let y of o.properties)if(y.type===de.Property&&y.key.type===de.Identifier&&y.key.name===p&&y.value.type===de.Literal&&y.value.value===!0){m=!0;break}if(!m){e.report({node:i,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:l.name,requireTrueProp:p}});continue}}l.replacement&&e.report({node:i,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:l.name,replacement:l.replacement},suggest:[{messageId:"replace",data:{replacement:l.replacement},fix:p=>l.replacement?p.replaceText(i.key,l.replacement):null}]})}}}}}}}}),Cn={name:ii,rule:wa};import{AST_NODE_TYPES as ie}from"@typescript-eslint/utils";import{z as si}from"zod/v4";var Fa=/\.(tsx|jsx)$/,va=/^[A-Z][A-Za-z0-9]*$/,Ra=/^[A-Z][A-Z0-9_]*$/,oi=80,Na=si.object({ignoreConstCaseVarRegex:si.string().optional()}),An=z({name:"react-no-module-level-single-use-values",meta:{type:"problem",docs:{description:"Disallow module-level allocated data values and long strings that are only used in one React component, excluding functions, inferable aliases, regex values, and class instantiations except Set/Map"},schema:[_(Na)],messages:{moveValueInsideComponent:"Module-level `{{valueName}}` is only used in React component `{{componentName}}`. Move it inside the component to improve memory usage."}},defaultOptions:[{}],create(e,[t]){if(!Fa.test(e.filename))return{};let r=e.sourceCode,n=Va(t.ignoreConstCaseVarRegex),s=ka(r.ast.body);return s.length===0?{}:{VariableDeclarator(o){if(o.id.type!==ie.Identifier||!Pa(o)||!La(o.init))return;let i=o.id.name;if(n&&za(i)&&n.test(i))return;let l=r.getDeclaredVariables(o).find(d=>d.name===i);if(!l)return;let p=new Set,m=!1,y=!1;for(let d of l.references){if(d.init)continue;y=!0;let c=Oa(d.identifier,s);if(!c){m=!0;break}if(p.add(c),p.size>1)break}if(!y||m||p.size!==1)return;let[u]=Array.from(p);u&&e.report({node:o.id,messageId:"moveValueInsideComponent",data:{valueName:i,componentName:u}})}}}});function ka(e){let t=[],r=new Set;function n(o,i){va.test(o)&&(r.has(o)||(r.add(o),t.push({name:o,range:i.range})))}function s(o){for(let i of o.declarations){if(i.id.type!==ie.Identifier)continue;let a=ai(i.init);a&&n(i.id.name,a)}}for(let o of e){if(o.type===ie.VariableDeclaration){s(o);continue}if(o.type===ie.FunctionDeclaration){n(o.id.name,o);continue}o.type===ie.ExportNamedDeclaration&&o.declaration&&(o.declaration.type===ie.VariableDeclaration?s(o.declaration):o.declaration.type===ie.FunctionDeclaration&&o.declaration.id&&n(o.declaration.id.name,o.declaration))}return t}function Pa(e){return e.parent.parent.type===ie.Program}function Oa(e,t){let r=null;for(let n of t){if(!(e.range[0]>=n.range[0]&&e.range[1]<=n.range[1]))continue;if(!r){r=n;continue}let o=r.range[1]-r.range[0];n.range[1]-n.range[0]<o&&(r=n)}return r?.name??null}function ai(e){if(!e)return null;let t=In(e);if(t.type===ie.ArrowFunctionExpression||t.type===ie.FunctionExpression)return t;if(t.type!==ie.CallExpression||!Da(t.callee))return null;let r=t.arguments[0];if(!r||r.type===ie.SpreadElement)return null;if(r.type===ie.CallExpression)return ai(r);let n=In(r);return n.type===ie.ArrowFunctionExpression||n.type===ie.FunctionExpression?n:null}function Da(e){return e.type===ie.Identifier?e.name==="memo"||e.name==="forwardRef":e.type===ie.MemberExpression?e.property.type===ie.Identifier&&(e.property.name==="memo"||e.property.name==="forwardRef"):!1}function In(e){let t=e;for(;;){if(t.type===ie.TSAsExpression){t=t.expression;continue}if(t.type===ie.TSSatisfiesExpression){t=t.expression;continue}if(t.type===ie.TSNonNullExpression){t=t.expression;continue}return t}}function La(e){if(!e)return!1;let t=In(e);return ja(t)?!1:Ma(t)?!0:$a(t)}function ja(e){return e.type===ie.Identifier||e.type===ie.MemberExpression}function Ma(e){if(e.type===ie.Literal)return typeof e.value=="string"&&e.value.length>=oi;if(e.type===ie.TemplateLiteral){if(e.expressions.length>0)return!1;let t=e.quasis[0];return t?t.value.cooked.length>=oi:!1}return!1}function $a(e){return e.type===ie.ArrayExpression||e.type===ie.ObjectExpression||e.type===ie.ClassExpression?!0:e.type===ie.NewExpression?_a(e):!1}function _a(e){let t=Ua(e.callee);return t==="Set"||t==="Map"}function Ua(e){return e.type===ie.Identifier?e.name:e.type===ie.MemberExpression?e.computed||e.property.type!==ie.Identifier?null:e.property.name:null}function za(e){return Ra.test(e)}function Va(e){if(!e)return null;try{return new RegExp(e)}catch{return null}}import{AST_NODE_TYPES as V}from"@typescript-eslint/utils";import{z as li}from"zod";var Wa=li.object({runOnlyWithEnableCompilerDirective:li.boolean().optional()}),Ja=/eslint +react-compiler\/react-compiler: +\["error/,Xa=/^\d+$/,Ba=/[\s_-]+/,Ha=/[a-z][A-Z]/,Ya=/^(.+?)([A-Z][a-z]+s?)$/,qa=/^[a-z][a-zA-Z]*$/;function pi(e,t){let r=[];if(e.type===V.JSXElement){for(let n of e.openingElement.attributes)if(n.type===V.JSXAttribute&&n.name.type===V.JSXIdentifier&&n.value?.type===V.JSXExpressionContainer&&n.value.expression.type!==V.JSXEmptyExpression){let s=n.name.name,o=n.value.expression,i=!1;Le(o,a=>{switch(a.type){case V.ObjectExpression:case V.ArrowFunctionExpression:case V.FunctionExpression:case V.ArrayExpression:return i=!0,!0}return!1},t),i&&r.push(s)}}return{hasUnstable:r.length>0,problematicProps:r}}function Za(e){if(e.body.type===V.JSXElement||e.body.type===V.JSXFragment)return!0;if(e.body.type===V.BlockStatement){for(let t of e.body.body)if(t.type===V.ReturnStatement&&t.argument&&(t.argument.type===V.JSXElement||t.argument.type===V.JSXFragment))return!0}return!1}function Ga(e,t){let r=e.callee;if(r.type===V.MemberExpression){let n=r.object;if(n.type===V.Identifier){let s=n.name,o=Ka(s);if(o!==s)return Fn(o)}}if(t.length>0){let n=t[0];if(n&&n.type===V.Identifier)return Fn(n.name)}return"ListItem"}function Ka(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(Ha)){let n=e.match(Ya);if(n){let s=n[1],o=n[2];if(!s||!o)return wn(e);let i=wn(o);if(i!==o)return s+i}}return wn(e)}function wn(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 Fn(e){return e.match(qa)?e.charAt(0).toUpperCase()+e.slice(1):e.split(Ba).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function ci(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.Identifier&&!t.includes(i.name)&&!o.has(i.name)&&!Xa.test(i.name)){let a=i.parent;if(a.type===V.Property&&a.key===i||a.type===V.MemberExpression&&a.property===i&&!a.computed||a.type===V.JSXOpeningElement||a.type===V.JSXClosingElement||a.type===V.JSXAttribute&&a.name.type===V.JSXIdentifier&&a.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 ui(e,t,r,n,s){let i=[...r.map(y=>y.type===V.Identifier?y.name:"item").map((y,u)=>({name:y,type:u===0?`${e}Type`:u===1?"number":"unknown"})),...n],a=i.map(y=>{let u=y.type;return y.name.includes("on")&&u==="any"&&(u="unknown"),` ${y.name}: ${u};`}).join(`
23
23
  `),l=i.map(y=>y.name).join(", "),p=s.getText(t),m=`${e}Props`;return`type ${m} = {
24
24
  ${a}
25
25
  };
@@ -28,22 +28,22 @@ const ${e}: FC<${m}> = ({ ${l} }) => {
28
28
  return (
29
29
  ${p}
30
30
  );
31
- };`}function Za(e,t,r,n){let s=t.map(i=>i.type===V.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 Ga(e){if(e.type===V.JSXElement&&e.openingElement.name.type===V.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return Fn(t)}return"ListItem"}function Ka(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 fi(e,t){for(let r of e.openingElement.attributes)if(r.type===V.JSXAttribute&&r.name.type===V.JSXIdentifier&&r.name.name==="key"&&r.value&&r.value.type===V.JSXExpressionContainer&&r.value.expression.type!==V.JSXEmptyExpression)return t.getText(r.value.expression);return null}var vn=z({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:[_(Ua)],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(za.test(s.value)){n=!0;break}if(!n)return{}}return{CallExpression(n){n.callee.type===V.MemberExpression&&n.callee.property.type===V.Identifier&&(n.callee.property.name==="map"||n.callee.property.name==="push")&&(n.callee.property.name==="map"?Qa(n,r,e):el(n,r,e))}}}});function Qa(e,t,r){let n=e.arguments[0];if(!n||n.type!==V.ArrowFunctionExpression&&n.type!==V.FunctionExpression||!Ha(n))return;let s=null;if(n.body.type===V.JSXElement||n.body.type===V.JSXFragment?s=n.body:n.body.type===V.BlockStatement&&n.body.body[0]?.type===V.ReturnStatement&&n.body.body[0].argument&&(n.body.body[0].argument.type===V.JSXElement||n.body.body[0].argument.type===V.JSXFragment)&&(s=n.body.body[0].argument),!s)return;let o=pi(s,t);if(!o.hasUnstable)return;let i=Ya(e,n.params),a=n.params.map(y=>y.type===V.Identifier?y.name:"item"),l=ci(s,a,t),p=s.type===V.JSXElement?fi(s,t):null,m=o.problematicProps.length===1?`prop "${o.problematicProps[0]}"`:`props "${o.problematicProps.join('", "')}"`;r.report({node:s,messageId:"unstableValueInMap",data:{problematicProps:m},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:y=>{let u=ui(i,s,n.params,l,t),d=Za(i,n.params,l,p),c=e;for(;c.parent.type!==V.Program&&!(c.type===V.FunctionDeclaration||c.type===V.VariableDeclarator&&c.init&&(c.init.type===V.ArrowFunctionExpression||c.init.type===V.FunctionExpression));)c=c.parent;let g=[];return g.push(y.insertTextAfter(c,`
31
+ };`}function Qa(e,t,r,n){let s=t.map(i=>i.type===V.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 el(e){if(e.type===V.JSXElement&&e.openingElement.name.type===V.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return Fn(t)}return"ListItem"}function tl(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 fi(e,t){for(let r of e.openingElement.attributes)if(r.type===V.JSXAttribute&&r.name.type===V.JSXIdentifier&&r.name.name==="key"&&r.value&&r.value.type===V.JSXExpressionContainer&&r.value.expression.type!==V.JSXEmptyExpression)return t.getText(r.value.expression);return null}var vn=z({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:[_(Wa)],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(Ja.test(s.value)){n=!0;break}if(!n)return{}}return{CallExpression(n){n.callee.type===V.MemberExpression&&n.callee.property.type===V.Identifier&&(n.callee.property.name==="map"||n.callee.property.name==="push")&&(n.callee.property.name==="map"?nl(n,r,e):rl(n,r,e))}}}});function nl(e,t,r){let n=e.arguments[0];if(!n||n.type!==V.ArrowFunctionExpression&&n.type!==V.FunctionExpression||!Za(n))return;let s=null;if(n.body.type===V.JSXElement||n.body.type===V.JSXFragment?s=n.body:n.body.type===V.BlockStatement&&n.body.body[0]?.type===V.ReturnStatement&&n.body.body[0].argument&&(n.body.body[0].argument.type===V.JSXElement||n.body.body[0].argument.type===V.JSXFragment)&&(s=n.body.body[0].argument),!s)return;let o=pi(s,t);if(!o.hasUnstable)return;let i=Ga(e,n.params),a=n.params.map(y=>y.type===V.Identifier?y.name:"item"),l=ci(s,a,t),p=s.type===V.JSXElement?fi(s,t):null,m=o.problematicProps.length===1?`prop "${o.problematicProps[0]}"`:`props "${o.problematicProps.join('", "')}"`;r.report({node:s,messageId:"unstableValueInMap",data:{problematicProps:m},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:y=>{let u=ui(i,s,n.params,l,t),d=Qa(i,n.params,l,p),c=e;for(;c.parent.type!==V.Program&&!(c.type===V.FunctionDeclaration||c.type===V.VariableDeclarator&&c.init&&(c.init.type===V.ArrowFunctionExpression||c.init.type===V.FunctionExpression));)c=c.parent;let g=[];return g.push(y.insertTextAfter(c,`
32
32
 
33
- ${u}`)),g.push(y.replaceText(s,d)),g}}]})}function el(e,t,r){let n=e.arguments[0];if(!n||n.type!==V.JSXElement&&n.type!==V.JSXFragment)return;let s=n,o=pi(s,t);if(!o.hasUnstable)return;let i=Ga(s),a=ci(s,[],t),l=s.type===V.JSXElement?fi(s,t):null,p=o.problematicProps.length===1?`prop "${o.problematicProps[0]}"`:`props "${o.problematicProps.join('", "')}"`;r.report({node:s,messageId:"unstableValueInMap",data:{problematicProps:p},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:m=>{let y=ui(i,s,[],a,t),u=Ka(i,a,l),d=e;for(;d.parent.type!==V.Program&&!(d.type===V.FunctionDeclaration||d.type===V.VariableDeclarator&&d.init&&(d.init.type===V.ArrowFunctionExpression||d.init.type===V.FunctionExpression));)d=d.parent;let c=[];return c.push(m.insertTextAfter(d,`
33
+ ${u}`)),g.push(y.replaceText(s,d)),g}}]})}function rl(e,t,r){let n=e.arguments[0];if(!n||n.type!==V.JSXElement&&n.type!==V.JSXFragment)return;let s=n,o=pi(s,t);if(!o.hasUnstable)return;let i=el(s),a=ci(s,[],t),l=s.type===V.JSXElement?fi(s,t):null,p=o.problematicProps.length===1?`prop "${o.problematicProps[0]}"`:`props "${o.problematicProps.join('", "')}"`;r.report({node:s,messageId:"unstableValueInMap",data:{problematicProps:p},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:m=>{let y=ui(i,s,[],a,t),u=tl(i,a,l),d=e;for(;d.parent.type!==V.Program&&!(d.type===V.FunctionDeclaration||d.type===V.VariableDeclarator&&d.init&&(d.init.type===V.ArrowFunctionExpression||d.init.type===V.FunctionExpression));)d=d.parent;let c=[];return c.push(m.insertTextAfter(d,`
34
34
 
35
- ${y}`)),c.push(m.replaceText(s,u)),c}}]})}import{ESLintUtils as tl,TSESTree as nl}from"@typescript-eslint/utils";var rl=tl.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mi="require-description",il=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,sl=/^eslint-disable-(next-)?line$/u,ol=rl({name:mi,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=al(s);o!=null&&(n.has(o.kind)||o.description||e.report({loc:cl(s.loc),messageId:"missingDescription"}))}}}}}),yi={name:mi,rule:ol};function al(e){let{text:t,description:r}=pl(e.value);if(!t)return null;let n=il.exec(t);if(!n)return null;let s=n[1];if(!s)return null;let o=sl.test(s);if(e.type===nl.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 ll=/\s-{2,}\s/u;function pl(e){let t=e.split(ll);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function cl(e){return{start:{line:e.start.line,column:-1},end:e.end}}import{AST_NODE_TYPES as ne}from"@typescript-eslint/utils";import{z as Je}from"zod/v4";var ul=Je.object({varsToCheck:Je.array(Je.object({selector:Je.string().optional(),fromFnCall:Je.string().optional(),prop:Je.string().or(Je.array(Je.string())),errorMsg:Je.string().optional()}))}),Rn=z({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:[_(ul)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,a,l,p){let m=new Set;for(let u of i.properties)u.type===ne.Property&&u.key.type===ne.Identifier&&m.add(u.key.name);let y=a.filter(u=>!m.has(u));if(y.length>0)if(y.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:y[0],fnName:p,customMsg:l||""}});else{let u=y.map(d=>`"${d}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:u,fnName:p,customMsg:l||""}})}}function s(i){if(i.init?.type===ne.CallExpression){if(i.init.callee.type===ne.Identifier)return i.init.callee.name;if(i.init.callee.type===ne.MemberExpression&&i.init.callee.property.type===ne.Identifier)return i.init.callee.object.type===ne.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]=a=>{if(a.type===ne.VariableDeclarator&&a.id.type===ne.Identifier&&r.set(a.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:a.id,fnName:s(a)}),a.type===ne.VariableDeclarator&&a.id.type===ne.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(a.id,l,i.errorMsg,s(a))}});for(let i of t.varsToCheck)if(i.fromFnCall){let a=i.fromFnCall;if(a.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${a.slice(2)}"]`;o[p]=m=>{if(m.type!==ne.MemberExpression||m.parent.type!==ne.CallExpression)return;let y=m.parent;if(y.parent.type!==ne.VariableDeclarator)return;let u=y.parent;if(u.id.type===ne.Identifier)r.set(u.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:u.id,fnName:i.fromFnCall||"unknown function"});else if(u.id.type===ne.ObjectPattern){let d=Array.isArray(i.prop)?i.prop:[i.prop];n(u.id,d,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(a.includes(".")){let[l,p]=a.split("."),m=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;o[m]=y=>{if(y.type!==ne.MemberExpression||y.parent.type!==ne.CallExpression)return;let u=y.parent;if(u.parent.type!==ne.VariableDeclarator)return;let d=u.parent;if(d.id.type===ne.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===ne.ObjectPattern){let c=Array.isArray(i.prop)?i.prop:[i.prop];n(d.id,c,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${a}"]`;o[l]=p=>{if(p.type!==ne.Identifier||p.parent.type!==ne.CallExpression)return;let m=p.parent;if(m.parent.type!==ne.VariableDeclarator)return;let y=m.parent;if(y.id.type===ne.Identifier)r.set(y.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:y.id,fnName:i.fromFnCall||"unknown function"});else if(y.id.type===ne.ObjectPattern){let u=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,u,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...o,"Program:exit"(){for(let[i,{props:a,errorMsg:l,node:p,fnName:m}]of r){let u=e.sourceCode.getScope(p).set.get(i);if(u){let d=new Set(a);for(let c of u.references){let g=c.identifier,h=g.parent;if(!(h.type===ne.VariableDeclarator&&h.id===g)){if(h.type===ne.MemberExpression&&h.object===g&&h.property.type===ne.Identifier&&d.has(h.property.name)){if(d.delete(h.property.name),d.size===0)break;continue}if(h.type===ne.VariableDeclarator&&h.init===g&&h.id.type===ne.ObjectPattern){for(let S of h.id.properties)S.type===ne.Property&&S.key.type===ne.Identifier&&d.has(S.key.name)&&d.delete(S.key.name);if(d.size===0)break;continue}if(!(h.type===ne.MemberExpression&&h.object===g&&h.property.type===ne.Identifier&&!a.includes(h.property.name))){d.clear();break}}}if(d.size>0){let c=Array.from(d);if(c.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:c[0],fnName:m,customMsg:l||""}});else{let g=c.map(h=>`"${h}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:g,fnName:m,customMsg:l||""}})}}}}}}}});function Ei(e){return/^use[A-Z0-9]/.test(e)}function kt(e){return e.type==="Identifier"?Ei(e.name):e.type==="MemberExpression"&&!e.computed&&kt(e.property)?e.object.type==="Identifier":!1}function hi(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function bi(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function xi(e){return!!(e.parent&&e.parent.callee&&bi(e.parent.callee,"forwardRef"))}function Ci(e){return!!(e.parent&&e.parent.callee&&bi(e.parent.callee,"memo"))}function Nn(e){for(;e;){let t=Ai(e);if(t&&(hi(t)||kt(t))||xi(e)||Ci(e))return!0;e=e.parent}return!1}function di(e){return!1}function kn(e){return!1}var fl=/eslint +react-compiler\/react-compiler: +\["error/;function gi(e){let t=null;if((e.type==="FunctionDeclaration"||e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"&&e.body.type==="BlockStatement")&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r.type==="ExpressionStatement"&&r.expression.type==="Literal"&&r.expression.value==="use no memo"}function Si(e){let t=e.parent;for(;t;){if(t.type==="FunctionDeclaration"||t.type==="FunctionExpression"||t.type==="ArrowFunctionExpression")return t;t=t.parent}return null}var Ii={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"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let t=!!e.options[0]?.reactCompilerIsEnabled;if(t)return{CallExpression(p){let m=null;if(p.callee.name==="useMemo"?m="useMemo":p.callee.name==="useCallback"&&(m="useCallback"),m){let y=Si(p);if(y&&gi(y))return;e.report({node:p,message:`"${m}" is not necessary when using React Compiler.`})}}};if(e.options[0]?.ignoreIfReactCompilerIsEnabled||t){for(let p of e.sourceCode.getAllComments())if(fl.test(p.value))return{CallExpression(m){let y=null;if(m.callee.name==="useMemo"?y="useMemo":m.callee.name==="useCallback"&&(y="useCallback"),y){let u=Si(m);if(u&&gi(u))return;e.report({node:m,message:`"${y}" is not necessary when using React Compiler.`})}}}}let r=typeof e.getSource=="function"?p=>r(p):p=>e.sourceCode.getText(p),n=typeof e.getScope=="function"?()=>n():p=>e.sourceCode.getScope(p),s=null,o=[],i=[],a=new WeakSet;function l(p){for(let m of p.references){let y=m.identifier.parent;if(y.type==="VariableDeclarator"&&y.init&&y.init.type==="CallExpression"&&y.init.callee&&di(y.init.callee))for(let u of m.resolved.references)u!==m&&a.add(u.identifier)}}return{onCodePathSegmentStart:p=>i.push(p),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(p,m){let y=o.pop();if(y.size===0)return;let u=new Set;function d(b,C){let{cache:w}=d,N=w.get(b.id),k=new Set(C);if(k.has(b.id)){let O=[...k],f=O.slice(O.indexOf(b.id)+1);for(let x of f)u.add(x);return BigInt("0")}if(k.add(b.id),N!==void 0)return N;if(p.thrownSegments.includes(b))N=BigInt("0");else if(b.prevSegments.length===0)N=BigInt("1");else{N=BigInt("0");for(let O of b.prevSegments)N+=d(O,k)}return b.reachable&&N===BigInt("0")?w.delete(b.id):w.set(b.id,N),N}function c(b,C){let{cache:w}=c,N=w.get(b.id),k=new Set(C);if(k.has(b.id)){let O=Array.from(k),f=O.slice(O.indexOf(b.id)+1);for(let x of f)u.add(x);return BigInt("0")}if(k.add(b.id),N!==void 0)return N;if(p.thrownSegments.includes(b))N=BigInt("0");else if(b.nextSegments.length===0)N=BigInt("1");else{N=BigInt("0");for(let O of b.nextSegments)N+=c(O,k)}return w.set(b.id,N),N}function g(b){let{cache:C}=g,w=C.get(b.id);if(w===null)return 1/0;if(w!==void 0)return w;if(C.set(b.id,null),b.prevSegments.length===0)w=1;else{w=1/0;for(let N of b.prevSegments){let k=g(N);k<w&&(w=k)}w+=1}return C.set(b.id,w),w}d.cache=new Map,c.cache=new Map,g.cache=new Map;let h=c(p.initialSegment),S=Ai(m),I=Nn(m),A=S?hi(S)||kt(S):xi(m)||Ci(m),T=1/0;for(let b of p.finalSegments){if(!b.reachable)continue;let C=g(b);C<T&&(T=C)}for(let[b,C]of y){if(!b.reachable)continue;let w=b.nextSegments.length===0?T<=g(b):T<g(b),N=d(b)*c(b),k=u.has(b.id);for(let O of C)if(k&&!kn(O)&&e.report({node:O,message:`React Hook "${r(O)}" 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.`}),A){if(m.async&&e.report({node:O,message:`React Hook "${r(O)}" cannot be called in an async function.`}),!k&&N!==h&&!kn(O)){let x=`React Hook "${r(O)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(w?" Did you accidentally call a React Hook after an early return?":"");e.report({node:O,message:x})}}else if(m.parent&&(m.parent.type==="MethodDefinition"||m.parent.type==="ClassProperty")&&m.parent.value===m){let f=`React Hook "${r(O)}" 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:O,message:f})}else if(S){let f=`React Hook "${r(O)}" is called in function "${r(S)}" 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:O,message:f})}else if(m.type==="Program"){let f=`React Hook "${r(O)}" 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:O,message:f})}else if(I&&!kn(O)){if(m.parent.type==="CallExpression"&&m.parent.callee.type==="Identifier"&&m.parent.callee.name==="useCallback"){let x=m.parent;if(x.parent.type==="VariableDeclarator"&&Ei(x.parent.id.name))return}let f=`React Hook "${r(O)}" 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:O,message:f})}}},CallExpression(p){if(kt(p.callee)){let m=Ti(o),y=Ti(i),u=m.get(y);u||(u=[],m.set(y,u)),u.push(p.callee)}p.callee.type==="Identifier"&&(p.callee.name==="useEffect"||di(p.callee))&&p.arguments.length>0&&(s=p)},Identifier(p){s==null&&a.has(p)&&p.parent.type!=="CallExpression"&&e.report({node:p,message:`\`${r(p)}\` 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"(p){p===s&&(s=null)},FunctionDeclaration(p){Nn(p)&&l(n(p))},ArrowFunctionExpression(p){Nn(p)&&l(n(p))}}}};function Ai(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 Ti(e){return e[e.length-1]}import{AST_NODE_TYPES as he,AST_TOKEN_TYPES as ml}from"@typescript-eslint/utils";import*as Ie from"zod/v4";var yl=/^\s+$/,Pn=/\r?\n/,dl=/^(\s*)/,gl=/^(\s*)\S/,Sl=/\r?\n/,Tl=Ie.object({indent:Ie.union([Ie.string().regex(yl),Ie.number().int().min(1)]).optional(),tags:Ie.array(Ie.string()).optional(),functions:Ie.array(Ie.string()).optional(),comments:Ie.array(Ie.string()).optional()}),On=z({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[_(Tl)],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(S=>S.toLowerCase());function a(S){let I=S.split(Pn),A=I.filter(b=>b.trim()!=="");if(A.length===0)return S;let T=Number.POSITIVE_INFINITY;for(let b of A){let C=b.match(dl);C&&(T=Math.min(T,C[1]?.length??0))}return!isFinite(T)||T===0?S:I.map(b=>b.slice(T)).join(`
35
+ ${y}`)),c.push(m.replaceText(s,u)),c}}]})}import{ESLintUtils as il,TSESTree as sl}from"@typescript-eslint/utils";var ol=il.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mi="require-description",al=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,ll=/^eslint-disable-(next-)?line$/u,pl=ol({name:mi,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=cl(s);o!=null&&(n.has(o.kind)||o.description||e.report({loc:ml(s.loc),messageId:"missingDescription"}))}}}}}),yi={name:mi,rule:pl};function cl(e){let{text:t,description:r}=fl(e.value);if(!t)return null;let n=al.exec(t);if(!n)return null;let s=n[1];if(!s)return null;let o=ll.test(s);if(e.type===sl.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 ul=/\s-{2,}\s/u;function fl(e){let t=e.split(ul);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function ml(e){return{start:{line:e.start.line,column:-1},end:e.end}}import{AST_NODE_TYPES as ne}from"@typescript-eslint/utils";import{z as Je}from"zod/v4";var yl=Je.object({varsToCheck:Je.array(Je.object({selector:Je.string().optional(),fromFnCall:Je.string().optional(),prop:Je.string().or(Je.array(Je.string())),errorMsg:Je.string().optional()}))}),Rn=z({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:[_(yl)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,a,l,p){let m=new Set;for(let u of i.properties)u.type===ne.Property&&u.key.type===ne.Identifier&&m.add(u.key.name);let y=a.filter(u=>!m.has(u));if(y.length>0)if(y.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:y[0],fnName:p,customMsg:l||""}});else{let u=y.map(d=>`"${d}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:u,fnName:p,customMsg:l||""}})}}function s(i){if(i.init?.type===ne.CallExpression){if(i.init.callee.type===ne.Identifier)return i.init.callee.name;if(i.init.callee.type===ne.MemberExpression&&i.init.callee.property.type===ne.Identifier)return i.init.callee.object.type===ne.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]=a=>{if(a.type===ne.VariableDeclarator&&a.id.type===ne.Identifier&&r.set(a.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:a.id,fnName:s(a)}),a.type===ne.VariableDeclarator&&a.id.type===ne.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(a.id,l,i.errorMsg,s(a))}});for(let i of t.varsToCheck)if(i.fromFnCall){let a=i.fromFnCall;if(a.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${a.slice(2)}"]`;o[p]=m=>{if(m.type!==ne.MemberExpression||m.parent.type!==ne.CallExpression)return;let y=m.parent;if(y.parent.type!==ne.VariableDeclarator)return;let u=y.parent;if(u.id.type===ne.Identifier)r.set(u.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:u.id,fnName:i.fromFnCall||"unknown function"});else if(u.id.type===ne.ObjectPattern){let d=Array.isArray(i.prop)?i.prop:[i.prop];n(u.id,d,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(a.includes(".")){let[l,p]=a.split("."),m=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;o[m]=y=>{if(y.type!==ne.MemberExpression||y.parent.type!==ne.CallExpression)return;let u=y.parent;if(u.parent.type!==ne.VariableDeclarator)return;let d=u.parent;if(d.id.type===ne.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===ne.ObjectPattern){let c=Array.isArray(i.prop)?i.prop:[i.prop];n(d.id,c,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${a}"]`;o[l]=p=>{if(p.type!==ne.Identifier||p.parent.type!==ne.CallExpression)return;let m=p.parent;if(m.parent.type!==ne.VariableDeclarator)return;let y=m.parent;if(y.id.type===ne.Identifier)r.set(y.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:y.id,fnName:i.fromFnCall||"unknown function"});else if(y.id.type===ne.ObjectPattern){let u=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,u,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...o,"Program:exit"(){for(let[i,{props:a,errorMsg:l,node:p,fnName:m}]of r){let u=e.sourceCode.getScope(p).set.get(i);if(u){let d=new Set(a);for(let c of u.references){let g=c.identifier,h=g.parent;if(!(h.type===ne.VariableDeclarator&&h.id===g)){if(h.type===ne.MemberExpression&&h.object===g&&h.property.type===ne.Identifier&&d.has(h.property.name)){if(d.delete(h.property.name),d.size===0)break;continue}if(h.type===ne.VariableDeclarator&&h.init===g&&h.id.type===ne.ObjectPattern){for(let S of h.id.properties)S.type===ne.Property&&S.key.type===ne.Identifier&&d.has(S.key.name)&&d.delete(S.key.name);if(d.size===0)break;continue}if(!(h.type===ne.MemberExpression&&h.object===g&&h.property.type===ne.Identifier&&!a.includes(h.property.name))){d.clear();break}}}if(d.size>0){let c=Array.from(d);if(c.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:c[0],fnName:m,customMsg:l||""}});else{let g=c.map(h=>`"${h}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:g,fnName:m,customMsg:l||""}})}}}}}}}});function Ei(e){return/^use[A-Z0-9]/.test(e)}function kt(e){return e.type==="Identifier"?Ei(e.name):e.type==="MemberExpression"&&!e.computed&&kt(e.property)?e.object.type==="Identifier":!1}function hi(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function bi(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function xi(e){return!!(e.parent&&e.parent.callee&&bi(e.parent.callee,"forwardRef"))}function Ci(e){return!!(e.parent&&e.parent.callee&&bi(e.parent.callee,"memo"))}function Nn(e){for(;e;){let t=Ai(e);if(t&&(hi(t)||kt(t))||xi(e)||Ci(e))return!0;e=e.parent}return!1}function di(e){return!1}function kn(e){return!1}var dl=/eslint +react-compiler\/react-compiler: +\["error/;function gi(e){let t=null;if((e.type==="FunctionDeclaration"||e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"&&e.body.type==="BlockStatement")&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r.type==="ExpressionStatement"&&r.expression.type==="Literal"&&r.expression.value==="use no memo"}function Si(e){let t=e.parent;for(;t;){if(t.type==="FunctionDeclaration"||t.type==="FunctionExpression"||t.type==="ArrowFunctionExpression")return t;t=t.parent}return null}var Ii={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"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let t=!!e.options[0]?.reactCompilerIsEnabled;if(t)return{CallExpression(p){let m=null;if(p.callee.name==="useMemo"?m="useMemo":p.callee.name==="useCallback"&&(m="useCallback"),m){let y=Si(p);if(y&&gi(y))return;e.report({node:p,message:`"${m}" is not necessary when using React Compiler.`})}}};if(e.options[0]?.ignoreIfReactCompilerIsEnabled||t){for(let p of e.sourceCode.getAllComments())if(dl.test(p.value))return{CallExpression(m){let y=null;if(m.callee.name==="useMemo"?y="useMemo":m.callee.name==="useCallback"&&(y="useCallback"),y){let u=Si(m);if(u&&gi(u))return;e.report({node:m,message:`"${y}" is not necessary when using React Compiler.`})}}}}let r=typeof e.getSource=="function"?p=>r(p):p=>e.sourceCode.getText(p),n=typeof e.getScope=="function"?()=>n():p=>e.sourceCode.getScope(p),s=null,o=[],i=[],a=new WeakSet;function l(p){for(let m of p.references){let y=m.identifier.parent;if(y.type==="VariableDeclarator"&&y.init&&y.init.type==="CallExpression"&&y.init.callee&&di(y.init.callee))for(let u of m.resolved.references)u!==m&&a.add(u.identifier)}}return{onCodePathSegmentStart:p=>i.push(p),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(p,m){let y=o.pop();if(y.size===0)return;let u=new Set;function d(b,C){let{cache:w}=d,N=w.get(b.id),k=new Set(C);if(k.has(b.id)){let O=[...k],f=O.slice(O.indexOf(b.id)+1);for(let x of f)u.add(x);return BigInt("0")}if(k.add(b.id),N!==void 0)return N;if(p.thrownSegments.includes(b))N=BigInt("0");else if(b.prevSegments.length===0)N=BigInt("1");else{N=BigInt("0");for(let O of b.prevSegments)N+=d(O,k)}return b.reachable&&N===BigInt("0")?w.delete(b.id):w.set(b.id,N),N}function c(b,C){let{cache:w}=c,N=w.get(b.id),k=new Set(C);if(k.has(b.id)){let O=Array.from(k),f=O.slice(O.indexOf(b.id)+1);for(let x of f)u.add(x);return BigInt("0")}if(k.add(b.id),N!==void 0)return N;if(p.thrownSegments.includes(b))N=BigInt("0");else if(b.nextSegments.length===0)N=BigInt("1");else{N=BigInt("0");for(let O of b.nextSegments)N+=c(O,k)}return w.set(b.id,N),N}function g(b){let{cache:C}=g,w=C.get(b.id);if(w===null)return 1/0;if(w!==void 0)return w;if(C.set(b.id,null),b.prevSegments.length===0)w=1;else{w=1/0;for(let N of b.prevSegments){let k=g(N);k<w&&(w=k)}w+=1}return C.set(b.id,w),w}d.cache=new Map,c.cache=new Map,g.cache=new Map;let h=c(p.initialSegment),S=Ai(m),I=Nn(m),A=S?hi(S)||kt(S):xi(m)||Ci(m),T=1/0;for(let b of p.finalSegments){if(!b.reachable)continue;let C=g(b);C<T&&(T=C)}for(let[b,C]of y){if(!b.reachable)continue;let w=b.nextSegments.length===0?T<=g(b):T<g(b),N=d(b)*c(b),k=u.has(b.id);for(let O of C)if(k&&!kn(O)&&e.report({node:O,message:`React Hook "${r(O)}" 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.`}),A){if(m.async&&e.report({node:O,message:`React Hook "${r(O)}" cannot be called in an async function.`}),!k&&N!==h&&!kn(O)){let x=`React Hook "${r(O)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(w?" Did you accidentally call a React Hook after an early return?":"");e.report({node:O,message:x})}}else if(m.parent&&(m.parent.type==="MethodDefinition"||m.parent.type==="ClassProperty")&&m.parent.value===m){let f=`React Hook "${r(O)}" 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:O,message:f})}else if(S){let f=`React Hook "${r(O)}" is called in function "${r(S)}" 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:O,message:f})}else if(m.type==="Program"){let f=`React Hook "${r(O)}" 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:O,message:f})}else if(I&&!kn(O)){if(m.parent.type==="CallExpression"&&m.parent.callee.type==="Identifier"&&m.parent.callee.name==="useCallback"){let x=m.parent;if(x.parent.type==="VariableDeclarator"&&Ei(x.parent.id.name))return}let f=`React Hook "${r(O)}" 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:O,message:f})}}},CallExpression(p){if(kt(p.callee)){let m=Ti(o),y=Ti(i),u=m.get(y);u||(u=[],m.set(y,u)),u.push(p.callee)}p.callee.type==="Identifier"&&(p.callee.name==="useEffect"||di(p.callee))&&p.arguments.length>0&&(s=p)},Identifier(p){s==null&&a.has(p)&&p.parent.type!=="CallExpression"&&e.report({node:p,message:`\`${r(p)}\` 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"(p){p===s&&(s=null)},FunctionDeclaration(p){Nn(p)&&l(n(p))},ArrowFunctionExpression(p){Nn(p)&&l(n(p))}}}};function Ai(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 Ti(e){return e[e.length-1]}import{AST_NODE_TYPES as he,AST_TOKEN_TYPES as gl}from"@typescript-eslint/utils";import*as Ie from"zod/v4";var Sl=/^\s+$/,Pn=/\r?\n/,Tl=/^(\s*)/,El=/^(\s*)\S/,hl=/\r?\n/,bl=Ie.object({indent:Ie.union([Ie.string().regex(Sl),Ie.number().int().min(1)]).optional(),tags:Ie.array(Ie.string()).optional(),functions:Ie.array(Ie.string()).optional(),comments:Ie.array(Ie.string()).optional()}),On=z({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[_(bl)],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(S=>S.toLowerCase());function a(S){let I=S.split(Pn),A=I.filter(b=>b.trim()!=="");if(A.length===0)return S;let T=Number.POSITIVE_INFINITY;for(let b of A){let C=b.match(Tl);C&&(T=Math.min(T,C[1]?.length??0))}return!isFinite(T)||T===0?S:I.map(b=>b.slice(T)).join(`
36
36
  `)}function l(S,I,A){return S.split(Pn).map(b=>b.trim()===""?b:A.repeat(I)+b).join(`
37
- `)}function p(S){if(S.type===he.Identifier)return S.name;if(S.type===he.MemberExpression){let I=S.object.type===he.Identifier?S.object.name:null,A=S.property.type===he.Identifier?S.property.name:null;return I&&A?`${I}.${A}`:A}return null}function m(S,I){if(!S)return!1;for(let A of I)if(A.includes(".")){let T=A.split(".");if(S.type===he.MemberExpression&&S.object.type===he.Identifier&&S.property.type===he.Identifier&&S.object.name===T[0]&&S.property.name===T[1])return!0}else if(S.type===he.Identifier&&S.name===A)return!0;return!1}function y(S,I){let A=S.parent;if(A.type!==he.TaggedTemplateExpression)return!1;let T=p(A.tag);return T?I.includes(T):!1}function u(S,I){if(!S||S.type!==he.CallExpression)return!1;let{method:A,argumentsLength:T,optionalCall:b=!0,optionalMember:C=!0}=I;return T!==void 0&&S.arguments.length!==T||!b&&S.optional||S.callee.type!==he.MemberExpression||!C&&S.callee.optional||S.callee.property.type!==he.Identifier?!1:S.callee.property.name===A}function d(S,I){if(!S||S.type!==he.CallExpression)return!1;let{name:A,argumentsLength:T,optionalCall:b=!0}=I;return T!==void 0&&S.arguments.length!==T||!b&&S.optional||S.callee.type!==he.Identifier?!1:S.callee.name===A}function c(S){return u(S.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&S.parent.type===he.CallExpression&&S.parent.arguments[0]===S&&d(S.parent.callee.type===he.MemberExpression?S.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function g(S){if(i.length>0){let I=t.getTokenBefore(S,{includeComments:!0});if(I?.type===ml.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(c(S)||s.length>0&&y(S,s)||n.length>0&&S.parent.type===he.CallExpression&&S.parent.arguments.includes(S)&&m(S.parent.callee,n))}function h(S){let I=`__PLACEHOLDER__${Math.random()}`,A=S.quasis.map(M=>t.getText(M).slice(1,M.tail?-1:-2)).join(I),T=A.match(Sl);if(!T)return;let b=T[0],C=t.lines[t.getLocFromIndex(S.range[0]).line-1];if(!C)return;let N=C.match(gl)?.[1]??"",k;typeof o=="string"?k=o:typeof o=="number"?k=" ".repeat(o):k=N.startsWith(" ")?" ":" ";let f=a(A).replace(new RegExp(`^${b}|${b}[ ]*$`,"g"),""),x=b+l(f,1,N+k)+b+N,E=A.includes(`\r
37
+ `)}function p(S){if(S.type===he.Identifier)return S.name;if(S.type===he.MemberExpression){let I=S.object.type===he.Identifier?S.object.name:null,A=S.property.type===he.Identifier?S.property.name:null;return I&&A?`${I}.${A}`:A}return null}function m(S,I){if(!S)return!1;for(let A of I)if(A.includes(".")){let T=A.split(".");if(S.type===he.MemberExpression&&S.object.type===he.Identifier&&S.property.type===he.Identifier&&S.object.name===T[0]&&S.property.name===T[1])return!0}else if(S.type===he.Identifier&&S.name===A)return!0;return!1}function y(S,I){let A=S.parent;if(A.type!==he.TaggedTemplateExpression)return!1;let T=p(A.tag);return T?I.includes(T):!1}function u(S,I){if(!S||S.type!==he.CallExpression)return!1;let{method:A,argumentsLength:T,optionalCall:b=!0,optionalMember:C=!0}=I;return T!==void 0&&S.arguments.length!==T||!b&&S.optional||S.callee.type!==he.MemberExpression||!C&&S.callee.optional||S.callee.property.type!==he.Identifier?!1:S.callee.property.name===A}function d(S,I){if(!S||S.type!==he.CallExpression)return!1;let{name:A,argumentsLength:T,optionalCall:b=!0}=I;return T!==void 0&&S.arguments.length!==T||!b&&S.optional||S.callee.type!==he.Identifier?!1:S.callee.name===A}function c(S){return u(S.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&S.parent.type===he.CallExpression&&S.parent.arguments[0]===S&&d(S.parent.callee.type===he.MemberExpression?S.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function g(S){if(i.length>0){let I=t.getTokenBefore(S,{includeComments:!0});if(I?.type===gl.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(c(S)||s.length>0&&y(S,s)||n.length>0&&S.parent.type===he.CallExpression&&S.parent.arguments.includes(S)&&m(S.parent.callee,n))}function h(S){let I=`__PLACEHOLDER__${Math.random()}`,A=S.quasis.map(M=>t.getText(M).slice(1,M.tail?-1:-2)).join(I),T=A.match(hl);if(!T)return;let b=T[0],C=t.lines[t.getLocFromIndex(S.range[0]).line-1];if(!C)return;let N=C.match(El)?.[1]??"",k;typeof o=="string"?k=o:typeof o=="number"?k=" ".repeat(o):k=N.startsWith(" ")?" ":" ";let f=a(A).replace(new RegExp(`^${b}|${b}[ ]*$`,"g"),""),x=b+l(f,1,N+k)+b+N,E=A.includes(`\r
38
38
  `)?`\r
39
39
  `:`
40
- `,F=A.split(Pn),R=F.map((M,P)=>P!==F.length-1&&M===k+N?"":M).join(E);if(x!==R)return{node:S,messageId:"improperlyIndented",fix:M=>x.split(I).map((P,ee)=>{let Z=S.quasis[ee];return Z?M.replaceTextRange([Z.range[0]+1,Z.range[1]-(Z.tail?1:2)],P):[]}).flat()}}return{TemplateLiteral(S){if(!g(S))return;let I=h(S);if(I)return e.report(I)}}}});import{AST_NODE_TYPES as wi}from"@typescript-eslint/utils";function El(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function hl(e){let t=e.parent;return t?.type===wi.NewExpression&&t.callee.type===wi.Identifier&&t.callee.name==="RegExp"}var Dn=z({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){El(r)||hl(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});import{AST_NODE_TYPES as be}from"@typescript-eslint/utils";import{z as Tt}from"zod/v4";var bl=Tt.object({checkOnly:Tt.array(Tt.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:Tt.array(Tt.string()).optional()}),Ln=z({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:[_(bl)],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(c){for(let g of s)if(c.range[0]>=g.range[0]&&c.range[1]<=g.range[1])return g;return null}function i(c){let g=c.parent;for(;g;){if(g.type===be.FunctionDeclaration||g.type===be.FunctionExpression||g.type===be.ArrowFunctionExpression){let h=g.params;for(let S of h)if(c.range[0]>=S.range[0]&&c.range[1]<=S.range[1])return!0;break}g=g.parent}return!1}function a(c){let g=c.parent;for(;g;){if(g.type===be.TSTypeParameterInstantiation){let h=g.parent;if(h.type===be.TSTypeReference&&h.typeName.type===be.Identifier&&(h.typeName.name==="FC"||h.typeName.name==="React.FC")||h.type===be.TSTypeReference&&h.typeName.type===be.TSQualifiedName&&h.typeName.right.name==="FC")return!0}g=g.parent}return!1}function l(c){let g=c.parent;for(;g;){if(g.type===be.TSTypeParameterInstantiation){let h=g.parent;if(h.type===be.CallExpression||h.type===be.NewExpression)return!0}g=g.parent}return!1}function p(c){let g=c.parent;for(;g;){if(g.type===be.TSTypeAliasDeclaration||g.type===be.TSInterfaceDeclaration)return!0;g=g.parent}return!1}function m(c){return c.parent.type===be.TSIndexedAccessType&&c.parent.objectType===c}let y=[];function u(c){let g=[],h=new Map;for(let{typeName:I,firstUsage:A}of c){let T=h.get(A)||[];T.push(I),h.set(A,T)}for(let{typeName:I,firstUsage:A,firstUsagePosition:T,firstUsageInFunctionArgs:b}of c){let C=n.get(I);if(!C||C.statement===A)continue;let w=s.indexOf(C.statement),N=s.indexOf(A);if(w===-1||N===-1)continue;let k=!!(t.checkOnly&&t.checkOnly.includes("function-args")&&b),f=(h.get(A)||[]).length>1;(k||f?w>N:w>N||w!==N-1)&&g.push({typeName:I,typeDef:C,targetStatement:A,firstUsagePosition:T})}if(g.length===0)return;g.sort((I,A)=>{let T=I.firstUsagePosition-A.firstUsagePosition;if(T!==0)return T;let b=s.indexOf(I.typeDef.statement),C=s.indexOf(A.typeDef.statement);return b-C});let S=g[0];S&&e.report({node:S.typeDef.node,messageId:"moveTypeAboveUsage",fix:d(g)})}function d(c){return function*(g){let h=new Map;for(let S of c){let I=h.get(S.targetStatement)||[];I.push(S),h.set(S.targetStatement,I)}for(let[,S]of h)S.sort((I,A)=>{let T=I.firstUsagePosition-A.firstUsagePosition;if(T!==0)return T;let b=s.indexOf(I.typeDef.statement),C=s.indexOf(A.typeDef.statement);return b-C});for(let S of c){let{typeDef:I}=S,A=I.statement,T=r.getCommentsBefore(A),b=A.range[0],C=A.range[1];T.length>0&&T[0]&&(b=T[0].range[0]),yield g.removeRange([b,C])}for(let[S,I]of h){let A=r.getCommentsBefore(S),T=A.length>0&&A[0]?A[0].range[0]:S.range[0],b=[];for(let C of I){let w=C.typeDef.statement,N=r.getText(w),k=r.getCommentsBefore(w),O=N;k.length>0&&(O=`${k.map(x=>r.getText(x)).join(`
40
+ `,F=A.split(Pn),R=F.map((M,P)=>P!==F.length-1&&M===k+N?"":M).join(E);if(x!==R)return{node:S,messageId:"improperlyIndented",fix:M=>x.split(I).map((P,ee)=>{let Z=S.quasis[ee];return Z?M.replaceTextRange([Z.range[0]+1,Z.range[1]-(Z.tail?1:2)],P):[]}).flat()}}return{TemplateLiteral(S){if(!g(S))return;let I=h(S);if(I)return e.report(I)}}}});import{AST_NODE_TYPES as wi}from"@typescript-eslint/utils";function xl(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function Cl(e){let t=e.parent;return t?.type===wi.NewExpression&&t.callee.type===wi.Identifier&&t.callee.name==="RegExp"}var Dn=z({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){xl(r)||Cl(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});import{AST_NODE_TYPES as be}from"@typescript-eslint/utils";import{z as Tt}from"zod/v4";var Il=Tt.object({checkOnly:Tt.array(Tt.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:Tt.array(Tt.string()).optional()}),Ln=z({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:[_(Il)],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(c){for(let g of s)if(c.range[0]>=g.range[0]&&c.range[1]<=g.range[1])return g;return null}function i(c){let g=c.parent;for(;g;){if(g.type===be.FunctionDeclaration||g.type===be.FunctionExpression||g.type===be.ArrowFunctionExpression){let h=g.params;for(let S of h)if(c.range[0]>=S.range[0]&&c.range[1]<=S.range[1])return!0;break}g=g.parent}return!1}function a(c){let g=c.parent;for(;g;){if(g.type===be.TSTypeParameterInstantiation){let h=g.parent;if(h.type===be.TSTypeReference&&h.typeName.type===be.Identifier&&(h.typeName.name==="FC"||h.typeName.name==="React.FC")||h.type===be.TSTypeReference&&h.typeName.type===be.TSQualifiedName&&h.typeName.right.name==="FC")return!0}g=g.parent}return!1}function l(c){let g=c.parent;for(;g;){if(g.type===be.TSTypeParameterInstantiation){let h=g.parent;if(h.type===be.CallExpression||h.type===be.NewExpression)return!0}g=g.parent}return!1}function p(c){let g=c.parent;for(;g;){if(g.type===be.TSTypeAliasDeclaration||g.type===be.TSInterfaceDeclaration)return!0;g=g.parent}return!1}function m(c){return c.parent.type===be.TSIndexedAccessType&&c.parent.objectType===c}let y=[];function u(c){let g=[],h=new Map;for(let{typeName:I,firstUsage:A}of c){let T=h.get(A)||[];T.push(I),h.set(A,T)}for(let{typeName:I,firstUsage:A,firstUsagePosition:T,firstUsageInFunctionArgs:b}of c){let C=n.get(I);if(!C||C.statement===A)continue;let w=s.indexOf(C.statement),N=s.indexOf(A);if(w===-1||N===-1)continue;let k=!!(t.checkOnly&&t.checkOnly.includes("function-args")&&b),f=(h.get(A)||[]).length>1;(k||f?w>N:w>N||w!==N-1)&&g.push({typeName:I,typeDef:C,targetStatement:A,firstUsagePosition:T})}if(g.length===0)return;g.sort((I,A)=>{let T=I.firstUsagePosition-A.firstUsagePosition;if(T!==0)return T;let b=s.indexOf(I.typeDef.statement),C=s.indexOf(A.typeDef.statement);return b-C});let S=g[0];S&&e.report({node:S.typeDef.node,messageId:"moveTypeAboveUsage",fix:d(g)})}function d(c){return function*(g){let h=new Map;for(let S of c){let I=h.get(S.targetStatement)||[];I.push(S),h.set(S.targetStatement,I)}for(let[,S]of h)S.sort((I,A)=>{let T=I.firstUsagePosition-A.firstUsagePosition;if(T!==0)return T;let b=s.indexOf(I.typeDef.statement),C=s.indexOf(A.typeDef.statement);return b-C});for(let S of c){let{typeDef:I}=S,A=I.statement,T=r.getCommentsBefore(A),b=A.range[0],C=A.range[1];T.length>0&&T[0]&&(b=T[0].range[0]),yield g.removeRange([b,C])}for(let[S,I]of h){let A=r.getCommentsBefore(S),T=A.length>0&&A[0]?A[0].range[0]:S.range[0],b=[];for(let C of I){let w=C.typeDef.statement,N=r.getText(w),k=r.getCommentsBefore(w),O=N;k.length>0&&(O=`${k.map(x=>r.getText(x)).join(`
41
41
  `)}
42
42
  ${N}`),b.push(O)}yield g.insertTextBeforeRange([T,T],`${b.join(`
43
43
 
44
44
  `)}
45
45
 
46
- `)}}}return{Program(c){s.push(...c.body)},TSTypeAliasDeclaration(c){if(s.some(h=>h.type===be.ExportNamedDeclaration&&h.declaration===c?!0:h===c)){let h=o(c);h&&n.set(c.id.name,{node:c,name:c.id.name,statement:h})}},TSInterfaceDeclaration(c){if(s.some(h=>h.type===be.ExportNamedDeclaration&&h.declaration===c?!0:h===c)){let h=o(c);h&&n.set(c.id.name,{node:c,name:c.id.name,statement:h})}},TSTypeReference(c){if(c.typeName.type===be.Identifier){if(m(c))return;let g=i(c),h=a(c),S=l(c);y.push({typeName:c.typeName.name,node:c,inFunctionArgs:g,inFCProps:h,inGenericArgAtFunctionCall:S,usagePosition:c.range[0]})}},"Program:exit"(){let c=new Map;function g(S){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let I of t.checkOnly)if(I==="function-args"&&S.inFunctionArgs||I==="FC"&&S.inFCProps||I==="generic-args-at-fn-calls"&&S.inGenericArgAtFunctionCall)return!0;return!1}for(let S of y){let{typeName:I,node:A}=S;if(!n.has(I)||!g(S))continue;let T=o(A),b=n.get(I);if(!T||!b||T===b.statement)continue;c.has(I)||c.set(I,[]);let C=c.get(I);if(!C)return;C.includes(T)||C.push(T)}let h=[];for(let[S,I]of c)if(I.length>0){if(I.length===0)continue;let A=I[0];if(!A)continue;let T=Number.MAX_SAFE_INTEGER,b=!1;for(let w of I)w.range[0]<A.range[0]&&(A=w);for(let w of y)g(w)&&w.typeName===S&&o(w.node)===A&&w.usagePosition<T&&(T=w.usagePosition,b=w.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let w=Number.MAX_SAFE_INTEGER;for(let k of y){if(k.typeName!==S)continue;let O=o(k.node);if(!O)continue;let f=s.indexOf(O);f!==-1&&f<w&&(w=f)}let N=s.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&N!==-1&&w<N)continue}else{let w=Number.MAX_SAFE_INTEGER;for(let k of y){if(k.typeName!==S||p(k.node))continue;let O=o(k.node);if(!O)continue;let f=s.indexOf(O);f!==-1&&f<w&&(w=f)}let N=s.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&N!==-1&&w<N)continue}h.push({typeName:S,firstUsage:A,firstUsagePosition:T,firstUsageInFunctionArgs:b})}h.length>0&&u(h)}}}});import{AST_NODE_TYPES as re}from"@typescript-eslint/utils";import*as pt from"zod/v4";var xl=["tsx"],Cl=/^[A-Z][A-Za-z0-9]*$/,Il=pt.object({extensions:pt.array(pt.string()).optional()}),jn=z({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:[_(Il)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??xl,s=!1;for(let T of n)if(r.endsWith(T)){s=!0;break}if(!s)return{};let o=e.sourceCode,i=new Set,a=new Map;function l(T){return Cl.test(T)}function p(T){if(T.type!==re.CallExpression)return!1;let b=T.callee;return b.type===re.Identifier?b.name==="memo"||b.name==="forwardRef":b.type===re.MemberExpression&&b.property.type===re.Identifier?b.property.name==="memo"||b.property.name==="forwardRef":!1}function m(T){if(T.type===re.JSXElement||T.type===re.JSXFragment)return!0;if(T.type===re.ArrayExpression){for(let b of T.elements)if(b&&(b.type===re.JSXElement||b.type===re.JSXFragment))return!0}return!1}function y(T){if(T.type!==re.ArrowFunctionExpression)return!1;let b=T.body;if(b.type===re.ArrowFunctionExpression){let C=b.body;if(m(C))return!0}return!1}function u(T){if(T.id.type!==re.Identifier)return;let b=T.id.name,C=T.init;if(C){if(l(b)&&(C.type===re.ArrowFunctionExpression||C.type===re.FunctionExpression||p(C))){i.add(b);return}C.type===re.Identifier&&a.set(b,C.name),l(b)||y(C)&&i.add(b)}}function d(T){if(T.type===re.VariableDeclaration){for(let b of T.declarations)u(b);return}if(T.type===re.FunctionDeclaration&&T.id){l(T.id.name)&&i.add(T.id.name);return}if(T.type===re.ExportNamedDeclaration&&T.declaration){let b=T.declaration;if(b.type===re.VariableDeclaration){for(let C of b.declarations)u(C);return}if(b.type===re.FunctionDeclaration&&b.id){l(b.id.name)&&i.add(b.id.name);return}}}for(let T of o.ast.body)d(T);function c(T,b=new Set){if(i.has(T))return!0;if(b.has(T))return!1;b.add(T);let C=a.get(T);return C?c(C,b):!1}let g=[];function h(T,b,C){g.push({node:T,isType:b,isComponent:C})}for(let T of o.ast.body){if(T.type===re.ExportNamedDeclaration){let b=T.exportKind==="type";if(T.declaration){let C=T.declaration;if(C.type===re.TSTypeAliasDeclaration||C.type===re.TSInterfaceDeclaration){h(C,!0,!1);continue}if(C.type===re.VariableDeclaration){for(let w of C.declarations){if(w.id.type!==re.Identifier)continue;let N=w.id.name,k=c(N);h(w,b,k)}continue}if(C.type===re.FunctionDeclaration){let w=C.id?.name,N=w?c(w)||l(w):!1;h(C,b,N);continue}h(C,b,!1);continue}if(T.specifiers.length>0)for(let C of T.specifiers){if(C.local.type!==re.Identifier)continue;let w=C.local.name,N=c(w);h(C,b,N)}continue}if(T.type===re.ExportDefaultDeclaration){let b=T.declaration;if(b.type===re.Identifier){let C=c(b.name)||l(b.name);h(T,!1,C);continue}if(b.type===re.FunctionDeclaration||b.type===re.ArrowFunctionExpression||b.type===re.FunctionExpression||b.type===re.CallExpression){h(T,!1,!0);continue}h(T,!1,!1);continue}}let S=!1;for(let T of g)if(!T.isType&&T.isComponent){S=!0;break}if(!S)return{};let I=[];for(let T of g)T.isType||I.push(T);let A=-1;for(let[T,b]of I.entries())if(b.isComponent){A=T;break}if(A===-1)return{};for(let[T,b]of I.entries())if(T!==A){e.report({node:b.node,messageId:"multipleExports"});break}return{}}});import{AST_NODE_TYPES as qe}from"@typescript-eslint/utils";import{z as Mn}from"zod/v4";function Pt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Al(e){return e.callee.type===qe.Identifier?e.callee.name==="useState":e.callee.type===qe.MemberExpression&&e.callee.object.type===qe.Identifier&&e.callee.property.type===qe.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var wl=Mn.object({ignorePrefixes:Mn.array(Mn.string()).optional()});function Fi(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function Fl(e){return`set${Pt(e)}`}var $n=z({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:[_(wl)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==qe.CallExpression||!Al(r.init)||r.id.type!==qe.ArrayPattern||r.id.elements.length!==2)return;let[n,s]=r.id.elements;if(!n||!s||n.type!==qe.Identifier||s.type!==qe.Identifier)return;let o=n.name,i=s.name,a=t.ignorePrefixes||[],l=Fi(o,a),p=Fi(i,a);if(l===""){if(!p.startsWith("set")){let y=`set${Pt(o)}`;e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:Pt(o),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:y},fix:u=>u.replaceText(s,y)}]})}return}let m=Fl(l);p!==m&&e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:Pt(l),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:m},fix:y=>y.replaceText(s,m)}]})}}}});import{AST_NODE_TYPES as Se}from"@typescript-eslint/utils";import{z as ct}from"zod/v4";var vl=ct.object({name:ct.string(),defaults:ct.array(ct.unknown())}),Rl=ct.object({functions:ct.array(vl)});function Ot(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)=>Ot(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 a=o.value,l=i.value;if(!Ot(a,l))return!1}return!0}function Nl(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&&Ot(s.value,o.value)&&r.add(n)}return r}function vi(e){if(e.type===Se.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case Se.Literal:return e.value;case Se.ObjectExpression:{let t={};for(let r of e.properties)r.type===Se.Property&&r.key.type===Se.Identifier&&!r.computed&&(r.value.type===Se.Literal?t[r.key.name]=r.value.value:r.value.type===Se.ObjectExpression?t[r.key.name]=vi(r.value):t[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case Se.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===Se.SpreadElement))return t.type===Se.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function kl(e){return e.type===Se.Identifier?e.name:e.type===Se.MemberExpression&&e.property.type===Se.Identifier&&!e.computed?e.property.name:null}var _n=z({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:[_(Rl)]},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=kl(n.callee);if(!s)return;let o=r.get(s);if(!o)return;let i=n.arguments;if(i.length===0)return;let a=-1,l=!1,p=new Map,m=new Set,y=new Map,u=[];for(let c=0;c<i.length;c++){if(c>=o.length){a=c;continue}let g=o[c],h=i[c];if(!h||h.type===Se.SpreadElement){a=c;continue}let S=vi(h);if(g===void 0){a=c;continue}if(Ot(S,g)){h.type===Se.ObjectExpression?(m.add(c),u.push({type:"object",position:c+1})):(y.set(c,S),u.push({type:"simple",position:c+1,value:S}));continue}if(h.type===Se.ObjectExpression&&h.properties.length===0&&typeof g=="object"&&g!==null&&Object.keys(g).length>0){m.add(c),u.push({type:"object",position:c+1});continue}let I=Nl(S,g);if(I.size>0){let A=typeof g=="object"&&g!==null?Object.keys(g).length:0;if(h.type===Se.ObjectExpression&&h.properties.length===I.size&&h.properties.length===A){m.add(c),u.push({type:"object",position:c+1});continue}else l=!0,p.set(c,I),u.push({type:"partialObject",position:c+1,redundantProperties:Array.from(I)}),a=c}else a=c}if(a<i.length-1||l||m.size>0){let c=function(){let h=[];for(let S of u)if(S.type==="simple")h.push(`Param ${S.position} with value ${JSON.stringify(S.value)}`);else if(S.type==="object")h.push(`Param ${S.position} (object)`);else{let I=S.redundantProperties||[],A=o?o[S.position-1]:void 0;if(typeof A=="object"&&A!==null){let T=A;for(let b of I)if(b in T){let C=Object.getOwnPropertyDescriptor(T,b);C&&h.push(`Param ${S.position} property "${b}" with value ${JSON.stringify(C.value)}`)}}}return{messageId:"redundantParams",data:{details:h.join(", ")}}};var d=c;let g=c();e.report({node:n,messageId:g.messageId,data:g.data,fix(h){let S=[];if(l)for(let[A,T]of p){let b=i[A];if(b&&b.type===Se.ObjectExpression){let C=[];for(let N of b.properties)N.type===Se.Property&&N.key.type===Se.Identifier&&!N.computed&&T.has(N.key.name)||C.push(N);let w=C.map(N=>e.sourceCode.getText(N));S.push(h.replaceText(b,`{ ${w.join(", ")} }`))}}let I=-1;for(let A=i.length-1;A>=0;A--)if(!m.has(A)&&A<=a){I=A;break}if(I<i.length-1)if(I===-1){let A=e.sourceCode.getTokenAfter(n.callee),T=e.sourceCode.getLastToken(n);A&&T&&S.push(h.replaceTextRange([A.range[1],T.range[0]],""))}else{let A=i[I],T=e.sourceCode.getLastToken(n);T&&A&&S.push(h.replaceTextRange([A.range[1],T.range[0]],""))}return S.length>0?S:null}})}}}}});import{AST_NODE_TYPES as ke}from"@typescript-eslint/utils";function Pl(e){let t=e.parent;for(;t;){if(t.type===ke.AwaitExpression||t.type===ke.MemberExpression&&t.object===e&&t.property.type===ke.Identifier&&t.property.name==="then"||t.type===ke.ArrowFunctionExpression&&t.body===e)return!0;if(t.type===ke.ArrayExpression&&t.parent.type===ke.CallExpression){let r=t.parent;if(r.callee.type===ke.MemberExpression&&r.callee.object.type===ke.Identifier&&r.callee.object.name==="Promise"&&r.callee.property.type===ke.Identifier&&["all","allSettled","race"].includes(r.callee.property.name))return!0}if(t.parent)t=t.parent;else break}return!1}function Ol(e){let{callee:t}=e;return t.type===ke.Identifier&&t.name==="require"||t.type===ke.MemberExpression&&t.object.type===ke.Identifier&&t.object.name==="require"}var Un=z({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){Pl(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){Ol(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});import{AST_NODE_TYPES as $}from"@typescript-eslint/utils";import{z as zn}from"zod/v4";var Dl=zn.object({mainComponentRegex:zn.string().optional(),mainComponentSelector:zn.string().optional()}),Ll=/^[A-Z][A-Za-z0-9]*$/,Vn=z({name:"sort-react-components-and-styles",meta:{type:"suggestion",docs:{description:"Sort React components and styles with styles placed above their first usage"},fixable:"code",schema:[_(Dl)],messages:{stylesShouldBeAboveUsage:"Style definitions should be placed above the first component that uses them",mainComponentShouldBeFirst:"Main component should be placed before other components"}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.mainComponentRegex?new RegExp(t.mainComponentRegex):void 0,s=t.mainComponentSelector;if(!e.filename.endsWith(".tsx"))return{};let i=new Set,a=new Map,l=[],p=[],m=new Set;function y(x){let E=x.node;if(E.type===$.VariableDeclaration){for(let F of E.declarations)if(F.id.type===$.Identifier&&F.id.name===x.name&&F.init)return F.init}if(E.type===$.ExportNamedDeclaration){let F=E.declaration;if(F&&F.type===$.VariableDeclaration){for(let R of F.declarations)if(R.id.type===$.Identifier&&R.id.name===x.name&&R.init)return R.init}}return null}function u(x){let E=new Set;return Le(x,F=>(F.type===$.Identifier&&F.name!=="styled"&&F.name!=="css"&&E.add(F.name),!1),r),E}function d(x){return Ll.test(x)}function c(x){if(x.type!==$.CallExpression)return!1;let E=x.callee;return E.type===$.Identifier?E.name==="memo"||E.name==="forwardRef":E.type===$.MemberExpression&&E.property.type===$.Identifier?E.property.name==="memo"||E.property.name==="forwardRef":!1}function g(x){if(x.type===$.JSXElement||x.type===$.JSXFragment)return!0;if(x.type===$.BlockStatement){for(let E of x.body)if(E.type===$.ReturnStatement&&E.argument)return g(E.argument)}if(x.type===$.ArrayExpression){for(let E of x.elements)if(E&&(E.type===$.JSXElement||E.type===$.JSXFragment))return!0}return!1}function h(x){if(x.type!==$.ArrowFunctionExpression)return!1;let E=x.body;if(E.type===$.ArrowFunctionExpression){let F=E.body;if(g(F))return!0}return!1}function S(x){if(x.type===$.TaggedTemplateExpression){let E=x.tag;if(E.type===$.MemberExpression&&E.object.type===$.Identifier&&E.object.name==="styled")return!0;if(E.type===$.CallExpression){let F=E.callee;if(F.type===$.Identifier&&F.name==="styled")return!0}}return!1}function I(x){if(x.type===$.TaggedTemplateExpression){let E=x.tag;if(E.type===$.Identifier&&E.name==="css")return!0}return!1}function A(x,E){if(x.id.type!==$.Identifier)return;let F=x.id.name,R=x.init;if(R){if(S(R)||I(R)){p.push({node:E,name:F});return}if((d(F)||R.type===$.ArrowFunctionExpression)&&(R.type===$.ArrowFunctionExpression||R.type===$.FunctionExpression||c(R))){if(R.type===$.ArrowFunctionExpression||R.type===$.FunctionExpression){if(g(R.body)){i.add(F);return}}else if(c(R)){i.add(F);return}}R.type===$.Identifier&&a.set(F,R.name),d(F)||h(R)&&i.add(F)}}function T(x){return x.type===$.ExportDefaultDeclaration||x.type===$.ExportNamedDeclaration}function b(x){if(x.type===$.FunctionDeclaration)return x.id?x.id.name:null;if(x.type===$.VariableDeclaration){let E=x.declarations[0];if(E&&E.id.type===$.Identifier)return E.id.name}if(x.type===$.ExportDefaultDeclaration){let E=x.declaration;if(E.type===$.FunctionDeclaration)return E.id?E.id.name:"default";if(E.type===$.Identifier)return E.name}if(x.type===$.ExportNamedDeclaration){let E=x.declaration;if(E&&E.type===$.FunctionDeclaration)return E.id?E.id.name:null;if(E&&E.type===$.VariableDeclaration){let F=E.declarations[0];if(F&&F.id.type===$.Identifier)return F.id.name}}return null}function C(x,E){return s?m.has(x):n?n.test(E):T(x)}function w(x){let E=new Set;Le(x.node,F=>{if(F.type===$.Identifier)for(let R of p)R.name===F.name&&(E.add(R.name),(R.firstUsagePosition===void 0||F.range[0]<R.firstUsagePosition)&&(R.firstUsagePosition=F.range[0]));if(F.type===$.JSXElement){let R=F.openingElement;if(R.name.type===$.JSXIdentifier)for(let M of p)M.name===R.name.name&&(E.add(M.name),(M.firstUsagePosition===void 0||R.name.range[0]<M.firstUsagePosition)&&(M.firstUsagePosition=R.name.range[0]))}return!1},r),x.usedStyles=E}function N(x){if(x.type===$.VariableDeclaration){for(let E of x.declarations)A(E,x);return}if(x.type===$.FunctionDeclaration){d(x.id.name)&&g(x.body)&&i.add(x.id.name);return}if(x.type===$.ExportNamedDeclaration&&x.declaration){let E=x.declaration;if(E.type===$.VariableDeclaration){for(let F of E.declarations)A(F,x);return}if(E.type===$.FunctionDeclaration&&E.id){d(E.id.name)&&g(E.body)&&i.add(E.id.name);return}}if(x.type===$.ExportDefaultDeclaration){let E=x.declaration;E.type===$.Identifier&&i.add(E.name),(E.type===$.FunctionDeclaration||E.type===$.ArrowFunctionExpression||E.type===$.FunctionExpression)&&(E.type===$.FunctionDeclaration?E.id?i.add(E.id.name):i.add("default"):g(E.body)&&i.add("default"))}}function k(x,E=new Set){if(i.has(x))return!0;if(E.has(x))return!1;E.add(x);let F=a.get(x);return F?k(F,E):!1}let O={};return s&&(O[s]=x=>{let E=x;for(;E.parent&&E.parent.type!==$.Program;)E=E.parent;E.parent&&(E.type===$.VariableDeclaration||E.type===$.FunctionDeclaration||E.type===$.ExportNamedDeclaration||E.type===$.ExportDefaultDeclaration)&&m.add(E)}),O["Program:exit"]=x=>{let E=0;for(let D of x.body){if(D.type===$.ImportDeclaration){E+=1;continue}break}for(let D of x.body)N(D);for(let D of x.body){let q=b(D);if(q&&k(q)){let B=C(D,q);l.push({node:D,name:q,isMainComponent:B,usedStyles:new Set,isExported:T(D)})}}if(!s&&n&&!l.some(D=>D.isMainComponent))for(let D of l)D.isExported&&(D.isMainComponent=!0);for(let D of l)w(D);let F=new Set;for(let D of p)F.add(D.name);let R=new Map;for(let D=0;D<x.body.length;D+=1){let q=x.body[D];for(let B of p)B.node===q&&R.set(B.name,D)}let M=new Map;for(let D of p){let q=y(D),B=new Set;if(q){let ae=u(q);for(let fe of ae)F.has(fe)&&fe!==D.name&&B.add(fe)}M.set(D.name,B)}let P=new Map;for(let D of p){let q=M.get(D.name);if(!q)continue;let B=R.get(D.name);if(B!==void 0)for(let ae of q){let fe=P.get(ae);(fe===void 0||B<fe)&&P.set(ae,B)}}let ee=[];for(let D of p){if(D.firstUsagePosition===void 0)continue;let q=x.body.indexOf(D.node),B=-1;for(let Ce of l){if(!Ce.usedStyles.has(D.name))continue;let Ae=x.body.indexOf(Ce.node);(B===-1||Ae<B)&&(B=Ae)}let ae=P.get(D.name);if(ae!==void 0&&(B===-1||ae<B)&&(B=ae),B===-1)continue;let fe=-1;for(let Ce of l){let Ae=x.body.indexOf(Ce.node);Ae<B&&Ae>fe&&(fe=Ae)}let Re=q<B,Be=q>fe,Ee=-1,ut=M.get(D.name);if(ut)for(let Ce of ut){let Ae=R.get(Ce);Ae!==void 0&&Ae>Ee&&(Ee=Ae)}let rt=q>Ee;if(!(Re&&Be&&rt)){let Ce=fe+1;if(Ee+1>Ce&&(Ce=Ee+1),Ce<E&&(Ce=E),Ce>B)continue;ee.push({style:D,targetPosition:Ce})}}let Z=null;if(l.length>1){let D=l.map(B=>({c:B,idx:x.body.indexOf(B.node)})).sort((B,ae)=>B.idx-ae.idx)[0]?.c,q=l.find(B=>B.isMainComponent)||null;D&&q&&D.node!==q.node&&(Z={component:q,targetBefore:D.node})}if(ee.length>0||Z){let D=ee[0]?.style.node||Z?.component.node||x,q=ee.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:D,messageId:q,fix:f(ee,Z,x.body)})}},O;function f(x,E,F){return function*(R){x.sort((P,ee)=>P.targetPosition-ee.targetPosition);for(let{style:P}of x){let ee=r.getCommentsBefore(P.node),Z=P.node.range[0],D=P.node.range[1];ee.length>0&&ee[0]&&(Z=ee[0].range[0]),Z===P.node.range[0]&&r.text.slice(0,Z).trim().length===0&&(Z=0),yield R.removeRange([Z,D])}let M=new Map;for(let P of x){let ee=M.get(P.targetPosition)||[];ee.push(P),M.set(P.targetPosition,ee)}for(let[P,ee]of M){let Z=F[P];if(!Z)continue;let D=r.getCommentsBefore(Z),q=D.length>0&&D[0]?D[0].range[0]:Z.range[0],B=[];for(let{style:ae}of ee){let fe=r.getCommentsBefore(ae.node),Re=r.getText(ae.node);fe.length>0&&(Re=`${fe.map(Ee=>r.getText(Ee)).join(`
46
+ `)}}}return{Program(c){s.push(...c.body)},TSTypeAliasDeclaration(c){if(s.some(h=>h.type===be.ExportNamedDeclaration&&h.declaration===c?!0:h===c)){let h=o(c);h&&n.set(c.id.name,{node:c,name:c.id.name,statement:h})}},TSInterfaceDeclaration(c){if(s.some(h=>h.type===be.ExportNamedDeclaration&&h.declaration===c?!0:h===c)){let h=o(c);h&&n.set(c.id.name,{node:c,name:c.id.name,statement:h})}},TSTypeReference(c){if(c.typeName.type===be.Identifier){if(m(c))return;let g=i(c),h=a(c),S=l(c);y.push({typeName:c.typeName.name,node:c,inFunctionArgs:g,inFCProps:h,inGenericArgAtFunctionCall:S,usagePosition:c.range[0]})}},"Program:exit"(){let c=new Map;function g(S){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let I of t.checkOnly)if(I==="function-args"&&S.inFunctionArgs||I==="FC"&&S.inFCProps||I==="generic-args-at-fn-calls"&&S.inGenericArgAtFunctionCall)return!0;return!1}for(let S of y){let{typeName:I,node:A}=S;if(!n.has(I)||!g(S))continue;let T=o(A),b=n.get(I);if(!T||!b||T===b.statement)continue;c.has(I)||c.set(I,[]);let C=c.get(I);if(!C)return;C.includes(T)||C.push(T)}let h=[];for(let[S,I]of c)if(I.length>0){if(I.length===0)continue;let A=I[0];if(!A)continue;let T=Number.MAX_SAFE_INTEGER,b=!1;for(let w of I)w.range[0]<A.range[0]&&(A=w);for(let w of y)g(w)&&w.typeName===S&&o(w.node)===A&&w.usagePosition<T&&(T=w.usagePosition,b=w.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let w=Number.MAX_SAFE_INTEGER;for(let k of y){if(k.typeName!==S)continue;let O=o(k.node);if(!O)continue;let f=s.indexOf(O);f!==-1&&f<w&&(w=f)}let N=s.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&N!==-1&&w<N)continue}else{let w=Number.MAX_SAFE_INTEGER;for(let k of y){if(k.typeName!==S||p(k.node))continue;let O=o(k.node);if(!O)continue;let f=s.indexOf(O);f!==-1&&f<w&&(w=f)}let N=s.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&N!==-1&&w<N)continue}h.push({typeName:S,firstUsage:A,firstUsagePosition:T,firstUsageInFunctionArgs:b})}h.length>0&&u(h)}}}});import{AST_NODE_TYPES as re}from"@typescript-eslint/utils";import*as pt from"zod/v4";var Al=["tsx"],wl=/^[A-Z][A-Za-z0-9]*$/,Fl=pt.object({extensions:pt.array(pt.string()).optional()}),jn=z({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:[_(Fl)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??Al,s=!1;for(let T of n)if(r.endsWith(T)){s=!0;break}if(!s)return{};let o=e.sourceCode,i=new Set,a=new Map;function l(T){return wl.test(T)}function p(T){if(T.type!==re.CallExpression)return!1;let b=T.callee;return b.type===re.Identifier?b.name==="memo"||b.name==="forwardRef":b.type===re.MemberExpression&&b.property.type===re.Identifier?b.property.name==="memo"||b.property.name==="forwardRef":!1}function m(T){if(T.type===re.JSXElement||T.type===re.JSXFragment)return!0;if(T.type===re.ArrayExpression){for(let b of T.elements)if(b&&(b.type===re.JSXElement||b.type===re.JSXFragment))return!0}return!1}function y(T){if(T.type!==re.ArrowFunctionExpression)return!1;let b=T.body;if(b.type===re.ArrowFunctionExpression){let C=b.body;if(m(C))return!0}return!1}function u(T){if(T.id.type!==re.Identifier)return;let b=T.id.name,C=T.init;if(C){if(l(b)&&(C.type===re.ArrowFunctionExpression||C.type===re.FunctionExpression||p(C))){i.add(b);return}C.type===re.Identifier&&a.set(b,C.name),l(b)||y(C)&&i.add(b)}}function d(T){if(T.type===re.VariableDeclaration){for(let b of T.declarations)u(b);return}if(T.type===re.FunctionDeclaration&&T.id){l(T.id.name)&&i.add(T.id.name);return}if(T.type===re.ExportNamedDeclaration&&T.declaration){let b=T.declaration;if(b.type===re.VariableDeclaration){for(let C of b.declarations)u(C);return}if(b.type===re.FunctionDeclaration&&b.id){l(b.id.name)&&i.add(b.id.name);return}}}for(let T of o.ast.body)d(T);function c(T,b=new Set){if(i.has(T))return!0;if(b.has(T))return!1;b.add(T);let C=a.get(T);return C?c(C,b):!1}let g=[];function h(T,b,C){g.push({node:T,isType:b,isComponent:C})}for(let T of o.ast.body){if(T.type===re.ExportNamedDeclaration){let b=T.exportKind==="type";if(T.declaration){let C=T.declaration;if(C.type===re.TSTypeAliasDeclaration||C.type===re.TSInterfaceDeclaration){h(C,!0,!1);continue}if(C.type===re.VariableDeclaration){for(let w of C.declarations){if(w.id.type!==re.Identifier)continue;let N=w.id.name,k=c(N);h(w,b,k)}continue}if(C.type===re.FunctionDeclaration){let w=C.id?.name,N=w?c(w)||l(w):!1;h(C,b,N);continue}h(C,b,!1);continue}if(T.specifiers.length>0)for(let C of T.specifiers){if(C.local.type!==re.Identifier)continue;let w=C.local.name,N=c(w);h(C,b,N)}continue}if(T.type===re.ExportDefaultDeclaration){let b=T.declaration;if(b.type===re.Identifier){let C=c(b.name)||l(b.name);h(T,!1,C);continue}if(b.type===re.FunctionDeclaration||b.type===re.ArrowFunctionExpression||b.type===re.FunctionExpression||b.type===re.CallExpression){h(T,!1,!0);continue}h(T,!1,!1);continue}}let S=!1;for(let T of g)if(!T.isType&&T.isComponent){S=!0;break}if(!S)return{};let I=[];for(let T of g)T.isType||I.push(T);let A=-1;for(let[T,b]of I.entries())if(b.isComponent){A=T;break}if(A===-1)return{};for(let[T,b]of I.entries())if(T!==A){e.report({node:b.node,messageId:"multipleExports"});break}return{}}});import{AST_NODE_TYPES as qe}from"@typescript-eslint/utils";import{z as Mn}from"zod/v4";function Pt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function vl(e){return e.callee.type===qe.Identifier?e.callee.name==="useState":e.callee.type===qe.MemberExpression&&e.callee.object.type===qe.Identifier&&e.callee.property.type===qe.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var Rl=Mn.object({ignorePrefixes:Mn.array(Mn.string()).optional()});function Fi(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function Nl(e){return`set${Pt(e)}`}var $n=z({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:[_(Rl)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==qe.CallExpression||!vl(r.init)||r.id.type!==qe.ArrayPattern||r.id.elements.length!==2)return;let[n,s]=r.id.elements;if(!n||!s||n.type!==qe.Identifier||s.type!==qe.Identifier)return;let o=n.name,i=s.name,a=t.ignorePrefixes||[],l=Fi(o,a),p=Fi(i,a);if(l===""){if(!p.startsWith("set")){let y=`set${Pt(o)}`;e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:Pt(o),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:y},fix:u=>u.replaceText(s,y)}]})}return}let m=Nl(l);p!==m&&e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:Pt(l),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:m},fix:y=>y.replaceText(s,m)}]})}}}});import{AST_NODE_TYPES as Se}from"@typescript-eslint/utils";import{z as ct}from"zod/v4";var kl=ct.object({name:ct.string(),defaults:ct.array(ct.unknown())}),Pl=ct.object({functions:ct.array(kl)});function Ot(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)=>Ot(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 a=o.value,l=i.value;if(!Ot(a,l))return!1}return!0}function Ol(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&&Ot(s.value,o.value)&&r.add(n)}return r}function vi(e){if(e.type===Se.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case Se.Literal:return e.value;case Se.ObjectExpression:{let t={};for(let r of e.properties)r.type===Se.Property&&r.key.type===Se.Identifier&&!r.computed&&(r.value.type===Se.Literal?t[r.key.name]=r.value.value:r.value.type===Se.ObjectExpression?t[r.key.name]=vi(r.value):t[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case Se.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===Se.SpreadElement))return t.type===Se.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function Dl(e){return e.type===Se.Identifier?e.name:e.type===Se.MemberExpression&&e.property.type===Se.Identifier&&!e.computed?e.property.name:null}var _n=z({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:[_(Pl)]},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=Dl(n.callee);if(!s)return;let o=r.get(s);if(!o)return;let i=n.arguments;if(i.length===0)return;let a=-1,l=!1,p=new Map,m=new Set,y=new Map,u=[];for(let c=0;c<i.length;c++){if(c>=o.length){a=c;continue}let g=o[c],h=i[c];if(!h||h.type===Se.SpreadElement){a=c;continue}let S=vi(h);if(g===void 0){a=c;continue}if(Ot(S,g)){h.type===Se.ObjectExpression?(m.add(c),u.push({type:"object",position:c+1})):(y.set(c,S),u.push({type:"simple",position:c+1,value:S}));continue}if(h.type===Se.ObjectExpression&&h.properties.length===0&&typeof g=="object"&&g!==null&&Object.keys(g).length>0){m.add(c),u.push({type:"object",position:c+1});continue}let I=Ol(S,g);if(I.size>0){let A=typeof g=="object"&&g!==null?Object.keys(g).length:0;if(h.type===Se.ObjectExpression&&h.properties.length===I.size&&h.properties.length===A){m.add(c),u.push({type:"object",position:c+1});continue}else l=!0,p.set(c,I),u.push({type:"partialObject",position:c+1,redundantProperties:Array.from(I)}),a=c}else a=c}if(a<i.length-1||l||m.size>0){let c=function(){let h=[];for(let S of u)if(S.type==="simple")h.push(`Param ${S.position} with value ${JSON.stringify(S.value)}`);else if(S.type==="object")h.push(`Param ${S.position} (object)`);else{let I=S.redundantProperties||[],A=o?o[S.position-1]:void 0;if(typeof A=="object"&&A!==null){let T=A;for(let b of I)if(b in T){let C=Object.getOwnPropertyDescriptor(T,b);C&&h.push(`Param ${S.position} property "${b}" with value ${JSON.stringify(C.value)}`)}}}return{messageId:"redundantParams",data:{details:h.join(", ")}}};var d=c;let g=c();e.report({node:n,messageId:g.messageId,data:g.data,fix(h){let S=[];if(l)for(let[A,T]of p){let b=i[A];if(b&&b.type===Se.ObjectExpression){let C=[];for(let N of b.properties)N.type===Se.Property&&N.key.type===Se.Identifier&&!N.computed&&T.has(N.key.name)||C.push(N);let w=C.map(N=>e.sourceCode.getText(N));S.push(h.replaceText(b,`{ ${w.join(", ")} }`))}}let I=-1;for(let A=i.length-1;A>=0;A--)if(!m.has(A)&&A<=a){I=A;break}if(I<i.length-1)if(I===-1){let A=e.sourceCode.getTokenAfter(n.callee),T=e.sourceCode.getLastToken(n);A&&T&&S.push(h.replaceTextRange([A.range[1],T.range[0]],""))}else{let A=i[I],T=e.sourceCode.getLastToken(n);T&&A&&S.push(h.replaceTextRange([A.range[1],T.range[0]],""))}return S.length>0?S:null}})}}}}});import{AST_NODE_TYPES as ke}from"@typescript-eslint/utils";function Ll(e){let t=e.parent;for(;t;){if(t.type===ke.AwaitExpression||t.type===ke.MemberExpression&&t.object===e&&t.property.type===ke.Identifier&&t.property.name==="then"||t.type===ke.ArrowFunctionExpression&&t.body===e)return!0;if(t.type===ke.ArrayExpression&&t.parent.type===ke.CallExpression){let r=t.parent;if(r.callee.type===ke.MemberExpression&&r.callee.object.type===ke.Identifier&&r.callee.object.name==="Promise"&&r.callee.property.type===ke.Identifier&&["all","allSettled","race"].includes(r.callee.property.name))return!0}if(t.parent)t=t.parent;else break}return!1}function jl(e){let{callee:t}=e;return t.type===ke.Identifier&&t.name==="require"||t.type===ke.MemberExpression&&t.object.type===ke.Identifier&&t.object.name==="require"}var Un=z({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){Ll(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){jl(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});import{AST_NODE_TYPES as $}from"@typescript-eslint/utils";import{z as zn}from"zod/v4";var Ml=zn.object({mainComponentRegex:zn.string().optional(),mainComponentSelector:zn.string().optional()}),$l=/^[A-Z][A-Za-z0-9]*$/,Vn=z({name:"sort-react-components-and-styles",meta:{type:"suggestion",docs:{description:"Sort React components and styles with styles placed above their first usage"},fixable:"code",schema:[_(Ml)],messages:{stylesShouldBeAboveUsage:"Style definitions should be placed above the first component that uses them",mainComponentShouldBeFirst:"Main component should be placed before other components"}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.mainComponentRegex?new RegExp(t.mainComponentRegex):void 0,s=t.mainComponentSelector;if(!e.filename.endsWith(".tsx"))return{};let i=new Set,a=new Map,l=[],p=[],m=new Set;function y(x){let E=x.node;if(E.type===$.VariableDeclaration){for(let F of E.declarations)if(F.id.type===$.Identifier&&F.id.name===x.name&&F.init)return F.init}if(E.type===$.ExportNamedDeclaration){let F=E.declaration;if(F&&F.type===$.VariableDeclaration){for(let R of F.declarations)if(R.id.type===$.Identifier&&R.id.name===x.name&&R.init)return R.init}}return null}function u(x){let E=new Set;return Le(x,F=>(F.type===$.Identifier&&F.name!=="styled"&&F.name!=="css"&&E.add(F.name),!1),r),E}function d(x){return $l.test(x)}function c(x){if(x.type!==$.CallExpression)return!1;let E=x.callee;return E.type===$.Identifier?E.name==="memo"||E.name==="forwardRef":E.type===$.MemberExpression&&E.property.type===$.Identifier?E.property.name==="memo"||E.property.name==="forwardRef":!1}function g(x){if(x.type===$.JSXElement||x.type===$.JSXFragment)return!0;if(x.type===$.BlockStatement){for(let E of x.body)if(E.type===$.ReturnStatement&&E.argument)return g(E.argument)}if(x.type===$.ArrayExpression){for(let E of x.elements)if(E&&(E.type===$.JSXElement||E.type===$.JSXFragment))return!0}return!1}function h(x){if(x.type!==$.ArrowFunctionExpression)return!1;let E=x.body;if(E.type===$.ArrowFunctionExpression){let F=E.body;if(g(F))return!0}return!1}function S(x){if(x.type===$.TaggedTemplateExpression){let E=x.tag;if(E.type===$.MemberExpression&&E.object.type===$.Identifier&&E.object.name==="styled")return!0;if(E.type===$.CallExpression){let F=E.callee;if(F.type===$.Identifier&&F.name==="styled")return!0}}return!1}function I(x){if(x.type===$.TaggedTemplateExpression){let E=x.tag;if(E.type===$.Identifier&&E.name==="css")return!0}return!1}function A(x,E){if(x.id.type!==$.Identifier)return;let F=x.id.name,R=x.init;if(R){if(S(R)||I(R)){p.push({node:E,name:F});return}if((d(F)||R.type===$.ArrowFunctionExpression)&&(R.type===$.ArrowFunctionExpression||R.type===$.FunctionExpression||c(R))){if(R.type===$.ArrowFunctionExpression||R.type===$.FunctionExpression){if(g(R.body)){i.add(F);return}}else if(c(R)){i.add(F);return}}R.type===$.Identifier&&a.set(F,R.name),d(F)||h(R)&&i.add(F)}}function T(x){return x.type===$.ExportDefaultDeclaration||x.type===$.ExportNamedDeclaration}function b(x){if(x.type===$.FunctionDeclaration)return x.id?x.id.name:null;if(x.type===$.VariableDeclaration){let E=x.declarations[0];if(E&&E.id.type===$.Identifier)return E.id.name}if(x.type===$.ExportDefaultDeclaration){let E=x.declaration;if(E.type===$.FunctionDeclaration)return E.id?E.id.name:"default";if(E.type===$.Identifier)return E.name}if(x.type===$.ExportNamedDeclaration){let E=x.declaration;if(E&&E.type===$.FunctionDeclaration)return E.id?E.id.name:null;if(E&&E.type===$.VariableDeclaration){let F=E.declarations[0];if(F&&F.id.type===$.Identifier)return F.id.name}}return null}function C(x,E){return s?m.has(x):n?n.test(E):T(x)}function w(x){let E=new Set;Le(x.node,F=>{if(F.type===$.Identifier)for(let R of p)R.name===F.name&&(E.add(R.name),(R.firstUsagePosition===void 0||F.range[0]<R.firstUsagePosition)&&(R.firstUsagePosition=F.range[0]));if(F.type===$.JSXElement){let R=F.openingElement;if(R.name.type===$.JSXIdentifier)for(let M of p)M.name===R.name.name&&(E.add(M.name),(M.firstUsagePosition===void 0||R.name.range[0]<M.firstUsagePosition)&&(M.firstUsagePosition=R.name.range[0]))}return!1},r),x.usedStyles=E}function N(x){if(x.type===$.VariableDeclaration){for(let E of x.declarations)A(E,x);return}if(x.type===$.FunctionDeclaration){d(x.id.name)&&g(x.body)&&i.add(x.id.name);return}if(x.type===$.ExportNamedDeclaration&&x.declaration){let E=x.declaration;if(E.type===$.VariableDeclaration){for(let F of E.declarations)A(F,x);return}if(E.type===$.FunctionDeclaration&&E.id){d(E.id.name)&&g(E.body)&&i.add(E.id.name);return}}if(x.type===$.ExportDefaultDeclaration){let E=x.declaration;E.type===$.Identifier&&i.add(E.name),(E.type===$.FunctionDeclaration||E.type===$.ArrowFunctionExpression||E.type===$.FunctionExpression)&&(E.type===$.FunctionDeclaration?E.id?i.add(E.id.name):i.add("default"):g(E.body)&&i.add("default"))}}function k(x,E=new Set){if(i.has(x))return!0;if(E.has(x))return!1;E.add(x);let F=a.get(x);return F?k(F,E):!1}let O={};return s&&(O[s]=x=>{let E=x;for(;E.parent&&E.parent.type!==$.Program;)E=E.parent;E.parent&&(E.type===$.VariableDeclaration||E.type===$.FunctionDeclaration||E.type===$.ExportNamedDeclaration||E.type===$.ExportDefaultDeclaration)&&m.add(E)}),O["Program:exit"]=x=>{let E=0;for(let D of x.body){if(D.type===$.ImportDeclaration){E+=1;continue}break}for(let D of x.body)N(D);for(let D of x.body){let q=b(D);if(q&&k(q)){let B=C(D,q);l.push({node:D,name:q,isMainComponent:B,usedStyles:new Set,isExported:T(D)})}}if(!s&&n&&!l.some(D=>D.isMainComponent))for(let D of l)D.isExported&&(D.isMainComponent=!0);for(let D of l)w(D);let F=new Set;for(let D of p)F.add(D.name);let R=new Map;for(let D=0;D<x.body.length;D+=1){let q=x.body[D];for(let B of p)B.node===q&&R.set(B.name,D)}let M=new Map;for(let D of p){let q=y(D),B=new Set;if(q){let ae=u(q);for(let fe of ae)F.has(fe)&&fe!==D.name&&B.add(fe)}M.set(D.name,B)}let P=new Map;for(let D of p){let q=M.get(D.name);if(!q)continue;let B=R.get(D.name);if(B!==void 0)for(let ae of q){let fe=P.get(ae);(fe===void 0||B<fe)&&P.set(ae,B)}}let ee=[];for(let D of p){if(D.firstUsagePosition===void 0)continue;let q=x.body.indexOf(D.node),B=-1;for(let Ce of l){if(!Ce.usedStyles.has(D.name))continue;let Ae=x.body.indexOf(Ce.node);(B===-1||Ae<B)&&(B=Ae)}let ae=P.get(D.name);if(ae!==void 0&&(B===-1||ae<B)&&(B=ae),B===-1)continue;let fe=-1;for(let Ce of l){let Ae=x.body.indexOf(Ce.node);Ae<B&&Ae>fe&&(fe=Ae)}let Re=q<B,Be=q>fe,Ee=-1,ut=M.get(D.name);if(ut)for(let Ce of ut){let Ae=R.get(Ce);Ae!==void 0&&Ae>Ee&&(Ee=Ae)}let rt=q>Ee;if(!(Re&&Be&&rt)){let Ce=fe+1;if(Ee+1>Ce&&(Ce=Ee+1),Ce<E&&(Ce=E),Ce>B)continue;ee.push({style:D,targetPosition:Ce})}}let Z=null;if(l.length>1){let D=l.map(B=>({c:B,idx:x.body.indexOf(B.node)})).sort((B,ae)=>B.idx-ae.idx)[0]?.c,q=l.find(B=>B.isMainComponent)||null;D&&q&&D.node!==q.node&&(Z={component:q,targetBefore:D.node})}if(ee.length>0||Z){let D=ee[0]?.style.node||Z?.component.node||x,q=ee.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:D,messageId:q,fix:f(ee,Z,x.body)})}},O;function f(x,E,F){return function*(R){x.sort((P,ee)=>P.targetPosition-ee.targetPosition);for(let{style:P}of x){let ee=r.getCommentsBefore(P.node),Z=P.node.range[0],D=P.node.range[1];ee.length>0&&ee[0]&&(Z=ee[0].range[0]),Z===P.node.range[0]&&r.text.slice(0,Z).trim().length===0&&(Z=0),yield R.removeRange([Z,D])}let M=new Map;for(let P of x){let ee=M.get(P.targetPosition)||[];ee.push(P),M.set(P.targetPosition,ee)}for(let[P,ee]of M){let Z=F[P];if(!Z)continue;let D=r.getCommentsBefore(Z),q=D.length>0&&D[0]?D[0].range[0]:Z.range[0],B=[];for(let{style:ae}of ee){let fe=r.getCommentsBefore(ae.node),Re=r.getText(ae.node);fe.length>0&&(Re=`${fe.map(Ee=>r.getText(Ee)).join(`
47
47
  `)}
48
48
  ${Re}`),B.push(Re)}yield R.insertTextBeforeRange([q,q],`${B.join(`
49
49
 
@@ -52,4 +52,4 @@ ${Re}`),B.push(Re)}yield R.insertTextBeforeRange([q,q],`${B.join(`
52
52
  `)}if(E){let{component:P,targetBefore:ee}=E,Z=r.getCommentsBefore(P.node),D=P.node.range[0],q=P.node.range[1];Z.length>0&&Z[0]&&(D=Z[0].range[0]),D===P.node.range[0]&&r.text.slice(0,D).trim().length===0&&(D=0);let B=r.getCommentsBefore(ee),ae=B.length>0&&B[0]?B[0].range[0]:ee.range[0],fe=(()=>{let Re=r.getText(P.node);return Z.length>0&&(Re=`${Z.map(Ee=>r.getText(Ee)).join(`
53
53
  `)}
54
54
  ${Re}`),Re})();yield R.removeRange([D,q]),yield R.insertTextBeforeRange([ae,ae],`${fe}
55
- `)}}}}});import{AST_NODE_TYPES as jl,ESLintUtils as Ml}from"@typescript-eslint/utils";import Ri from"typescript";import{z as $l}from"zod/v4";var _l=$l.object({}),Wn=z({name:"no-unnecessary-void-on-promise",meta:{type:"suggestion",docs:{description:"Disallow void operator on non-Promise function calls to avoid unnecessary void keywords added by no-floating-promises"},messages:{unnecessaryVoid:"Unnecessary void operator on non-Promise function call",removeVoid:"Remove void operator"},hasSuggestions:!0,schema:[_(_l)]},defaultOptions:[{}],create(e){let t=Ml.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(s,o){if(s.flags&Ri.TypeFlags.Any||s.flags&Ri.TypeFlags.Unknown)return!1;let i=s.getProperty("then");return i?o.getTypeOfSymbol(i).getCallSignatures().length>0:!1}return{UnaryExpression(s){if(s.operator!=="void"||s.argument.type!==jl.CallExpression)return;let o=t.esTreeNodeToTSNodeMap.get(s.argument),i=r.getTypeAtLocation(o);if(!n(i,r)){let l=e.sourceCode.getText(s.argument);e.report({node:s,messageId:"unnecessaryVoid",suggest:[{messageId:"removeVoid",fix(p){return p.replaceText(s,l)}}]})}}}}});import{AST_NODE_TYPES as we}from"@typescript-eslint/utils";import{z as Et}from"zod/v4";var Ul=Et.object({functions:Et.array(Et.string()).optional(),selectors:Et.array(Et.string()).optional()});function Ni(e){let t=e.parent;for(;t;){if(t.type===we.FunctionDeclaration||t.type===we.FunctionExpression||t.type===we.ArrowFunctionExpression)return!0;t=t.parent}return!1}function ki(e){if(e.type===we.TaggedTemplateExpression){let{tag:r}=e;return r.type===we.Identifier?r.name:r.type===we.MemberExpression&&r.property.type===we.Identifier?r.property.name:null}let{callee:t}=e;return t.type===we.Identifier?t.name:t.type===we.MemberExpression&&t.property.type===we.Identifier?t.property.name:null}var Jn=z({name:"require-lazy-execution",meta:{type:"problem",docs:{description:"Require certain function calls to be executed lazily (inside functions, not at module level)"},messages:{moduleLevel:'Function "{{ functionName }}" must only be called inside functions or getters, not at module level'},schema:[_(Ul)]},defaultOptions:[{functions:[],selectors:[]}],create(e){let[t]=e.options,r=new Set(t.functions??[]),n=t.selectors??[];function s(i){if(Ni(i))return;let a=ki(i);a&&r.has(a)&&e.report({node:i,messageId:"moduleLevel",data:{functionName:a}})}let o={CallExpression(i){i.type===we.CallExpression&&s(i)},TaggedTemplateExpression(i){i.type===we.TaggedTemplateExpression&&s(i)}};for(let i of n)o[i]=a=>{if(a.type!==we.CallExpression&&a.type!==we.TaggedTemplateExpression||Ni(a))return;let l=ki(a);l&&e.report({node:a,messageId:"moduleLevel",data:{functionName:l}})};return o}});import{AST_NODE_TYPES as Pe}from"@typescript-eslint/utils";function zl(e,t){let{body:r}=e;if(r.type!==Pe.BlockStatement)return t.getText(r);let n=r.body[0];return!n||n.type!==Pe.ReturnStatement?"":n.argument?t.getText(n.argument):"undefined"}function Vl(e){let t=e.parent;if(t.type!==Pe.ReturnStatement)return null;let r=t.parent;if(r.type!==Pe.BlockStatement||r.body.length!==1)return null;let n=r.parent;return n.type!==Pe.FunctionDeclaration&&n.type!==Pe.ArrowFunctionExpression&&n.type!==Pe.FunctionExpression?null:{parentFunction:n,returnStatement:t}}var Xn=z({name:"no-unnecessary-iife",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary immediately invoked function expressions"},messages:{unnecessaryIife:"Unnecessary IIFE. Can be simplified to the returned expression."},schema:[]},defaultOptions:[],create(e){let t=e.sourceCode;return{CallExpression(r){let{callee:n,arguments:s}=r;if(s.length>0||n.type!==Pe.FunctionExpression&&n.type!==Pe.ArrowFunctionExpression||n.async||n.params.length>0)return;let{body:o}=n;if(o.type===Pe.BlockStatement){if(o.body.length!==1){let p=Vl(r);if(p){if(t.getCommentsInside(n).length>0)return;let y=t.getText(o);e.report({node:r,messageId:"unnecessaryIife",fix:u=>{let{parentFunction:d}=p;return d.body.type!==Pe.BlockStatement?null:u.replaceText(d.body,y)}})}return}let l=o.body[0];if(!l||l.type!==Pe.ReturnStatement)return}if(t.getCommentsInside(n).length>0)return;let a=zl(n,t);e.report({node:r,messageId:"unnecessaryIife",fix:l=>l.replaceText(r,a)})}}}});import{z as et}from"zod/v4";var Wl="no-restricted-comments",Jl=et.object({regex:et.string().optional(),includes:et.string().optional(),message:et.string().optional(),autoFix:et.boolean().optional()}),Xl=et.object({patterns:et.array(Jl)}),Bn=z({name:Wl,meta:{type:"problem",docs:{description:"Disallow comments matching specific patterns"},fixable:"code",hasSuggestions:!0,schema:[_(Xl)],messages:{restrictedComment:"Comment matches restricted pattern '{{pattern}}'",restrictedCommentWithMessage:"{{message}}",removeComment:"Remove this comment"}},defaultOptions:[{patterns:[]}],create(e,[t]){let r=e.sourceCode,n=new Map;function s(i){let a=n.get(i);return a||(a=new RegExp(i),n.set(i,a)),a}function o(i,a){return a.regex?s(a.regex).test(i):a.includes?i.includes(a.includes):!1}return{Program(){let i=r.getAllComments();for(let l of i)for(let p of t.patterns)if(o(l.value,p)){let y=function(u){return u.remove(l)};var a=y;let m=p.regex??p.includes??"";p.message?e.report({loc:l.loc,messageId:"restrictedCommentWithMessage",data:{message:p.message},fix:p.autoFix?y:void 0,suggest:p.autoFix?void 0:[{messageId:"removeComment",fix:y}]}):e.report({loc:l.loc,messageId:"restrictedComment",data:{pattern:m},fix:p.autoFix?y:void 0,suggest:p.autoFix?void 0:[{messageId:"removeComment",fix:y}]});break}}}}});import{AST_NODE_TYPES as Hn}from"@typescript-eslint/utils";import{z as ht}from"zod/v4";var Bl=ht.object({allow:ht.record(ht.string(),ht.array(ht.string())).optional()}),Yn=z({name:"no-data-attributes-on-components",meta:{type:"problem",docs:{description:"Disallow data-* attributes on custom React components. Use regular props instead."},schema:[_(Bl)],messages:{noDataAttributesOnComponents:"Avoid using data-* attributes on custom components. Use regular props instead or apply data attributes to the underlying DOM element."}},defaultOptions:[{}],create(e,[t]){let r=t.allow??{};function n(i){let a=i.charAt(0);return a===a.toUpperCase()&&a!==a.toLowerCase()}function s(i){return i.type===Hn.JSXIdentifier?{name:i.name,isCustom:n(i.name)}:i.type===Hn.JSXMemberExpression?{name:"",isCustom:!0}:{name:`${i.namespace.name}:${i.name.name}`,isCustom:!1}}function o(i,a){let l=r[i];return l?l.includes(a):!1}return{JSXAttribute(i){if(i.name.type!==Hn.JSXIdentifier)return;let a=i.name.name;if(!a.startsWith("data-"))return;let l=s(i.parent.name);!l||!l.isCustom||l.name&&o(l.name,a)||e.report({node:i,messageId:"noDataAttributesOnComponents"})}}}});import{AST_NODE_TYPES as tt}from"@typescript-eslint/utils";import{z as nt}from"zod/v4";var Hl=nt.object({fn:nt.string().optional(),selector:nt.string().optional(),commentPrefix:nt.string(),message:nt.string().optional()}),Yl=nt.object({matches:nt.array(Hl)}),qn=z({name:"require-usage-explanation",meta:{type:"problem",docs:{description:"Require explanatory comments with a specific prefix above matched code patterns"},schema:[_(Yl)],messages:{default:"{{message}}"}},defaultOptions:[{matches:[]}],create(e,[t]){let r=e.sourceCode,n={},s=[];function o(u){let d=u;for(;d.parent;){let c=d.parent.type;if(c===tt.Program||c===tt.BlockStatement||c===tt.SwitchCase)return d;d=d.parent}}function i(u,d){for(let c of u){let g=c.value.trim();if(g.startsWith(d)&&g.slice(d.length).trim().length>0)return!0}return!1}function a(u){let{callee:d}=u;if(d.type===tt.Identifier)return d.name;if(d.type===tt.MemberExpression&&d.property.type===tt.Identifier)return d.property.name}function l(u,d,c){let g=`Add a comment with prefix "${u}" to explain why "${d}" is being used.`;return c?`${g} ${c}`:g}function p(u,d){let c=o(u);if(!c)return!1;let g=u;for(;g!==c&&g.parent;){let S=r.getCommentsBefore(g);if(i(S,d))return!0;g=g.parent}let h=r.getCommentsBefore(c);return!!i(h,d)}function m(u,d){p(u,d.commentPrefix)||e.report({node:u,messageId:"default",data:{message:l(d.commentPrefix,d.label,d.message)}})}function y(u,d){let c=n[u];c?n[u]=g=>{c(g),d(g)}:n[u]=d}for(let u of t.matches){if(u.fn){let d=u.fn,c={commentPrefix:u.commentPrefix,label:d,message:u.message};s.push(g=>{a(g)===d&&m(g,c)})}if(u.selector){let d={commentPrefix:u.commentPrefix,label:u.selector,message:u.message};y(u.selector,c=>{m(c,d)})}}return s.length>0&&y("CallExpression",u=>{if(u.type===tt.CallExpression)for(let d of s)d(u)}),n}});import{AST_NODE_TYPES as Te,ESLintUtils as ql}from"@typescript-eslint/utils";import*as Oe from"typescript";import{z as Xe}from"zod/v4";var Zl=Xe.object({additionalCastFunctions:Xe.array(Xe.object({name:Xe.string(),expectedType:Xe.enum(["string","number"])})).optional(),allowNullishCasting:Xe.boolean().optional(),allowInvalidCasting:Xe.boolean().optional(),allowAnyCasting:Xe.boolean().optional(),allowUnknownCasting:Xe.boolean().optional()}),Pi=new Set([Te.Identifier,Te.Literal,Te.TemplateLiteral,Te.MemberExpression,Te.CallExpression]),Gl=Oe.TypeFlags.Null|Oe.TypeFlags.Undefined|Oe.TypeFlags.Void;function Kl(e,t){if(Pi.has(e.type))return!1;if(e.type===Te.SequenceExpression)return!0;let r=t.parent;switch(r.type){case Te.VariableDeclarator:case Te.ExpressionStatement:case Te.ReturnStatement:case Te.ArrowFunctionExpression:case Te.Property:case Te.ArrayExpression:case Te.AssignmentExpression:case Te.JSXExpressionContainer:return!1;case Te.CallExpression:case Te.NewExpression:return r.callee===t;default:return!0}}var Zn=z({name:"strict-casting",meta:{type:"problem",docs:{description:"Disallow unnecessary, nullish and invalid String()/Number() casts"},schema:[_(Zl)],fixable:"code",hasSuggestions:!0,messages:{unnecessaryCasting:"Unnecessary {{name}}() cast of a value that is already of type {{type}}",nullishStringCasting:"String() cast of a possibly nullish value results in the strings 'null' or 'undefined', handle the nullish case explicitly",nullishNumberCasting:"Number() cast of a possibly nullish value results in 0 for null and NaN for undefined, handle the nullish case explicitly",symbolNumberCasting:"Number() cast of a symbol throws at runtime",nanNumberCasting:'Number() cast of a value of type "{{type}}" will result in NaN',anyCasting:"{{name}}() cast of an `any` value is unsafe, type the value before casting",unknownCasting:"{{name}}() cast of an `unknown` value is unsafe, narrow the value before casting",addNullishFallback:"Add a `?? {{fallback}}` fallback to handle the nullish case"}},defaultOptions:[{}],create(e,[t]){let r=t.allowNullishCasting??!1,n=t.allowInvalidCasting??!1,s=t.allowAnyCasting??!1,o=t.allowUnknownCasting??!1,i=new Map([["String",{expectedType:"string",builtin:!0}],["Number",{expectedType:"number",builtin:!0}]]);for(let u of t.additionalCastFunctions??[])i.set(u.name,{expectedType:u.expectedType,builtin:!1});let a=ql.getParserServices(e),l=a.program.getTypeChecker();function p(u){let d=u.isUnion()?u.types:[u],c=[];for(let g of d)if(g.isTypeParameter()){let h=l.getBaseConstraintOfType(g);if(!h)return;h.isUnion()?c.push(...h.types):c.push(h)}else c.push(g);return c}function m(u,d){let g=l.getApparentType(u).getProperty("valueOf");if(!g)return!1;let h=l.getTypeOfSymbolAtLocation(g,d);for(let S of h.getCallSignatures())if(S.getReturnType().flags&Oe.TypeFlags.NumberLike)return!0;return!1}function y(u,d,c,g){e.report({node:u,messageId:"unnecessaryCasting",data:{name:c,type:g},fix(h){let S=e.sourceCode.getText(d);return h.replaceText(u,Kl(d,u)?`(${S})`:S)}})}return{CallExpression(u){if(u.callee.type!==Te.Identifier)return;let d=i.get(u.callee.name);if(!d||u.arguments.length!==1)return;let c=u.arguments[0];if(!c||c.type===Te.SpreadElement)return;let g=u.callee.name,{expectedType:h,builtin:S}=d;if(c.type===Te.Literal){if(typeof c.value===h){y(u,c,g,h);return}}else if(c.type===Te.TemplateLiteral&&h==="string"){y(u,c,g,h);return}let I=l.getTypeAtLocation(a.esTreeNodeToTSNodeMap.get(c)),A=p(I);if(!A)return;let T=!1,b=!1;for(let w of A)w.flags&Oe.TypeFlags.Any?T=!0:w.flags&Oe.TypeFlags.Unknown&&(b=!0);if(T||b){S&&(T&&!s?e.report({node:u,messageId:"anyCasting",data:{name:g}}):b&&!o&&e.report({node:u,messageId:"unknownCasting",data:{name:g}}));return}if(S&&!r&&A.some(N=>N.flags&Gl)){let N=h==="string"?"''":"0";e.report({node:u,messageId:h==="string"?"nullishStringCasting":"nullishNumberCasting",suggest:[{messageId:"addNullishFallback",data:{fallback:N},fix(k){let O=e.sourceCode.getText(c),f=Pi.has(c.type)?O:`(${O})`;return k.replaceText(c,`${f} ?? ${N}`)}}]});return}if(S&&h==="number"&&!n){if(A.some(k=>k.flags&Oe.TypeFlags.ESSymbolLike)){e.report({node:u,messageId:"symbolNumberCasting"});return}let w=a.esTreeNodeToTSNodeMap.get(c);if(A.some(k=>k.flags&(Oe.TypeFlags.Object|Oe.TypeFlags.Intersection)&&!m(k,w))){e.report({node:u,messageId:"nanNumberCasting",data:{type:l.typeToString(I)}});return}}let C=h==="string"?Oe.TypeFlags.StringLike:Oe.TypeFlags.NumberLike;A.every(w=>w.flags&C)&&y(u,c,g,h)}}}});var Oi={[fn.name]:fn.rule,[Bt.name]:Bt.rule,[Xt.name]:Xt.rule,"rules-of-hooks":Ii,"exhaustive-deps":lr,"require-description":yi.rule,[Ht.name]:Ht.rule,[qt.name]:qt.rule,[dn.name]:dn.rule,[Lt.name]:Lt.rule,[Jt.name]:Jt.rule,[Kt.name]:Kt.rule,[mt.name]:mt.rule,[En.name]:En.rule,[Zt.name]:Zt.rule,[Yt.name]:Yt.rule,[Qt.name]:Qt.rule,[Mt.name]:Mt.rule,[Cn.name]:Cn.rule,[xn.name]:xn.rule,[An.name]:An.rule,[vn.name]:vn.rule,[Wt.name]:Wt.rule,[rn.name]:rn.rule,[sn.name]:sn.rule,[on.name]:on.rule,[pn.name]:pn.rule,[cn.name]:cn.rule,[an.name]:an.rule,[ln.name]:ln.rule,[Sn.name]:Sn.rule,[tn.name]:tn.rule,[en.name]:en.rule,[Dn.name]:Dn.rule,[mn.name]:mn.rule,[Rn.name]:Rn.rule,[On.name]:On.rule,[Ln.name]:Ln.rule,[jn.name]:jn.rule,[$n.name]:$n.rule,[_n.name]:_n.rule,[Un.name]:Un.rule,[Vn.name]:Vn.rule,[Wn.name]:Wn.rule,[Jn.name]:Jn.rule,[mt.name]:mt.rule,[Xn.name]:Xn.rule,[Bn.name]:Bn.rule,[Yn.name]:Yn.rule,[qn.name]:qn.rule,[Zn.name]:Zn.rule};var Ql={rules:Oi},yy=Ql;export{yy as default,Ql as extendedLintPlugin};
55
+ `)}}}}});import{AST_NODE_TYPES as _l,ESLintUtils as Ul}from"@typescript-eslint/utils";import Ri from"typescript";import{z as zl}from"zod/v4";var Vl=zl.object({}),Wn=z({name:"no-unnecessary-void-on-promise",meta:{type:"suggestion",docs:{description:"Disallow void operator on non-Promise function calls to avoid unnecessary void keywords added by no-floating-promises"},messages:{unnecessaryVoid:"Unnecessary void operator on non-Promise function call",removeVoid:"Remove void operator"},hasSuggestions:!0,schema:[_(Vl)]},defaultOptions:[{}],create(e){let t=Ul.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(s,o){if(s.flags&Ri.TypeFlags.Any||s.flags&Ri.TypeFlags.Unknown)return!1;let i=s.getProperty("then");return i?o.getTypeOfSymbol(i).getCallSignatures().length>0:!1}return{UnaryExpression(s){if(s.operator!=="void"||s.argument.type!==_l.CallExpression)return;let o=t.esTreeNodeToTSNodeMap.get(s.argument),i=r.getTypeAtLocation(o);if(!n(i,r)){let l=e.sourceCode.getText(s.argument);e.report({node:s,messageId:"unnecessaryVoid",suggest:[{messageId:"removeVoid",fix(p){return p.replaceText(s,l)}}]})}}}}});import{AST_NODE_TYPES as we}from"@typescript-eslint/utils";import{z as Et}from"zod/v4";var Wl=Et.object({functions:Et.array(Et.string()).optional(),selectors:Et.array(Et.string()).optional()});function Ni(e){let t=e.parent;for(;t;){if(t.type===we.FunctionDeclaration||t.type===we.FunctionExpression||t.type===we.ArrowFunctionExpression)return!0;t=t.parent}return!1}function ki(e){if(e.type===we.TaggedTemplateExpression){let{tag:r}=e;return r.type===we.Identifier?r.name:r.type===we.MemberExpression&&r.property.type===we.Identifier?r.property.name:null}let{callee:t}=e;return t.type===we.Identifier?t.name:t.type===we.MemberExpression&&t.property.type===we.Identifier?t.property.name:null}var Jn=z({name:"require-lazy-execution",meta:{type:"problem",docs:{description:"Require certain function calls to be executed lazily (inside functions, not at module level)"},messages:{moduleLevel:'Function "{{ functionName }}" must only be called inside functions or getters, not at module level'},schema:[_(Wl)]},defaultOptions:[{functions:[],selectors:[]}],create(e){let[t]=e.options,r=new Set(t.functions??[]),n=t.selectors??[];function s(i){if(Ni(i))return;let a=ki(i);a&&r.has(a)&&e.report({node:i,messageId:"moduleLevel",data:{functionName:a}})}let o={CallExpression(i){i.type===we.CallExpression&&s(i)},TaggedTemplateExpression(i){i.type===we.TaggedTemplateExpression&&s(i)}};for(let i of n)o[i]=a=>{if(a.type!==we.CallExpression&&a.type!==we.TaggedTemplateExpression||Ni(a))return;let l=ki(a);l&&e.report({node:a,messageId:"moduleLevel",data:{functionName:l}})};return o}});import{AST_NODE_TYPES as Pe}from"@typescript-eslint/utils";function Jl(e,t){let{body:r}=e;if(r.type!==Pe.BlockStatement)return t.getText(r);let n=r.body[0];return!n||n.type!==Pe.ReturnStatement?"":n.argument?t.getText(n.argument):"undefined"}function Xl(e){let t=e.parent;if(t.type!==Pe.ReturnStatement)return null;let r=t.parent;if(r.type!==Pe.BlockStatement||r.body.length!==1)return null;let n=r.parent;return n.type!==Pe.FunctionDeclaration&&n.type!==Pe.ArrowFunctionExpression&&n.type!==Pe.FunctionExpression?null:{parentFunction:n,returnStatement:t}}var Xn=z({name:"no-unnecessary-iife",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary immediately invoked function expressions"},messages:{unnecessaryIife:"Unnecessary IIFE. Can be simplified to the returned expression."},schema:[]},defaultOptions:[],create(e){let t=e.sourceCode;return{CallExpression(r){let{callee:n,arguments:s}=r;if(s.length>0||n.type!==Pe.FunctionExpression&&n.type!==Pe.ArrowFunctionExpression||n.async||n.params.length>0)return;let{body:o}=n;if(o.type===Pe.BlockStatement){if(o.body.length!==1){let p=Xl(r);if(p){if(t.getCommentsInside(n).length>0)return;let y=t.getText(o);e.report({node:r,messageId:"unnecessaryIife",fix:u=>{let{parentFunction:d}=p;return d.body.type!==Pe.BlockStatement?null:u.replaceText(d.body,y)}})}return}let l=o.body[0];if(!l||l.type!==Pe.ReturnStatement)return}if(t.getCommentsInside(n).length>0)return;let a=Jl(n,t);e.report({node:r,messageId:"unnecessaryIife",fix:l=>l.replaceText(r,a)})}}}});import{z as et}from"zod/v4";var Bl="no-restricted-comments",Hl=et.object({regex:et.string().optional(),includes:et.string().optional(),message:et.string().optional(),autoFix:et.boolean().optional()}),Yl=et.object({patterns:et.array(Hl)}),Bn=z({name:Bl,meta:{type:"problem",docs:{description:"Disallow comments matching specific patterns"},fixable:"code",hasSuggestions:!0,schema:[_(Yl)],messages:{restrictedComment:"Comment matches restricted pattern '{{pattern}}'",restrictedCommentWithMessage:"{{message}}",removeComment:"Remove this comment"}},defaultOptions:[{patterns:[]}],create(e,[t]){let r=e.sourceCode,n=new Map;function s(i){let a=n.get(i);return a||(a=new RegExp(i),n.set(i,a)),a}function o(i,a){return a.regex?s(a.regex).test(i):a.includes?i.includes(a.includes):!1}return{Program(){let i=r.getAllComments();for(let l of i)for(let p of t.patterns)if(o(l.value,p)){let y=function(u){return u.remove(l)};var a=y;let m=p.regex??p.includes??"";p.message?e.report({loc:l.loc,messageId:"restrictedCommentWithMessage",data:{message:p.message},fix:p.autoFix?y:void 0,suggest:p.autoFix?void 0:[{messageId:"removeComment",fix:y}]}):e.report({loc:l.loc,messageId:"restrictedComment",data:{pattern:m},fix:p.autoFix?y:void 0,suggest:p.autoFix?void 0:[{messageId:"removeComment",fix:y}]});break}}}}});import{AST_NODE_TYPES as Hn}from"@typescript-eslint/utils";import{z as ht}from"zod/v4";var ql=ht.object({allow:ht.record(ht.string(),ht.array(ht.string())).optional()}),Yn=z({name:"no-data-attributes-on-components",meta:{type:"problem",docs:{description:"Disallow data-* attributes on custom React components. Use regular props instead."},schema:[_(ql)],messages:{noDataAttributesOnComponents:"Avoid using data-* attributes on custom components. Use regular props instead or apply data attributes to the underlying DOM element."}},defaultOptions:[{}],create(e,[t]){let r=t.allow??{};function n(i){let a=i.charAt(0);return a===a.toUpperCase()&&a!==a.toLowerCase()}function s(i){return i.type===Hn.JSXIdentifier?{name:i.name,isCustom:n(i.name)}:i.type===Hn.JSXMemberExpression?{name:"",isCustom:!0}:{name:`${i.namespace.name}:${i.name.name}`,isCustom:!1}}function o(i,a){let l=r[i];return l?l.includes(a):!1}return{JSXAttribute(i){if(i.name.type!==Hn.JSXIdentifier)return;let a=i.name.name;if(!a.startsWith("data-"))return;let l=s(i.parent.name);!l||!l.isCustom||l.name&&o(l.name,a)||e.report({node:i,messageId:"noDataAttributesOnComponents"})}}}});import{AST_NODE_TYPES as tt}from"@typescript-eslint/utils";import{z as nt}from"zod/v4";var Zl=nt.object({fn:nt.string().optional(),selector:nt.string().optional(),commentPrefix:nt.string(),message:nt.string().optional()}),Gl=nt.object({matches:nt.array(Zl)}),qn=z({name:"require-usage-explanation",meta:{type:"problem",docs:{description:"Require explanatory comments with a specific prefix above matched code patterns"},schema:[_(Gl)],messages:{default:"{{message}}"}},defaultOptions:[{matches:[]}],create(e,[t]){let r=e.sourceCode,n={},s=[];function o(u){let d=u;for(;d.parent;){let c=d.parent.type;if(c===tt.Program||c===tt.BlockStatement||c===tt.SwitchCase)return d;d=d.parent}}function i(u,d){for(let c of u){let g=c.value.trim();if(g.startsWith(d)&&g.slice(d.length).trim().length>0)return!0}return!1}function a(u){let{callee:d}=u;if(d.type===tt.Identifier)return d.name;if(d.type===tt.MemberExpression&&d.property.type===tt.Identifier)return d.property.name}function l(u,d,c){let g=`Add a comment with prefix "${u}" to explain why "${d}" is being used.`;return c?`${g} ${c}`:g}function p(u,d){let c=o(u);if(!c)return!1;let g=u;for(;g!==c&&g.parent;){let S=r.getCommentsBefore(g);if(i(S,d))return!0;g=g.parent}let h=r.getCommentsBefore(c);return!!i(h,d)}function m(u,d){p(u,d.commentPrefix)||e.report({node:u,messageId:"default",data:{message:l(d.commentPrefix,d.label,d.message)}})}function y(u,d){let c=n[u];c?n[u]=g=>{c(g),d(g)}:n[u]=d}for(let u of t.matches){if(u.fn){let d=u.fn,c={commentPrefix:u.commentPrefix,label:d,message:u.message};s.push(g=>{a(g)===d&&m(g,c)})}if(u.selector){let d={commentPrefix:u.commentPrefix,label:u.selector,message:u.message};y(u.selector,c=>{m(c,d)})}}return s.length>0&&y("CallExpression",u=>{if(u.type===tt.CallExpression)for(let d of s)d(u)}),n}});import{AST_NODE_TYPES as Te,ESLintUtils as Kl}from"@typescript-eslint/utils";import*as Oe from"typescript";import{z as Xe}from"zod/v4";var Ql=Xe.object({additionalCastFunctions:Xe.array(Xe.object({name:Xe.string(),expectedType:Xe.enum(["string","number"])})).optional(),allowNullishCasting:Xe.boolean().optional(),allowInvalidCasting:Xe.boolean().optional(),allowAnyCasting:Xe.boolean().optional(),allowUnknownCasting:Xe.boolean().optional()}),Pi=new Set([Te.Identifier,Te.Literal,Te.TemplateLiteral,Te.MemberExpression,Te.CallExpression]),ep=Oe.TypeFlags.Null|Oe.TypeFlags.Undefined|Oe.TypeFlags.Void;function tp(e,t){if(Pi.has(e.type))return!1;if(e.type===Te.SequenceExpression)return!0;let r=t.parent;switch(r.type){case Te.VariableDeclarator:case Te.ExpressionStatement:case Te.ReturnStatement:case Te.ArrowFunctionExpression:case Te.Property:case Te.ArrayExpression:case Te.AssignmentExpression:case Te.JSXExpressionContainer:return!1;case Te.CallExpression:case Te.NewExpression:return r.callee===t;default:return!0}}var Zn=z({name:"strict-casting",meta:{type:"problem",docs:{description:"Disallow unnecessary, nullish and invalid String()/Number() casts"},schema:[_(Ql)],fixable:"code",hasSuggestions:!0,messages:{unnecessaryCasting:"Unnecessary {{name}}() cast of a value that is already of type {{type}}",nullishStringCasting:"String() cast of a possibly nullish value results in the strings 'null' or 'undefined', handle the nullish case explicitly",nullishNumberCasting:"Number() cast of a possibly nullish value results in 0 for null and NaN for undefined, handle the nullish case explicitly",symbolNumberCasting:"Number() cast of a symbol throws at runtime",nanNumberCasting:'Number() cast of a value of type "{{type}}" will result in NaN',anyCasting:"{{name}}() cast of an `any` value is unsafe, type the value before casting",unknownCasting:"{{name}}() cast of an `unknown` value is unsafe, narrow the value before casting",addNullishFallback:"Add a `?? {{fallback}}` fallback to handle the nullish case"}},defaultOptions:[{}],create(e,[t]){let r=t.allowNullishCasting??!1,n=t.allowInvalidCasting??!1,s=t.allowAnyCasting??!1,o=t.allowUnknownCasting??!1,i=new Map([["String",{expectedType:"string",builtin:!0}],["Number",{expectedType:"number",builtin:!0}]]);for(let u of t.additionalCastFunctions??[])i.set(u.name,{expectedType:u.expectedType,builtin:!1});let a=Kl.getParserServices(e),l=a.program.getTypeChecker();function p(u){let d=u.isUnion()?u.types:[u],c=[];for(let g of d)if(g.isTypeParameter()){let h=l.getBaseConstraintOfType(g);if(!h)return;h.isUnion()?c.push(...h.types):c.push(h)}else c.push(g);return c}function m(u,d){let g=l.getApparentType(u).getProperty("valueOf");if(!g)return!1;let h=l.getTypeOfSymbolAtLocation(g,d);for(let S of h.getCallSignatures())if(S.getReturnType().flags&Oe.TypeFlags.NumberLike)return!0;return!1}function y(u,d,c,g){e.report({node:u,messageId:"unnecessaryCasting",data:{name:c,type:g},fix(h){let S=e.sourceCode.getText(d);return h.replaceText(u,tp(d,u)?`(${S})`:S)}})}return{CallExpression(u){if(u.callee.type!==Te.Identifier)return;let d=i.get(u.callee.name);if(!d||u.arguments.length!==1)return;let c=u.arguments[0];if(!c||c.type===Te.SpreadElement)return;let g=u.callee.name,{expectedType:h,builtin:S}=d;if(c.type===Te.Literal){if(typeof c.value===h){y(u,c,g,h);return}}else if(c.type===Te.TemplateLiteral&&h==="string"){y(u,c,g,h);return}let I=l.getTypeAtLocation(a.esTreeNodeToTSNodeMap.get(c)),A=p(I);if(!A)return;let T=!1,b=!1;for(let w of A)w.flags&Oe.TypeFlags.Any?T=!0:w.flags&Oe.TypeFlags.Unknown&&(b=!0);if(T||b){S&&(T&&!s?e.report({node:u,messageId:"anyCasting",data:{name:g}}):b&&!o&&e.report({node:u,messageId:"unknownCasting",data:{name:g}}));return}if(S&&!r&&A.some(N=>N.flags&ep)){let N=h==="string"?"''":"0";e.report({node:u,messageId:h==="string"?"nullishStringCasting":"nullishNumberCasting",suggest:[{messageId:"addNullishFallback",data:{fallback:N},fix(k){let O=e.sourceCode.getText(c),f=Pi.has(c.type)?O:`(${O})`;return k.replaceText(c,`${f} ?? ${N}`)}}]});return}if(S&&h==="number"&&!n){if(A.some(k=>k.flags&Oe.TypeFlags.ESSymbolLike)){e.report({node:u,messageId:"symbolNumberCasting"});return}let w=a.esTreeNodeToTSNodeMap.get(c);if(A.some(k=>k.flags&(Oe.TypeFlags.Object|Oe.TypeFlags.Intersection)&&!m(k,w))){e.report({node:u,messageId:"nanNumberCasting",data:{type:l.typeToString(I)}});return}}let C=h==="string"?Oe.TypeFlags.StringLike:Oe.TypeFlags.NumberLike;A.every(w=>w.flags&C)&&y(u,c,g,h)}}}});var Oi={[fn.name]:fn.rule,[Bt.name]:Bt.rule,[Xt.name]:Xt.rule,"rules-of-hooks":Ii,"exhaustive-deps":lr,"require-description":yi.rule,[Ht.name]:Ht.rule,[qt.name]:qt.rule,[dn.name]:dn.rule,[Lt.name]:Lt.rule,[Jt.name]:Jt.rule,[Kt.name]:Kt.rule,[mt.name]:mt.rule,[En.name]:En.rule,[Zt.name]:Zt.rule,[Yt.name]:Yt.rule,[Qt.name]:Qt.rule,[Mt.name]:Mt.rule,[Cn.name]:Cn.rule,[xn.name]:xn.rule,[An.name]:An.rule,[vn.name]:vn.rule,[Wt.name]:Wt.rule,[rn.name]:rn.rule,[sn.name]:sn.rule,[on.name]:on.rule,[pn.name]:pn.rule,[cn.name]:cn.rule,[an.name]:an.rule,[ln.name]:ln.rule,[Sn.name]:Sn.rule,[tn.name]:tn.rule,[en.name]:en.rule,[Dn.name]:Dn.rule,[mn.name]:mn.rule,[Rn.name]:Rn.rule,[On.name]:On.rule,[Ln.name]:Ln.rule,[jn.name]:jn.rule,[$n.name]:$n.rule,[_n.name]:_n.rule,[Un.name]:Un.rule,[Vn.name]:Vn.rule,[Wn.name]:Wn.rule,[Jn.name]:Jn.rule,[mt.name]:mt.rule,[Xn.name]:Xn.rule,[Bn.name]:Bn.rule,[Yn.name]:Yn.rule,[qn.name]:qn.rule,[Zn.name]:Zn.rule};var np={rules:Oi},Sy=np;export{Sy as default,np as extendedLintPlugin};