@ethang/eslint-config 22.1.0 → 22.1.4

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,7 +5,7 @@
5
5
  > [!CAUTION]
6
6
  > Prettier is already included for styling!
7
7
 
8
- * 775 errored rules.
8
+ * 776 errored rules.
9
9
  * 240 rules from [eslint-plugin-sonarjs](https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md)
10
10
  * 142 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)
@@ -14,10 +14,10 @@
14
14
  * 34 rules from [jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)
15
15
  * 32 rules from [eslint-plugin-lodash](https://github.com/wix-incubator/eslint-plugin-lodash)
16
16
  * 20 rules from [eslint-plugin-perfectionist](https://github.com/azat-io/eslint-plugin-perfectionist)
17
+ * 7 rules from [@eslint/css](https://github.com/eslint/css)
17
18
  * 7 rules from [@eslint/markdown](https://github.com/eslint/markdown)
18
19
  * 6 rules from [@tanstack/eslint-plugin-query](https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query)
19
20
  * 6 rules from [@eslint/json](https://github.com/eslint/json)
20
- * 6 rules from [@eslint/css](https://github.com/eslint/css)
21
21
  * 1 rule from [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat)
22
22
  * 1 rule from [@tanstack/eslint-plugin-router](https://tanstack.com/router/latest/docs/eslint/eslint-plugin-router)
23
23
  * 1 rule from [@cspell/eslint-plugin](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-eslint-plugin)
package/config.react.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as D,b as ie,c as N,d as L}from"./chunk-BCW6UQO7.js";var B=D((Be,se)=>{se.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((Ue,U)=>{"use strict";var b=B(),ae=Object.freeze(Object.keys(b));for(let e of ae)Object.freeze(b[e]);Object.freeze(b);var le=new Set(["parent","leadingComments","trailingComments"]);function ue(e){return!le.has(e)&&e[0]!=="_"}U.exports=Object.freeze({KEYS:b,getKeys(e){return Object.keys(e).filter(ue)},unionWith(e){let r=Object.assign({},b);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=ie($(),1);function ce(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 g(e,r){let t="",n=e;for(typeof r=="string"?t=r:(t=r.name,n=ce(n,r));n!=null;){let o=n.set.get(t);if(o!=null)return o;n=n.upper}return null}function fe(e){return!this(e)}function p(e){return fe.bind(e)}function m(e,r){return e.type==="Punctuator"&&e.value===r}function pe(e){return m(e,"=>")}function me(e){return m(e,",")}function ye(e){return m(e,";")}function de(e){return m(e,":")}function ge(e){return m(e,"(")}function he(e){return m(e,")")}function ve(e){return m(e,"[")}function be(e){return m(e,"]")}function xe(e){return m(e,"{")}function Ee(e){return m(e,"}")}function ke(e){return["Block","Line","Shebang"].includes(e.type)}var $e=p(pe),Ve=p(me),_e=p(ye),ze=p(de),qe=p(ge),Me=p(he),We=p(ve),Je=p(be),Xe=p(xe),Ye=p(Ee),Ge=p(ke);var V=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{},Se=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"])),C=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 we(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 Ie(e,r){let t=we(e,r);return t!=null&&t.get!=null}function x(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=c(o.argument,r);if(i==null)return null;t.push(...i.value)}else{let i=c(o,r);if(i==null)return null;t.push(i.value)}}return t}var z=Object.freeze({ArrayExpression(e,r){let t=x(e.elements,r);return t!=null?{value:t}:null},AssignmentExpression(e,r){return e.operator==="="?c(e.right,r):null},BinaryExpression(e,r){if(e.operator==="in"||e.operator==="instanceof")return null;let t=c(e.left,r),n=c(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=x(e.arguments,r);if(n!=null)if(t.type==="MemberExpression"){if(t.property.type==="PrivateIdentifier")return null;let o=c(t.object,r);if(o!=null){if(o.value==null&&(o.optional||e.optional))return{value:void 0,optional:!0};let i=P(t,r);if(i!=null){let s=o.value,u=i.value;if(C.has(s[u]))return{value:s[u](...n)};if(_.has(s[u]))return{value:n[0]}}}}else{let o=c(t,r);if(o!=null){if(o.value==null&&e.optional)return{value:void 0,optional:!0};let i=o.value;if(C.has(i))return{value:i(...n)};if(_.has(i))return{value:n[0]}}}return null},ConditionalExpression(e,r){let t=c(e.test,r);return t!=null?t.value?c(e.consequent,r):c(e.alternate,r):null},ExpressionStatement(e,r){return c(e.expression,r)},Identifier(e,r){if(r!=null){let t=g(r,e);if(t!=null&&t.defs.length===0&&Se.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 c(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=c(e.left,r);if(t!=null){if(e.operator==="||"&&t.value||e.operator==="&&"&&!t.value||e.operator==="??"&&t.value!=null)return t;let n=c(e.right,r);if(n!=null)return n}return null},MemberExpression(e,r){if(e.property.type==="PrivateIdentifier")return null;let t=c(e.object,r);if(t!=null){if(t.value==null&&(t.optional||e.optional))return{value:void 0,optional:!0};let n=P(e,r);if(n!=null&&!Ie(t.value,n.value))return{value:t.value[n.value]}}return null},ChainExpression(e,r){let t=c(e.expression,r);return t!=null?{value:t.value}:null},NewExpression(e,r){let t=c(e.callee,r),n=x(e.arguments,r);if(t!=null&&n!=null){let o=t.value;if(C.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=P(n,r),i=c(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=c(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 c(t,r)},TaggedTemplateExpression(e,r){let t=c(e.tag,r),n=x(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=x(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=c(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 c(e,r){return e!=null&&Object.hasOwnProperty.call(z,e.type)?z[e.type](e,r):null}function P(e,r){let t=e.type==="Property"?e.key:e.property;return e.computed?c(t,r):t.type==="Identifier"?{value:t.name}:t.type==="Literal"?t.bigint?{value:t.bigint}:{value:String(t.value)}:null}function Ce(e,r=null){try{return c(e,r)}catch{return null}}function T(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=Ce(e,r);return t&&String(t.value)}function q(e,r){switch(e.type){case"MemberExpression":return e.computed?T(e.property,r):e.property.type==="PrivateIdentifier"?null:e.property.name;case"Property":case"MethodDefinition":case"PropertyDefinition":return e.computed?T(e.key,r):e.key.type==="Literal"?String(e.key.value):e.key.type==="PrivateIdentifier"?null:e.key.name}return null}var Pe=Object.freeze(new Set(["==","!=","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","|","^","&","in"])),Te=Object.freeze(new Set(["-","+","!","~"]));function M(e){return e!==null&&typeof e=="object"&&typeof e.type=="string"}var Ke=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(M(s)&&this.$visit(s,r,t))return!0}else if(M(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&&Pe.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&&Te.has(e.operator)&&e.argument.type!=="Literal"?!0:this.$visitChildren(e,r,t)},UpdateExpression(){return!0},YieldExpression(){return!0}}));var Ae=/^(?:Import|Export(?:All|Default|Named))Declaration$/u,d=Function.call.bind(Object.hasOwnProperty),a=Symbol("read"),E=Symbol("call"),S=Symbol("construct"),X=Symbol("esm"),je={require:{[E]:!0}};function W(e){return e==null||e.defs.length!==0||e.references.some(r=>r.isWrite())}function Re(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 h=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(je)){let n=T(t.arguments[0]);if(n==null||!d(r,n))continue;let o=r[n],i=[n];o[a]&&(yield{node:t,path:i,type:a,info:o[a]}),yield*this._iteratePropertyReferences(t,i,o)}}*iterateEsmReferences(r){let t=this.globalScope.block;for(let n of t.body){if(!Ae.test(n.type)||n.source==null)continue;let o=n.source.value;if(!d(r,o))continue;let i=r[o],s=[o];if(i[a]&&(yield{node:n,path:s,type:a,info:i[a]}),n.type==="ExportAllDeclaration")for(let u of Object.keys(i)){let y=i[u];y[a]&&(yield{node:n,path:s.concat(u),type:a,info:y[a]})}else for(let u of n.specifiers){let y=d(i,X),l=this._iterateImportReferences(u,s,y?i:this.mode==="legacy"?{default:i,...i}:{default:i});if(y)yield*l;else for(let f of l)f.path=f.path.filter(Oe),(f.path.length>=2||f.type!==a)&&(yield f)}}}*_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[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 o=r;for(;Re(o);)o=o.parent;let i=o.parent;if(i.type==="MemberExpression"){if(i.object===o){let s=q(i);if(s==null||!d(n,s))return;t=t.concat(s);let u=n[s];u[a]&&(yield{node:i,path:t,type:a,info:u[a]}),yield*this._iteratePropertyReferences(i,t,u)}return}if(i.type==="CallExpression"){i.callee===o&&n[E]&&(yield{node:i,path:t,type:E,info:n[E]});return}if(i.type==="NewExpression"){i.callee===o&&n[S]&&(yield{node:i,path:t,type:S,info:n[S]});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=g(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=q(o);if(i==null||!d(n,i))continue;let s=t.concat(i),u=n[i];u[a]&&(yield{node:o,path:s,type:a,info:u[a]}),yield*this._iterateLhsReferences(o.value,s,u)}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(!d(n,i))return;t=t.concat(i);let s=n[i];s[a]&&(yield{node:r,path:t,type:a,info:s[a]}),yield*this._iterateVariableReferences(g(this.globalScope,r.local),t,s,!1);return}if(o==="ImportNamespaceSpecifier"){yield*this._iterateVariableReferences(g(this.globalScope,r.local),t,n,!1);return}if(o==="ExportSpecifier"){let i=r.local.name;if(!d(n,i))return;t=t.concat(i);let s=n[i];s[a]&&(yield{node:r,path:t,type:a,info:s[a]})}}};h.READ=a;h.CALL=E;h.CONSTRUCT=S;h.ESM=X;function Oe(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]||[]).map(o=>r[o]).filter(o=>o).flatMap(o=>Array.isArray(o)?o:[o]).filter(o=>typeof o?.type=="string").forEach(o=>Y(e,o,t,n)))},G=(e,r)=>{let t=[];return Y(e,r,n=>{n.type==="Identifier"&&t.push(n)}),t},A=(e,r,t,n,o=new Set)=>{if(!r||typeof r!="object"||o.has(r))return!1;o.add(r);let i=G(t,r);return i.some(s=>s.name===e.name)?!0:i.map(s=>g(n,s)).filter(s=>s).some(s=>s.defs.filter(u=>u.type==="Variable").some(u=>A(e,u.node.init,t,n,o)))},Fe=e=>{let r=e.type==="FunctionDeclaration",t=e.type==="VariableDeclarator"&&e.init.type==="ArrowFunctionExpression";return(r||t)&&e.id.type==="Identifier"&&e.id.name[0].toUpperCase()===e.id.name[0]},K=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"),k=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",j=e=>{if(!k(e)||e.arguments.length<1)return null;let r=e.arguments[0];return r.type!=="ArrowFunctionExpression"&&r.type!=="FunctionExpression"?null:r},H=(e,r)=>{if(!k(r)||r.arguments.length<1)return null;let t=j(r);if(!t)return null;let n=o=>o.references.concat(o.childScopes.flatMap(i=>n(i)));return n(e.sourceCode.getScope(t))};function Q(e,r){if(!k(r)||r.arguments.length<2)return null;let t=r.arguments[1];if(t.type!=="ArrayExpression")return null;let n=G(e,t),o=e.sourceCode.getScope(r);return n.map(i=>[i,g(o,i)]).filter(([i,s])=>s).flatMap(([i,s])=>s.references.filter(u=>u.identifier===i))}var R=e=>e.identifier.parent.type==="CallExpression"&&e.identifier.parent.callee===e.identifier,w=e=>e.resolved?.defs.some(r=>r.type==="Variable"&&K(r.node)),v=e=>e.resolved?.defs.some(r=>r.type==="Parameter"&&Fe(r.node.type==="ArrowFunctionExpression"?r.node.parent:r.node)),Z=(e,r)=>r.variables.some(t=>t.defs===e.resolved?.defs),O=e=>e.resolved.defs.find(r=>r.type==="Variable"&&K(r.node))?.node,ee=(e,r)=>{let t=e.identifier.parent,n=O(e).init.arguments?.[0];return r.sourceCode.getText(t.arguments[0])===r.sourceCode.getText(n)};var te="you-might-not-need-an-effect",re={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(!k(r))return;let t=j(r),n=H(e,r),o=Q(e,r);if(!t||!n||!o||n.length===0)return;let i=n.concat(o).every(l=>w(l)||v(l)||Z(l,e.sourceCode.getScope(t)));i&&e.report({node:r,messageId:"avoidInternalEffect"});let s=n.filter(l=>R(l)).filter(l=>w(l)),u=o.some(l=>v(l)),y=s.length>0&&s.every(l=>ee(l,e));u&&y&&e.report({node:r,messageId:"avoidResettingStateFromProps"}),n.every(l=>v(l))&&o.every(l=>v(l))&&e.report({node:r,messageId:"avoidManagingParentBehavior"}),n.filter(l=>R(l)).forEach(l=>{let f=l.identifier.parent,F=f.arguments.some(I=>o.some(oe=>A(oe.identifier,I,e,e.sourceCode.getScope(t))));if(i&&w(l)){let I=O(l);F?e.report({node:f.callee,messageId:"avoidDerivedState",data:{state:I.id.elements[0].name}}):o.length>0?e.report({node:f.callee,messageId:"avoidChainingState"}):e.report({node:f.callee,messageId:"avoidInitializingState"})}v(l)&&F&&e.report({node:f.callee,messageId:"avoidPassingStateToParent"})})}})};var ne={rules:{[te]:re}};import Ne from"eslint-plugin-react-hooks";import Le from"typescript-eslint";var ut=Le.config({files:["**/*.{jsx,tsx}"],ignores:N,languageOptions:L,settings:{react:{version:"19.1.0"}},plugins:{react:De,"react-hooks":Ne,"react-you-might-not-need-an-effect":ne},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{ut as default};
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};
2
2
  /*! Bundled license information:
3
3
 
4
4
  eslint-utils/index.mjs: