@ls-stack/extended-lint 0.82.0 → 0.82.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  "use strict";var xi=Object.create;var St=Object.defineProperty;var Ci=Object.getOwnPropertyDescriptor;var Ii=Object.getOwnPropertyNames;var Ai=Object.getPrototypeOf,wi=Object.prototype.hasOwnProperty;var Fi=(e,t)=>{for(var r in t)St(e,r,{get:t[r],enumerable:!0})},Kn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ii(t))!wi.call(e,o)&&o!==r&&St(e,o,{get:()=>t[o],enumerable:!(n=Ci(t,o))||n.enumerable});return e};var Pe=(e,t,r)=>(r=e!=null?xi(Ai(e)):{},Kn(t||!e||!e.__esModule?St(r,"default",{value:e,enumerable:!0}):r,e)),Ri=e=>Kn(St({},"__esModule",{value:!0}),e);var Ga={};Fi(Ga,{extendedLintPlugin:()=>Za});module.exports=Ri(Ga);var he=require("@typescript-eslint/utils"),M=require("zod/v4");var Qn=require("@typescript-eslint/utils"),er=Pe(require("zod/v4"));function X(e){let r=Qn.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function z(e){return er.toJSONSchema(e)}var vi=M.z.object({disallow:M.z.array(M.z.object({selector:M.z.string(),message:M.z.string(),replace:M.z.optional(M.z.union([M.z.string(),M.z.object({regex:M.z.string(),with:M.z.string()})])),replaceType:M.z.optional(M.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:M.z.optional(M.z.array(M.z.object({fn:M.z.string(),withArgs:M.z.optional(M.z.array(M.z.object({atIndex:M.z.number(),value:M.z.union([M.z.string(),M.z.number(),M.z.boolean()])}))),message:M.z.string(),replaceWith:M.z.optional(M.z.string()),ignoreRegex:M.z.optional(M.z.string())}))),__dev_simulateFileName:M.z.optional(M.z.string()),mustMatchSyntax:M.z.optional(M.z.array(M.z.object({includeRegex:M.z.string(),mustCallFn:M.z.optional(M.z.array(M.z.object({anyCall:M.z.array(M.z.object({fn:M.z.string(),withArgs:M.z.array(M.z.object({atIndex:M.z.number(),literal:M.z.union([M.z.string(),M.z.number(),M.z.boolean()])}))})),message:M.z.optional(M.z.string())}))),mustMatchSelector:M.z.optional(M.z.array(M.z.object({selector:M.z.string(),message:M.z.string()}))),mustHaveExport:M.z.optional(M.z.array(M.z.object({name:M.z.string(),type:M.z.enum(["function","variable","any"]).default("any"),message:M.z.string()})))})))}),Lt=X({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[z(vi)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:s,disallowFnCalls:i}=t,l=o??e.filename,c=[],a=new Map,u=new Set,f=new Map,y=new Set,x=new Map;function m(b){for(let w of b.specifiers)w.type===he.AST_NODE_TYPES.ImportSpecifier&&w.imported.type===he.AST_NODE_TYPES.Identifier&&w.imported.name!==w.local.name&&x.set(w.local.name,w.imported.name)}function E(b){if(b.declaration){if(b.declaration.type===he.AST_NODE_TYPES.FunctionDeclaration&&b.declaration.id){let w=b.declaration.id.name;for(let k of Array.from(y)){let[N,p]=k.split(":");N===w&&(p==="function"||p==="any")&&y.delete(k)}}else if(b.declaration.type===he.AST_NODE_TYPES.VariableDeclaration){for(let w of b.declaration.declarations)if(w.id.type===he.AST_NODE_TYPES.Identifier){let k=w.id.name;for(let N of Array.from(y)){let[p,F]=N.split(":");p===k&&(F==="variable"||F==="any")&&y.delete(N)}}}}for(let w of b.specifiers)if(w.exported.type===he.AST_NODE_TYPES.Identifier){let k=w.exported.name;for(let N of Array.from(y)){let[p,F]=N.split(":");p===k&&F==="any"&&y.delete(N)}}}function C(b){b.id.type===he.AST_NODE_TYPES.Identifier&&b.init?.type===he.AST_NODE_TYPES.Identifier&&x.set(b.id.name,b.init.name)}function S(b){return x.get(b)??b}function I(b,w){return S(b)===w||b===w}for(let{includeRegex:b,mustCallFn:w,mustMatchSelector:k,mustHaveExport:N}of n??[]){let F=function(d){let g=d;for(let{name:R,value:P}of p??[])g=g.replaceAll(R,P);return g};var h=F;let p=ki(l,new RegExp(b));if(p){for(let{anyCall:d,message:g}of w??[]){let R=`Expected file to call the function: ${d.map(({fn:P})=>P).join(" or ")}`;u.add(R),c.push(P=>{let{callee:j}=P;if(j.type===he.AST_NODE_TYPES.Identifier){for(let{fn:V,withArgs:G}of d)if(j.name===V){u.delete(R);for(let Y of G){let D=P.arguments[Y.atIndex],Z=typeof Y.literal=="string"?F(Y.literal):Y.literal;if(!D){e.report({node:P,messageId:"default",data:{message:`Missing argument with value "${Z}" at index ${Y.atIndex}${g?`: ${F(g)}`:""}`}});continue}if(D.type!==he.AST_NODE_TYPES.Literal){e.report({node:D,messageId:"default",data:{message:`Argument at position ${Y.atIndex} should the literal "${Z}"${g?`: ${F(g)}`:""}`}});continue}D.value!==Z&&e.report({node:D,messageId:"default",data:{message:`Argument should have the value "${Z}"${g?`: ${F(g)}`:""}`},fix:q=>q.replaceText(D,typeof Z=="string"?`'${Z}'`:String(Z))})}break}}})}for(let{selector:d,message:g}of k??[])f.set(d,F(g)),a.set(F(d),()=>{f.delete(d)});for(let{name:d,type:g,message:R}of N??[]){let P=F(d),j=F(R);y.add(`${P}:${g}:${j}`)}}}for(let{fn:b,withArgs:w,message:k,replaceWith:N,ignoreRegex:p}of i??[])p&&new RegExp(p).test(l)||c.push(F=>{let{callee:d}=F;if(d.type!==he.AST_NODE_TYPES.Identifier||!I(d.name,b))return;if(w)for(let R of w){let P=F.arguments[R.atIndex];if(!P){e.report({node:F,messageId:"default",data:{message:`Missing argument with value "${R.value}" at index ${R.atIndex}: ${k}`}});return}if(P.type!==he.AST_NODE_TYPES.Literal||P.value!==R.value)return}let g=R=>N?R.replaceText(F,N):null;e.report({node:F,messageId:"default",data:{message:k},suggest:N?[{messageId:"default",data:{message:`Replace with "${N}"`},fix:g}]:void 0})});function A(b,w){let k=r[b];k?r[b]=N=>{k(N),w(N)}:r[b]=w}for(let{selector:b,message:w,replace:k,replaceType:N="suggestion"}of s??[]){if(b==="CallExpression"){c.push(p=>{T(k,p,w,N)});continue}r[b]=p=>{T(k,p,w,N)}}if(a.size>0)for(let[b,w]of a)A(b,w);return c.length>0&&(r.CallExpression=b=>{if(b.type===he.AST_NODE_TYPES.CallExpression)for(let w of c)w(b)}),r.ImportDeclaration=b=>{b.type===he.AST_NODE_TYPES.ImportDeclaration&&m(b)},r.ExportNamedDeclaration=b=>{b.type===he.AST_NODE_TYPES.ExportNamedDeclaration&&E(b)},r.VariableDeclarator=b=>{b.type===he.AST_NODE_TYPES.VariableDeclarator&&C(b)},r["Program:exit"]=b=>{for(let w of u)e.report({node:b,messageId:"default",data:{message:w}});for(let[,w]of f)e.report({node:b,messageId:"default",data:{message:w}});for(let w of y){let[k,N,p]=w.split(":");e.report({node:b,messageId:"default",data:{message:`Missing required export "${k}" of type ${N}: ${p}`}})}},r;function T(b,w,k,N){let p=F=>{if(!b)return null;if(typeof b=="string")return F.replaceText(w,b);{let d=new RegExp(b.regex),g=e.sourceCode.getText(w);return F.replaceText(w,g.replace(d,b.with))}};e.report({node:w,messageId:"default",data:{message:k},fix:b&&N==="autofix"?p:void 0,suggest:b&&N==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof b=="string"?b:b.with}"`},fix:p}]:void 0})}}});function ki(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...s]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:tr(o)}),r.push({name:"$0_uncapitalize",value:nr(o)}),r.push({name:"$0",value:o});for(let i=0;i<s.length;i++){let l=`$${i+1}`,c=s[i];c!==void 0&&(r.push({name:`${l}_lowercase`,value:c.toLowerCase()}),r.push({name:`${l}_capitalize`,value:tr(c)}),r.push({name:`${l}_uncapitalize`,value:nr(c)}),r.push({name:l,value:c}))}return r}function tr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function nr(e){return e.charAt(0).toLowerCase()+e.slice(1)}var re=require("@typescript-eslint/utils"),Be=require("zod/v4");var Pi=re.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ir="collapse-simple-objs-in-one-line",Oi=Be.z.object({maxLineLength:Be.z.number().optional(),maxProperties:Be.z.number().optional(),nestedObjMaxLineLength:Be.z.number().optional(),nestedObjMaxProperties:Be.z.number().optional(),ignoreTypesWithSuffix:Be.z.array(Be.z.string()).optional()}),Ni=Pi({name:ir,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[z(Oi)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,s=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function l(a){if(a.type===re.AST_NODE_TYPES.ObjectExpression){let u=a.parent.type===re.AST_NODE_TYPES.Property,f=u?i:o,y=a.properties.length;if(y>f)return!1;if(y===1){let m=a.properties[0];return!m||m.type===re.AST_NODE_TYPES.Property&&m.value.type===re.AST_NODE_TYPES.ObjectExpression||m.type===re.AST_NODE_TYPES.Property&&m.value.type===re.AST_NODE_TYPES.ArrayExpression&&!m.value.elements.every(C=>C&&Mt(C))?!1:{text:r.getText(m),isNested:u,propsSize:y}}let x=[];for(let m of a.properties){if(m.type===re.AST_NODE_TYPES.Property&&!Mt(m.value))return!1;x.push(r.getText(m))}return{text:x.join(", "),isNested:u,propsSize:y}}else{let u=a.parent.parent?.type===re.AST_NODE_TYPES.TSPropertySignature,f=u?i:o,y=a.members.length;if(y>f)return!1;if(n.length>0&&a.parent.type===re.AST_NODE_TYPES.TSTypeAliasDeclaration){let m=a.parent.id.name;if(n.some(E=>m.endsWith(E)))return!1}if(y===1){let m=a.members[0];return!m||m.type===re.AST_NODE_TYPES.TSPropertySignature&&m.typeAnnotation?.typeAnnotation.type===re.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(m),isNested:u,propsSize:1}}if(a.parent.type===re.AST_NODE_TYPES.TSIntersectionType||a.parent.type===re.AST_NODE_TYPES.TSUnionType&&a.parent.types[0]!==a)return!1;let x=[];for(let m of a.members){if(m.type!==re.AST_NODE_TYPES.TSPropertySignature)return!1;let E=m.typeAnnotation?.typeAnnotation;if(!E||E.type===re.AST_NODE_TYPES.TSTypeLiteral||!rr(E))return!1;if(E.type===re.AST_NODE_TYPES.TSTypeReference&&E.typeArguments){if(E.typeArguments.params.length>1)return!1;let S=E.typeArguments.params[0];if(!S||!rr(S))return!1}let C=r.getText(m).trim();(C.endsWith(";")||C.endsWith(","))&&(C=C.slice(0,-1)),x.push(C)}return{text:x.join("; "),isNested:u,propsSize:y}}}function c(a){if(a.loc.start.line===a.loc.end.line)return;if(a.parent.type!==re.AST_NODE_TYPES.JSXExpressionContainer){let E=0,C=!1,S=r.getTokenAfter(a,{filter:A=>A.type!==re.AST_TOKEN_TYPES.Punctuator||C?!0:A.value===","?(E++,!1):A.value===";"?(E++,C=!0,!1):A.value===")"||A.value==="}"?(E++,!1):!0});if(E>4)return;let I=S?.type===re.AST_TOKEN_TYPES.Template&&S.value.startsWith(`}
2
2
  `);if(S?.loc.start.line===a.loc.end.line&&!I)return}let u=l(a);if(!u)return;let f=u.text;if(f.includes(`
3
3
  `)||r.getCommentsInside(a).length>0)return;f.endsWith(";")&&(f=f.slice(0,-1));let y=`{ ${f} }`,x=ji(r,a),m=u.isNested&&u.propsSize>2?s:t.maxLineLength;m&&y.length+x.length+Di(a,r)>m||e.report({node:a,messageId:"singleLineProp",fix:E=>E.replaceText(a,y)})}return{TSTypeLiteral:c,ObjectExpression:c}}});function rr(e){return e.type===re.AST_NODE_TYPES.TSLiteralType||e.type===re.AST_NODE_TYPES.TSTypeReference||e.type===re.AST_NODE_TYPES.TSNumberKeyword||e.type===re.AST_NODE_TYPES.TSStringKeyword||e.type===re.AST_NODE_TYPES.TSBooleanKeyword||e.type===re.AST_NODE_TYPES.TSNullKeyword||e.type===re.AST_NODE_TYPES.TSUndefinedKeyword}function Mt(e,t){return!!(e.type===re.AST_NODE_TYPES.Literal||e.type===re.AST_NODE_TYPES.Identifier||e.type===re.AST_NODE_TYPES.TemplateLiteral||e.type===re.AST_NODE_TYPES.TaggedTemplateExpression||!t&&e.type===re.AST_NODE_TYPES.ArrayExpression&&e.elements.every(r=>r&&Mt(r,!0)))}function Di(e,t){let r=t.getLastToken(e);if(!r)return 0;let n=t.text.indexOf(`
4
- `,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function ji(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var _t={name:ir,rule:Ni};var Li=/eslint +react-compiler\/react-compiler: +\["error/,sr={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let t=!1,r=typeof e.getSource=="function"?I=>r(I):I=>e.sourceCode.getText(I),n=typeof e.getScope=="function"?()=>n():I=>e.sourceCode.getScope(I),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,s=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:s};function l(I){s&&Array.isArray(I.suggest)&&I.suggest.length>0&&(I.fix=I.suggest[0].fix),e.report(I)}let c=e.getSourceCode().scopeManager,a=new WeakMap,u=new WeakSet,f=new WeakMap,y=new WeakMap,x=new WeakSet;function m(I,A){return function(T){if(A.has(T))return A.get(T);let h=I(T);return A.set(T,h),h}}function E(I,A,T,h,b){b&&I.async&&l({node:I,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
4
+ `,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function ji(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var _t={name:ir,rule:Ni};var Li=/eslint +react-compiler\/react-compiler: +\["error/;var sr={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let t=!1,r=typeof e.getSource=="function"?I=>r(I):I=>e.sourceCode.getText(I),n=typeof e.getScope=="function"?()=>n():I=>e.sourceCode.getScope(I),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,s=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:s};function l(I){s&&Array.isArray(I.suggest)&&I.suggest.length>0&&(I.fix=I.suggest[0].fix),e.report(I)}let c=e.getSourceCode().scopeManager,a=new WeakMap,u=new WeakSet,f=new WeakMap,y=new WeakMap,x=new WeakSet;function m(I,A){return function(T){if(A.has(T))return A.get(T);let h=I(T);return A.set(T,h),h}}function E(I,A,T,h,b){b&&I.async&&l({node:I,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
5
5
 
6
6
  useEffect(() => {
7
7
  async function fetchData() {
@@ -32,7 +32,7 @@ const ${e}: FC<${u}> = ({ ${c} }) => {
32
32
 
33
33
  ${y}`)),E.push(f.replaceText(o,x)),E}}]})}function ca(e,t,r){let n=e.arguments[0];if(!n||n.type!==_.AST_NODE_TYPES.JSXElement&&n.type!==_.AST_NODE_TYPES.JSXFragment)return;let o=n,s=Kr(o,t);if(!s.hasUnstable)return;let i=aa(o),l=Qr(o,[],t),c=o.type===_.AST_NODE_TYPES.JSXElement?ti(o,t):null,a=s.problematicProps.length===1?`prop "${s.problematicProps[0]}"`:`props "${s.problematicProps.join('", "')}"`;r.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:a},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:u=>{let f=ei(i,o,[],l,t),y=la(i,l,c),x=e;for(;x.parent.type!==_.AST_NODE_TYPES.Program&&!(x.type===_.AST_NODE_TYPES.FunctionDeclaration||x.type===_.AST_NODE_TYPES.VariableDeclarator&&x.init&&(x.init.type===_.AST_NODE_TYPES.ArrowFunctionExpression||x.init.type===_.AST_NODE_TYPES.FunctionExpression));)x=x.parent;let m=[];return m.push(u.insertTextAfter(x,`
34
34
 
35
- ${f}`)),m.push(u.replaceText(o,y)),m}}]})}var Rt=require("@typescript-eslint/utils"),ua=Rt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ni="require-description",fa=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,ma=/^eslint-disable-(next-)?line$/u,ya=ua({name:ni,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of r.getAllComments()){let s=da(o);s!=null&&(n.has(s.kind)||s.description||e.report({loc:Ta(o.loc),messageId:"missingDescription"}))}}}}}),ri={name:ni,rule:ya};function da(e){let{text:t,description:r}=Sa(e.value);if(!t)return null;let n=fa.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let s=ma.test(o);if(e.type===Rt.TSESTree.AST_TOKEN_TYPES.Line&&!s||s&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+o.length);return{kind:o,value:i.trim(),description:r}}var ga=/\s-{2,}\s/u;function Sa(e){let t=e.split(ga);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Ta(e){return{start:{line:e.start.line,column:-1},end:e.end}}var ne=require("@typescript-eslint/utils"),$e=require("zod/v4");var ha=$e.z.object({varsToCheck:$e.z.array($e.z.object({selector:$e.z.string().optional(),fromFnCall:$e.z.string().optional(),prop:$e.z.string().or($e.z.array($e.z.string())),errorMsg:$e.z.string().optional()}))}),On=X({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[z(ha)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,l,c,a){let u=new Set;for(let y of i.properties)y.type===ne.AST_NODE_TYPES.Property&&y.key.type===ne.AST_NODE_TYPES.Identifier&&u.add(y.key.name);let f=l.filter(y=>!u.has(y));if(f.length>0)if(f.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:f[0],fnName:a,customMsg:c||""}});else{let y=f.map(x=>`"${x}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:a,customMsg:c||""}})}}function o(i){if(i.init?.type===ne.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===ne.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===ne.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===ne.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===ne.AST_NODE_TYPES.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"}let s={};for(let i of t.varsToCheck)i.selector&&(s[i.selector]=l=>{if(l.type===ne.AST_NODE_TYPES.VariableDeclarator&&l.id.type===ne.AST_NODE_TYPES.Identifier&&r.set(l.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:l.id,fnName:o(l)}),l.type===ne.AST_NODE_TYPES.VariableDeclarator&&l.id.type===ne.AST_NODE_TYPES.ObjectPattern){let c=Array.isArray(i.prop)?i.prop:[i.prop];n(l.id,c,i.errorMsg,o(l))}});for(let i of t.varsToCheck)if(i.fromFnCall){let l=i.fromFnCall;if(l.startsWith("*.")){let a=`VariableDeclarator > CallExpression > MemberExpression[property.name="${l.slice(2)}"]`;s[a]=u=>{if(u.type!==ne.AST_NODE_TYPES.MemberExpression||u.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let f=u.parent;if(f.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let y=f.parent;if(y.id.type===ne.AST_NODE_TYPES.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.AST_NODE_TYPES.ObjectPattern){let x=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,x,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(l.includes(".")){let[c,a]=l.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${c}"][property.name="${a}"]`;s[u]=f=>{if(f.type!==ne.AST_NODE_TYPES.MemberExpression||f.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let y=f.parent;if(y.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let x=y.parent;if(x.id.type===ne.AST_NODE_TYPES.Identifier)r.set(x.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:x.id,fnName:i.fromFnCall||"unknown function"});else if(x.id.type===ne.AST_NODE_TYPES.ObjectPattern){let m=Array.isArray(i.prop)?i.prop:[i.prop];n(x.id,m,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let c=`VariableDeclarator > CallExpression > Identifier[name="${l}"]`;s[c]=a=>{if(a.type!==ne.AST_NODE_TYPES.Identifier||a.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let u=a.parent;if(u.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let f=u.parent;if(f.id.type===ne.AST_NODE_TYPES.Identifier)r.set(f.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:f.id,fnName:i.fromFnCall||"unknown function"});else if(f.id.type===ne.AST_NODE_TYPES.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];n(f.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...s,"Program:exit"(){for(let[i,{props:l,errorMsg:c,node:a,fnName:u}]of r){let y=e.sourceCode.getScope(a).set.get(i);if(y){let x=new Set(l);for(let m of y.references){let E=m.identifier,C=E.parent;if(!(C.type===ne.AST_NODE_TYPES.VariableDeclarator&&C.id===E)){if(C.type===ne.AST_NODE_TYPES.MemberExpression&&C.object===E&&C.property.type===ne.AST_NODE_TYPES.Identifier&&x.has(C.property.name)){if(x.delete(C.property.name),x.size===0)break;continue}if(C.type===ne.AST_NODE_TYPES.VariableDeclarator&&C.init===E&&C.id.type===ne.AST_NODE_TYPES.ObjectPattern){for(let S of C.id.properties)S.type===ne.AST_NODE_TYPES.Property&&S.key.type===ne.AST_NODE_TYPES.Identifier&&x.has(S.key.name)&&x.delete(S.key.name);if(x.size===0)break;continue}if(!(C.type===ne.AST_NODE_TYPES.MemberExpression&&C.object===E&&C.property.type===ne.AST_NODE_TYPES.Identifier&&!l.includes(C.property.name))){x.clear();break}}}if(x.size>0){let m=Array.from(x);if(m.length===1)e.report({node:a,messageId:"propNotRead",data:{prop:m[0],fnName:u,customMsg:c||""}});else{let E=m.map(C=>`"${C}"`).join(", ");e.report({node:a,messageId:"propsNotRead",data:{props:E,fnName:u,customMsg:c||""}})}}}}}}}});function si(e){return/^use[A-Z0-9]/.test(e)}function vt(e){return e.type==="Identifier"?si(e.name):e.type==="MemberExpression"&&!e.computed&&vt(e.property)?e.object.type==="Identifier":!1}function ai(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function li(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function pi(e){return!!(e.parent&&e.parent.callee&&li(e.parent.callee,"forwardRef"))}function ci(e){return!!(e.parent&&e.parent.callee&&li(e.parent.callee,"memo"))}function Nn(e){for(;e;){let t=fi(e);if(t&&(ai(t)||vt(t))||pi(e)||ci(e))return!0;e=e.parent}return!1}function ii(e){return!1}function Dn(e){return!1}var Ea=/eslint +react-compiler\/react-compiler: +\["error/,ui={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(a){let u=null;a.callee.name==="useMemo"?u="useMemo":a.callee.name==="useCallback"&&(u="useCallback"),u&&e.report({node:a,message:`"${u}" is not necessary when using React Compiler.`})}};if(e.options[0]?.ignoreIfReactCompilerIsEnabled||t){for(let a of e.sourceCode.getAllComments())if(Ea.test(a.value))return{CallExpression(u){let f=null;u.callee.name==="useMemo"?f="useMemo":u.callee.name==="useCallback"&&(f="useCallback"),f&&e.report({node:u,message:`"${f}" is not necessary when using React Compiler.`})}}}let r=typeof e.getSource=="function"?a=>r(a):a=>e.sourceCode.getText(a),n=typeof e.getScope=="function"?()=>n():a=>e.sourceCode.getScope(a),o=null,s=[],i=[],l=new WeakSet;function c(a){for(let u of a.references){let f=u.identifier.parent;if(f.type==="VariableDeclarator"&&f.init&&f.init.type==="CallExpression"&&f.init.callee&&ii(f.init.callee))for(let y of u.resolved.references)y!==u&&l.add(y.identifier)}}return{onCodePathSegmentStart:a=>i.push(a),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(a,u){let f=s.pop();if(f.size===0)return;let y=new Set;function x(h,b){let{cache:w}=x,k=w.get(h.id),N=new Set(b);if(N.has(h.id)){let p=[...N],F=p.slice(p.indexOf(h.id)+1);for(let d of F)y.add(d);return BigInt("0")}if(N.add(h.id),k!==void 0)return k;if(a.thrownSegments.includes(h))k=BigInt("0");else if(h.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let p of h.prevSegments)k+=x(p,N)}return h.reachable&&k===BigInt("0")?w.delete(h.id):w.set(h.id,k),k}function m(h,b){let{cache:w}=m,k=w.get(h.id),N=new Set(b);if(N.has(h.id)){let p=Array.from(N),F=p.slice(p.indexOf(h.id)+1);for(let d of F)y.add(d);return BigInt("0")}if(N.add(h.id),k!==void 0)return k;if(a.thrownSegments.includes(h))k=BigInt("0");else if(h.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let p of h.nextSegments)k+=m(p,N)}return w.set(h.id,k),k}function E(h){let{cache:b}=E,w=b.get(h.id);if(w===null)return 1/0;if(w!==void 0)return w;if(b.set(h.id,null),h.prevSegments.length===0)w=1;else{w=1/0;for(let k of h.prevSegments){let N=E(k);N<w&&(w=N)}w+=1}return b.set(h.id,w),w}x.cache=new Map,m.cache=new Map,E.cache=new Map;let C=m(a.initialSegment),S=fi(u),I=Nn(u),A=S?ai(S)||vt(S):pi(u)||ci(u),T=1/0;for(let h of a.finalSegments){if(!h.reachable)continue;let b=E(h);b<T&&(T=b)}for(let[h,b]of f){if(!h.reachable)continue;let w=h.nextSegments.length===0?T<=E(h):T<E(h),k=x(h)*m(h),N=y.has(h.id);for(let p of b)if(N&&!Dn(p)&&e.report({node:p,message:`React Hook "${r(p)}" 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(u.async&&e.report({node:p,message:`React Hook "${r(p)}" cannot be called in an async function.`}),!N&&k!==C&&!Dn(p)){let d=`React Hook "${r(p)}" 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:p,message:d})}}else if(u.parent&&(u.parent.type==="MethodDefinition"||u.parent.type==="ClassProperty")&&u.parent.value===u){let F=`React Hook "${r(p)}" 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:p,message:F})}else if(S){let F=`React Hook "${r(p)}" 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:p,message:F})}else if(u.type==="Program"){let F=`React Hook "${r(p)}" 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:p,message:F})}else if(I&&!Dn(p)){if(u.parent.type==="CallExpression"&&u.parent.callee.type==="Identifier"&&u.parent.callee.name==="useCallback"){let d=u.parent;if(d.parent.type==="VariableDeclarator"&&si(d.parent.id.name))return}let F=`React Hook "${r(p)}" 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:p,message:F})}}},CallExpression(a){if(vt(a.callee)){let u=oi(s),f=oi(i),y=u.get(f);y||(y=[],u.set(f,y)),y.push(a.callee)}a.callee.type==="Identifier"&&(a.callee.name==="useEffect"||ii(a.callee))&&a.arguments.length>0&&(o=a)},Identifier(a){o==null&&l.has(a)&&a.parent.type!=="CallExpression"&&e.report({node:a,message:`\`${r(a)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(a){a===o&&(o=null)},FunctionDeclaration(a){Nn(a)&&c(n(a))},ArrowFunctionExpression(a){Nn(a)&&c(n(a))}}}};function fi(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 oi(e){return e[e.length-1]}var ge=require("@typescript-eslint/utils"),xe=Pe(require("zod/v4"));var ba=/^\s+$/,jn=/\r?\n/,xa=/^(\s*)/,Ca=/^(\s*)\S/,Ia=/\r?\n/,Aa=xe.object({indent:xe.union([xe.string().regex(ba),xe.number().int().min(1)]).optional(),tags:xe.array(xe.string()).optional(),functions:xe.array(xe.string()).optional(),comments:xe.array(xe.string()).optional()}),Ln=X({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[z(Aa)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:s}=e.options[0],i=r.map(S=>S.toLowerCase());function l(S){let I=S.split(jn),A=I.filter(h=>h.trim()!=="");if(A.length===0)return S;let T=Number.POSITIVE_INFINITY;for(let h of A){let b=h.match(xa);b&&(T=Math.min(T,b[1]?.length??0))}return!isFinite(T)||T===0?S:I.map(h=>h.slice(T)).join(`
35
+ ${f}`)),m.push(u.replaceText(o,y)),m}}]})}var Rt=require("@typescript-eslint/utils"),ua=Rt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ni="require-description",fa=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,ma=/^eslint-disable-(next-)?line$/u,ya=ua({name:ni,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of r.getAllComments()){let s=da(o);s!=null&&(n.has(s.kind)||s.description||e.report({loc:Ta(o.loc),messageId:"missingDescription"}))}}}}}),ri={name:ni,rule:ya};function da(e){let{text:t,description:r}=Sa(e.value);if(!t)return null;let n=fa.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let s=ma.test(o);if(e.type===Rt.TSESTree.AST_TOKEN_TYPES.Line&&!s||s&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+o.length);return{kind:o,value:i.trim(),description:r}}var ga=/\s-{2,}\s/u;function Sa(e){let t=e.split(ga);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Ta(e){return{start:{line:e.start.line,column:-1},end:e.end}}var ne=require("@typescript-eslint/utils"),$e=require("zod/v4");var ha=$e.z.object({varsToCheck:$e.z.array($e.z.object({selector:$e.z.string().optional(),fromFnCall:$e.z.string().optional(),prop:$e.z.string().or($e.z.array($e.z.string())),errorMsg:$e.z.string().optional()}))}),On=X({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[z(ha)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,l,c,a){let u=new Set;for(let y of i.properties)y.type===ne.AST_NODE_TYPES.Property&&y.key.type===ne.AST_NODE_TYPES.Identifier&&u.add(y.key.name);let f=l.filter(y=>!u.has(y));if(f.length>0)if(f.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:f[0],fnName:a,customMsg:c||""}});else{let y=f.map(x=>`"${x}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:a,customMsg:c||""}})}}function o(i){if(i.init?.type===ne.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===ne.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===ne.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===ne.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===ne.AST_NODE_TYPES.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"}let s={};for(let i of t.varsToCheck)i.selector&&(s[i.selector]=l=>{if(l.type===ne.AST_NODE_TYPES.VariableDeclarator&&l.id.type===ne.AST_NODE_TYPES.Identifier&&r.set(l.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:l.id,fnName:o(l)}),l.type===ne.AST_NODE_TYPES.VariableDeclarator&&l.id.type===ne.AST_NODE_TYPES.ObjectPattern){let c=Array.isArray(i.prop)?i.prop:[i.prop];n(l.id,c,i.errorMsg,o(l))}});for(let i of t.varsToCheck)if(i.fromFnCall){let l=i.fromFnCall;if(l.startsWith("*.")){let a=`VariableDeclarator > CallExpression > MemberExpression[property.name="${l.slice(2)}"]`;s[a]=u=>{if(u.type!==ne.AST_NODE_TYPES.MemberExpression||u.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let f=u.parent;if(f.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let y=f.parent;if(y.id.type===ne.AST_NODE_TYPES.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.AST_NODE_TYPES.ObjectPattern){let x=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,x,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(l.includes(".")){let[c,a]=l.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${c}"][property.name="${a}"]`;s[u]=f=>{if(f.type!==ne.AST_NODE_TYPES.MemberExpression||f.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let y=f.parent;if(y.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let x=y.parent;if(x.id.type===ne.AST_NODE_TYPES.Identifier)r.set(x.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:x.id,fnName:i.fromFnCall||"unknown function"});else if(x.id.type===ne.AST_NODE_TYPES.ObjectPattern){let m=Array.isArray(i.prop)?i.prop:[i.prop];n(x.id,m,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let c=`VariableDeclarator > CallExpression > Identifier[name="${l}"]`;s[c]=a=>{if(a.type!==ne.AST_NODE_TYPES.Identifier||a.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let u=a.parent;if(u.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let f=u.parent;if(f.id.type===ne.AST_NODE_TYPES.Identifier)r.set(f.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:f.id,fnName:i.fromFnCall||"unknown function"});else if(f.id.type===ne.AST_NODE_TYPES.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];n(f.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...s,"Program:exit"(){for(let[i,{props:l,errorMsg:c,node:a,fnName:u}]of r){let y=e.sourceCode.getScope(a).set.get(i);if(y){let x=new Set(l);for(let m of y.references){let E=m.identifier,C=E.parent;if(!(C.type===ne.AST_NODE_TYPES.VariableDeclarator&&C.id===E)){if(C.type===ne.AST_NODE_TYPES.MemberExpression&&C.object===E&&C.property.type===ne.AST_NODE_TYPES.Identifier&&x.has(C.property.name)){if(x.delete(C.property.name),x.size===0)break;continue}if(C.type===ne.AST_NODE_TYPES.VariableDeclarator&&C.init===E&&C.id.type===ne.AST_NODE_TYPES.ObjectPattern){for(let S of C.id.properties)S.type===ne.AST_NODE_TYPES.Property&&S.key.type===ne.AST_NODE_TYPES.Identifier&&x.has(S.key.name)&&x.delete(S.key.name);if(x.size===0)break;continue}if(!(C.type===ne.AST_NODE_TYPES.MemberExpression&&C.object===E&&C.property.type===ne.AST_NODE_TYPES.Identifier&&!l.includes(C.property.name))){x.clear();break}}}if(x.size>0){let m=Array.from(x);if(m.length===1)e.report({node:a,messageId:"propNotRead",data:{prop:m[0],fnName:u,customMsg:c||""}});else{let E=m.map(C=>`"${C}"`).join(", ");e.report({node:a,messageId:"propsNotRead",data:{props:E,fnName:u,customMsg:c||""}})}}}}}}}});function si(e){return/^use[A-Z0-9]/.test(e)}function vt(e){return e.type==="Identifier"?si(e.name):e.type==="MemberExpression"&&!e.computed&&vt(e.property)?e.object.type==="Identifier":!1}function ai(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function li(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function pi(e){return!!(e.parent&&e.parent.callee&&li(e.parent.callee,"forwardRef"))}function ci(e){return!!(e.parent&&e.parent.callee&&li(e.parent.callee,"memo"))}function Nn(e){for(;e;){let t=fi(e);if(t&&(ai(t)||vt(t))||pi(e)||ci(e))return!0;e=e.parent}return!1}function ii(e){return!1}function Dn(e){return!1}var Ea=/eslint +react-compiler\/react-compiler: +\["error/;var ui={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(a){let u=null;a.callee.name==="useMemo"?u="useMemo":a.callee.name==="useCallback"&&(u="useCallback"),u&&e.report({node:a,message:`"${u}" is not necessary when using React Compiler.`})}};if(e.options[0]?.ignoreIfReactCompilerIsEnabled||t){for(let a of e.sourceCode.getAllComments())if(Ea.test(a.value))return{CallExpression(u){let f=null;u.callee.name==="useMemo"?f="useMemo":u.callee.name==="useCallback"&&(f="useCallback"),f&&e.report({node:u,message:`"${f}" is not necessary when using React Compiler.`})}}}let r=typeof e.getSource=="function"?a=>r(a):a=>e.sourceCode.getText(a),n=typeof e.getScope=="function"?()=>n():a=>e.sourceCode.getScope(a),o=null,s=[],i=[],l=new WeakSet;function c(a){for(let u of a.references){let f=u.identifier.parent;if(f.type==="VariableDeclarator"&&f.init&&f.init.type==="CallExpression"&&f.init.callee&&ii(f.init.callee))for(let y of u.resolved.references)y!==u&&l.add(y.identifier)}}return{onCodePathSegmentStart:a=>i.push(a),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(a,u){let f=s.pop();if(f.size===0)return;let y=new Set;function x(h,b){let{cache:w}=x,k=w.get(h.id),N=new Set(b);if(N.has(h.id)){let p=[...N],F=p.slice(p.indexOf(h.id)+1);for(let d of F)y.add(d);return BigInt("0")}if(N.add(h.id),k!==void 0)return k;if(a.thrownSegments.includes(h))k=BigInt("0");else if(h.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let p of h.prevSegments)k+=x(p,N)}return h.reachable&&k===BigInt("0")?w.delete(h.id):w.set(h.id,k),k}function m(h,b){let{cache:w}=m,k=w.get(h.id),N=new Set(b);if(N.has(h.id)){let p=Array.from(N),F=p.slice(p.indexOf(h.id)+1);for(let d of F)y.add(d);return BigInt("0")}if(N.add(h.id),k!==void 0)return k;if(a.thrownSegments.includes(h))k=BigInt("0");else if(h.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let p of h.nextSegments)k+=m(p,N)}return w.set(h.id,k),k}function E(h){let{cache:b}=E,w=b.get(h.id);if(w===null)return 1/0;if(w!==void 0)return w;if(b.set(h.id,null),h.prevSegments.length===0)w=1;else{w=1/0;for(let k of h.prevSegments){let N=E(k);N<w&&(w=N)}w+=1}return b.set(h.id,w),w}x.cache=new Map,m.cache=new Map,E.cache=new Map;let C=m(a.initialSegment),S=fi(u),I=Nn(u),A=S?ai(S)||vt(S):pi(u)||ci(u),T=1/0;for(let h of a.finalSegments){if(!h.reachable)continue;let b=E(h);b<T&&(T=b)}for(let[h,b]of f){if(!h.reachable)continue;let w=h.nextSegments.length===0?T<=E(h):T<E(h),k=x(h)*m(h),N=y.has(h.id);for(let p of b)if(N&&!Dn(p)&&e.report({node:p,message:`React Hook "${r(p)}" 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(u.async&&e.report({node:p,message:`React Hook "${r(p)}" cannot be called in an async function.`}),!N&&k!==C&&!Dn(p)){let d=`React Hook "${r(p)}" 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:p,message:d})}}else if(u.parent&&(u.parent.type==="MethodDefinition"||u.parent.type==="ClassProperty")&&u.parent.value===u){let F=`React Hook "${r(p)}" 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:p,message:F})}else if(S){let F=`React Hook "${r(p)}" 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:p,message:F})}else if(u.type==="Program"){let F=`React Hook "${r(p)}" 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:p,message:F})}else if(I&&!Dn(p)){if(u.parent.type==="CallExpression"&&u.parent.callee.type==="Identifier"&&u.parent.callee.name==="useCallback"){let d=u.parent;if(d.parent.type==="VariableDeclarator"&&si(d.parent.id.name))return}let F=`React Hook "${r(p)}" 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:p,message:F})}}},CallExpression(a){if(vt(a.callee)){let u=oi(s),f=oi(i),y=u.get(f);y||(y=[],u.set(f,y)),y.push(a.callee)}a.callee.type==="Identifier"&&(a.callee.name==="useEffect"||ii(a.callee))&&a.arguments.length>0&&(o=a)},Identifier(a){o==null&&l.has(a)&&a.parent.type!=="CallExpression"&&e.report({node:a,message:`\`${r(a)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(a){a===o&&(o=null)},FunctionDeclaration(a){Nn(a)&&c(n(a))},ArrowFunctionExpression(a){Nn(a)&&c(n(a))}}}};function fi(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 oi(e){return e[e.length-1]}var ge=require("@typescript-eslint/utils"),xe=Pe(require("zod/v4"));var ba=/^\s+$/,jn=/\r?\n/,xa=/^(\s*)/,Ca=/^(\s*)\S/,Ia=/\r?\n/,Aa=xe.object({indent:xe.union([xe.string().regex(ba),xe.number().int().min(1)]).optional(),tags:xe.array(xe.string()).optional(),functions:xe.array(xe.string()).optional(),comments:xe.array(xe.string()).optional()}),Ln=X({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[z(Aa)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:s}=e.options[0],i=r.map(S=>S.toLowerCase());function l(S){let I=S.split(jn),A=I.filter(h=>h.trim()!=="");if(A.length===0)return S;let T=Number.POSITIVE_INFINITY;for(let h of A){let b=h.match(xa);b&&(T=Math.min(T,b[1]?.length??0))}return!isFinite(T)||T===0?S:I.map(h=>h.slice(T)).join(`
36
36
  `)}function c(S,I,A){return S.split(jn).map(h=>h.trim()===""?h:A.repeat(I)+h).join(`
37
37
  `)}function a(S){if(S.type===ge.AST_NODE_TYPES.Identifier)return S.name;if(S.type===ge.AST_NODE_TYPES.MemberExpression){let I=S.object.type===ge.AST_NODE_TYPES.Identifier?S.object.name:null,A=S.property.type===ge.AST_NODE_TYPES.Identifier?S.property.name:null;return I&&A?`${I}.${A}`:A}return null}function u(S,I){if(!S)return!1;for(let A of I)if(A.includes(".")){let T=A.split(".");if(S.type===ge.AST_NODE_TYPES.MemberExpression&&S.object.type===ge.AST_NODE_TYPES.Identifier&&S.property.type===ge.AST_NODE_TYPES.Identifier&&S.object.name===T[0]&&S.property.name===T[1])return!0}else if(S.type===ge.AST_NODE_TYPES.Identifier&&S.name===A)return!0;return!1}function f(S,I){let A=S.parent;if(A.type!==ge.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let T=a(A.tag);return T?I.includes(T):!1}function y(S,I){if(!S||S.type!==ge.AST_NODE_TYPES.CallExpression)return!1;let{method:A,argumentsLength:T,optionalCall:h=!0,optionalMember:b=!0}=I;return T!==void 0&&S.arguments.length!==T||!h&&S.optional||S.callee.type!==ge.AST_NODE_TYPES.MemberExpression||!b&&S.callee.optional||S.callee.property.type!==ge.AST_NODE_TYPES.Identifier?!1:S.callee.property.name===A}function x(S,I){if(!S||S.type!==ge.AST_NODE_TYPES.CallExpression)return!1;let{name:A,argumentsLength:T,optionalCall:h=!0}=I;return T!==void 0&&S.arguments.length!==T||!h&&S.optional||S.callee.type!==ge.AST_NODE_TYPES.Identifier?!1:S.callee.name===A}function m(S){return y(S.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&S.parent.type===ge.AST_NODE_TYPES.CallExpression&&S.parent.arguments[0]===S&&x(S.parent.callee.type===ge.AST_NODE_TYPES.MemberExpression?S.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function E(S){if(i.length>0){let I=t.getTokenBefore(S,{includeComments:!0});if(I?.type===ge.AST_TOKEN_TYPES.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(m(S)||o.length>0&&f(S,o)||n.length>0&&S.parent.type===ge.AST_NODE_TYPES.CallExpression&&S.parent.arguments.includes(S)&&u(S.parent.callee,n))}function C(S){let I=`__PLACEHOLDER__${Math.random()}`,A=S.quasis.map(j=>t.getText(j).slice(1,j.tail?-1:-2)).join(I),T=A.match(Ia);if(!T)return;let h=T[0],b=t.lines[t.getLocFromIndex(S.range[0]).line-1];if(!b)return;let k=b.match(Ca)?.[1]??"",N;typeof s=="string"?N=s:typeof s=="number"?N=" ".repeat(s):N=k.startsWith(" ")?" ":" ";let F=l(A).replace(new RegExp(`^${h}|${h}[ ]*$`,"g"),""),d=h+c(F,1,k+N)+h+k,g=A.includes(`\r
38
38
  `)?`\r
@@ -1,7 +1,7 @@
1
1
  import{AST_NODE_TYPES as he}from"@typescript-eslint/utils";import{z as M}from"zod/v4";import{ESLintUtils as yi}from"@typescript-eslint/utils";import*as _n from"zod/v4";function X(e){let r=yi.RuleCreator(t=>`https://github.com/lucasols/extended-lint#${t}`)(e);return{name:e.name,rule:r}}function U(e){return _n.toJSONSchema(e)}var di=M.object({disallow:M.array(M.object({selector:M.string(),message:M.string(),replace:M.optional(M.union([M.string(),M.object({regex:M.string(),with:M.string()})])),replaceType:M.optional(M.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:M.optional(M.array(M.object({fn:M.string(),withArgs:M.optional(M.array(M.object({atIndex:M.number(),value:M.union([M.string(),M.number(),M.boolean()])}))),message:M.string(),replaceWith:M.optional(M.string()),ignoreRegex:M.optional(M.string())}))),__dev_simulateFileName:M.optional(M.string()),mustMatchSyntax:M.optional(M.array(M.object({includeRegex:M.string(),mustCallFn:M.optional(M.array(M.object({anyCall:M.array(M.object({fn:M.string(),withArgs:M.array(M.object({atIndex:M.number(),literal:M.union([M.string(),M.number(),M.boolean()])}))})),message:M.optional(M.string())}))),mustMatchSelector:M.optional(M.array(M.object({selector:M.string(),message:M.string()}))),mustHaveExport:M.optional(M.array(M.object({name:M.string(),type:M.enum(["function","variable","any"]).default("any"),message:M.string()})))})))}),It=X({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[U(di)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[n]){let r={},{mustMatchSyntax:t,__dev_simulateFileName:o,disallow:s,disallowFnCalls:i}=n,l=o??e.filename,c=[],a=new Map,u=new Set,f=new Map,y=new Set,x=new Map;function m(b){for(let w of b.specifiers)w.type===he.ImportSpecifier&&w.imported.type===he.Identifier&&w.imported.name!==w.local.name&&x.set(w.local.name,w.imported.name)}function E(b){if(b.declaration){if(b.declaration.type===he.FunctionDeclaration&&b.declaration.id){let w=b.declaration.id.name;for(let k of Array.from(y)){let[N,p]=k.split(":");N===w&&(p==="function"||p==="any")&&y.delete(k)}}else if(b.declaration.type===he.VariableDeclaration){for(let w of b.declaration.declarations)if(w.id.type===he.Identifier){let k=w.id.name;for(let N of Array.from(y)){let[p,F]=N.split(":");p===k&&(F==="variable"||F==="any")&&y.delete(N)}}}}for(let w of b.specifiers)if(w.exported.type===he.Identifier){let k=w.exported.name;for(let N of Array.from(y)){let[p,F]=N.split(":");p===k&&F==="any"&&y.delete(N)}}}function C(b){b.id.type===he.Identifier&&b.init?.type===he.Identifier&&x.set(b.id.name,b.init.name)}function S(b){return x.get(b)??b}function I(b,w){return S(b)===w||b===w}for(let{includeRegex:b,mustCallFn:w,mustMatchSelector:k,mustHaveExport:N}of t??[]){let F=function(d){let g=d;for(let{name:R,value:P}of p??[])g=g.replaceAll(R,P);return g};var h=F;let p=gi(l,new RegExp(b));if(p){for(let{anyCall:d,message:g}of w??[]){let R=`Expected file to call the function: ${d.map(({fn:P})=>P).join(" or ")}`;u.add(R),c.push(P=>{let{callee:j}=P;if(j.type===he.Identifier){for(let{fn:V,withArgs:G}of d)if(j.name===V){u.delete(R);for(let Y of G){let D=P.arguments[Y.atIndex],Z=typeof Y.literal=="string"?F(Y.literal):Y.literal;if(!D){e.report({node:P,messageId:"default",data:{message:`Missing argument with value "${Z}" at index ${Y.atIndex}${g?`: ${F(g)}`:""}`}});continue}if(D.type!==he.Literal){e.report({node:D,messageId:"default",data:{message:`Argument at position ${Y.atIndex} should the literal "${Z}"${g?`: ${F(g)}`:""}`}});continue}D.value!==Z&&e.report({node:D,messageId:"default",data:{message:`Argument should have the value "${Z}"${g?`: ${F(g)}`:""}`},fix:q=>q.replaceText(D,typeof Z=="string"?`'${Z}'`:String(Z))})}break}}})}for(let{selector:d,message:g}of k??[])f.set(d,F(g)),a.set(F(d),()=>{f.delete(d)});for(let{name:d,type:g,message:R}of N??[]){let P=F(d),j=F(R);y.add(`${P}:${g}:${j}`)}}}for(let{fn:b,withArgs:w,message:k,replaceWith:N,ignoreRegex:p}of i??[])p&&new RegExp(p).test(l)||c.push(F=>{let{callee:d}=F;if(d.type!==he.Identifier||!I(d.name,b))return;if(w)for(let R of w){let P=F.arguments[R.atIndex];if(!P){e.report({node:F,messageId:"default",data:{message:`Missing argument with value "${R.value}" at index ${R.atIndex}: ${k}`}});return}if(P.type!==he.Literal||P.value!==R.value)return}let g=R=>N?R.replaceText(F,N):null;e.report({node:F,messageId:"default",data:{message:k},suggest:N?[{messageId:"default",data:{message:`Replace with "${N}"`},fix:g}]:void 0})});function A(b,w){let k=r[b];k?r[b]=N=>{k(N),w(N)}:r[b]=w}for(let{selector:b,message:w,replace:k,replaceType:N="suggestion"}of s??[]){if(b==="CallExpression"){c.push(p=>{T(k,p,w,N)});continue}r[b]=p=>{T(k,p,w,N)}}if(a.size>0)for(let[b,w]of a)A(b,w);return c.length>0&&(r.CallExpression=b=>{if(b.type===he.CallExpression)for(let w of c)w(b)}),r.ImportDeclaration=b=>{b.type===he.ImportDeclaration&&m(b)},r.ExportNamedDeclaration=b=>{b.type===he.ExportNamedDeclaration&&E(b)},r.VariableDeclarator=b=>{b.type===he.VariableDeclarator&&C(b)},r["Program:exit"]=b=>{for(let w of u)e.report({node:b,messageId:"default",data:{message:w}});for(let[,w]of f)e.report({node:b,messageId:"default",data:{message:w}});for(let w of y){let[k,N,p]=w.split(":");e.report({node:b,messageId:"default",data:{message:`Missing required export "${k}" of type ${N}: ${p}`}})}},r;function T(b,w,k,N){let p=F=>{if(!b)return null;if(typeof b=="string")return F.replaceText(w,b);{let d=new RegExp(b.regex),g=e.sourceCode.getText(w);return F.replaceText(w,g.replace(d,b.with))}};e.report({node:w,messageId:"default",data:{message:k},fix:b&&N==="autofix"?p:void 0,suggest:b&&N==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof b=="string"?b:b.with}"`},fix:p}]:void 0})}}});function gi(e,n){let r=[],t=n.exec(e);if(!t)return null;let[o,...s]=t;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:$n(o)}),r.push({name:"$0_uncapitalize",value:Un(o)}),r.push({name:"$0",value:o});for(let i=0;i<s.length;i++){let l=`$${i+1}`,c=s[i];c!==void 0&&(r.push({name:`${l}_lowercase`,value:c.toLowerCase()}),r.push({name:`${l}_capitalize`,value:$n(c)}),r.push({name:`${l}_uncapitalize`,value:Un(c)}),r.push({name:l,value:c}))}return r}function $n(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Un(e){return e.charAt(0).toLowerCase()+e.slice(1)}import{AST_NODE_TYPES as oe,AST_TOKEN_TYPES as zn,ESLintUtils as Si}from"@typescript-eslint/utils";import{z as Xe}from"zod/v4";var Ti=Si.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Jn="collapse-simple-objs-in-one-line",hi=Xe.object({maxLineLength:Xe.number().optional(),maxProperties:Xe.number().optional(),nestedObjMaxLineLength:Xe.number().optional(),nestedObjMaxProperties:Xe.number().optional(),ignoreTypesWithSuffix:Xe.array(Xe.string()).optional()}),Ei=Ti({name:Jn,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[U(hi)]},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode,t=n.ignoreTypesWithSuffix??[],o=n.maxProperties??2,s=n.nestedObjMaxLineLength??n.maxLineLength,i=n.nestedObjMaxProperties??3;function l(a){if(a.type===oe.ObjectExpression){let u=a.parent.type===oe.Property,f=u?i:o,y=a.properties.length;if(y>f)return!1;if(y===1){let m=a.properties[0];return!m||m.type===oe.Property&&m.value.type===oe.ObjectExpression||m.type===oe.Property&&m.value.type===oe.ArrayExpression&&!m.value.elements.every(C=>C&&At(C))?!1:{text:r.getText(m),isNested:u,propsSize:y}}let x=[];for(let m of a.properties){if(m.type===oe.Property&&!At(m.value))return!1;x.push(r.getText(m))}return{text:x.join(", "),isNested:u,propsSize:y}}else{let u=a.parent.parent?.type===oe.TSPropertySignature,f=u?i:o,y=a.members.length;if(y>f)return!1;if(t.length>0&&a.parent.type===oe.TSTypeAliasDeclaration){let m=a.parent.id.name;if(t.some(E=>m.endsWith(E)))return!1}if(y===1){let m=a.members[0];return!m||m.type===oe.TSPropertySignature&&m.typeAnnotation?.typeAnnotation.type===oe.TSTypeLiteral?!1:{text:r.getText(m),isNested:u,propsSize:1}}if(a.parent.type===oe.TSIntersectionType||a.parent.type===oe.TSUnionType&&a.parent.types[0]!==a)return!1;let x=[];for(let m of a.members){if(m.type!==oe.TSPropertySignature)return!1;let E=m.typeAnnotation?.typeAnnotation;if(!E||E.type===oe.TSTypeLiteral||!Wn(E))return!1;if(E.type===oe.TSTypeReference&&E.typeArguments){if(E.typeArguments.params.length>1)return!1;let S=E.typeArguments.params[0];if(!S||!Wn(S))return!1}let C=r.getText(m).trim();(C.endsWith(";")||C.endsWith(","))&&(C=C.slice(0,-1)),x.push(C)}return{text:x.join("; "),isNested:u,propsSize:y}}}function c(a){if(a.loc.start.line===a.loc.end.line)return;if(a.parent.type!==oe.JSXExpressionContainer){let E=0,C=!1,S=r.getTokenAfter(a,{filter:A=>A.type!==zn.Punctuator||C?!0:A.value===","?(E++,!1):A.value===";"?(E++,C=!0,!1):A.value===")"||A.value==="}"?(E++,!1):!0});if(E>4)return;let I=S?.type===zn.Template&&S.value.startsWith(`}
2
2
  `);if(S?.loc.start.line===a.loc.end.line&&!I)return}let u=l(a);if(!u)return;let f=u.text;if(f.includes(`
3
3
  `)||r.getCommentsInside(a).length>0)return;f.endsWith(";")&&(f=f.slice(0,-1));let y=`{ ${f} }`,x=xi(r,a),m=u.isNested&&u.propsSize>2?s:n.maxLineLength;m&&y.length+x.length+bi(a,r)>m||e.report({node:a,messageId:"singleLineProp",fix:E=>E.replaceText(a,y)})}return{TSTypeLiteral:c,ObjectExpression:c}}});function Wn(e){return e.type===oe.TSLiteralType||e.type===oe.TSTypeReference||e.type===oe.TSNumberKeyword||e.type===oe.TSStringKeyword||e.type===oe.TSBooleanKeyword||e.type===oe.TSNullKeyword||e.type===oe.TSUndefinedKeyword}function At(e,n){return!!(e.type===oe.Literal||e.type===oe.Identifier||e.type===oe.TemplateLiteral||e.type===oe.TaggedTemplateExpression||!n&&e.type===oe.ArrayExpression&&e.elements.every(r=>r&&At(r,!0)))}function bi(e,n){let r=n.getLastToken(e);if(!r)return 0;let t=n.text.indexOf(`
4
- `,r.range[1]);return(t!==-1?t:n.text.length)-r.range[1]}function xi(e,n){return e.text.slice(n.range[0]-n.loc.start.column,n.range[0])}var wt={name:Jn,rule:Ei};var Ci=/eslint +react-compiler\/react-compiler: +\["error/,Xn={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let n=!1,r=typeof e.getSource=="function"?I=>r(I):I=>e.sourceCode.getText(I),t=typeof e.getScope=="function"?()=>t():I=>e.sourceCode.getScope(I),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,s=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:s};function l(I){s&&Array.isArray(I.suggest)&&I.suggest.length>0&&(I.fix=I.suggest[0].fix),e.report(I)}let c=e.getSourceCode().scopeManager,a=new WeakMap,u=new WeakSet,f=new WeakMap,y=new WeakMap,x=new WeakSet;function m(I,A){return function(T){if(A.has(T))return A.get(T);let h=I(T);return A.set(T,h),h}}function E(I,A,T,h,b){b&&I.async&&l({node:I,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
4
+ `,r.range[1]);return(t!==-1?t:n.text.length)-r.range[1]}function xi(e,n){return e.text.slice(n.range[0]-n.loc.start.column,n.range[0])}var wt={name:Jn,rule:Ei};var Ci=/eslint +react-compiler\/react-compiler: +\["error/;var Xn={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let n=!1,r=typeof e.getSource=="function"?I=>r(I):I=>e.sourceCode.getText(I),t=typeof e.getScope=="function"?()=>t():I=>e.sourceCode.getScope(I),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,s=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:s};function l(I){s&&Array.isArray(I.suggest)&&I.suggest.length>0&&(I.fix=I.suggest[0].fix),e.report(I)}let c=e.getSourceCode().scopeManager,a=new WeakMap,u=new WeakSet,f=new WeakMap,y=new WeakMap,x=new WeakSet;function m(I,A){return function(T){if(A.has(T))return A.get(T);let h=I(T);return A.set(T,h),h}}function E(I,A,T,h,b){b&&I.async&&l({node:I,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
5
5
 
6
6
  useEffect(() => {
7
7
  async function fetchData() {
@@ -32,7 +32,7 @@ const ${e}: FC<${u}> = ({ ${c} }) => {
32
32
 
33
33
  ${y}`)),E.push(f.replaceText(o,x)),E}}]})}function ma(e,n,r){let t=e.arguments[0];if(!t||t.type!==$.JSXElement&&t.type!==$.JSXFragment)return;let o=t,s=Jr(o,n);if(!s.hasUnstable)return;let i=ca(o),l=Vr(o,[],n),c=o.type===$.JSXElement?Br(o,n):null,a=s.problematicProps.length===1?`prop "${s.problematicProps[0]}"`:`props "${s.problematicProps.join('", "')}"`;r.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:a},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:u=>{let f=Xr(i,o,[],l,n),y=ua(i,l,c),x=e;for(;x.parent.type!==$.Program&&!(x.type===$.FunctionDeclaration||x.type===$.VariableDeclarator&&x.init&&(x.init.type===$.ArrowFunctionExpression||x.init.type===$.FunctionExpression));)x=x.parent;let m=[];return m.push(u.insertTextAfter(x,`
34
34
 
35
- ${f}`)),m.push(u.replaceText(o,y)),m}}]})}import{ESLintUtils as ya,TSESTree as da}from"@typescript-eslint/utils";var ga=ya.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Hr="require-description",Sa=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Ta=/^eslint-disable-(next-)?line$/u,ha=ga({name:Hr,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,[n]){let r=e.sourceCode,t=new Set(n.ignore||[]);return{Program(){for(let o of r.getAllComments()){let s=Ea(o);s!=null&&(t.has(s.kind)||s.description||e.report({loc:Ca(o.loc),messageId:"missingDescription"}))}}}}}),Yr={name:Hr,rule:ha};function Ea(e){let{text:n,description:r}=xa(e.value);if(!n)return null;let t=Sa.exec(n);if(!t)return null;let o=t[1];if(!o)return null;let s=Ta.test(o);if(e.type===da.AST_TOKEN_TYPES.Line&&!s||s&&e.loc.start.line!==e.loc.end.line)return null;let i=n.slice(t.index+o.length);return{kind:o,value:i.trim(),description:r}}var ba=/\s-{2,}\s/u;function xa(e){let n=e.split(ba);return{text:n[0]?.trim(),description:n.length>1?n[1]?.trim()??null:null}}function Ca(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 Ue}from"zod/v4";var Ia=Ue.object({varsToCheck:Ue.array(Ue.object({selector:Ue.string().optional(),fromFnCall:Ue.string().optional(),prop:Ue.string().or(Ue.array(Ue.string())),errorMsg:Ue.string().optional()}))}),Tn=X({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[U(Ia)]},defaultOptions:[{varsToCheck:[]}],create(e,[n]){let r=new Map;function t(i,l,c,a){let u=new Set;for(let y of i.properties)y.type===ne.Property&&y.key.type===ne.Identifier&&u.add(y.key.name);let f=l.filter(y=>!u.has(y));if(f.length>0)if(f.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:f[0],fnName:a,customMsg:c||""}});else{let y=f.map(x=>`"${x}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:a,customMsg:c||""}})}}function o(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 s={};for(let i of n.varsToCheck)i.selector&&(s[i.selector]=l=>{if(l.type===ne.VariableDeclarator&&l.id.type===ne.Identifier&&r.set(l.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:l.id,fnName:o(l)}),l.type===ne.VariableDeclarator&&l.id.type===ne.ObjectPattern){let c=Array.isArray(i.prop)?i.prop:[i.prop];t(l.id,c,i.errorMsg,o(l))}});for(let i of n.varsToCheck)if(i.fromFnCall){let l=i.fromFnCall;if(l.startsWith("*.")){let a=`VariableDeclarator > CallExpression > MemberExpression[property.name="${l.slice(2)}"]`;s[a]=u=>{if(u.type!==ne.MemberExpression||u.parent.type!==ne.CallExpression)return;let f=u.parent;if(f.parent.type!==ne.VariableDeclarator)return;let y=f.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 x=Array.isArray(i.prop)?i.prop:[i.prop];t(y.id,x,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(l.includes(".")){let[c,a]=l.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${c}"][property.name="${a}"]`;s[u]=f=>{if(f.type!==ne.MemberExpression||f.parent.type!==ne.CallExpression)return;let y=f.parent;if(y.parent.type!==ne.VariableDeclarator)return;let x=y.parent;if(x.id.type===ne.Identifier)r.set(x.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:x.id,fnName:i.fromFnCall||"unknown function"});else if(x.id.type===ne.ObjectPattern){let m=Array.isArray(i.prop)?i.prop:[i.prop];t(x.id,m,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let c=`VariableDeclarator > CallExpression > Identifier[name="${l}"]`;s[c]=a=>{if(a.type!==ne.Identifier||a.parent.type!==ne.CallExpression)return;let u=a.parent;if(u.parent.type!==ne.VariableDeclarator)return;let f=u.parent;if(f.id.type===ne.Identifier)r.set(f.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:f.id,fnName:i.fromFnCall||"unknown function"});else if(f.id.type===ne.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];t(f.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...s,"Program:exit"(){for(let[i,{props:l,errorMsg:c,node:a,fnName:u}]of r){let y=e.sourceCode.getScope(a).set.get(i);if(y){let x=new Set(l);for(let m of y.references){let E=m.identifier,C=E.parent;if(!(C.type===ne.VariableDeclarator&&C.id===E)){if(C.type===ne.MemberExpression&&C.object===E&&C.property.type===ne.Identifier&&x.has(C.property.name)){if(x.delete(C.property.name),x.size===0)break;continue}if(C.type===ne.VariableDeclarator&&C.init===E&&C.id.type===ne.ObjectPattern){for(let S of C.id.properties)S.type===ne.Property&&S.key.type===ne.Identifier&&x.has(S.key.name)&&x.delete(S.key.name);if(x.size===0)break;continue}if(!(C.type===ne.MemberExpression&&C.object===E&&C.property.type===ne.Identifier&&!l.includes(C.property.name))){x.clear();break}}}if(x.size>0){let m=Array.from(x);if(m.length===1)e.report({node:a,messageId:"propNotRead",data:{prop:m[0],fnName:u,customMsg:c||""}});else{let E=m.map(C=>`"${C}"`).join(", ");e.report({node:a,messageId:"propsNotRead",data:{props:E,fnName:u,customMsg:c||""}})}}}}}}}});function Gr(e){return/^use[A-Z0-9]/.test(e)}function Et(e){return e.type==="Identifier"?Gr(e.name):e.type==="MemberExpression"&&!e.computed&&Et(e.property)?e.object.type==="Identifier":!1}function Kr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Qr(e,n){return e.name===n||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===n}function ei(e){return!!(e.parent&&e.parent.callee&&Qr(e.parent.callee,"forwardRef"))}function ti(e){return!!(e.parent&&e.parent.callee&&Qr(e.parent.callee,"memo"))}function hn(e){for(;e;){let n=ri(e);if(n&&(Kr(n)||Et(n))||ei(e)||ti(e))return!0;e=e.parent}return!1}function qr(e){return!1}function En(e){return!1}var Aa=/eslint +react-compiler\/react-compiler: +\["error/,ni={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 n=!!e.options[0]?.reactCompilerIsEnabled;if(n)return{CallExpression(a){let u=null;a.callee.name==="useMemo"?u="useMemo":a.callee.name==="useCallback"&&(u="useCallback"),u&&e.report({node:a,message:`"${u}" is not necessary when using React Compiler.`})}};if(e.options[0]?.ignoreIfReactCompilerIsEnabled||n){for(let a of e.sourceCode.getAllComments())if(Aa.test(a.value))return{CallExpression(u){let f=null;u.callee.name==="useMemo"?f="useMemo":u.callee.name==="useCallback"&&(f="useCallback"),f&&e.report({node:u,message:`"${f}" is not necessary when using React Compiler.`})}}}let r=typeof e.getSource=="function"?a=>r(a):a=>e.sourceCode.getText(a),t=typeof e.getScope=="function"?()=>t():a=>e.sourceCode.getScope(a),o=null,s=[],i=[],l=new WeakSet;function c(a){for(let u of a.references){let f=u.identifier.parent;if(f.type==="VariableDeclarator"&&f.init&&f.init.type==="CallExpression"&&f.init.callee&&qr(f.init.callee))for(let y of u.resolved.references)y!==u&&l.add(y.identifier)}}return{onCodePathSegmentStart:a=>i.push(a),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(a,u){let f=s.pop();if(f.size===0)return;let y=new Set;function x(h,b){let{cache:w}=x,k=w.get(h.id),N=new Set(b);if(N.has(h.id)){let p=[...N],F=p.slice(p.indexOf(h.id)+1);for(let d of F)y.add(d);return BigInt("0")}if(N.add(h.id),k!==void 0)return k;if(a.thrownSegments.includes(h))k=BigInt("0");else if(h.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let p of h.prevSegments)k+=x(p,N)}return h.reachable&&k===BigInt("0")?w.delete(h.id):w.set(h.id,k),k}function m(h,b){let{cache:w}=m,k=w.get(h.id),N=new Set(b);if(N.has(h.id)){let p=Array.from(N),F=p.slice(p.indexOf(h.id)+1);for(let d of F)y.add(d);return BigInt("0")}if(N.add(h.id),k!==void 0)return k;if(a.thrownSegments.includes(h))k=BigInt("0");else if(h.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let p of h.nextSegments)k+=m(p,N)}return w.set(h.id,k),k}function E(h){let{cache:b}=E,w=b.get(h.id);if(w===null)return 1/0;if(w!==void 0)return w;if(b.set(h.id,null),h.prevSegments.length===0)w=1;else{w=1/0;for(let k of h.prevSegments){let N=E(k);N<w&&(w=N)}w+=1}return b.set(h.id,w),w}x.cache=new Map,m.cache=new Map,E.cache=new Map;let C=m(a.initialSegment),S=ri(u),I=hn(u),A=S?Kr(S)||Et(S):ei(u)||ti(u),T=1/0;for(let h of a.finalSegments){if(!h.reachable)continue;let b=E(h);b<T&&(T=b)}for(let[h,b]of f){if(!h.reachable)continue;let w=h.nextSegments.length===0?T<=E(h):T<E(h),k=x(h)*m(h),N=y.has(h.id);for(let p of b)if(N&&!En(p)&&e.report({node:p,message:`React Hook "${r(p)}" 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(u.async&&e.report({node:p,message:`React Hook "${r(p)}" cannot be called in an async function.`}),!N&&k!==C&&!En(p)){let d=`React Hook "${r(p)}" 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:p,message:d})}}else if(u.parent&&(u.parent.type==="MethodDefinition"||u.parent.type==="ClassProperty")&&u.parent.value===u){let F=`React Hook "${r(p)}" 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:p,message:F})}else if(S){let F=`React Hook "${r(p)}" 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:p,message:F})}else if(u.type==="Program"){let F=`React Hook "${r(p)}" 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:p,message:F})}else if(I&&!En(p)){if(u.parent.type==="CallExpression"&&u.parent.callee.type==="Identifier"&&u.parent.callee.name==="useCallback"){let d=u.parent;if(d.parent.type==="VariableDeclarator"&&Gr(d.parent.id.name))return}let F=`React Hook "${r(p)}" 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:p,message:F})}}},CallExpression(a){if(Et(a.callee)){let u=Zr(s),f=Zr(i),y=u.get(f);y||(y=[],u.set(f,y)),y.push(a.callee)}a.callee.type==="Identifier"&&(a.callee.name==="useEffect"||qr(a.callee))&&a.arguments.length>0&&(o=a)},Identifier(a){o==null&&l.has(a)&&a.parent.type!=="CallExpression"&&e.report({node:a,message:`\`${r(a)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(a){a===o&&(o=null)},FunctionDeclaration(a){hn(a)&&c(t(a))},ArrowFunctionExpression(a){hn(a)&&c(t(a))}}}};function ri(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 Zr(e){return e[e.length-1]}import{AST_NODE_TYPES as Se,AST_TOKEN_TYPES as wa}from"@typescript-eslint/utils";import*as be from"zod/v4";var Fa=/^\s+$/,bn=/\r?\n/,Ra=/^(\s*)/,va=/^(\s*)\S/,ka=/\r?\n/,Pa=be.object({indent:be.union([be.string().regex(Fa),be.number().int().min(1)]).optional(),tags:be.array(be.string()).optional(),functions:be.array(be.string()).optional(),comments:be.array(be.string()).optional()}),xn=X({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[U(Pa)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let n=e.sourceCode,{comments:r=["HTML","indent"],functions:t=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:s}=e.options[0],i=r.map(S=>S.toLowerCase());function l(S){let I=S.split(bn),A=I.filter(h=>h.trim()!=="");if(A.length===0)return S;let T=Number.POSITIVE_INFINITY;for(let h of A){let b=h.match(Ra);b&&(T=Math.min(T,b[1]?.length??0))}return!isFinite(T)||T===0?S:I.map(h=>h.slice(T)).join(`
35
+ ${f}`)),m.push(u.replaceText(o,y)),m}}]})}import{ESLintUtils as ya,TSESTree as da}from"@typescript-eslint/utils";var ga=ya.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Hr="require-description",Sa=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Ta=/^eslint-disable-(next-)?line$/u,ha=ga({name:Hr,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,[n]){let r=e.sourceCode,t=new Set(n.ignore||[]);return{Program(){for(let o of r.getAllComments()){let s=Ea(o);s!=null&&(t.has(s.kind)||s.description||e.report({loc:Ca(o.loc),messageId:"missingDescription"}))}}}}}),Yr={name:Hr,rule:ha};function Ea(e){let{text:n,description:r}=xa(e.value);if(!n)return null;let t=Sa.exec(n);if(!t)return null;let o=t[1];if(!o)return null;let s=Ta.test(o);if(e.type===da.AST_TOKEN_TYPES.Line&&!s||s&&e.loc.start.line!==e.loc.end.line)return null;let i=n.slice(t.index+o.length);return{kind:o,value:i.trim(),description:r}}var ba=/\s-{2,}\s/u;function xa(e){let n=e.split(ba);return{text:n[0]?.trim(),description:n.length>1?n[1]?.trim()??null:null}}function Ca(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 Ue}from"zod/v4";var Ia=Ue.object({varsToCheck:Ue.array(Ue.object({selector:Ue.string().optional(),fromFnCall:Ue.string().optional(),prop:Ue.string().or(Ue.array(Ue.string())),errorMsg:Ue.string().optional()}))}),Tn=X({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[U(Ia)]},defaultOptions:[{varsToCheck:[]}],create(e,[n]){let r=new Map;function t(i,l,c,a){let u=new Set;for(let y of i.properties)y.type===ne.Property&&y.key.type===ne.Identifier&&u.add(y.key.name);let f=l.filter(y=>!u.has(y));if(f.length>0)if(f.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:f[0],fnName:a,customMsg:c||""}});else{let y=f.map(x=>`"${x}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:a,customMsg:c||""}})}}function o(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 s={};for(let i of n.varsToCheck)i.selector&&(s[i.selector]=l=>{if(l.type===ne.VariableDeclarator&&l.id.type===ne.Identifier&&r.set(l.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:l.id,fnName:o(l)}),l.type===ne.VariableDeclarator&&l.id.type===ne.ObjectPattern){let c=Array.isArray(i.prop)?i.prop:[i.prop];t(l.id,c,i.errorMsg,o(l))}});for(let i of n.varsToCheck)if(i.fromFnCall){let l=i.fromFnCall;if(l.startsWith("*.")){let a=`VariableDeclarator > CallExpression > MemberExpression[property.name="${l.slice(2)}"]`;s[a]=u=>{if(u.type!==ne.MemberExpression||u.parent.type!==ne.CallExpression)return;let f=u.parent;if(f.parent.type!==ne.VariableDeclarator)return;let y=f.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 x=Array.isArray(i.prop)?i.prop:[i.prop];t(y.id,x,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(l.includes(".")){let[c,a]=l.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${c}"][property.name="${a}"]`;s[u]=f=>{if(f.type!==ne.MemberExpression||f.parent.type!==ne.CallExpression)return;let y=f.parent;if(y.parent.type!==ne.VariableDeclarator)return;let x=y.parent;if(x.id.type===ne.Identifier)r.set(x.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:x.id,fnName:i.fromFnCall||"unknown function"});else if(x.id.type===ne.ObjectPattern){let m=Array.isArray(i.prop)?i.prop:[i.prop];t(x.id,m,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let c=`VariableDeclarator > CallExpression > Identifier[name="${l}"]`;s[c]=a=>{if(a.type!==ne.Identifier||a.parent.type!==ne.CallExpression)return;let u=a.parent;if(u.parent.type!==ne.VariableDeclarator)return;let f=u.parent;if(f.id.type===ne.Identifier)r.set(f.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:f.id,fnName:i.fromFnCall||"unknown function"});else if(f.id.type===ne.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];t(f.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...s,"Program:exit"(){for(let[i,{props:l,errorMsg:c,node:a,fnName:u}]of r){let y=e.sourceCode.getScope(a).set.get(i);if(y){let x=new Set(l);for(let m of y.references){let E=m.identifier,C=E.parent;if(!(C.type===ne.VariableDeclarator&&C.id===E)){if(C.type===ne.MemberExpression&&C.object===E&&C.property.type===ne.Identifier&&x.has(C.property.name)){if(x.delete(C.property.name),x.size===0)break;continue}if(C.type===ne.VariableDeclarator&&C.init===E&&C.id.type===ne.ObjectPattern){for(let S of C.id.properties)S.type===ne.Property&&S.key.type===ne.Identifier&&x.has(S.key.name)&&x.delete(S.key.name);if(x.size===0)break;continue}if(!(C.type===ne.MemberExpression&&C.object===E&&C.property.type===ne.Identifier&&!l.includes(C.property.name))){x.clear();break}}}if(x.size>0){let m=Array.from(x);if(m.length===1)e.report({node:a,messageId:"propNotRead",data:{prop:m[0],fnName:u,customMsg:c||""}});else{let E=m.map(C=>`"${C}"`).join(", ");e.report({node:a,messageId:"propsNotRead",data:{props:E,fnName:u,customMsg:c||""}})}}}}}}}});function Gr(e){return/^use[A-Z0-9]/.test(e)}function Et(e){return e.type==="Identifier"?Gr(e.name):e.type==="MemberExpression"&&!e.computed&&Et(e.property)?e.object.type==="Identifier":!1}function Kr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Qr(e,n){return e.name===n||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===n}function ei(e){return!!(e.parent&&e.parent.callee&&Qr(e.parent.callee,"forwardRef"))}function ti(e){return!!(e.parent&&e.parent.callee&&Qr(e.parent.callee,"memo"))}function hn(e){for(;e;){let n=ri(e);if(n&&(Kr(n)||Et(n))||ei(e)||ti(e))return!0;e=e.parent}return!1}function qr(e){return!1}function En(e){return!1}var Aa=/eslint +react-compiler\/react-compiler: +\["error/;var ni={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 n=!!e.options[0]?.reactCompilerIsEnabled;if(n)return{CallExpression(a){let u=null;a.callee.name==="useMemo"?u="useMemo":a.callee.name==="useCallback"&&(u="useCallback"),u&&e.report({node:a,message:`"${u}" is not necessary when using React Compiler.`})}};if(e.options[0]?.ignoreIfReactCompilerIsEnabled||n){for(let a of e.sourceCode.getAllComments())if(Aa.test(a.value))return{CallExpression(u){let f=null;u.callee.name==="useMemo"?f="useMemo":u.callee.name==="useCallback"&&(f="useCallback"),f&&e.report({node:u,message:`"${f}" is not necessary when using React Compiler.`})}}}let r=typeof e.getSource=="function"?a=>r(a):a=>e.sourceCode.getText(a),t=typeof e.getScope=="function"?()=>t():a=>e.sourceCode.getScope(a),o=null,s=[],i=[],l=new WeakSet;function c(a){for(let u of a.references){let f=u.identifier.parent;if(f.type==="VariableDeclarator"&&f.init&&f.init.type==="CallExpression"&&f.init.callee&&qr(f.init.callee))for(let y of u.resolved.references)y!==u&&l.add(y.identifier)}}return{onCodePathSegmentStart:a=>i.push(a),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(a,u){let f=s.pop();if(f.size===0)return;let y=new Set;function x(h,b){let{cache:w}=x,k=w.get(h.id),N=new Set(b);if(N.has(h.id)){let p=[...N],F=p.slice(p.indexOf(h.id)+1);for(let d of F)y.add(d);return BigInt("0")}if(N.add(h.id),k!==void 0)return k;if(a.thrownSegments.includes(h))k=BigInt("0");else if(h.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let p of h.prevSegments)k+=x(p,N)}return h.reachable&&k===BigInt("0")?w.delete(h.id):w.set(h.id,k),k}function m(h,b){let{cache:w}=m,k=w.get(h.id),N=new Set(b);if(N.has(h.id)){let p=Array.from(N),F=p.slice(p.indexOf(h.id)+1);for(let d of F)y.add(d);return BigInt("0")}if(N.add(h.id),k!==void 0)return k;if(a.thrownSegments.includes(h))k=BigInt("0");else if(h.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let p of h.nextSegments)k+=m(p,N)}return w.set(h.id,k),k}function E(h){let{cache:b}=E,w=b.get(h.id);if(w===null)return 1/0;if(w!==void 0)return w;if(b.set(h.id,null),h.prevSegments.length===0)w=1;else{w=1/0;for(let k of h.prevSegments){let N=E(k);N<w&&(w=N)}w+=1}return b.set(h.id,w),w}x.cache=new Map,m.cache=new Map,E.cache=new Map;let C=m(a.initialSegment),S=ri(u),I=hn(u),A=S?Kr(S)||Et(S):ei(u)||ti(u),T=1/0;for(let h of a.finalSegments){if(!h.reachable)continue;let b=E(h);b<T&&(T=b)}for(let[h,b]of f){if(!h.reachable)continue;let w=h.nextSegments.length===0?T<=E(h):T<E(h),k=x(h)*m(h),N=y.has(h.id);for(let p of b)if(N&&!En(p)&&e.report({node:p,message:`React Hook "${r(p)}" 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(u.async&&e.report({node:p,message:`React Hook "${r(p)}" cannot be called in an async function.`}),!N&&k!==C&&!En(p)){let d=`React Hook "${r(p)}" 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:p,message:d})}}else if(u.parent&&(u.parent.type==="MethodDefinition"||u.parent.type==="ClassProperty")&&u.parent.value===u){let F=`React Hook "${r(p)}" 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:p,message:F})}else if(S){let F=`React Hook "${r(p)}" 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:p,message:F})}else if(u.type==="Program"){let F=`React Hook "${r(p)}" 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:p,message:F})}else if(I&&!En(p)){if(u.parent.type==="CallExpression"&&u.parent.callee.type==="Identifier"&&u.parent.callee.name==="useCallback"){let d=u.parent;if(d.parent.type==="VariableDeclarator"&&Gr(d.parent.id.name))return}let F=`React Hook "${r(p)}" 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:p,message:F})}}},CallExpression(a){if(Et(a.callee)){let u=Zr(s),f=Zr(i),y=u.get(f);y||(y=[],u.set(f,y)),y.push(a.callee)}a.callee.type==="Identifier"&&(a.callee.name==="useEffect"||qr(a.callee))&&a.arguments.length>0&&(o=a)},Identifier(a){o==null&&l.has(a)&&a.parent.type!=="CallExpression"&&e.report({node:a,message:`\`${r(a)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(a){a===o&&(o=null)},FunctionDeclaration(a){hn(a)&&c(t(a))},ArrowFunctionExpression(a){hn(a)&&c(t(a))}}}};function ri(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 Zr(e){return e[e.length-1]}import{AST_NODE_TYPES as Se,AST_TOKEN_TYPES as wa}from"@typescript-eslint/utils";import*as be from"zod/v4";var Fa=/^\s+$/,bn=/\r?\n/,Ra=/^(\s*)/,va=/^(\s*)\S/,ka=/\r?\n/,Pa=be.object({indent:be.union([be.string().regex(Fa),be.number().int().min(1)]).optional(),tags:be.array(be.string()).optional(),functions:be.array(be.string()).optional(),comments:be.array(be.string()).optional()}),xn=X({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[U(Pa)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let n=e.sourceCode,{comments:r=["HTML","indent"],functions:t=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:s}=e.options[0],i=r.map(S=>S.toLowerCase());function l(S){let I=S.split(bn),A=I.filter(h=>h.trim()!=="");if(A.length===0)return S;let T=Number.POSITIVE_INFINITY;for(let h of A){let b=h.match(Ra);b&&(T=Math.min(T,b[1]?.length??0))}return!isFinite(T)||T===0?S:I.map(h=>h.slice(T)).join(`
36
36
  `)}function c(S,I,A){return S.split(bn).map(h=>h.trim()===""?h:A.repeat(I)+h).join(`
37
37
  `)}function a(S){if(S.type===Se.Identifier)return S.name;if(S.type===Se.MemberExpression){let I=S.object.type===Se.Identifier?S.object.name:null,A=S.property.type===Se.Identifier?S.property.name:null;return I&&A?`${I}.${A}`:A}return null}function u(S,I){if(!S)return!1;for(let A of I)if(A.includes(".")){let T=A.split(".");if(S.type===Se.MemberExpression&&S.object.type===Se.Identifier&&S.property.type===Se.Identifier&&S.object.name===T[0]&&S.property.name===T[1])return!0}else if(S.type===Se.Identifier&&S.name===A)return!0;return!1}function f(S,I){let A=S.parent;if(A.type!==Se.TaggedTemplateExpression)return!1;let T=a(A.tag);return T?I.includes(T):!1}function y(S,I){if(!S||S.type!==Se.CallExpression)return!1;let{method:A,argumentsLength:T,optionalCall:h=!0,optionalMember:b=!0}=I;return T!==void 0&&S.arguments.length!==T||!h&&S.optional||S.callee.type!==Se.MemberExpression||!b&&S.callee.optional||S.callee.property.type!==Se.Identifier?!1:S.callee.property.name===A}function x(S,I){if(!S||S.type!==Se.CallExpression)return!1;let{name:A,argumentsLength:T,optionalCall:h=!0}=I;return T!==void 0&&S.arguments.length!==T||!h&&S.optional||S.callee.type!==Se.Identifier?!1:S.callee.name===A}function m(S){return y(S.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&S.parent.type===Se.CallExpression&&S.parent.arguments[0]===S&&x(S.parent.callee.type===Se.MemberExpression?S.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function E(S){if(i.length>0){let I=n.getTokenBefore(S,{includeComments:!0});if(I?.type===wa.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(m(S)||o.length>0&&f(S,o)||t.length>0&&S.parent.type===Se.CallExpression&&S.parent.arguments.includes(S)&&u(S.parent.callee,t))}function C(S){let I=`__PLACEHOLDER__${Math.random()}`,A=S.quasis.map(j=>n.getText(j).slice(1,j.tail?-1:-2)).join(I),T=A.match(ka);if(!T)return;let h=T[0],b=n.lines[n.getLocFromIndex(S.range[0]).line-1];if(!b)return;let k=b.match(va)?.[1]??"",N;typeof s=="string"?N=s:typeof s=="number"?N=" ".repeat(s):N=k.startsWith(" ")?" ":" ";let F=l(A).replace(new RegExp(`^${h}|${h}[ ]*$`,"g"),""),d=h+c(F,1,k+N)+h+k,g=A.includes(`\r
38
38
  `)?`\r
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ls-stack/extended-lint",
3
- "version": "0.82.0",
3
+ "version": "0.82.2",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"