@ethang/eslint-config 22.1.4 → 22.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,9 +5,9 @@
5
5
  > [!CAUTION]
6
6
  > Prettier is already included for styling!
7
7
 
8
- * 776 errored rules.
8
+ * 777 errored rules.
9
9
  * 240 rules from [eslint-plugin-sonarjs](https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md)
10
- * 142 rules from [@eslint/js](https://github.com/eslint/eslint/tree/main/packages/js)
10
+ * 143 rules from [@eslint/js](https://github.com/eslint/eslint/tree/main/packages/js)
11
11
  * 123 rules from [sindresorhus/eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
12
12
  * 107 rules from [@typescript/eslint](https://github.com/typescript-eslint/typescript-eslint)
13
13
  * 49 rules from [@html-eslint/eslint-plugin](https://github.com/html-eslint/html-eslint)
package/config.react.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as F,b as ne,c as N,d as B}from"./chunk-BCW6UQO7.js";var L=F((Be,oe)=>{oe.exports={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["exported","source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ExperimentalRestProperty:["argument"],ExperimentalSpreadProperty:["argument"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportExpression:["source"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXElement:["openingElement","children","closingElement"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes"],JSXSpreadAttribute:["argument"],JSXText:[],JSXFragment:["openingFragment","children","closingFragment"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]}});var V=F((Le,U)=>{"use strict";var E=L(),ie=Object.freeze(Object.keys(E));for(let e of ie)Object.freeze(E[e]);Object.freeze(E);var se=new Set(["parent","leadingComments","trailingComments"]);function ae(e){return!se.has(e)&&e[0]!=="_"}U.exports=Object.freeze({KEYS:E,getKeys(e){return Object.keys(e).filter(ae)},unionWith(e){let r=Object.assign({},E);for(let t of Object.keys(e))if(r.hasOwnProperty(t)){let n=new Set(e[t]);for(let o of r[t])n.add(o);r[t]=Object.freeze(Array.from(n))}else r[t]=Object.freeze(Array.from(e[t]));return Object.freeze(r)}})});import De from"@eslint-react/eslint-plugin";var J=ne(V(),1);function le(e,r){let t=r.range[0],n=e,o=!1;do{o=!1;for(let i of n.childScopes){let s=i.block.range;if(s[0]<=t&&t<s[1]){n=i,o=!0;break}}}while(o);return n}function y(e,r){let t="",n=e;for(typeof r=="string"?t=r:(t=r.name,n=le(n,r));n!=null;){let o=n.set.get(t);if(o!=null)return o;n=n.upper}return null}function ue(e){return!this(e)}function p(e){return ue.bind(e)}function f(e,r){return e.type==="Punctuator"&&e.value===r}function ce(e){return f(e,"=>")}function pe(e){return f(e,",")}function fe(e){return f(e,";")}function me(e){return f(e,":")}function ye(e){return f(e,"(")}function de(e){return f(e,")")}function ge(e){return f(e,"[")}function he(e){return f(e,"]")}function ve(e){return f(e,"{")}function be(e){return f(e,"}")}function xe(e){return["Block","Line","Shebang"].includes(e.type)}var Ue=p(ce),Ve=p(pe),$e=p(fe),_e=p(me),ze=p(ye),Me=p(de),qe=p(ge),We=p(he),Je=p(ve),Xe=p(be),Ye=p(xe);var $=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{},Ee=Object.freeze(new Set(["Array","ArrayBuffer","BigInt","BigInt64Array","BigUint64Array","Boolean","DataView","Date","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","Float32Array","Float64Array","Function","Infinity","Int16Array","Int32Array","Int8Array","isFinite","isNaN","isPrototypeOf","JSON","Map","Math","NaN","Number","Object","parseFloat","parseInt","Promise","Proxy","Reflect","RegExp","Set","String","Symbol","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray","undefined","unescape","WeakMap","WeakSet"])),T=new Set([Array.isArray,typeof BigInt=="function"?BigInt:void 0,Boolean,Date,Date.parse,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,escape,isFinite,isNaN,isPrototypeOf,...Object.getOwnPropertyNames(Math).map(e=>Math[e]).filter(e=>typeof e=="function"),Number,Number.isFinite,Number.isNaN,Number.parseFloat,Number.parseInt,Object,Object.entries,Object.is,Object.isExtensible,Object.isFrozen,Object.isSealed,Object.keys,Object.values,parseFloat,parseInt,RegExp,String,String.fromCharCode,String.fromCodePoint,String.raw,Symbol.for,Symbol.keyFor,unescape].filter(e=>typeof e=="function")),_=new Set([Object.freeze,Object.preventExtensions,Object.seal]);function ke(e,r){let t=e;for(;(typeof t=="object"||typeof t=="function")&&t!==null;){let n=Object.getOwnPropertyDescriptor(t,r);if(n)return n;t=Object.getPrototypeOf(t)}return null}function Se(e,r){let t=ke(e,r);return t!=null&&t.get!=null}function k(e,r){let t=[];for(let n=0;n<e.length;++n){let o=e[n];if(o==null)t.length=n+1;else if(o.type==="SpreadElement"){let i=u(o.argument,r);if(i==null)return null;t.push(...i.value)}else{let i=u(o,r);if(i==null)return null;t.push(i.value)}}return t}var z=Object.freeze({ArrayExpression(e,r){let t=k(e.elements,r);return t!=null?{value:t}:null},AssignmentExpression(e,r){return e.operator==="="?u(e.right,r):null},BinaryExpression(e,r){if(e.operator==="in"||e.operator==="instanceof")return null;let t=u(e.left,r),n=u(e.right,r);if(t!=null&&n!=null)switch(e.operator){case"==":return{value:t.value==n.value};case"!=":return{value:t.value!=n.value};case"===":return{value:t.value===n.value};case"!==":return{value:t.value!==n.value};case"<":return{value:t.value<n.value};case"<=":return{value:t.value<=n.value};case">":return{value:t.value>n.value};case">=":return{value:t.value>=n.value};case"<<":return{value:t.value<<n.value};case">>":return{value:t.value>>n.value};case">>>":return{value:t.value>>>n.value};case"+":return{value:t.value+n.value};case"-":return{value:t.value-n.value};case"*":return{value:t.value*n.value};case"/":return{value:t.value/n.value};case"%":return{value:t.value%n.value};case"**":return{value:Math.pow(t.value,n.value)};case"|":return{value:t.value|n.value};case"^":return{value:t.value^n.value};case"&":return{value:t.value&n.value}}return null},CallExpression(e,r){let t=e.callee,n=k(e.arguments,r);if(n!=null)if(t.type==="MemberExpression"){if(t.property.type==="PrivateIdentifier")return null;let o=u(t.object,r);if(o!=null){if(o.value==null&&(o.optional||e.optional))return{value:void 0,optional:!0};let i=A(t,r);if(i!=null){let s=o.value,c=i.value;if(T.has(s[c]))return{value:s[c](...n)};if(_.has(s[c]))return{value:n[0]}}}}else{let o=u(t,r);if(o!=null){if(o.value==null&&e.optional)return{value:void 0,optional:!0};let i=o.value;if(T.has(i))return{value:i(...n)};if(_.has(i))return{value:n[0]}}}return null},ConditionalExpression(e,r){let t=u(e.test,r);return t!=null?t.value?u(e.consequent,r):u(e.alternate,r):null},ExpressionStatement(e,r){return u(e.expression,r)},Identifier(e,r){if(r!=null){let t=y(r,e);if(t!=null&&t.defs.length===0&&Ee.has(t.name)&&t.name in $)return{value:$[t.name]};if(t!=null&&t.defs.length===1){let n=t.defs[0];if(n.parent&&n.parent.kind==="const"&&n.node.id.type==="Identifier")return u(n.node.init,r)}}return null},Literal(e){return(e.regex!=null||e.bigint!=null)&&e.value==null?null:{value:e.value}},LogicalExpression(e,r){let t=u(e.left,r);if(t!=null){if(e.operator==="||"&&t.value||e.operator==="&&"&&!t.value||e.operator==="??"&&t.value!=null)return t;let n=u(e.right,r);if(n!=null)return n}return null},MemberExpression(e,r){if(e.property.type==="PrivateIdentifier")return null;let t=u(e.object,r);if(t!=null){if(t.value==null&&(t.optional||e.optional))return{value:void 0,optional:!0};let n=A(e,r);if(n!=null&&!Se(t.value,n.value))return{value:t.value[n.value]}}return null},ChainExpression(e,r){let t=u(e.expression,r);return t!=null?{value:t.value}:null},NewExpression(e,r){let t=u(e.callee,r),n=k(e.arguments,r);if(t!=null&&n!=null){let o=t.value;if(T.has(o))return{value:new o(...n)}}return null},ObjectExpression(e,r){let t={};for(let n of e.properties)if(n.type==="Property"){if(n.kind!=="init")return null;let o=A(n,r),i=u(n.value,r);if(o==null||i==null)return null;t[o.value]=i.value}else if(n.type==="SpreadElement"||n.type==="ExperimentalSpreadProperty"){let o=u(n.argument,r);if(o==null)return null;Object.assign(t,o.value)}else return null;return{value:t}},SequenceExpression(e,r){let t=e.expressions[e.expressions.length-1];return u(t,r)},TaggedTemplateExpression(e,r){let t=u(e.tag,r),n=k(e.quasi.expressions,r);if(t!=null&&n!=null){let o=t.value,i=e.quasi.quasis.map(s=>s.value.cooked);if(i.raw=e.quasi.quasis.map(s=>s.value.raw),o===String.raw)return{value:o(i,...n)}}return null},TemplateLiteral(e,r){let t=k(e.expressions,r);if(t!=null){let n=e.quasis[0].value.cooked;for(let o=0;o<t.length;++o)n+=t[o],n+=e.quasis[o+1].value.cooked;return{value:n}}return null},UnaryExpression(e,r){if(e.operator==="delete")return null;if(e.operator==="void")return{value:void 0};let t=u(e.argument,r);if(t!=null)switch(e.operator){case"-":return{value:-t.value};case"+":return{value:+t.value};case"!":return{value:!t.value};case"~":return{value:~t.value};case"typeof":return{value:typeof t.value}}return null}});function u(e,r){return e!=null&&Object.hasOwnProperty.call(z,e.type)?z[e.type](e,r):null}function A(e,r){let t=e.type==="Property"?e.key:e.property;return e.computed?u(t,r):t.type==="Identifier"?{value:t.name}:t.type==="Literal"?t.bigint?{value:t.bigint}:{value:String(t.value)}:null}function we(e,r=null){try{return u(e,r)}catch{return null}}function j(e,r=null){if(e&&e.type==="Literal"&&e.value===null){if(e.regex)return`/${e.regex.pattern}/${e.regex.flags}`;if(e.bigint)return e.bigint}let t=we(e,r);return t&&String(t.value)}function M(e,r){switch(e.type){case"MemberExpression":return e.computed?j(e.property,r):e.property.type==="PrivateIdentifier"?null:e.property.name;case"Property":case"MethodDefinition":case"PropertyDefinition":return e.computed?j(e.key,r):e.key.type==="Literal"?String(e.key.value):e.key.type==="PrivateIdentifier"?null:e.key.name}return null}var Ie=Object.freeze(new Set(["==","!=","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","|","^","&","in"])),Ce=Object.freeze(new Set(["-","+","!","~"]));function q(e){return e!==null&&typeof e=="object"&&typeof e.type=="string"}var Ge=Object.freeze(Object.assign(Object.create(null),{$visit(e,r,t){let{type:n}=e;return typeof this[n]=="function"?this[n](e,r,t):this.$visitChildren(e,r,t)},$visitChildren(e,r,t){let{type:n}=e;for(let o of t[n]||J.default.getKeys(e)){let i=e[o];if(Array.isArray(i)){for(let s of i)if(q(s)&&this.$visit(s,r,t))return!0}else if(q(i)&&this.$visit(i,r,t))return!0}return!1},ArrowFunctionExpression(){return!1},AssignmentExpression(){return!0},AwaitExpression(){return!0},BinaryExpression(e,r,t){return r.considerImplicitTypeConversion&&Ie.has(e.operator)&&(e.left.type!=="Literal"||e.right.type!=="Literal")?!0:this.$visitChildren(e,r,t)},CallExpression(){return!0},FunctionExpression(){return!1},ImportExpression(){return!0},MemberExpression(e,r,t){return r.considerGetters||r.considerImplicitTypeConversion&&e.computed&&e.property.type!=="Literal"?!0:this.$visitChildren(e,r,t)},MethodDefinition(e,r,t){return r.considerImplicitTypeConversion&&e.computed&&e.key.type!=="Literal"?!0:this.$visitChildren(e,r,t)},NewExpression(){return!0},Property(e,r,t){return r.considerImplicitTypeConversion&&e.computed&&e.key.type!=="Literal"?!0:this.$visitChildren(e,r,t)},PropertyDefinition(e,r,t){return r.considerImplicitTypeConversion&&e.computed&&e.key.type!=="Literal"?!0:this.$visitChildren(e,r,t)},UnaryExpression(e,r,t){return e.operator==="delete"||r.considerImplicitTypeConversion&&Ce.has(e.operator)&&e.argument.type!=="Literal"?!0:this.$visitChildren(e,r,t)},UpdateExpression(){return!0},YieldExpression(){return!0}}));var Pe=/^(?:Import|Export(?:All|Default|Named))Declaration$/u,g=Function.call.bind(Object.hasOwnProperty),l=Symbol("read"),S=Symbol("call"),C=Symbol("construct"),X=Symbol("esm"),Te={require:{[S]:!0}};function W(e){return e==null||e.defs.length!==0||e.references.some(r=>r.isWrite())}function Ae(e){let r=e.parent;switch(r&&r.type){case"ConditionalExpression":return r.consequent===e||r.alternate===e;case"LogicalExpression":return!0;case"SequenceExpression":return r.expressions[r.expressions.length-1]===e;case"ChainExpression":return!0;default:return!1}}var v=class{constructor(r,{mode:t="strict",globalObjectNames:n=["global","globalThis","self","window"]}={}){this.variableStack=[],this.globalScope=r,this.mode=t,this.globalObjectNames=n.slice(0)}*iterateGlobalReferences(r){for(let t of Object.keys(r)){let n=r[t],o=[t],i=this.globalScope.set.get(t);W(i)||(yield*this._iterateVariableReferences(i,o,n,!0))}for(let t of this.globalObjectNames){let n=[],o=this.globalScope.set.get(t);W(o)||(yield*this._iterateVariableReferences(o,n,r,!1))}}*iterateCjsReferences(r){for(let{node:t}of this.iterateGlobalReferences(Te)){let n=j(t.arguments[0]);if(n==null||!g(r,n))continue;let o=r[n],i=[n];o[l]&&(yield{node:t,path:i,type:l,info:o[l]}),yield*this._iteratePropertyReferences(t,i,o)}}*iterateEsmReferences(r){let t=this.globalScope.block;for(let n of t.body){if(!Pe.test(n.type)||n.source==null)continue;let o=n.source.value;if(!g(r,o))continue;let i=r[o],s=[o];if(i[l]&&(yield{node:n,path:s,type:l,info:i[l]}),n.type==="ExportAllDeclaration")for(let c of Object.keys(i)){let a=i[c];a[l]&&(yield{node:n,path:s.concat(c),type:l,info:a[l]})}else for(let c of n.specifiers){let a=g(i,X),m=this._iterateImportReferences(c,s,a?i:this.mode==="legacy"?{default:i,...i}:{default:i});if(a)yield*m;else for(let d of m)d.path=d.path.filter(je),(d.path.length>=2||d.type!==l)&&(yield d)}}}*_iterateVariableReferences(r,t,n,o){if(!this.variableStack.includes(r)){this.variableStack.push(r);try{for(let i of r.references){if(!i.isRead())continue;let s=i.identifier;o&&n[l]&&(yield{node:s,path:t,type:l,info:n[l]}),yield*this._iteratePropertyReferences(s,t,n)}}finally{this.variableStack.pop()}}}*_iteratePropertyReferences(r,t,n){let o=r;for(;Ae(o);)o=o.parent;let i=o.parent;if(i.type==="MemberExpression"){if(i.object===o){let s=M(i);if(s==null||!g(n,s))return;t=t.concat(s);let c=n[s];c[l]&&(yield{node:i,path:t,type:l,info:c[l]}),yield*this._iteratePropertyReferences(i,t,c)}return}if(i.type==="CallExpression"){i.callee===o&&n[S]&&(yield{node:i,path:t,type:S,info:n[S]});return}if(i.type==="NewExpression"){i.callee===o&&n[C]&&(yield{node:i,path:t,type:C,info:n[C]});return}if(i.type==="AssignmentExpression"){i.right===o&&(yield*this._iterateLhsReferences(i.left,t,n),yield*this._iteratePropertyReferences(i,t,n));return}if(i.type==="AssignmentPattern"){i.right===o&&(yield*this._iterateLhsReferences(i.left,t,n));return}i.type==="VariableDeclarator"&&i.init===o&&(yield*this._iterateLhsReferences(i.id,t,n))}*_iterateLhsReferences(r,t,n){if(r.type==="Identifier"){let o=y(this.globalScope,r);o!=null&&(yield*this._iterateVariableReferences(o,t,n,!1));return}if(r.type==="ObjectPattern"){for(let o of r.properties){let i=M(o);if(i==null||!g(n,i))continue;let s=t.concat(i),c=n[i];c[l]&&(yield{node:o,path:s,type:l,info:c[l]}),yield*this._iterateLhsReferences(o.value,s,c)}return}r.type==="AssignmentPattern"&&(yield*this._iterateLhsReferences(r.left,t,n))}*_iterateImportReferences(r,t,n){let o=r.type;if(o==="ImportSpecifier"||o==="ImportDefaultSpecifier"){let i=o==="ImportDefaultSpecifier"?"default":r.imported.name;if(!g(n,i))return;t=t.concat(i);let s=n[i];s[l]&&(yield{node:r,path:t,type:l,info:s[l]}),yield*this._iterateVariableReferences(y(this.globalScope,r.local),t,s,!1);return}if(o==="ImportNamespaceSpecifier"){yield*this._iterateVariableReferences(y(this.globalScope,r.local),t,n,!1);return}if(o==="ExportSpecifier"){let i=r.local.name;if(!g(n,i))return;t=t.concat(i);let s=n[i];s[l]&&(yield{node:r,path:t,type:l,info:s[l]})}}};v.READ=l;v.CALL=S;v.CONSTRUCT=C;v.ESM=X;function je(e,r){return!(r===1&&e==="default")}var Y=(e,r,t,n=new Set)=>{n.has(r)||(n.add(r),t(r),(e.sourceCode.visitorKeys[r.type]||[]).filter(o=>!(r.type==="CallExpression"&&o==="arguments")).map(o=>r[o]).filter(Boolean).flatMap(o=>Array.isArray(o)?o:[o]).filter(Boolean).filter(o=>typeof o.type=="string").forEach(o=>Y(e,o,t,n)))},O=(e,r)=>{let t=[];return Y(e,r,n=>{n.type==="Identifier"&&t.push(n)}),t},b=(e,r,t=new Set)=>!r||typeof r!="object"||t.has(r)?[]:(t.add(r),O(e,r).map(n=>y(e.sourceCode.getScope(r),n)).filter(Boolean).flatMap(n=>n.defs.filter(o=>o.type==="Variable").flatMap(o=>b(e,o.node.init,t)).concat(n))),R=e=>e.identifier.parent.type==="CallExpression"&&e.identifier.parent.callee===e.identifier;Object.defineProperty(Array.prototype,"notEmptyEvery",{value:function(e){return this.length>0&&this.every(e)}});var Oe=e=>(e.type==="FunctionDeclaration"||e.type==="VariableDeclarator"&&e.init.type==="ArrowFunctionExpression")&&e.id.type==="Identifier"&&e.id.name[0].toUpperCase()===e.id.name[0],G=e=>e.init&&e.init.type==="CallExpression"&&e.init.callee.name==="useState"&&e.id.type==="ArrayPattern"&&e.id.elements.length===2&&e.id.elements.every(r=>r.type==="Identifier"),w=e=>e.type==="CallExpression"&&e.callee.type==="Identifier"&&e.callee.name==="useEffect"||e.callee.type==="MemberExpression"&&e.callee.object.name==="React"&&e.callee.property.name==="useEffect",Re=e=>{if(!w(e)||e.arguments.length<1)return null;let r=e.arguments[0];return r.type!=="ArrowFunctionExpression"&&r.type!=="FunctionExpression"?null:r},K=(e,r)=>{if(!w(r)||r.arguments.length<1)return null;let t=Re(r);if(!t)return null;let n=o=>o.references.concat(o.childScopes.flatMap(i=>n(i)));return n(e.sourceCode.getScope(t))};function H(e,r){if(!w(r)||r.arguments.length<2)return null;let t=r.arguments[1];if(t.type!=="ArrayExpression")return null;let n=O(e,t),o=e.sourceCode.getScope(r);return n.map(i=>[i,y(o,i)]).filter(([i,s])=>s).flatMap(([i,s])=>s.references.filter(c=>c.identifier===i))}var x=(e,r)=>b(e,r.identifier).some(t=>t.defs.notEmptyEvery(n=>n.type==="Variable"&&G(n.node))),h=(e,r)=>b(e,r.identifier).some(t=>t.defs.notEmptyEvery(n=>n.type==="Parameter"&&Oe(n.node.type==="ArrowFunctionExpression"?n.node.parent:n.node))),D=e=>e.resolved.defs.find(r=>r.type==="Variable"&&G(r.node))?.node,Q=(e,r)=>{let t=e.identifier.parent,n=D(e).init.arguments?.[0];return r.sourceCode.getText(t.arguments[0])===r.sourceCode.getText(n)};var Z="you-might-not-need-an-effect",ee={meta:{type:"suggestion",docs:{description:"Warn against unnecessary React useEffect hooks.",url:"https://react.dev/learn/you-might-not-need-an-effect"},schema:[],messages:{avoidInternalEffect:"This effect operates entirely on internal React state, with no external dependencies. It is likely unnecessary.",avoidDerivedState:'Avoid storing derived state. Compute "{{state}}" directly during render, optionally with `useMemo` if it\'s expensive.',avoidInitializingState:"Avoid initializing state in an effect. Instead, pass the initial value to `useState`.",avoidChainingState:"Avoid chaining state changes. When possible, update all relevant state simultaneously.",avoidManagingParentBehavior:"Avoid managing parent behavior. Instead, lift this logic up to the parent component.",avoidPassingStateToParent:"Avoid making parent components depend on a child's intermediate state. If the parent needs live updates, consider lifting state up.",avoidResettingStateFromProps:"Avoid resetting state from props. If the prop is a key, pass it as `key` instead so React will reset the component."}},create:e=>({CallExpression:r=>{if(!w(r))return;let t=K(e,r),n=H(e,r);if(!t||!n||t.length===0)return;let o=t.concat(n).every(a=>x(e,a)||h(e,a));o&&e.report({node:r,messageId:"avoidInternalEffect"});let i=t.filter(a=>R(a)).filter(a=>x(e,a)),s=n.some(a=>h(e,a)),c=i.notEmptyEvery(a=>Q(a,e));s&&c&&e.report({node:r,messageId:"avoidResettingStateFromProps"}),t.concat(n).every(a=>h(e,a))&&e.report({node:r,messageId:"avoidManagingParentBehavior"}),t.filter(a=>R(a)&&(x(e,a)||h(e,a))).forEach(a=>{let m=a.identifier.parent,d=m.arguments.some(P=>b(e,P).some(I=>n.some(re=>re.identifier.name===I.name)));if(o&&x(e,a)){let P=D(a);d?e.report({node:m.callee,messageId:"avoidDerivedState",data:{state:P.id.elements[0].name}}):n.notEmptyEvery(I=>x(e,I)||h(e,I))?e.report({node:m.callee,messageId:"avoidChainingState"}):e.report({node:m.callee,messageId:"avoidInitializingState"})}h(e,a)&&m.arguments.length>0&&e.report({node:m.callee,messageId:"avoidPassingStateToParent"})})}})};var te={rules:{[Z]:ee}};import Fe from"eslint-plugin-react-hooks";import Ne from"typescript-eslint";var ft=Ne.config({files:["**/*.{jsx,tsx}"],ignores:N,languageOptions:B,settings:{react:{version:"19.1.0"}},plugins:{react:De,"react-hooks":Fe,"react-you-might-not-need-an-effect":te},rules:{"react/avoid-shorthand-boolean":"off","react/avoid-shorthand-fragment":"off","react/debug/class-component":"off","react/debug/function-component":"off","react/debug/hook":"off","react/debug/is-from-react":"off","react/debug/jsx":"off","react/debug/react-hooks":"off","react/dom/no-children-in-void-dom-elements":"error","react/dom/no-dangerously-set-innerhtml":"error","react/dom/no-dangerously-set-innerhtml-with-children":"error","react/dom/no-find-dom-node":"error","react/dom/no-flush-sync":"error","react/dom/no-hydrate":"error","react/dom/no-missing-button-type":"error","react/dom/no-missing-iframe-sandbox":"error","react/dom/no-namespace":"error","react/dom/no-render":"error","react/dom/no-render-return-value":"error","react/dom/no-script-url":"error","react/dom/no-unknown-property":"error","react/dom/no-unsafe-iframe-sandbox":"error","react/dom/no-unsafe-target-blank":"error","react/dom/no-use-form-state":"error","react/dom/no-void-elements-with-children":"error","react/ensure-forward-ref-using-ref":"error","react/hooks-extra/ensure-custom-hooks-using-other-hooks":"error","react/hooks-extra/ensure-use-callback-has-non-empty-deps":"error","react/hooks-extra/ensure-use-memo-has-non-empty-deps":"error","react/hooks-extra/no-direct-set-state-in-use-effect":"error","react/hooks-extra/no-direct-set-state-in-use-layout-effect":"error","react/hooks-extra/no-redundant-custom-hook":"error","react/hooks-extra/no-unnecessary-use-callback":"error","react/hooks-extra/no-unnecessary-use-memo":"error","react/hooks-extra/no-unnecessary-use-prefix":"error","react/hooks-extra/no-useless-custom-hooks":"error","react/hooks-extra/prefer-use-state-lazy-initialization":"error","react/jsx-key-before-spread":"error","react/jsx-no-duplicate-props":"error","react/jsx-no-undef":"error","react/jsx-uses-react":"error","react/jsx-uses-vars":"error","react/naming-convention/component-name":"error","react/naming-convention/context-name":"error","react/naming-convention/filename":["error",{rule:"kebab-case"}],"react/naming-convention/filename-extension":"error","react/naming-convention/use-state":"error","react/no-access-state-in-setstate":"error","react/no-array-index-key":"error","react/no-children-count":"error","react/no-children-for-each":"error","react/no-children-map":"error","react/no-children-only":"error","react/no-children-prop":"error","react/no-children-to-array":"error","react/no-class-component":"error","react/no-clone-element":"error","react/no-comment-textnodes":"error","react/no-complex-conditional-rendering":"error","react/no-complicated-conditional-rendering":"error","react/no-component-will-mount":"error","react/no-component-will-receive-props":"error","react/no-component-will-update":"error","react/no-context-provider":"error","react/no-create-ref":"error","react/no-default-props":"error","react/no-direct-mutation-state":"error","react/no-duplicate-jsx-props":"error","react/no-duplicate-key":"error","react/no-forward-ref":"error","react/no-implicit-key":"error","react/no-leaked-conditional-rendering":"error","react/no-missing-component-display-name":"error","react/no-missing-context-display-name":"error","react/no-missing-key":"error","react/no-misused-capture-owner-stack":"error","react/no-nested-component-definitions":"error","react/no-nested-components":"error","react/no-nested-lazy-component-declarations":"error","react/no-prop-types":"error","react/no-redundant-should-component-update":"error","react/no-set-state-in-component-did-mount":"error","react/no-set-state-in-component-did-update":"error","react/no-set-state-in-component-will-update":"error","react/no-string-refs":"error","react/no-unsafe-component-will-mount":"error","react/no-unsafe-component-will-receive-props":"error","react/no-unsafe-component-will-update":"error","react/no-unstable-context-value":"error","react/no-unstable-default-props":"error","react/no-unused-class-component-members":"error","react/no-unused-state":"error","react/no-use-context":"error","react/no-useless-forward-ref":"error","react/no-useless-fragment":"error","react/prefer-destructuring-assignment":"error","react/prefer-react-namespace-import":"error","react/prefer-read-only-props":"error","react/prefer-shorthand-boolean":"error","react/prefer-shorthand-fragment":"error","react/use-jsx-vars":"error","react/web-api/no-leaked-event-listener":"error","react/web-api/no-leaked-interval":"error","react/web-api/no-leaked-resize-observer":"error","react/web-api/no-leaked-timeout":"error","react-hooks/exhaustive-deps":"error","react-hooks/rules-of-hooks":"error","react-you-might-not-need-an-effect/you-might-not-need-an-effect":"error"}});export{ft as default};
1
+ import{a as D,b as ee,c as N,d as B}from"./chunk-BCW6UQO7.js";var L=D((Ne,te)=>{te.exports={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["exported","source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ExperimentalRestProperty:["argument"],ExperimentalSpreadProperty:["argument"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportExpression:["source"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXElement:["openingElement","children","closingElement"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes"],JSXSpreadAttribute:["argument"],JSXText:[],JSXFragment:["openingFragment","children","closingFragment"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]}});var $=D((Be,U)=>{"use strict";var E=L(),re=Object.freeze(Object.keys(E));for(let e of re)Object.freeze(E[e]);Object.freeze(E);var ne=new Set(["parent","leadingComments","trailingComments"]);function oe(e){return!ne.has(e)&&e[0]!=="_"}U.exports=Object.freeze({KEYS:E,getKeys(e){return Object.keys(e).filter(oe)},unionWith(e){let r=Object.assign({},E);for(let t of Object.keys(e))if(r.hasOwnProperty(t)){let n=new Set(e[t]);for(let i of r[t])n.add(i);r[t]=Object.freeze(Array.from(n))}else r[t]=Object.freeze(Array.from(e[t]));return Object.freeze(r)}})});import Oe from"@eslint-react/eslint-plugin";var J=ee($(),1);function ie(e,r){let t=r.range[0],n=e,i=!1;do{i=!1;for(let o of n.childScopes){let s=o.block.range;if(s[0]<=t&&t<s[1]){n=o,i=!0;break}}}while(i);return n}function m(e,r){let t="",n=e;for(typeof r=="string"?t=r:(t=r.name,n=ie(n,r));n!=null;){let i=n.set.get(t);if(i!=null)return i;n=n.upper}return null}function se(e){return!this(e)}function c(e){return se.bind(e)}function f(e,r){return e.type==="Punctuator"&&e.value===r}function ae(e){return f(e,"=>")}function le(e){return f(e,",")}function ue(e){return f(e,";")}function ce(e){return f(e,":")}function pe(e){return f(e,"(")}function fe(e){return f(e,")")}function me(e){return f(e,"[")}function ye(e){return f(e,"]")}function de(e){return f(e,"{")}function ge(e){return f(e,"}")}function he(e){return["Block","Line","Shebang"].includes(e.type)}var Le=c(ae),Ue=c(le),$e=c(ue),Ve=c(ce),_e=c(pe),ze=c(fe),Me=c(me),qe=c(ye),We=c(de),Je=c(ge),Xe=c(he);var V=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{},ve=Object.freeze(new Set(["Array","ArrayBuffer","BigInt","BigInt64Array","BigUint64Array","Boolean","DataView","Date","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","Float32Array","Float64Array","Function","Infinity","Int16Array","Int32Array","Int8Array","isFinite","isNaN","isPrototypeOf","JSON","Map","Math","NaN","Number","Object","parseFloat","parseInt","Promise","Proxy","Reflect","RegExp","Set","String","Symbol","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray","undefined","unescape","WeakMap","WeakSet"])),T=new Set([Array.isArray,typeof BigInt=="function"?BigInt:void 0,Boolean,Date,Date.parse,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,escape,isFinite,isNaN,isPrototypeOf,...Object.getOwnPropertyNames(Math).map(e=>Math[e]).filter(e=>typeof e=="function"),Number,Number.isFinite,Number.isNaN,Number.parseFloat,Number.parseInt,Object,Object.entries,Object.is,Object.isExtensible,Object.isFrozen,Object.isSealed,Object.keys,Object.values,parseFloat,parseInt,RegExp,String,String.fromCharCode,String.fromCodePoint,String.raw,Symbol.for,Symbol.keyFor,unescape].filter(e=>typeof e=="function")),_=new Set([Object.freeze,Object.preventExtensions,Object.seal]);function be(e,r){let t=e;for(;(typeof t=="object"||typeof t=="function")&&t!==null;){let n=Object.getOwnPropertyDescriptor(t,r);if(n)return n;t=Object.getPrototypeOf(t)}return null}function xe(e,r){let t=be(e,r);return t!=null&&t.get!=null}function k(e,r){let t=[];for(let n=0;n<e.length;++n){let i=e[n];if(i==null)t.length=n+1;else if(i.type==="SpreadElement"){let o=l(i.argument,r);if(o==null)return null;t.push(...o.value)}else{let o=l(i,r);if(o==null)return null;t.push(o.value)}}return t}var z=Object.freeze({ArrayExpression(e,r){let t=k(e.elements,r);return t!=null?{value:t}:null},AssignmentExpression(e,r){return e.operator==="="?l(e.right,r):null},BinaryExpression(e,r){if(e.operator==="in"||e.operator==="instanceof")return null;let t=l(e.left,r),n=l(e.right,r);if(t!=null&&n!=null)switch(e.operator){case"==":return{value:t.value==n.value};case"!=":return{value:t.value!=n.value};case"===":return{value:t.value===n.value};case"!==":return{value:t.value!==n.value};case"<":return{value:t.value<n.value};case"<=":return{value:t.value<=n.value};case">":return{value:t.value>n.value};case">=":return{value:t.value>=n.value};case"<<":return{value:t.value<<n.value};case">>":return{value:t.value>>n.value};case">>>":return{value:t.value>>>n.value};case"+":return{value:t.value+n.value};case"-":return{value:t.value-n.value};case"*":return{value:t.value*n.value};case"/":return{value:t.value/n.value};case"%":return{value:t.value%n.value};case"**":return{value:Math.pow(t.value,n.value)};case"|":return{value:t.value|n.value};case"^":return{value:t.value^n.value};case"&":return{value:t.value&n.value}}return null},CallExpression(e,r){let t=e.callee,n=k(e.arguments,r);if(n!=null)if(t.type==="MemberExpression"){if(t.property.type==="PrivateIdentifier")return null;let i=l(t.object,r);if(i!=null){if(i.value==null&&(i.optional||e.optional))return{value:void 0,optional:!0};let o=A(t,r);if(o!=null){let s=i.value,u=o.value;if(T.has(s[u]))return{value:s[u](...n)};if(_.has(s[u]))return{value:n[0]}}}}else{let i=l(t,r);if(i!=null){if(i.value==null&&e.optional)return{value:void 0,optional:!0};let o=i.value;if(T.has(o))return{value:o(...n)};if(_.has(o))return{value:n[0]}}}return null},ConditionalExpression(e,r){let t=l(e.test,r);return t!=null?t.value?l(e.consequent,r):l(e.alternate,r):null},ExpressionStatement(e,r){return l(e.expression,r)},Identifier(e,r){if(r!=null){let t=m(r,e);if(t!=null&&t.defs.length===0&&ve.has(t.name)&&t.name in V)return{value:V[t.name]};if(t!=null&&t.defs.length===1){let n=t.defs[0];if(n.parent&&n.parent.kind==="const"&&n.node.id.type==="Identifier")return l(n.node.init,r)}}return null},Literal(e){return(e.regex!=null||e.bigint!=null)&&e.value==null?null:{value:e.value}},LogicalExpression(e,r){let t=l(e.left,r);if(t!=null){if(e.operator==="||"&&t.value||e.operator==="&&"&&!t.value||e.operator==="??"&&t.value!=null)return t;let n=l(e.right,r);if(n!=null)return n}return null},MemberExpression(e,r){if(e.property.type==="PrivateIdentifier")return null;let t=l(e.object,r);if(t!=null){if(t.value==null&&(t.optional||e.optional))return{value:void 0,optional:!0};let n=A(e,r);if(n!=null&&!xe(t.value,n.value))return{value:t.value[n.value]}}return null},ChainExpression(e,r){let t=l(e.expression,r);return t!=null?{value:t.value}:null},NewExpression(e,r){let t=l(e.callee,r),n=k(e.arguments,r);if(t!=null&&n!=null){let i=t.value;if(T.has(i))return{value:new i(...n)}}return null},ObjectExpression(e,r){let t={};for(let n of e.properties)if(n.type==="Property"){if(n.kind!=="init")return null;let i=A(n,r),o=l(n.value,r);if(i==null||o==null)return null;t[i.value]=o.value}else if(n.type==="SpreadElement"||n.type==="ExperimentalSpreadProperty"){let i=l(n.argument,r);if(i==null)return null;Object.assign(t,i.value)}else return null;return{value:t}},SequenceExpression(e,r){let t=e.expressions[e.expressions.length-1];return l(t,r)},TaggedTemplateExpression(e,r){let t=l(e.tag,r),n=k(e.quasi.expressions,r);if(t!=null&&n!=null){let i=t.value,o=e.quasi.quasis.map(s=>s.value.cooked);if(o.raw=e.quasi.quasis.map(s=>s.value.raw),i===String.raw)return{value:i(o,...n)}}return null},TemplateLiteral(e,r){let t=k(e.expressions,r);if(t!=null){let n=e.quasis[0].value.cooked;for(let i=0;i<t.length;++i)n+=t[i],n+=e.quasis[i+1].value.cooked;return{value:n}}return null},UnaryExpression(e,r){if(e.operator==="delete")return null;if(e.operator==="void")return{value:void 0};let t=l(e.argument,r);if(t!=null)switch(e.operator){case"-":return{value:-t.value};case"+":return{value:+t.value};case"!":return{value:!t.value};case"~":return{value:~t.value};case"typeof":return{value:typeof t.value}}return null}});function l(e,r){return e!=null&&Object.hasOwnProperty.call(z,e.type)?z[e.type](e,r):null}function A(e,r){let t=e.type==="Property"?e.key:e.property;return e.computed?l(t,r):t.type==="Identifier"?{value:t.name}:t.type==="Literal"?t.bigint?{value:t.bigint}:{value:String(t.value)}:null}function Ee(e,r=null){try{return l(e,r)}catch{return null}}function j(e,r=null){if(e&&e.type==="Literal"&&e.value===null){if(e.regex)return`/${e.regex.pattern}/${e.regex.flags}`;if(e.bigint)return e.bigint}let t=Ee(e,r);return t&&String(t.value)}function M(e,r){switch(e.type){case"MemberExpression":return e.computed?j(e.property,r):e.property.type==="PrivateIdentifier"?null:e.property.name;case"Property":case"MethodDefinition":case"PropertyDefinition":return e.computed?j(e.key,r):e.key.type==="Literal"?String(e.key.value):e.key.type==="PrivateIdentifier"?null:e.key.name}return null}var ke=Object.freeze(new Set(["==","!=","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","|","^","&","in"])),Se=Object.freeze(new Set(["-","+","!","~"]));function q(e){return e!==null&&typeof e=="object"&&typeof e.type=="string"}var Ye=Object.freeze(Object.assign(Object.create(null),{$visit(e,r,t){let{type:n}=e;return typeof this[n]=="function"?this[n](e,r,t):this.$visitChildren(e,r,t)},$visitChildren(e,r,t){let{type:n}=e;for(let i of t[n]||J.default.getKeys(e)){let o=e[i];if(Array.isArray(o)){for(let s of o)if(q(s)&&this.$visit(s,r,t))return!0}else if(q(o)&&this.$visit(o,r,t))return!0}return!1},ArrowFunctionExpression(){return!1},AssignmentExpression(){return!0},AwaitExpression(){return!0},BinaryExpression(e,r,t){return r.considerImplicitTypeConversion&&ke.has(e.operator)&&(e.left.type!=="Literal"||e.right.type!=="Literal")?!0:this.$visitChildren(e,r,t)},CallExpression(){return!0},FunctionExpression(){return!1},ImportExpression(){return!0},MemberExpression(e,r,t){return r.considerGetters||r.considerImplicitTypeConversion&&e.computed&&e.property.type!=="Literal"?!0:this.$visitChildren(e,r,t)},MethodDefinition(e,r,t){return r.considerImplicitTypeConversion&&e.computed&&e.key.type!=="Literal"?!0:this.$visitChildren(e,r,t)},NewExpression(){return!0},Property(e,r,t){return r.considerImplicitTypeConversion&&e.computed&&e.key.type!=="Literal"?!0:this.$visitChildren(e,r,t)},PropertyDefinition(e,r,t){return r.considerImplicitTypeConversion&&e.computed&&e.key.type!=="Literal"?!0:this.$visitChildren(e,r,t)},UnaryExpression(e,r,t){return e.operator==="delete"||r.considerImplicitTypeConversion&&Se.has(e.operator)&&e.argument.type!=="Literal"?!0:this.$visitChildren(e,r,t)},UpdateExpression(){return!0},YieldExpression(){return!0}}));var we=/^(?:Import|Export(?:All|Default|Named))Declaration$/u,g=Function.call.bind(Object.hasOwnProperty),a=Symbol("read"),S=Symbol("call"),I=Symbol("construct"),X=Symbol("esm"),Ie={require:{[S]:!0}};function W(e){return e==null||e.defs.length!==0||e.references.some(r=>r.isWrite())}function Ce(e){let r=e.parent;switch(r&&r.type){case"ConditionalExpression":return r.consequent===e||r.alternate===e;case"LogicalExpression":return!0;case"SequenceExpression":return r.expressions[r.expressions.length-1]===e;case"ChainExpression":return!0;default:return!1}}var v=class{constructor(r,{mode:t="strict",globalObjectNames:n=["global","globalThis","self","window"]}={}){this.variableStack=[],this.globalScope=r,this.mode=t,this.globalObjectNames=n.slice(0)}*iterateGlobalReferences(r){for(let t of Object.keys(r)){let n=r[t],i=[t],o=this.globalScope.set.get(t);W(o)||(yield*this._iterateVariableReferences(o,i,n,!0))}for(let t of this.globalObjectNames){let n=[],i=this.globalScope.set.get(t);W(i)||(yield*this._iterateVariableReferences(i,n,r,!1))}}*iterateCjsReferences(r){for(let{node:t}of this.iterateGlobalReferences(Ie)){let n=j(t.arguments[0]);if(n==null||!g(r,n))continue;let i=r[n],o=[n];i[a]&&(yield{node:t,path:o,type:a,info:i[a]}),yield*this._iteratePropertyReferences(t,o,i)}}*iterateEsmReferences(r){let t=this.globalScope.block;for(let n of t.body){if(!we.test(n.type)||n.source==null)continue;let i=n.source.value;if(!g(r,i))continue;let o=r[i],s=[i];if(o[a]&&(yield{node:n,path:s,type:a,info:o[a]}),n.type==="ExportAllDeclaration")for(let u of Object.keys(o)){let p=o[u];p[a]&&(yield{node:n,path:s.concat(u),type:a,info:p[a]})}else for(let u of n.specifiers){let p=g(o,X),y=this._iterateImportReferences(u,s,p?o:this.mode==="legacy"?{default:o,...o}:{default:o});if(p)yield*y;else for(let d of y)d.path=d.path.filter(Pe),(d.path.length>=2||d.type!==a)&&(yield d)}}}*_iterateVariableReferences(r,t,n,i){if(!this.variableStack.includes(r)){this.variableStack.push(r);try{for(let o of r.references){if(!o.isRead())continue;let s=o.identifier;i&&n[a]&&(yield{node:s,path:t,type:a,info:n[a]}),yield*this._iteratePropertyReferences(s,t,n)}}finally{this.variableStack.pop()}}}*_iteratePropertyReferences(r,t,n){let i=r;for(;Ce(i);)i=i.parent;let o=i.parent;if(o.type==="MemberExpression"){if(o.object===i){let s=M(o);if(s==null||!g(n,s))return;t=t.concat(s);let u=n[s];u[a]&&(yield{node:o,path:t,type:a,info:u[a]}),yield*this._iteratePropertyReferences(o,t,u)}return}if(o.type==="CallExpression"){o.callee===i&&n[S]&&(yield{node:o,path:t,type:S,info:n[S]});return}if(o.type==="NewExpression"){o.callee===i&&n[I]&&(yield{node:o,path:t,type:I,info:n[I]});return}if(o.type==="AssignmentExpression"){o.right===i&&(yield*this._iterateLhsReferences(o.left,t,n),yield*this._iteratePropertyReferences(o,t,n));return}if(o.type==="AssignmentPattern"){o.right===i&&(yield*this._iterateLhsReferences(o.left,t,n));return}o.type==="VariableDeclarator"&&o.init===i&&(yield*this._iterateLhsReferences(o.id,t,n))}*_iterateLhsReferences(r,t,n){if(r.type==="Identifier"){let i=m(this.globalScope,r);i!=null&&(yield*this._iterateVariableReferences(i,t,n,!1));return}if(r.type==="ObjectPattern"){for(let i of r.properties){let o=M(i);if(o==null||!g(n,o))continue;let s=t.concat(o),u=n[o];u[a]&&(yield{node:i,path:s,type:a,info:u[a]}),yield*this._iterateLhsReferences(i.value,s,u)}return}r.type==="AssignmentPattern"&&(yield*this._iterateLhsReferences(r.left,t,n))}*_iterateImportReferences(r,t,n){let i=r.type;if(i==="ImportSpecifier"||i==="ImportDefaultSpecifier"){let o=i==="ImportDefaultSpecifier"?"default":r.imported.name;if(!g(n,o))return;t=t.concat(o);let s=n[o];s[a]&&(yield{node:r,path:t,type:a,info:s[a]}),yield*this._iterateVariableReferences(m(this.globalScope,r.local),t,s,!1);return}if(i==="ImportNamespaceSpecifier"){yield*this._iterateVariableReferences(m(this.globalScope,r.local),t,n,!1);return}if(i==="ExportSpecifier"){let o=r.local.name;if(!g(n,o))return;t=t.concat(o);let s=n[o];s[a]&&(yield{node:r,path:t,type:a,info:s[a]})}}};v.READ=a;v.CALL=S;v.CONSTRUCT=I;v.ESM=X;function Pe(e,r){return!(r===1&&e==="default")}var C=(e,r,t,n=new Set)=>{n.has(r)||(n.add(r),t(r),(e.sourceCode.visitorKeys[r.type]||[]).filter(i=>!(r.type==="CallExpression"&&i==="arguments")).map(i=>r[i]).filter(Boolean).flatMap(i=>Array.isArray(i)?i:[i]).filter(Boolean).filter(i=>typeof i.type=="string").forEach(i=>C(e,i,t,n)))},R=(e,r)=>{let t=[];return C(e,r,n=>{n.type==="Identifier"&&t.push(n)}),t},b=(e,r,t=new Set)=>!r||typeof r!="object"||t.has(r)?[]:(t.add(r),R(e,r).map(n=>m(e.sourceCode.getScope(r),n)).filter(Boolean).flatMap(n=>n.defs.filter(i=>i.type==="Variable").flatMap(i=>b(e,i.node.init,t)).concat(n))),P=e=>e.identifier.parent.type==="CallExpression"&&e.identifier.parent.callee===e.identifier;Object.defineProperty(Array.prototype,"notEmptyEvery",{value:function(e){return this.length>0&&this.every(e)}});var Te=e=>(e.type==="FunctionDeclaration"||e.type==="VariableDeclarator"&&e.init.type==="ArrowFunctionExpression")&&e.id.type==="Identifier"&&e.id.name[0].toUpperCase()===e.id.name[0],O=e=>e.init&&e.init.type==="CallExpression"&&e.init.callee.name==="useState"&&e.id.type==="ArrayPattern"&&e.id.elements.length===2&&e.id.elements.every(r=>r.type==="Identifier"),w=e=>e.type==="CallExpression"&&e.callee.type==="Identifier"&&e.callee.name==="useEffect"||e.callee.type==="MemberExpression"&&e.callee.object.name==="React"&&e.callee.property.name==="useEffect",Ae=e=>{if(!w(e)||e.arguments.length<1)return null;let r=e.arguments[0];return r.type!=="ArrowFunctionExpression"&&r.type!=="FunctionExpression"?null:r},Y=(e,r)=>{if(!w(r)||r.arguments.length<1)return null;let t=Ae(r);if(!t)return null;let n=i=>i.references.concat(i.childScopes.flatMap(o=>n(o)));return n(e.sourceCode.getScope(t))};function G(e,r){if(!w(r)||r.arguments.length<2)return null;let t=r.arguments[1];if(t.type!=="ArrayExpression")return null;let n=R(e,t),i=e.sourceCode.getScope(r);return n.map(o=>[o,m(i,o)]).filter(([o,s])=>s).flatMap(([o,s])=>s.references.filter(u=>u.identifier===o))}var x=(e,r)=>b(e,r.identifier).some(t=>t.defs.notEmptyEvery(n=>n.type==="Variable"&&O(n.node))),h=(e,r)=>b(e,r.identifier).some(t=>t.defs.notEmptyEvery(n=>n.type==="Parameter"&&Te(n.node.type==="ArrowFunctionExpression"?n.node.parent:n.node))),F=e=>e.resolved.defs.find(r=>r.type==="Variable"&&O(r.node)).node,K=(e,r,t,n)=>{let i=r.filter(o=>P(o)).filter(o=>x(e,o));return t.some(o=>h(e,o))&&i.notEmptyEvery(o=>je(e,o))&&i.length===Re(e,n.parent.parent)},je=(e,r)=>{let t=r.identifier.parent,n=F(r)?.init.arguments?.[0];return e.sourceCode.getText(t.arguments[0])===e.sourceCode.getText(n)},Re=(e,r)=>{let t=0;return C(e,r,n=>{O(n)&&t++}),t};var H="you-might-not-need-an-effect",Q={meta:{type:"suggestion",docs:{description:"Warn against unnecessary React useEffect hooks.",url:"https://react.dev/learn/you-might-not-need-an-effect"},schema:[],messages:{avoidInternalEffect:"This effect operates entirely on internal React state, with no external dependencies. It is likely unnecessary.",avoidDerivedState:'Avoid storing derived state. Compute "{{state}}" directly during render, optionally with `useMemo` if it\'s expensive.',avoidInitializingState:"Avoid initializing state in an effect. Instead, pass the initial value to `useState`.",avoidChainingState:"Avoid chaining state changes. When possible, update all relevant state simultaneously.",avoidManagingParentBehavior:"Avoid managing parent behavior. Instead, lift this logic up to the parent component.",avoidPassingStateToParent:"Avoid making parent components depend on a child's intermediate state. If the parent needs live updates, consider lifting state up.",avoidResettingStateFromProps:"Avoid resetting state from props. If the prop is a key, pass it as `key` instead so React will reset the component."}},create:e=>({CallExpression:r=>{if(!w(r))return;let t=Y(e,r),n=G(e,r);if(!t||!n||t.length===0)return;let i=t.concat(n).every(o=>x(e,o)||h(e,o));i&&e.report({node:r,messageId:"avoidInternalEffect"}),K(e,t,n,r)&&e.report({node:r,messageId:"avoidResettingStateFromProps"}),t.concat(n).every(o=>h(e,o))&&e.report({node:r,messageId:"avoidManagingParentBehavior"}),t.filter(o=>P(o)&&(x(e,o)||h(e,o))).forEach(o=>{let s=o.identifier.parent,u=s.arguments.some(p=>b(e,p).some(y=>n.some(d=>d.identifier.name===y.name)));if(i&&x(e,o)){let p=F(o);u&&p?e.report({node:s,messageId:"avoidDerivedState",data:{state:p.id.elements[0].name}}):n.notEmptyEvery(y=>x(e,y)||h(e,y))?e.report({node:s,messageId:"avoidChainingState"}):e.report({node:s,messageId:"avoidInitializingState"})}h(e,o)&&s.arguments.length>0&&e.report({node:s,messageId:"avoidPassingStateToParent"})})}})};var Z={rules:{[H]:Q}};import Fe from"eslint-plugin-react-hooks";import De from"typescript-eslint";var pt=De.config({files:["**/*.{jsx,tsx}"],ignores:N,languageOptions:B,settings:{react:{version:"19.1.0"}},plugins:{react:Oe,"react-hooks":Fe,"react-you-might-not-need-an-effect":Z},rules:{"react/avoid-shorthand-boolean":"off","react/avoid-shorthand-fragment":"off","react/debug/class-component":"off","react/debug/function-component":"off","react/debug/hook":"off","react/debug/is-from-react":"off","react/debug/jsx":"off","react/debug/react-hooks":"off","react/dom/no-children-in-void-dom-elements":"error","react/dom/no-dangerously-set-innerhtml":"error","react/dom/no-dangerously-set-innerhtml-with-children":"error","react/dom/no-find-dom-node":"error","react/dom/no-flush-sync":"error","react/dom/no-hydrate":"error","react/dom/no-missing-button-type":"error","react/dom/no-missing-iframe-sandbox":"error","react/dom/no-namespace":"error","react/dom/no-render":"error","react/dom/no-render-return-value":"error","react/dom/no-script-url":"error","react/dom/no-unknown-property":"error","react/dom/no-unsafe-iframe-sandbox":"error","react/dom/no-unsafe-target-blank":"error","react/dom/no-use-form-state":"error","react/dom/no-void-elements-with-children":"error","react/ensure-forward-ref-using-ref":"error","react/hooks-extra/ensure-custom-hooks-using-other-hooks":"error","react/hooks-extra/ensure-use-callback-has-non-empty-deps":"error","react/hooks-extra/ensure-use-memo-has-non-empty-deps":"error","react/hooks-extra/no-direct-set-state-in-use-effect":"error","react/hooks-extra/no-direct-set-state-in-use-layout-effect":"error","react/hooks-extra/no-redundant-custom-hook":"error","react/hooks-extra/no-unnecessary-use-callback":"error","react/hooks-extra/no-unnecessary-use-memo":"error","react/hooks-extra/no-unnecessary-use-prefix":"error","react/hooks-extra/no-useless-custom-hooks":"error","react/hooks-extra/prefer-use-state-lazy-initialization":"error","react/jsx-key-before-spread":"error","react/jsx-no-duplicate-props":"error","react/jsx-no-undef":"error","react/jsx-uses-react":"error","react/jsx-uses-vars":"error","react/naming-convention/component-name":"error","react/naming-convention/context-name":"error","react/naming-convention/filename":["error",{rule:"kebab-case"}],"react/naming-convention/filename-extension":"error","react/naming-convention/use-state":"error","react/no-access-state-in-setstate":"error","react/no-array-index-key":"error","react/no-children-count":"error","react/no-children-for-each":"error","react/no-children-map":"error","react/no-children-only":"error","react/no-children-prop":"error","react/no-children-to-array":"error","react/no-class-component":"error","react/no-clone-element":"error","react/no-comment-textnodes":"error","react/no-complex-conditional-rendering":"error","react/no-complicated-conditional-rendering":"error","react/no-component-will-mount":"error","react/no-component-will-receive-props":"error","react/no-component-will-update":"error","react/no-context-provider":"error","react/no-create-ref":"error","react/no-default-props":"error","react/no-direct-mutation-state":"error","react/no-duplicate-jsx-props":"error","react/no-duplicate-key":"error","react/no-forward-ref":"error","react/no-implicit-key":"error","react/no-leaked-conditional-rendering":"error","react/no-missing-component-display-name":"error","react/no-missing-context-display-name":"error","react/no-missing-key":"error","react/no-misused-capture-owner-stack":"error","react/no-nested-component-definitions":"error","react/no-nested-components":"error","react/no-nested-lazy-component-declarations":"error","react/no-prop-types":"error","react/no-redundant-should-component-update":"error","react/no-set-state-in-component-did-mount":"error","react/no-set-state-in-component-did-update":"error","react/no-set-state-in-component-will-update":"error","react/no-string-refs":"error","react/no-unsafe-component-will-mount":"error","react/no-unsafe-component-will-receive-props":"error","react/no-unsafe-component-will-update":"error","react/no-unstable-context-value":"error","react/no-unstable-default-props":"error","react/no-unused-class-component-members":"error","react/no-unused-state":"error","react/no-use-context":"error","react/no-useless-forward-ref":"error","react/no-useless-fragment":"error","react/prefer-destructuring-assignment":"error","react/prefer-react-namespace-import":"error","react/prefer-read-only-props":"error","react/prefer-shorthand-boolean":"error","react/prefer-shorthand-fragment":"error","react/use-jsx-vars":"error","react/web-api/no-leaked-event-listener":"error","react/web-api/no-leaked-interval":"error","react/web-api/no-leaked-resize-observer":"error","react/web-api/no-leaked-timeout":"error","react-hooks/exhaustive-deps":"error","react-hooks/rules-of-hooks":"error","react-you-might-not-need-an-effect/you-might-not-need-an-effect":"error"}});export{pt as default};
2
2
  /*! Bundled license information:
3
3
 
4
4
  eslint-utils/index.mjs: