@eslint-sukka/eslint-plugin-sukka-full 8.15.0 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -44,7 +44,7 @@ ${r}}`))}(t,i,l))}}}({discriminant:n,ifStatements:s},e,t)),yield l}})},meta:{typ
|
|
|
44
44
|
export default ${n};`)}]},vS=({context:e,declaration:t,exportDeclaration:r,expectedStyle:n,kind:o,name:a,scope:i})=>{if(!(n===va||((e,t,r)=>{let[,n]=e.sourceCode.getRange(t),[o]=e.sourceCode.getRange(r);return rM(e).some(t=>{let[r,a]=e.sourceCode.getRange(t);return r>=n&&a<=o})})(e,t,r)||vf(i,r.declaration))&&(o!==vs||"FunctionDeclaration"!==t.type||!t.generator)&&!(o===vs&&"FunctionDeclaration"===t.type&&vy(t,e.sourceCode.visitorKeys))){if(n===vn)return"VariableDeclaration"===t.type?{node:r,messageId:E7,data:{kind:o},suggest:(({context:e,declaration:t,exportDeclaration:r,name:n,scope:o})=>{let[{id:a,init:i}]=t.declarations;if(!(e.sourceCode.getCommentsInside(r).length>0||vm(e,r)||e.sourceCode.getCommentsInside(t).length>e.sourceCode.getCommentsInside(i).length||vx(o,a,r.declaration))&&"ArrowFunctionExpression"===i.type&&!vy(i,e.sourceCode.visitorKeys)&&0===e.sourceCode.getCommentsInside(i).length&&vh(i,e)&&!r2(i.body,e.sourceCode.visitorKeys))return[{messageId:vt,data:{kind:vs},fix:o=>o.replaceTextRange([e.sourceCode.getRange(t)[0],e.sourceCode.getRange(r)[1]],`export default ${i.async?"async ":""}function ${n}(${vE(i,e.sourceCode)}) ${"BlockStatement"===i.body.type?e.sourceCode.getText(i.body):`{ return ${to(i.body,e)}; }`}`)}]})({context:e,declaration:t,exportDeclaration:r,name:a,scope:i})}:o===vi&&vy(t,e.sourceCode.visitorKeys)?void 0:e.sourceCode.getCommentsInside(r).length>0||vm(e,r)?{node:r,messageId:E7,data:{kind:o}}:{node:r,messageId:E7,data:{kind:o},fix:function*(n){yield n.insertTextBefore(t,"export default "),yield n.removeRange([e.sourceCode.getRange(t)[1],e.sourceCode.getRange(r)[1]])}};if(n===vo&&o===vs&&"FunctionDeclaration"===t.type)return{node:r,messageId:ve,data:{kind:o,style:"const arrow function"},suggest:vv({context:e,declaration:t,exportDeclaration:r,name:a,scope:i})}}},vC=({context:e,exportDeclaration:t,expectedStyle:r,kind:n})=>{let{declaration:o}=t,a=vp(o),i=e.sourceCode.getScope(t);if(!(!a||r===va||r===vn||vf(i,a)||n===vs&&(o.generator||vy(o,e.sourceCode.visitorKeys)))){if(n===vs)return{node:t,messageId:ve,data:{kind:n,style:"const arrow function"},suggest:vv({context:e,declaration:o,exportDeclaration:t,name:a,scope:i,rangeStartNode:t})};if(!(n===vi&&vy(o,e.sourceCode.visitorKeys)))return e.sourceCode.getCommentsInside(t).length>e.sourceCode.getCommentsInside(o).length?{node:t,messageId:ve,data:{kind:n,style:"class declaration"}}:{node:t,messageId:ve,data:{kind:n,style:"class declaration"},fix:r=>{let{declaration:n}=t;return r.replaceText(t,`${e.sourceCode.getText(n)}
|
|
45
45
|
export default ${n.id.name};`)}}}},vD={create:e=>{let t=e.options[0];e.on("Program",r=>{for(let[n,o]of r.body.entries()){if("ExportDefaultDeclaration"===o.type){let{declaration:r}=o,n=vc(r),a=vp(r);if(!n||!a)continue;let i=vC({context:e,exportDeclaration:o,expectedStyle:t[vd(n)],kind:n});if(i)return i;continue}let a=r.body[n+1],i=vb(o,e);if(!i||!vu(a,i.name))continue;let s=vS({context:e,exportDeclaration:a,expectedStyle:t[vd(i.kind)],scope:e.sourceCode.getScope(a),...i});if(s)return s}})},meta:{type:"suggestion",docs:{description:"Enforce consistent default export declarations.",recommended:!0},fixable:"code",hasSuggestions:!0,schema:[{type:"object",properties:{functions:vl(),classes:vl()},additionalProperties:!1}],defaultOptions:[{functions:vn,classes:vn}],messages:{[E7]:"Prefer declaring this default-exported {{kind}} inline.",[ve]:"Prefer declaring this default-exported {{kind}} as a separate {{style}}.",[vt]:"Use an inline default {{kind}} declaration.",[vr]:"Use a separate const arrow function default export."},languages:["js/js"]}};function vT(e){for(;;){let t=rN(e);if(t!==e){e=t;continue}if(e?.type!=="ParenthesizedExpression")return e;e=e.expression}}function vA(e,t){return eS(t.sourceCode.getScope(e),e)}let vw="no-array-concat-in-loop",vk="no-array-front-mutation",vI=["stream.unshift","this.unshift","this.stream.unshift","process.stdin.unshift","process.stdout.unshift","process.stderr.unshift"],vj="no-array-sort-for-min-max/error",vF="no-array-sort-for-min-max/suggestion",vB=e=>tp(e)&&0===e.value,vR=(e,t)=>{if(!tR(e,{methods:["sort","toSorted"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||r3(e.callee.object))return;let[r]=e.arguments,n=(e=>{if(!tw(e)||e.async||e.generator||2!==e.params.length||e.params.some(e=>"Identifier"!==e.type))return;let t=rN((e=>{if("BlockStatement"!==e.body.type)return e.body;if(1!==e.body.body.length)return;let[t]=e.body.body;if("ReturnStatement"===t.type)return t.argument})(e));if(t?.type!=="BinaryExpression"||"-"!==t.operator)return;let[r,n]=e.params;if(r.name!==n.name){if(rk(t.left,r)&&rk(t.right,n))return"ascending";if(rk(t.left,n)&&rk(t.right,r))return"descending"}})(r);if(n&&!(nB(e.callee.object,t)||nR(e.callee.object,t)))return{direction:n,node:e.callee.object}},vP=(e,t,r,n)=>{var o,a,i;let s=(o=t.direction,"first"===r?"ascending"===o?"min":"max":"ascending"===o?"max":"min"),l={node:e,messageId:vj,data:{method:s,extreme:"min"===s?"minimum":"maximum"}};if("Super"!==t.node.type&&0===n.sourceCode.getCommentsInside(e).length){let r,o=(a=t.node,i=n.sourceCode,r=aj(a)?i.getText(a):`(${i.getText(a)})`,`Math.${s}(...${r})`);l.suggest=[{messageId:vF,data:{replacement:o},fix:t=>t.replaceText(e,o)}]}return l},vL="no-boolean-sort-comparator",vN="no-boolean-sort-comparator/suggestion",v$=new i(["sort","toSorted"]),vM=new i([">",">=","<","<="]),vO=(e,t,r,n)=>(e=rN(e),t=rN(t),"Identifier"===e.type&&"Identifier"===t.type)?e.name===r.name&&t.name===n.name||e.name===n.name&&t.name===r.name:"MemberExpression"===e.type&&"MemberExpression"===t.type&&e.computed===t.computed&&(e.computed?!!rk(e.property,t.property):e.property.name===t.property.name)&&vO(e.object,t.object,r,n),vq=(e,t)=>{for(;rL(e);){if(e.typeAnnotation&&on(e.typeAnnotation,t,t.sourceCode.getScope(e)))return!0;e=e.expression}return!1},vU="no-chained-comparison/error",vW="no-chained-comparison/suggestion",vV=new i(["<",">","<=",">="]),v_=new i(["===","!==","==","!="]),vz=vV.union(v_),vK=e=>"BinaryExpression"===e.type&&vz.has(e.operator),vG="no-constant-zero-expression/error",vJ="no-constant-zero-expression/suggestion",vX="no-duplicate-logical-operands",vY="no-duplicate-logical-operands/suggestion",vH=new i(["Identifier","ThisExpression","Literal"]),vQ=new i(["Identifier","ThisExpression"]),vZ=e=>{if(pB(e=rN(e)))return!1;switch(e.type){case"Identifier":case"Super":case"ThisExpression":return!0;case"MemberExpression":var t;return vZ(e.object)&&(!e.computed||(t=rN(t=e.property),vH.has(t.type)));default:return!1}},v0="no-impossible-length-comparison",v1={"<":">","<=":">=",">":"<",">=":"<=","===":"===","!==":"!==","==":"==","!=":"!="},v2="no-invalid-character-comparison",v3=new i(["==","===","!=","!=="]),v8=(e,t)=>!!(tR(e,{method:"charAt",maximumArguments:1,optionalCall:!1,optionalMember:!1})&&og(e.callee.object,t)||tR(e,{method:"at",maximumArguments:1,optionalCall:!1,optionalMember:!1})&&og(e.callee.object,t))||"MemberExpression"===e.type&&e.computed&&!e.optional&&(e=>{if(tp(e))return!0;if(!ts(e))return!1;let t=Number(e.value);return Number.isSafeInteger(t)&&t>=0&&String(t)===e.value})(e.property)&&og(e.object,t),v6="no-loop-iterable-mutation",v9=["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"],v5=["add","clear","delete"],v4=["clear","delete","set"],v7={array:new i(v9),set:new i(v5),map:new i(v4),unknown:new i([...v9,...v5,...v4])},Se=new i(["entries","keys","values"]),St=new i(["ArrowFunctionExpression","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression"]);function Sr(e,t){return nj(e,t)?"array":nq(e,t)?"set":nU(e,t)?"map":void 0}function Sn(e){return"VariableDeclaration"===e.left.type?e.left.declarations[0].id:e.left}function So(e){return"Identifier"===(e=rN(e)).type?e:void 0}function Sa(e){if("ArrayPattern"!==(e=rN(e)).type)return;let[t]=e.elements;return t&&So(t)}function Si(e,t){if(pB(e=rN(e)))return;if(pj(e))return{collectionKind:Sr(e,t),reference:e,method:"direct"};if("CallExpression"!==e.type||"MemberExpression"!==e.callee.type||e.arguments.length>0)return;let r=ez(e.callee,t.sourceCode.getScope(e.callee));if(!(!Se.has(r)||pB(e.callee.object))&&pj(e.callee.object))return{collectionKind:Sr(e.callee.object,t),reference:e.callee.object,method:r}}function Ss(e,t){let r=Sn(e);return"keys"===t.method?So(r):"entries"===t.method||"direct"===t.method&&"set"!==t.collectionKind?Sa(r):void 0}function Sl(e,t){let r,n;if("VariableDeclaration"!==e.left.type||"const"!==e.left.kind)return{collectionKind:t.collectionKind,iterable:t.reference,loopBody:e.body};let o=(r=Sn(e),"entries"===t.method?Sa(r):"direct"!==t.method||"map"!==t.collectionKind?So(r):void 0),a=Ss(e,t),i=(n=Sn(e),"set"===t.collectionKind&&("direct"===t.method||"values"===t.method)?So(n):"direct"===t.method&&"map"!==t.collectionKind?So(n)??Sa(n):Ss(e,t));return{addArgumentIdentifier:o,collectionKind:t.collectionKind,deleteArgumentIdentifier:i,iterable:t.reference,loopBody:e.body,setKeyIdentifier:a}}function*Su(e){"Identifier"===(e=rN(e)).type?yield e:"MemberExpression"===e.type&&(yield*Su(e.object),e.computed&&(yield*Su(e.property)))}function Sp(e,t,r){if(!pI(e,t))return!1;let n=[...Su(e)],o=[...Su(t)];return n.length!==o.length||0===n.length?n.length===o.length:n.every((e,t)=>{var n;let a,i;return n=o[t],a=eS(r.sourceCode.getScope(e),e),i=eS(r.sourceCode.getScope(n),n),a||i?a===i:e.name===n.name})}function Sc(e,t,r){let[n]=e.arguments;return!!(t&&n&&Sp(n,t,r))}function Sd(e,t,r,n){return"add"===r&&Sc(e,t.addArgumentIdentifier,n)||"set"===r&&Sc(e,t.setKeyIdentifier,n)}let Sm="no-selector-as-dom-name",Sf=["add","remove","contains","toggle","replace"],Sg=/^[#.]-?[A-Z_a-z][\w-]*$/u,Sy=new i([".","#"]),Sh=e=>Sy.has(e?.[0]),Sx=e=>tu(e)??("TemplateLiteral"===e.type&&e.quasis[0].value.cooked),Sb=(e,t,r,n)=>({node:e,messageId:Sm,fix:((e,t,r,n)=>{let o=((e,t)=>{let[r]=t.getRange(e);return[r+1,r+2]})(e,n);if(t.startsWith(r)&&n.text[o[0]]===r){if("TemplateLiteral"===e.type&&e.expressions.length>0){if(1!==e.expressions.length||e.quasis[0].value.cooked!==r||""!==e.quasis[1].value.cooked)return;return e=>e.removeRange(o)}if(Sg.test(t))return e=>e.removeRange(o)}})(e,t,r,n)}),SE=(e,t)=>e.map(e=>({node:e,expectedPrefix:t})),Sv="no-useless-compound-assignment/error",SS="no-useless-compound-assignment/remove",SC="no-useless-compound-assignment/replace",SD=new o([["+=",0],["-=",0],["*=",1],["/=",1],["**=",1]]),ST="no-useless-delete-check",SA="removeCheck",Sw={considerGetters:!0},Sk=new i(["Map","Set","WeakMap","WeakSet"]),SI=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]),Sj=new i(["ClassName","FunctionName"]),SF=new i(["TSConstructorType","TSFunctionType","TSObjectKeyword"]),SB=e=>null!==e&&("object"==typeof e||"function"==typeof e),SR=e=>!!SF.has(e?.type)||e?.type==="TSUnionType"&&e.types.every(e=>SR(e)),SP=(e,t)=>{if("Identifier"!==e.type)return!1;let r=eS(t.sourceCode.getScope(e),e);return r?.defs.some(e=>Sj.has(e.type))??!1},SL=(e,t)=>{let r=eV(e,t.sourceCode.getScope(e));return r&&"symbol"!=typeof r.value&&!SB(r.value)?String(r.value):void 0},SN=(e,t)=>{let r=eV(e,t.sourceCode.getScope(e));if(r)return SB(r.value);let n=rJ(rN(e),t);if(n){let e=rN(n),r=eV(e,t.sourceCode.getScope(e));if(r)return SB(r.value);if(SI.has(e.type))return!0}return!SP(rN(e),t)&&SR(((e,t)=>{if("Identifier"!==(e=rN(e)).type)return;let r=eS(t.sourceCode.getScope(e),e);return r?.defs[0]?.name?.typeAnnotation?.typeAnnotation??e.typeAnnotation?.typeAnnotation})(e,t))},S$=(e,t)=>!eH(e,t.sourceCode,Sw),SM=(e,t)=>tR(e,{method:t,argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1,allowSpreadElement:!1}),SO=(e,t,r)=>n=>{if(rV(r,r.sourceCode.getRange(e)))return;let o=r.sourceCode.getText(t.parent);return o.trimEnd().endsWith(";")||(o+=";"),aL(r.sourceCode.getTokenBefore(e),r,o)&&(o=`;${o}`),n.replaceText(e,o)},Sq="no-useless-logical-operand",SU=new o([["&&",!0],["||",!1]]),SW=new o([["&&",!1],["||",!0]]),SV=new i(["FunctionExpression","ClassExpression","ObjectExpression"]),S_="prefer-boolean-return",Sz=new i(["==","!=","===","!==","<","<=",">",">=","in","instanceof"]);function SK(e){if(e){if("BlockStatement"===e.type){let t=e.body.filter(({type:e})=>"EmptyStatement"!==e);if(1===t.length)return SK(t[0])}return e}}let SG=e=>{if(e?.type==="ReturnStatement"&&e.argument?.type==="Literal"&&"boolean"==typeof e.argument.value)return e.argument.value};function SJ(e,t){switch(e.type){case"Literal":return"boolean"==typeof e.value;case"UnaryExpression":return["!","delete"].includes(e.operator);case"BinaryExpression":return Sz.has(e.operator);case"LogicalExpression":return SJ(e.left,t)&&SJ(e.right,t);case"CallExpression":return tK(e,t)||"CallExpression"===e.type&&!e.optional&&"MemberExpression"===e.callee.type&&!e.callee.optional&&!e.callee.computed&&"Identifier"===e.callee.object.type&&"Array"===e.callee.object.name&&t.sourceCode.isGlobalReference(e.callee.object)&&"Identifier"===e.callee.property.type&&"isArray"===e.callee.property.name;default:return!1}}let SX="prefer-flat-math-min-max",SY=["min","max"],SH=(e,t)=>tR(e,{object:"Math",method:t,optionalCall:!1,optionalMember:!1}),SQ=(e,t)=>{let r=[];for(let n of e.arguments){if(SH(n,t)){r.push(...SQ(n,t));continue}r.push(n)}return r},SZ="prefer-hoisting-branch-code/start",S0="prefer-hoisting-branch-code/end",S1="prefer-hoisting-branch-code/suggestion",S2=new i(["await using","using"]),S3=(e,t)=>eH(e,t)||function e(t,r){if("TaggedTemplateExpression"===t.type)return!0;for(let n of r.visitorKeys[t.type]??[]){let o=t[n];if(Array.isArray(o)){for(let t of o)if(t&&e(t,r))return!0;continue}if(o&&e(o,r))return!0}return!1}(e,t),S8=(e,t)=>{let r=t.getTokens(e),n=r.at(-1);return n?.type==="Punctuator"&&";"===n.value?r.slice(0,-1):r},S6=(e,t,r)=>{let n=S8(e,r),o=S8(t,r);return 0!==n.length&&n.length===o.length&&n.every((e,t)=>e.type===o[t].type&&e.value===o[t].value)};function S9(e,{leading:t,trailing:r,isStart:n},o){let{sourceCode:a}=o,{body:i}=e;if(n){let[e]=a.getRange(i[0]),[r]=a.getRange(i[t]);return[e,r]}let[,s]=a.getRange(i[i.length-r-1]),[,l]=a.getRange(i.at(-1));return[s,l]}function S5({ifStatement:e,blocks:t,leading:r,trailing:n,isStart:o},a){var i;let{sourceCode:s}=a,l=t[0].body,u=o?l.slice(0,r):l.slice(l.length-n),p=u.every(e=>!rK(e))&&function(e){let{parent:t}=e;return["Program","BlockStatement","StaticBlock","SwitchCase"].includes(t.type)}(e)&&!((i={leading:r,trailing:n,isStart:o}).isStart&&((e,t)=>{let{sourceCode:r}=t,[n]=r.getRange(e),o=r.getTokenBefore(e);return rV(t,[o?r.getRange(o)[1]:0,n])})(e,a)||!i.isStart&&((e,t)=>{let{sourceCode:r}=t,n=r.getCommentsAfter(e)[0];return!!(n&&r.getLoc(n).start.line===r.getLoc(e).end.line)})(e,a)||t.some(e=>{let{sourceCode:t}=a,[r]=t.getRange(e),[n]=t.getRange(e.body[0]);if(i.isStart&&rV(a,[r+1,n]))return!0;if(!i.isStart){let[,r]=t.getRange(e.body.at(-1)),[,n]=t.getRange(e);if(rV(a,[r,n-1]))return!0}return rV(a,S9(e,i,a))}))&&(o||t.every(e=>!function(e,t,r){let{sourceCode:n}=r,{body:o}=e,[a]=n.getRange(o[o.length-t]),[i,s]=n.getRange(e);for(let t of n.getScope(e).variables){let[e]=t.defs;if(!e||e.parent?.type==="VariableDeclaration"&&"var"===e.parent.kind)continue;let[r]=n.getRange(e.name);if(!(r<=i)&&!(r>=a)){if(e.parent?.type==="VariableDeclaration"&&S2.has(e.parent.kind))return!0;for(let e of t.references){let[t]=n.getRange(e.identifier);if(t>=a&&t<=s)return!0}}}return!1}(e,n,a))),c={loc:{start:s.getLoc(u[0]).start,end:s.getLoc(u.at(-1)).end},messageId:o?SZ:S0};if(p){let i=function({ifStatement:e,blocks:t,leading:r,trailing:n,isStart:o},a){let{sourceCode:i}=a,s=rR(e,a),l=o?r:n,u=t[0].body,p=o?u.slice(0,l):u.slice(u.length-l),c=function(e,t,r){let{sourceCode:n}=r,[o]=n.getRange(e[0]),[,a]=n.getRange(e.at(-1)),i=n.text.slice(o,a),s=rR(e[0],r);return s===t?i:i.split("\n").map((e,r)=>0===r?e:e.startsWith(s)?`${t}${e.slice(s.length)}`:e).join("\n")}(p,s,a);return function*(l){if(o){let t=i.getTokenBefore(e),r=t&&aL(t,a,c)?";":"";yield l.insertTextBefore(e,`${r}${c}
|
|
46
46
|
${s}`)}else{let t=i.getLastToken(p.at(-1)),r=i.getTokenAfter(e),n=r&&aL(t,a,r.value)?";":"";yield l.insertTextAfter(e,`
|
|
47
|
-
${s}${c}${n}`)}for(let e of t)yield l.removeRange(S9(e,{leading:r,trailing:n,isStart:o},a))}}({ifStatement:e,blocks:t,leading:r,trailing:n,isStart:o},a);!o||function(e,t){for(let r=e;r?.type==="IfStatement";r=r.alternate)if(S3(r.test,t))return!1;return!0}(e,s)&&u.every(e=>"ExpressionStatement"===e.type&&!S3(e,s))?c.fix=i:c.suggest=[{messageId:S1,fix:i}]}return c}let{parse:S4}=lT,S7="prefer-single-replace",Ce=new i(["g","m","s"]),Ct=new o([["\\",String.raw`\\`],["]",String.raw`\]`],["\n",String.raw`\n`],["\r",String.raw`\r`],[" ",String.raw`\t`],["\f",String.raw`\f`],["\v",String.raw`\v`],["\u2028",String.raw`\u2028`],["\u2029",String.raw`\u2029`]]);function Cr(e){if(!tR(e,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1,optionalMember:!1,computed:!1}))return;let[t]=e.arguments;if(ts(t)){if("replaceAll"!==e.callee.property.name)return;return 1===t.value.length?t.value:void 0}if(tc(t))return function({pattern:e,flags:t}){let r;if(t.includes("g")){for(let e of t)if(!Ce.has(e))return;try{r=S4(e,t,{namedGroups:!0,lookbehind:!0})}catch{return}return function e(t){return"value"===t.type?String.fromCodePoint(t.codePoint):("alternative"!==t.type||1!==t.body.length)&&("characterClass"!==t.type||t.negative||1!==t.body.length)?void 0:e(t.body[0])}(r)}}(t.regex)}let Cn="consistent-tuple-labels",Co="no-invalid-well-known-symbol-methods/async-dispose",Ca="no-invalid-well-known-symbol-methods/dispose-generator",Ci="no-invalid-well-known-symbol-methods/sync-iterator",Cs="no-invalid-well-known-symbol-methods/async-iterator",Cl="no-invalid-well-known-symbol-methods/suggestion",Cu=new i(["Promise","PromiseLike"]),Cp=new i(["dispose","iterator","asyncIterator"]);function Cc(e){return"TSTypeReference"===e.type&&"Identifier"===e.typeName.type&&Cu.has(e.typeName.name)}function Cd(e,t){let r,n=function(e){if(e.computed&&"MemberExpression"===e.key.type&&!e.key.computed&&"Identifier"===e.key.object.type&&"Symbol"===e.key.object.name&&"Identifier"===e.key.property.type)return e.key.property.name}(e);if(!Cp.has(n))return;let o=function(e){if("get"!==e.kind&&"set"!==e.kind&&("MethodDefinition"===e.type||"PropertyDefinition"===e.type||"Property"===e.type))return e.value}(e);if(o?.type!=="FunctionExpression"&&o?.type!=="ArrowFunctionExpression")return;if("dispose"===n&&o.generator)return{node:e.key,messageId:Ca};let a=!o.async&&(!!(r=o.returnType?.typeAnnotation)&&("TSTypeReference"===r.type?Cc(r):"TSUnionType"===r.type&&r.types.some(e=>Cc(e)))||function(e,t){let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let t=r.program.getTypeChecker(),n=r.esTreeNodeToTSNodeMap.get(e),o=t.getSignatureFromDeclaration(n);if(o)return!0===oC(t.getReturnTypeOfSignature(o),t);return r.getTypeAtLocation(e).getCallSignatures().some(e=>!0===oC(t.getReturnTypeOfSignature(e),t))}catch{return!1}}(o,t));if("dispose"===n&&(o.async||a))return{node:e.key,messageId:Co,fix:t=>t.replaceText(e.key.property,"asyncDispose")};if("iterator"===n&&(o.async||a)){let t={node:e.key,messageId:Ci};return o.generator&&(t.suggest=[{messageId:Cl,data:{replacement:"asyncIterator"},fix:t=>t.replaceText(e.key.property,"asyncIterator")}]),t}if("asyncIterator"===n&&!o.generator&&(o.async||a))return{node:e.key,messageId:Cs}}let Cm="after-suspension",Cf="in-generator",Cg="in-nested-function",Cy=["preventDefault","stopImmediatePropagation","stopPropagation"],Ch="prefer-abort-signal-timeout",Cx="prefer-abort-signal-timeout/suggestion",Cb=new i(["reason","throwIfAborted"]),CE=(e,t)=>{let r,{parent:n}=e;if(!(!tF(n,{property:"signal",computed:!1,optional:!1})||n.object!==e||nG(n)||("ForInStatement"===n.parent.type||"ForOfStatement"===n.parent.type)&&n.parent.left===n||tF(n.parent)&&n.parent.object===n&&(r=n.parent,Cb.has(ez(r,t.sourceCode.getScope(r))))||(e=>{let{expression:t,parent:r}=(e=>{let t=e,{parent:r}=e;for(;rL(r);)t=r,r=r.parent;return{expression:t,parent:r}})(e);return"VariableDeclarator"===r.type&&r.init===t||"AssignmentExpression"===r.type&&r.right===t})(n)||rV(t,t.sourceCode.getRange(n))))return n},Cv=(e,t,r,n)=>{let o=eS(n.sourceCode.getScope(r),e);return o&&o!==t},CS="prefer-aggregate-error",CC=/[Ee]rrors$|[Ee]rror(?:List|Array|Collection)$/u,CD=new i(uu);function CT(e){for(;e?.type==="ParenthesizedExpression";)e=e.expression;return rN(e)}function CA(e){if("Identifier"===e.type)return e.name;if("TSQualifiedName"===e.type){let t=CA(e.left);return t?`${t}.${e.right.name}`:void 0}}function Cw(e){return e=e?.type==="TSTypeAnnotation"?e.typeAnnotation:e,e?.type==="TSTypeOperator"&&"readonly"===e.operator&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType"?Cw(e.typeAnnotation):e}function Ck(e,t,r,n=new i){switch(e=Cw(e),e?.type){case"TSTypeReference":{let o=CA(e.typeName);if(!o)return!1;let a=aM(o,t);if(CD.has(o)&&!((a?.defs.length??0)>0))return!0;if(n.has(o))return!1;n.add(o);let[i]=a?.defs??[],s=i?r.sourceCode.getScope(i.name):t,l=i?.type==="Type"&&"TSTypeAliasDeclaration"===i.node.type&&Ck(i.node.typeAnnotation,s,r,n);return n.delete(o),l}case"TSUnionType":return e.types.every(e=>Ck(e,t,r,n));case"TSIntersectionType":return e.types.some(e=>Ck(e,t,r,n));default:return!1}}function CI(e,t){let r;if(tF(e=CT(e),{property:"length",optional:!1})&&"Identifier"===e.object.type&&(r=e.object.name,CC.test(r))&&nj(e.object,t)&&function(e,t){let r=aM(e.name,t.sourceCode.getScope(e)),[n]=r?.defs??[],o=n?t.sourceCode.getScope(n.name):t.sourceCode.getScope(e);return function e(t,r,n,o=new i){switch(t=Cw(t),t?.type){case"TSArrayType":return Ck(t.elementType,r,n,o);case"TSTupleType":return t.elementTypes.length>0&&t.elementTypes.every(e=>Ck("TSNamedTupleMember"===e.type?e.elementType:"TSRestType"===e.type?e.typeAnnotation:e,r,n,o));case"TSTypeReference":return function(t,r,n,o){let a=CA(t.typeName),i=t.typeArguments?.params??t.typeParameters?.params;if(("Array"===a||"ReadonlyArray"===a)&&i?.length===1)return Ck(i[0],r,n,o);if(!a||o.has(a))return!1;o.add(a);let s=aM(a,r),[l]=s?.defs??[],u=l?n.sourceCode.getScope(l.name):r,p=l?.type==="Type"&&"TSTypeAliasDeclaration"===l.node.type&&e(l.node.typeAnnotation,u,n,o);return o.delete(a),p}(t,r,n,o);case"TSUnionType":return t.types.every(t=>e(t,r,n,o));case"TSIntersectionType":return t.types.some(t=>e(t,r,n,o));default:return!1}}(n?.name?.typeAnnotation,o,t)||function(e,t){let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let{program:t}=r;return function e(t,r,n,o=new i){if(!t||o.has(t))return!1;if(o.add(t),t.isUnion())return t.types.every(t=>e(t,r,n,o));if(t.isIntersection())return t.types.some(t=>e(t,r,n,o));let a=r.getBaseConstraintOfType(t);if(a&&a!==t)return e(a,r,n,o);if(!(r.isArrayType(t)||r.isTupleType(t)))return!1;let s=r.getTypeArguments(t);return s.length>0&&s.every(e=>(function e(t,r,n,o=new i){if(!t||o.has(t))return!1;if(o.add(t),t.isUnion())return t.types.every(t=>e(t,r,n,o));if(t.isIntersection())return t.types.some(t=>e(t,r,n,o));let a=r.getBaseConstraintOfType(t);if(a&&a!==t)return e(a,r,n,o);let s=r7(t);return!!(CD.has(s?.getName())&&ne(s,n))||nt(t,r).some(t=>e(t,r,n,o))})(e,r,n))}(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{return!1}}(e,t)}(e.object,t))return e.object}let Cj=(e,t,r)=>{var n;if(("!=="===e||"!="===e)&&ti(CT(t),0))return!0;let o=(n=CT(n=t),n?.type==="Literal"&&"number"==typeof n.value?n.value:void 0);return void 0!==o&&(r?">"===e&&o>=0||">="===e&&o>=1:"<"===e&&o>=0||"<="===e&&o>=1)},CF=e=>"LogicalExpression"!==(e=CT(e)).type||"&&"!==e.operator?[e]:[...CF(e.left),...CF(e.right)],CB={resize:"Prefer ResizeObserver over a resize listener with layout reads.",scroll:"Prefer IntersectionObserver over a scroll listener with layout reads."},CR=new i(Object.keys(CB)),CP=new i(["globalThis","self","window"]),CL=new i(["getBoundingClientRect","getClientRects"]),CN=new i(["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetParent","offsetTop","offsetWidth","scrollHeight","scrollWidth"]),C$=new i(["innerHeight","innerWidth"]),CM=new i(["height","width"]),CO=new i(["Window"]),Cq=new i(["VisualViewport"]),CU=new i(["Document","Element","HTMLElement","Node","SVGElement","VisualViewport","Window"]),CW=(e,t,r)=>{let n;if(r5.has(e.intrinsicName))return!1;if(r4.has(e.intrinsicName)||e.intrinsicName)return!0;if(e.isUnion()||e.isIntersection())return e.types.every(e=>CW(e,t,r));let o=t.getBaseConstraintOfType(e);if(o&&o!==e)return CW(o,t,r);let a=r7(e);return!(!a||nt(e,t).some(e=>!CW(e,t,r)))&&(!ne(a,r)||(n=a.getName(),!(CU.has(n)||/^HTML\w*Element$/.test(n)||/^SVG\w*Element$/.test(n))))},CV=(e,t,r,n)=>{if(r5.has(e.intrinsicName)||r4.has(e.intrinsicName))return!1;if(e.isUnion()){let o=e.types.filter(e=>!r4.has(e.intrinsicName));return o.length>0&&o.every(e=>CV(e,t,r,n))}if(e.isIntersection())return e.types.some(e=>CV(e,t,r,n));let o=t.getBaseConstraintOfType(e);if(o&&o!==e)return CV(o,t,r,n);let a=r7(e);return!!(a&&ne(a,r)&&n.has(a.getName()))||nt(e,t).some(e=>CV(e,t,r,n))},C_=(e,t,r)=>{let{parserServices:n}=t.sourceCode;if(!n?.program)return!1;try{let{program:t}=n,o=t.getTypeChecker();return CV(n.getTypeAtLocation(e),o,t,r)}catch{return!1}},Cz=(e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let{program:t}=r,n=t.getTypeChecker();return CW(r.getTypeAtLocation(e),n,t)}catch{return!1}},CK=e=>e.computed||"Identifier"!==e.property.type?tu(rN(e.property)):e.property.name,CG=(e,t)=>e.properties.some(e=>t.has((e=>{if("Property"===e.type)return e.computed||"Identifier"!==e.key.type?tu(rN(e.key)):e.key.name})(e))),CJ=(e,t)=>"Identifier"===e.type&&CP.has(e.name)&&oA(e,t),CX=e=>nG(e)&&"UpdateExpression"!==e.parent.type&&("AssignmentExpression"!==e.parent.type||e.parent.left!==e||"="===e.parent.operator),CY=(e,t)=>"Identifier"===(e=rN(e)).type?"visualViewport"===e.name&&oA(e,t):"MemberExpression"===e.type&&"visualViewport"===CK(e)&&CJ(rN(e.object),t),CH=(e,t)=>{var r;return CJ(e=rN(e),t)||("Identifier"===(r=rN(r=e)).type?"document"===r.name&&oA(r,t):"MemberExpression"===r.type&&"document"===CK(r)&&CJ(rN(r.object),t))||CY(e,t)},CQ=(e,t,r)=>{let n=rN(t);return CG(e,C$)&&(CJ(n,r)||C_(t,r,CO))||CG(e,CM)&&(CY(n,r)||C_(t,r,Cq))||CG(e,CN)&&!CH(n,r)&&!Cz(t,r)},CZ=(e,t,r=e)=>{let n,o,a,i;if(!e||e!==r&&tw(e))return!1;if(a=e,i=t,tb(a,void 0,ty)&&"MemberExpression"===a.callee.type&&CL.has(CK(a.callee))&&!CH(a.callee.object,i)&&!Cz(a.callee.object,i)||tL(e)&&C$.has(e.name)&&!CX(e)&&oA(e,t)||"MemberExpression"===e.type&&!CX(e)&&(n=CK(e),o=rN(e.object),C$.has(n)&&(CJ(o,t)||C_(e.object,t,CO))||CM.has(n)&&(CY(o,t)||C_(e.object,t,Cq))||CN.has(CK(e))&&!CH(e.object,t)&&!Cz(e.object,t))||("VariableDeclarator"===e.type&&"ObjectPattern"===e.id.type&&e.init?CQ(e.id,e.init,t):"AssignmentExpression"===e.type&&"ObjectPattern"===e.left.type&&CQ(e.left,e.right,t)))return!0;for(let n of t.sourceCode.visitorKeys[e.type]??[]){let o=e[n];if(Array.isArray(o)){if(o.some(e=>CZ(e,t,r)))return!0;continue}if(CZ(o,t,r))return!0}return!1},C0="prefer-set-methods/union",C1="prefer-set-methods/intersection",C2="prefer-set-methods/intersection-suggestion",C3="prefer-set-methods/difference",C8="prefer-set-methods/difference-suggestion",C6=(e,t)=>tE(e,{name:"Set",argumentsLength:1})&&oA(e.callee,t),C9=(e,t)=>{let r=to(e,t);return it(e,t)&&!ta(e,t)?`(${r})`:r},C5=(e,t,r)=>((e,t)=>{let r=e;for(;r.parent;){if("ExpressionStatement"===r.parent.type)return t.sourceCode.getRange(t.sourceCode.getFirstToken(r.parent.expression))[0]===t.sourceCode.getRange(t.sourceCode.getFirstToken(e))[0];r=r.parent}return!1})(e,r)&&aL(r.sourceCode.getTokenBefore(e),r,t)?`;${t}`:t,C4=(e,t)=>("ParenthesizedExpression"===e.type||rL(e))&&e.expression===t,C7=e=>{for(;e.parent;){let{parent:t}=e;if(C4(t,e)){e=t;continue}break}return e},De=(e,t)=>e?.type==="SpreadElement"&&"Set"===aY(e.argument,t),Dt=(e,t,r)=>{if(!(!tR(e,{method:"has",argumentsLength:1,optionalCall:!1,optionalMember:!1})||!rk(e.arguments[0],t)||rk(e.callee.object,t))&&"Set"===aY(e.callee.object,r))return e.callee.object},Dr=(e,t,r)=>{var n;if(r.sourceCode.getCommentsInside(t).length>0||(n=C7(n=e),n.parent?.type==="MemberExpression"&&n.parent.object===n)||e===t&&rL(e.parent))return;let o=((e,t)=>{if(!tR(e,{method:"filter",argumentsLength:1,optionalCall:!1,optionalMember:!1})||t.sourceCode.getCommentsInside(e).length>0)return;let r=((e,t)=>{if("ArrayExpression"===e.type&&1===e.elements.length&&De(e.elements[0],t))return e.elements[0].argument})(e.callee.object,t);if(!r)return;let[n]=e.arguments;if("ArrowFunctionExpression"!==n.type||n.async||1!==n.params.length||"Identifier"!==n.params[0].type)return;let o=((e,t,r)=>{let n=Dt(e,t,r);if(n)return{method:"intersection",messageId:C1,suggestionMessageId:C2,otherSet:n};if("UnaryExpression"!==e.type||"!"!==e.operator||!e.prefix)return;let o=Dt(e.argument,t,r);if(o)return{method:"difference",messageId:C3,suggestionMessageId:C8,otherSet:o}})(n.body,n.params[0],t);if(!(!o||eH(o.otherSet,t.sourceCode,{considerGetters:!0})))return{messageId:o.messageId,suggestionMessageId:o.suggestionMessageId,replacement:`${C9(r,t)}.${o.method}(${to(o.otherSet,t)})`}})(e,r);if(o)return{node:t,messageId:o.messageId,suggest:[{messageId:o.suggestionMessageId,fix:e=>e.replaceText(t,C5(t,o.replacement,r))}]}},Dn="prefer-toggle-attribute/error",Do="prefer-toggle-attribute/suggestion",Da=(e,t,r)=>{let n=to(e,t);return r?"UnaryExpression"===e.type&&"!"===e.operator&&e.prefix&&t.sourceCode.getCommentsInside(e).length===t.sourceCode.getCommentsInside(e.argument).length?Da(e.argument,t,!1):(!ta(e,t.sourceCode)&&ia(e,"!")&&(n=`(${n})`),`!${n}`):ta(e,t.sourceCode)||"SequenceExpression"!==e.type?n:`(${n})`},Di=(e,t,r)=>tR(e,{methods:t,argumentsLength:r,optionalCall:!1,computed:!1});function Ds(e){if(e?.type==="ChainExpression"&&(e=e.expression),Di(e,["removeAttribute","hasAttribute"],1)||Di(e,["setAttribute"],2)){let{callee:t}=e,[r,n]=e.arguments;if(tu(r)?.toLowerCase().startsWith("data-"))return;let o=t.property.name;return{node:e,method:o,receiver:t.object,attributeName:r,attributeValue:n,isOptional:!!t.optional,hasEmptyAttributeValue:"setAttribute"!==o||ti(n,"")}}}function Dl(e){if(e){if("BlockStatement"===e.type){if(1!==e.body.length)return;e=e.body[0]}return"ExpressionStatement"===e.type&&(e=e.expression),Ds(e)}}let Du=(e,t)=>e.isOptional===t.isOptional&&rk(e.receiver,t.receiver)&&rk(e.attributeName,t.attributeName),Dp=(e,t)=>oh(e.receiver)||nz(e.receiver,t),Dc="prefer-url-search-parameters/error",Dd="prefer-url-search-parameters/suggestion",Dm=new i(["node:url","url"]),Df=e=>"Type"===e.type||"ImportBinding"===e.type&&aN(e.node),Dg=(e,t,r)=>{let n=eS(r.sourceCode.getScope(t),e);return!n||n.defs.every(e=>Df(e))},Dy=(e,t)=>tu(rN(e))===t,Dh=(e,t)=>{let r=t.sourceCode.getText(e);return"SequenceExpression"===e.type?`(${r})`:r},Dx=(e,t)=>{if(!tR(e=rN(e),{method:"map",argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1})||e.typeArguments||e.typeParameters)return;let r=((e,t)=>{var r;let n;if(tR(e=rN(e),{method:"split",argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1})&&!(!Dy(e.arguments[0],"&")||of(e.callee.object,t)||(n=eV(r=e.callee.object,t.sourceCode.getScope(r)))&&"string"!=typeof n.value))return e})(e.callee.object,t);if(!r)return;let[n]=e.arguments,o="ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type||n.async||n.generator||1!==n.params.length||"Identifier"!==n.params[0].type?void 0:"BlockStatement"!==n.body.type?{parameter:n.params[0],returnExpression:n.body}:1===n.body.body.length&&"ReturnStatement"===n.body.body[0].type&&n.body.body[0].argument?{parameter:n.params[0],returnExpression:n.body.body[0].argument}:void 0;if(o&&((e,t,r)=>{let n;return!!tR(e=rN(e),{method:"split",minimumArguments:1,maximumArguments:2,computed:!1,optionalCall:!1,optionalMember:!1})&&!!oT(rN(e.callee.object),t)&&!!Dy(e.arguments[0],"=")&&(1===e.arguments.length||2===(n=e.arguments[1],eV(n,r.sourceCode.getScope(n))?.value))})(o.returnExpression,o.parameter,t))return{node:e,query:r.callee.object}},Db=(e,t)=>`new URLSearchParams(${Dh(e,t)})`,DE=(e,t,r,n)=>{let{sourceCode:o}=n,[a,i]=o.getRange(e),[s,l]=tn(t,n);return o.text.slice(a,s)+r+o.text.slice(l,i)},Dv=(e,t,r)=>{let[n,o]=r.sourceCode.getRange(e),[a,i]=tn(t,r);return[[n,a],[i,o]]},DS=({node:e,query:t,replacement:r,preservedNodes:n=[t]},o)=>{let a=(({node:e,replacement:t,preservedNodes:r},n)=>{let o;if(!(!(!(o=eS(n.sourceCode.getScope(e),"URLSearchParams"))||o.defs.every(e=>Df(e))||o.defs.some(e=>(e=>{if("ImportBinding"!==e.type)return!1;let{node:t,parent:r}=e;return Dm.has(r.source.value)&&"type"!==r.importKind&&"ImportSpecifier"===t.type&&"type"!==t.importKind&&"Identifier"===t.imported.type&&"URLSearchParams"===t.imported.name})(e)))||rU(n,e,r)))return[{messageId:Dd,data:{replacement:t},fix:r=>r.replaceText(e,t)}]})({node:e,replacement:r,preservedNodes:n},o);if(a)return{node:e,messageId:Dc,suggest:a}},DC="no-unsafe-promise-all-settled-values",DD=new i(["PromiseSettledResult","PromiseRejectedResult"]),DT=new i(["PromiseFulfilledResult"]),DA=new i(["ChainExpression","ParenthesizedExpression","TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),Dw=e=>e?.type==="ArrowFunctionExpression"||e?.type==="FunctionExpression"||e?.type==="FunctionDeclaration",Dk=e=>{for(;e&&DA.has(e.type);)e=e.expression;return e},DI=e=>tR(Dk(e),{object:"Promise",method:"allSettled",argumentsLength:1,optionalCall:!1,optionalMember:!1}),Dj=e=>e?.parent.type==="ReturnStatement"&&e.parent.argument===e,DF=e=>tR(Dk(e),{method:"filter",minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1});function DB(e){return"Identifier"===e.type?e.name:"TSQualifiedName"===e.type?DB(e.right):void 0}function DR(e){for(e=e?.type==="TSTypeAnnotation"?e.typeAnnotation:e;e?.type==="TSParenthesizedType"||e?.type==="TSTypeOperator";)e=e.typeAnnotation;return e?.type==="TSArrayType"?e.elementType:e?.type==="TSTypeReference"&&"Identifier"===e.typeName.type&&("Array"===e.typeName.name||"ReadonlyArray"===e.typeName.name)?e.typeArguments?.params[0]??e.typeParameters?.params[0]:void 0}function DP(e){return function e(t){if(t?.type==="TSTypeReference"){let e=DB(t.typeName);return DD.has(e)}return t?.type==="TSUnionType"&&t.types.some(t=>e(t))}(DR(e))}function DL(e){return function e(t){if(t?.type==="TSTypeReference"){let e=DB(t.typeName);return DT.has(e)}return t?.type==="TSUnionType"&&t.types.every(t=>e(t))}(DR(e))}function DN(e){if(e.isUnion())return e.types.every(e=>DN(e));let t=e.aliasSymbol??e.getSymbol();return DT.has(t?.getName())}function D$(e,t){if((e=t.getNonNullableType(e)).isUnion()){let r=e.types.map(e=>D$(e,t));return r.every(Boolean)?t.getUnionType(r):void 0}if(t.isArrayType(e)||t.isTupleType(e))return t.getTypeArguments(e)[0]}function DM(e,t){let{parserServices:r}=t.sourceCode;if(r?.program)try{return{checker:r.program.getTypeChecker(),type:r.getTypeAtLocation(e)}}catch{}}let DO=e=>e?.type==="TSAsExpression"||e?.type==="TSTypeAssertion";function Dq(e,t,r=new i){var n;let o;return!!(DO(o=e)&&DP(o.typeAnnotation))||!!(e=Dk(e))&&(n=Dk(n=e),!!(n?.type==="AwaitExpression"&&DI(n.argument)||DP(e.typeAnnotation)||function(e,t){let r=DM(e,t);if(!r)return!1;let{type:n,checker:o}=r,a=D$(n,o);return!!(a&&function e(t){if(t.isUnion())return t.types.some(t=>e(t));let r=t.aliasSymbol??t.getSymbol();return DD.has(r?.getName())}(a))}(e,t))||(DF(e)?Dq(e.callee.object,t,r):"Identifier"===e.type&&function(e,t,r){let n=eS(t.sourceCode.getScope(e),e);if(!n||r.has(n)||1!==n.defs.length)return!1;r.add(n);let[o]=n.defs,a=!!(DP(o.name?.typeAnnotation)||"Variable"===o.type&&"const"===o.parent.kind&&o.node.id===o.name&&o.node.init&&Dq(o.node.init,t,r));return r.delete(n),a}(e,t,r)))}let DU=e=>(e=Dk(e),e?.type==="Identifier"?e.name:void 0),DW=e=>{if(e=Dk(e),e?.type==="ObjectPattern"){for(let t of e.properties)if("Property"===t.type&&!t.computed&&"status"===ez(t)&&"Identifier"===t.value.type)return t.value}},DV=e=>{if(e?.type==="Literal"&&("fulfilled"===e.value||"rejected"===e.value))return e.value};function D_(e,t){return e=Dk(e),!!(t.statusVariable&&D0(e,t.statusVariable,t.context)||!t.statusVariable&&t.statusName&&e?.type==="Identifier"&&e.name===t.statusName||t.entryVariable&&e?.type==="MemberExpression"&&D0(e.object,t.entryVariable,t.context)&&"status"===ez(e))||!!(!t.entryVariable&&t.entryName&&e?.type==="MemberExpression"&&DU(e.object)===t.entryName&&"status"===ez(e))}function Dz(e,t){if(e=Dk(e),e?.type!=="BinaryExpression"||!["===","==","!==","!="].includes(e.operator))return;let r=D_(e.left,t)?DV(e.right):D_(e.right,t)?DV(e.left):void 0;if(!r)return;let n="==="===e.operator||"=="===e.operator;return n&&"fulfilled"===r||!n&&"rejected"===r?"fulfilled":"unfulfilled"}function DK(e,t){return"fulfilled"===Dz(e=Dk(e),t)||e?.type==="LogicalExpression"&&"&&"===e.operator&&(DK(e.left,t)||DK(e.right,t))}function DG(e,t){return"unfulfilled"===Dz(e=Dk(e),t)||e?.type==="LogicalExpression"&&"||"===e.operator&&(DG(e.left,t)||DG(e.right,t))}let DJ=(e,t,r)=>"ConditionalExpression"===e.type&&(e.consequent===t&&DK(e.test,r)||e.alternate===t&&DG(e.test,r)),DX=(e,t,r)=>"LogicalExpression"===e.type&&("&&"===e.operator&&e.right===t&&DK(e.left,r)||"||"===e.operator&&e.right===t&&DG(e.left,r)),DY=(e,t,r)=>"IfStatement"===e.type&&(e.consequent===t&&DK(e.test,r)||e.alternate===t&&DG(e.test,r)),DH=e=>{let t;if(!Dw(e)||0===e.params.length)return!1;let r={entryName:DU(e.params[0]),statusName:(t=e.params[0],DW(t)?.name)},n=Dk(e.body);if(n?.type==="BlockStatement"){let[e]=n.body;return 1===n.body.length&&"ReturnStatement"===e.type&&e.argument&&DK(e.argument,r)}return DK(n,r)};function DQ(e){if(e=Dk(e),e?.type==="ObjectPattern"){for(let t of e.properties)if("Property"===t.type&&!t.computed&&"value"===ez(t))return t}}let DZ=(e,t)=>"MemberExpression"===e.type&&"property"===t&&!e.computed||["Property","PropertyDefinition","MethodDefinition"].includes(e.type)&&"key"===t&&!e.computed;function D0(e,t,r){return e=Dk(e),e?.type==="Identifier"&&t&&eS(r.sourceCode.getScope(e),e)===t}function D1(e){for(e=Dk(e);DF(e);){if(DH(e.arguments[0]))return!0;e=Dk(e.callee.object)}return!1}function D2(e,t,{knownPromiseSettledResultArray:r=!1,branchAlwaysExits:n}={}){let o,a;if(!tR(e,{method:"map",minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1})||!r&&!Dq(e.callee.object,t)||function e(t,r,n=new i){return!!(DO(t)&&DL(t.typeAnnotation)||function(e,t){let r=DM(e,t);if(!r)return!1;let{type:n,checker:o}=r,a=D$(n,o);return!!(a&&DN(a))}(t=Dk(t),r))||("Identifier"===t.type?function(t,r,n){let o=eS(r.sourceCode.getScope(t),t);if(!o||n.has(o)||1!==o.defs.length)return!1;n.add(o);let[a]=o.defs,i=!!(DL(a.name?.typeAnnotation)||"Variable"===a.type&&"const"===a.parent.kind&&a.node.id===a.name&&a.node.init&&e(a.node.init,r,n));return n.delete(o),i}(t,r,n):DF(t)&&D1(t)&&Dq(t,r))}(e.callee.object,t))return;let[s]=e.arguments;if(!Dw(s)||0===s.params.length)return;let[l]=s.params;if(function(e,t){let r=DM(e,t);if(!r)return!1;let{type:n}=r;return DN(n)}(l,t))return;let u=DQ(l);if(u&&"Identifier"!==u.value.type)return{node:u.key,messageId:DC};let p=DU(l),c=p&&eS(t.sourceCode.getScope(l),l),d=(o=DQ(l),a=o?.value,a?.type==="Identifier"?a:a?.type==="AssignmentPattern"&&"Identifier"===a.left.type?a.left:void 0),m=d&&eS(t.sourceCode.getScope(d),d),f=DW(l),g=f?.name,y=f&&eS(t.sourceCode.getScope(f),f),h=function e(t,r){var n;if(n=t=Dk(t),n=Dk(n),(n?.type==="MemberExpression"&&D0(n.object,r.entryVariable,r.context)&&"value"===ez(n)||n?.type==="Identifier"&&D0(n,r.valueVariable,r.context))&&!function(e,t){for(let r=e,n=e.parent;n&&"ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type;r=n,n=n.parent){if(DJ(n,r,t)||DX(n,r,t)||DY(n,r,t)||function(e,t,r,n){let o,a=e.parent?.body;if(!Array.isArray(a))return!1;let i=a.indexOf(e),s=a[i-1];return s?.type==="IfStatement"&&!s.alternate&&DG(s.test,t)&&(o=s.consequent,aA(o,r,e=>{var t;return t=Dk(t=e),t?.type==="ReturnStatement"||t?.type==="ThrowStatement"||n(e)})||af(o,r))}(n,t,t.context,t.branchAlwaysExits))return!0;if(Dj(n))break}return!1}(t,r))return t;for(let[n,o]of Object.entries(t)){if("parent"===n||DZ(t,n)||!o||"object"!=typeof o)continue;let a=function(t,r){for(let n of t){if(!n?.type||Dw(n)||"ClassExpression"===n.type||"ClassDeclaration"===n.type)continue;let t=e(n,r);if(t)return t}}(Array.isArray(o)?o:[o],r);if(a)return a}}(s.body,{entryName:p,entryVariable:c,statusName:g,statusVariable:y,valueVariable:m,context:t,branchAlwaysExits:n});if(h)return{node:h,messageId:DC}}let D3="prefer-abort-signal-any",D8="prefer-abort-signal-any/suggestion",D6=new i(["reason","throwIfAborted"]),D9=new i(["capture","once","passive"]),D5=new i(["TSAsExpression","TSTypeAssertion","TSSatisfiesExpression"]),D4=e=>{let t=Array.isArray(e.parent.body)?e.parent.body:Array.isArray(e.parent.consequent)?e.parent.consequent:void 0;if(t)return t[t.indexOf(e)+1]},D7=(e,t,r)=>{let{sourceCode:n}=e,[,o]=n.getRange(t),[a]=n.getRange(r);return n.getAllComments().some(e=>{let[t,r]=n.getRange(e);return t>=o&&r<=a})},Te=e=>{let t=e,{parent:r}=e;for(;rL(r);)t=r,r=r.parent;return{expression:t,parent:r}},Tt=(e,t)=>{let{parent:r}=e;if(!(!tF(r,{property:"signal",computed:!1,optional:!1})||r.object!==e||nG(r)||("ForInStatement"===r.parent.type||"ForOfStatement"===r.parent.type)&&r.parent.left===r||((e,t)=>{let{expression:r,parent:n}=Te(e);return tF(n)&&n.object===r&&D6.has(ez(n,t.sourceCode.getScope(n)))})(r,t)||(e=>{let{expression:t,parent:r}=Te(e);return"VariableDeclarator"===r.type&&r.init===t||"AssignmentExpression"===r.type&&r.right===t})(r)||rV(t,t.sourceCode.getRange(r))))return r},Tr=(e,t,r)=>{if(r5.has(e.intrinsicName))return;if(r4.has(e.intrinsicName))return!1;if(e.isUnion()){let n=e.types.filter(e=>!r4.has(e.intrinsicName));if(0===n.length)return!1;let o=n.map(e=>Tr(e,t,r));return!!o.every(Boolean)||!o.every(e=>!1===e)&&void 0}if(e.isIntersection()){let n=e.types.map(e=>Tr(e,t,r));return!!n.some(Boolean)||!n.every(e=>!1===e)&&void 0}let n=t.getBaseConstraintOfType(e);if(n&&n!==e)return Tr(n,t,r);let o=r7(e);if(o&&ne(o,r))return"AbortSignal"===o.getName();let a=nt(e,t).map(e=>Tr(e,t,r));return!!a.some(Boolean)||!(a.length>0&&a.every(e=>!1===e))&&void 0},Tn=(e,t)=>tb(e,{optional:!1},ty)&&tF(e.callee,{object:"AbortSignal",properties:t,computed:!1,optional:!1}),To=e=>Tn(e,["any","timeout"]),Ta=e=>Tn(e,["any"]),Ti=(e,t)=>{if("Identifier"!==(e=rN(e)).type)return;let r=eS(t.sourceCode.getScope(e),e),n=r?.defs[0];if(r&&1===r.defs.length&&"Variable"===n.type&&"const"===n.parent.kind)return n.node.init},Ts=(e,t)=>{if("Identifier"!==(e=rN(e)).type)return!1;let r=eS(t.sourceCode.getScope(e),e),n=r?.defs[0];if(!r||1!==r.defs.length||"Variable"!==n.type||"const"!==n.parent.kind||!n.node.init)return!1;let[,o]=t.sourceCode.getRange(n.node.init),[a]=t.sourceCode.getRange(e);return r.references.some(r=>{if(r.init||r.identifier===e)return!1;let[n]=t.sourceCode.getRange(r.identifier);return n>o&&n<a})},Tl=(e,t,r)=>tb(e,{optional:!1},ty)&&tF(e.callee,{object:"Array",property:t,computed:!1,optional:!1})&&oA(e.callee.object,r),Tu=(e,t)=>(tb(e,{name:"Array",optional:!1},ty)||tE(e,{name:"Array"}))&&oA(e.callee,t),Tp=(e,t,r=new i)=>{if(e=rN(e),r.has(e))return!1;if(r.add(e),"SpreadElement"===e.type)return!0;if("ArrayExpression"===e.type)return e.elements.some(e=>e&&Tp(e,t,r));if(Tl(e,"of",t)||Tu(e,t))return e.arguments.some(e=>Tp(e,t,r));if(Tl(e,"from",t)){if(1!==e.arguments.length)return!0;let[n]=e.arguments;if("SpreadElement"===n.type)return!0;let o=Ti(n,t);if(o)return!!(!nj(o,t)||Ts(n,t))||Tp(o,t,r);let a=rN(n);return"ArrayExpression"!==a.type||Tp(a,t,r)}if(Ta(e))return e.arguments[0]&&Tp(e.arguments[0],t,r);let n=Ti(e,t);return n?!!(nj(n,t)&&Ts(e,t))||Tp(n,t,r):Tn(rN(e),["abort"])},Tc=(e,t,r,n=new i)=>{var o;if(e=rN(e),n.has(e))return!1;if(n.add(e),"SpreadElement"===e.type)return!0;if("ArrayExpression"===e.type)return e.elements.some(e=>e&&Tc(e,t,r,n));if(Tl(e,"of",r)||Tu(e,r))return e.arguments.some(e=>Tc(e,t,r,n));if(Tl(e,"from",r)){if(1!==e.arguments.length)return!0;let[o]=e.arguments;if("SpreadElement"===o.type)return!0;let a=Ti(o,r);if(a)return!!(!nj(a,r)||Ts(o,r))||Tc(a,t,r,n);let i=rN(o);return"ArrayExpression"!==i.type||Tc(i,t,r,n)}if(Ta(e))return e.arguments[0]&&Tc(e.arguments[0],t,r,n);let a=Ti(e,r);return a?!!(nj(a,r)&&Ts(e,r))||Tc(a,t,r,n):tF(o=rN(o=e),{property:"signal",computed:!1,optional:!1})&&"Identifier"===o.object.type&&o.object.name===t},Td=(e,t)=>{let r=((e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{let{program:t}=r;return Tr(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{}})(e=rN(e),t);if(!0===r)return!0;if(!1===r||t.sourceCode.parserServices?.program)return!1;if("Identifier"===e.type){let t;return"signal"===(t=e.name)||t.endsWith("Signal")}return To(e)},Tm=(e,t)=>"Identifier"===(e=rN(e)).type?Td(e,t):To(e)&&e.arguments.every(e=>"SpreadElement"!==e.type&&!eH(e,t.sourceCode)),Tf=(e,t)=>{if(!Tl(e,"from",t)||1!==e.arguments.length)return;let[r]=e.arguments;if("SpreadElement"===r.type)return;let n=rN(r);if("ArrayExpression"===n.type)return n;let o=Ti(r,t);if(o&&nj(o,t)&&!Ts(r,t))return o},Tg=(e,t,r=new i)=>{if(e=rN(e),r.has(e))return;if(r.add(e),"ArrayExpression"===e.type)return e.elements.every(e=>e&&"SpreadElement"!==e.type)?e.elements:void 0;if(Tl(e,"of",t)||Tu(e,t))return e.arguments.every(e=>"SpreadElement"!==e.type)?e.arguments:void 0;let n=Tf(e,t);if(n)return Tg(n,t,r);let o=Ti(e,t);if(o&&nj(o,t)&&!Ts(e,t))return Tg(o,t,r)},Ty=(e,t,r=new i)=>{if(e=rN(e),r.has(e))return!1;if(r.add(e),"Identifier"===e.type||"ArrayExpression"===e.type||Tl(e,"of",t)||Tu(e,t))return!0;let n=Tf(e,t);return!!n&&Ty(n,t,r)},Th=e=>"Identifier"===e.type?e.name:"TSQualifiedName"===e.type?Th(e.right):void 0,Tx=(e,t,r=new i)=>{if(e?.type==="TSTypeAnnotation"&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType")return Tx(e.typeAnnotation,t,r);if(e?.type!=="TSTypeReference")return!1;var n=e;let o=Th(n.typeName);if("AbortSignal"===o)return!0;if(!o||"Identifier"!==n.typeName.type||r.has(n.typeName.name))return!1;r.add(n.typeName.name);let a=eS(t.sourceCode.getScope(n),n.typeName),s=a?.defs[0],l=s?.type==="Type"&&"TSTypeAliasDeclaration"===s.node.type&&Tx(s.node.typeAnnotation,t,r);return r.delete(n.typeName.name),l},Tb=(e,t,r=new i)=>(e?.type==="TSTypeAnnotation"&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType")?Tb(e.typeAnnotation,t,r):e?.type==="TSTypeOperator"?"readonly"===e.operator?Tb(e.typeAnnotation,t,r):void 0:e?.type==="TSArrayType"?Tx(e.elementType,t,r):e?.type==="TSTupleType"?e.elementTypes.length>0&&e.elementTypes.every(e=>Tx("TSNamedTupleMember"===e.type?e.elementType:e,t,r)):e?.type==="TSTypeReference"?((e,t,r)=>{let n,o=Th(e.typeName),a=e.typeArguments?.params??e.typeParameters?.params;if(("Array"===o||"ReadonlyArray"===o)&&a?.length===1)return Tx(a[0],t,r);if(!o||"Identifier"!==e.typeName.type||r.has(e.typeName.name))return!1;r.add(e.typeName.name);let i=eS(t.sourceCode.getScope(e),e.typeName),s=i?.defs[0];return s?.type==="Type"&&"TSTypeAliasDeclaration"===s.node.type&&(n=Tb(s.node.typeAnnotation,t,r)),r.delete(e.typeName.name),n})(e,t,r):void 0,TE=(e,t,r=new i)=>{if(e?.type==="TSTypeAnnotation"&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType")return TE(e.typeAnnotation,t,r);if(e?.type==="TSTypeOperator")return"readonly"===e.operator&&("TSArrayType"===e.typeAnnotation.type||"TSTupleType"===e.typeAnnotation.type);if(e?.type!=="TSTypeReference")return!1;if("ReadonlyArray"===Th(e.typeName))return!0;if("Identifier"!==e.typeName.type||r.has(e.typeName.name))return!1;r.add(e.typeName.name);let n=eS(t.sourceCode.getScope(e),e.typeName),o=n?.defs[0];return o?.type==="Type"&&"TSTypeAliasDeclaration"===o.node.type&&TE(o.node.typeAnnotation,t,r)},Tv=(e,t,r,n=new i)=>{if(!e||r5.has(e.intrinsicName)||r4.has(e.intrinsicName)||n.has(e))return!1;if(n.add(e),e.isUnion()||e.isIntersection())return e.types.some(e=>Tv(e,t,r,n));let o=t.getBaseConstraintOfType(e);if(o&&o!==e)return Tv(o,t,r,n);let a=r7(e);if(a&&ne(a,r)&&"ReadonlyArray"===a.getName())return!0;let s=t.typeToString(e);return!!(s.startsWith("readonly ")||s.startsWith("ReadonlyArray<"))||nt(e,t).some(e=>Tv(e,t,r,n))},TS=(e,t)=>{if(D5.has(e.type)){let r;return r=e.typeAnnotation,r?.type==="TSTypeReference"&&"const"===Th(r.typeName)||TE(e.typeAnnotation,t)||TS(e.expression,t)}if("Identifier"!==(e=rN(e)).type)return!1;let r=eS(t.sourceCode.getScope(e),e),n=r?.defs[0];return!!(n?.name?.typeAnnotation&&TE(n.name.typeAnnotation,t)||n?.type==="Variable"&&n.node.init&&TS(n.node.init,t)||((e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let{program:t}=r;return Tv(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{return!1}})(e,t))},TC=(e,t,r=new i)=>{if(r.has(e))return!1;if(r.add(e),D5.has(e.type))return Tb(e.typeAnnotation,t)??TC(e.expression,t,r);if("Identifier"===(e=rN(e)).type){let n=eS(t.sourceCode.getScope(e),e),o=n?.defs[0];if(o?.name?.typeAnnotation){let e=Tb(o.name.typeAnnotation,t);if(void 0!==e)return e}if(o?.type==="Variable"&&o.node.init&&TC(o.node.init,t,r))return!0}return nj(e,t)},TD=(e,t,r,n)=>{var o,a;let i,s=!e||"ArrowFunctionExpression"!==e.type&&"FunctionExpression"!==e.type||e.async||e.generator||e.params.length>0?void 0:"BlockStatement"!==e.body.type?e.body:1===e.body.body.length&&"ExpressionStatement"===e.body.body[0].type?e.body.body[0].expression:void 0;if(tb(s,{optional:!1},ty)&&tF(s.callee,{property:"abort",computed:!1,optional:!1})&&"Identifier"===s.callee.object.type&&s.callee.object.name===t&&(0===s.arguments.length||1===s.arguments.length&&(i=s.arguments[0],tF(i,{property:"reason",computed:!1,optional:!1})&&(o=i.object,a=r,o=rN(o),a=rN(a),"Identifier"===o.type&&"Identifier"===a.type&&o.name===a.name&&eS(n.sourceCode.getScope(o),o)===eS(n.sourceCode.getScope(a),a)))))return s.callee.object},TT=e=>{var t;if(e?.type!=="ExpressionStatement")return;let{expression:r}=e;if(tb(r,{minimumArguments:2,maximumArguments:3,optional:!1},ty)&&tF(r.callee,{property:"addEventListener",computed:!1,optional:!1})&&"abort"===tu(rN(r.arguments[0]))&&(!(t=r.arguments[2])||"Literal"===(t=rN(t)).type&&"boolean"==typeof t.value||"ObjectExpression"===t.type&&t.properties.every(e=>{if("Property"!==e.type||e.computed||"init"!==e.kind||e.method||e.shorthand||"Literal"!==e.value.type||"boolean"!=typeof e.value.value)return!1;let t="Identifier"===e.key.type?e.key.name:e.key.value;return D9.has(t)})))return{call:r,sourceSignal:r.callee.object}},TA=(e,t)=>!rV(t,t.sourceCode.getRange(e))&&!rW(t,e),Tw=(e,t,r,n)=>{let o=eS(n.sourceCode.getScope(r),e);return o&&o!==t},Tk="prefer-block-statement-over-iife",TI=e=>"ThisExpression"===e.type||"MetaProperty"===e.type&&"new"===e.meta.name&&"target"===e.property.name||"Identifier"===e.type&&"arguments"===e.name,Tj=(e,t)=>e!==t&&tw(e),TF=(e,t)=>Tj(e,t)&&"ArrowFunctionExpression"!==e.type;function TB(e,t,r,n=Tj){return function o(a){if(r(a))return!0;if(n(a,e))return!1;for(let e of t[a.type]??[]){let t=a[e];for(let e of Array.isArray(t)?t:[t])if(e?.type&&o(e))return!0}return!1}(e)}let TR=(e,t)=>{let[r,n]=t.getRange(e),o=t.getLastToken(e);return[r,eA(o)?t.getRange(o)[1]:n]},TP="no-multiple-promise-resolver-calls",TL=e=>rL(e)||e?.type==="TSInstantiationExpression",TN=e=>"ReturnStatement"===e.type||"ThrowStatement"===e.type;function T$(e){for(;TL(e.parent)&&e.parent.expression===e;)e=e.parent;return e}function TM(e){for(;TL(e);)e=e.expression;return e}let TO=(e,t)=>{if(!(("FunctionExpression"===e.type||"ArrowFunctionExpression"===e.type)&&!e.generator))return!1;let r=T$(e);return tE(r.parent,{name:"Promise",argumentsLength:1})&&r.parent.arguments[0]===r&&oA(r.parent.callee,t)},Tq=e=>e.references.some(e=>e.isWrite()),TU=(e,t)=>{if("CallExpression"!==e.type)return;let r=TM(e.callee);return"Identifier"===r.type?t.get(r):void 0},TW=(e,t)=>"ExpressionStatement"===e.type&&"CallExpression"===e.expression.type&&0===e.expression.arguments.length&&!!TU(e.expression,t);function TV(e){let t=[];return e.traverseSegments(e=>{e.reachable&&t.push(e)}),t}let T_=({isTerminated:e=!1,resolverUncalled:t=!1,resolverCalled:r=!1,catchClausesAfterResolverCall:n=new i,pendingFinallyBlocksByCatchClause:a=new o}={})=>({isTerminated:e,resolverUncalled:t,resolverCalled:r,catchClausesAfterResolverCall:n,pendingFinallyBlocksByCatchClause:a}),Tz=e=>T_({isTerminated:e.isTerminated,resolverUncalled:e.resolverUncalled,resolverCalled:e.resolverCalled,catchClausesAfterResolverCall:new i(e.catchClausesAfterResolverCall),pendingFinallyBlocksByCatchClause:function(e){let t=new o;for(let[r,n]of e)t.set(r,new i(n));return t}(e.pendingFinallyBlocksByCatchClause)}),TK=(e,t,r)=>{if(e.isTerminated)return e;if(t.executor===r){let r=Tz(e);for(let[e,n]of r.pendingFinallyBlocksByCatchClause)t.finallyBlocks.some(e=>n.has(e))&&r.catchClausesAfterResolverCall.add(e);return r.resolverCalled=e.resolverUncalled||e.resolverCalled,r.resolverUncalled=!1,r}if(t.executor)return e;let n=Tz(e);if(t.catchClause){if(e.resolverUncalled){let e=n.pendingFinallyBlocksByCatchClause.get(t.catchClause);for(let r of(e||(e=new i,n.pendingFinallyBlocksByCatchClause.set(t.catchClause,e)),t.finallyBlocks))e.add(r)}e.resolverCalled&&n.catchClausesAfterResolverCall.add(t.catchClause)}return n};function TG(e,t){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}let TJ=(e,t)=>void 0!==t&&e.isTerminated===t.isTerminated&&e.resolverUncalled===t.resolverUncalled&&e.resolverCalled===t.resolverCalled&&TG(e.catchClausesAfterResolverCall,t.catchClausesAfterResolverCall)&&function(e,t){if(e.size!==t.size)return!1;for(let[r,n]of e){let e=t.get(r);if(!e||!TG(n,e))return!1}return!0}(e.pendingFinallyBlocksByCatchClause,t.pendingFinallyBlocksByCatchClause);function TX(e){let t=[],r=e,{parent:n}=e;for(;n&&!tw(n);){if("TryStatement"===n.type){if(n.block===r&&n.handler)return{catchClause:n.handler,finallyBlocks:t};n.finalizer&&(n.block===r||n.handler===r)&&t.push(n.finalizer)}r=n,{parent:n}=n}return{catchClause:void 0,finallyBlocks:t}}function TY(e,t,r){let n=T_({isTerminated:e!==r.codePath.initialSegment,resolverUncalled:e===r.codePath.initialSegment});for(let o of e.prevSegments){let a=function(e,t,r,n){if(!t.reachable||n.terminatedSegments.has(t)||e.isTerminated||n.ignoredLoopEdges.some(e=>e.previousSegment===t&&e.segment===r))return T_({isTerminated:!0});let o=n.catchClausesBySegment.get(r);return o?T_({resolverUncalled:e.pendingFinallyBlocksByCatchClause.has(o),resolverCalled:e.catchClausesAfterResolverCall.has(o)}):e}(t.get(o)??T_(),o,e,r);if(!a.isTerminated){for(let e of(n.isTerminated=!1,n.resolverUncalled||=a.resolverUncalled,n.resolverCalled||=a.resolverCalled,a.catchClausesAfterResolverCall))n.catchClausesAfterResolverCall.add(e);for(let[e,t]of a.pendingFinallyBlocksByCatchClause){let r=n.pendingFinallyBlocksByCatchClause.get(e);for(let o of(r||(r=new i,n.pendingFinallyBlocksByCatchClause.set(e,r)),t))r.add(o)}}}return n}let TH=e=>{let t=TM(e.test);return t?.type==="Literal"&&!t.value},TQ=e=>{let t=T$(e);return t.parent?.type==="AwaitExpression"&&t.parent.argument===t};function TZ(e,t){let r=e,{parent:n}=e;for(;n;){if("AssignmentPattern"===n.type&&n.right===r&&TO(n.parent,t)&&n.parent.params.slice(0,2).includes(n))return!0;r=n,{parent:n}=n}return!1}let T0=(e,t,r)=>"SequenceExpression"===e.type&&e.expressions.includes(t)||"LogicalExpression"===e.type&&e.left===t||"BinaryExpression"===e.type&&(e.left===t||e.right===t)||"UnaryExpression"===e.type&&e.argument===t||"AwaitExpression"===e.type&&e.argument===t||"ConditionalExpression"===e.type&&aA(e,r,TN)||TL(e)&&e.expression===t||"CallExpression"===e.type&&(e.callee===t||e.arguments.includes(t)&&!e.optional&&!oZ(e.callee))||"NewExpression"===e.type&&(e.callee===t||e.arguments.includes(t))||"MemberExpression"===e.type&&(e.object===t||e.computed&&e.property===t&&!e.optional&&!oZ(e.object)),T1=(e,t)=>af(e,t),T2=(e,t)=>"class-static-block"===e.origin||"class-field-initializer"===e.origin&&t.parent?.type==="PropertyDefinition"&&t.parent.value===t&&t.parent.static,T3="no-unnecessary-string-trim",T8=["startsWith","endsWith"],T6=new i(["bigint","boolean","number","string","undefined"]),T9=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]),T5=(e,t)=>eV(e=rN(e),t.sourceCode.getScope(e)),T4="no-useless-re-export",T7=e=>"Identifier"===e.type?e.name:e.value;function Ae(e,t){let r=e.attributes??[];return`${e.source.value}\u0000${r.map(e=>t.getText(e)).join("\0")}`}let At="preferGuard",Ar="preferFallback",An="guard",Ao="fallback",Aa=["keys","values","entries"],Ai=e=>{if("ForInStatement"===e.type)return;let t=rN(e.right);if(tR(t,{object:"Object",methods:Aa,argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1}))return t},As=e=>Ai(e)?.arguments[0]??e.right,Al=e=>"ForInStatement"===e.type||!!Ai(e),Au={configs:{node:{name:"@eslint-sukka/eslint-plugin-sukka-full node preset",plugins:{get sukka(){return Au}},rules:{"sukka/unicorn/prefer-node-protocol":"error","sukka/unicorn/prefer-import-meta-properties":"error","no-process-exit":"off","sukka/unicorn/no-process-exit":"warn","no-buffer-constructor":"off","sukka/unicorn/no-new-buffer":"error"}},comment:{name:"@eslint-sukka/eslint-plugin-sukka-full comments preset",plugins:{get sukka(){return Au}},rules:{"sukka/ban-eslint-disable":["error","allow-with-description"]}},recommended:{...c.eslint_plugin_sukka.configs.recommended,plugins:{get sukka(){return Au}},rules:Object.assign({"sukka/array/no-unneeded-flat-map":"error","sukka/browser/prefer-location-assign":"warn","sukka/jsx/no-template-literal":"error","sukka/jsx/no-unneeded-nested":"error","sukka/string/no-locale-case":"warn","sukka/string/no-simple-template-literal":"error","sukka/unicode/no-bidi":"warn","sukka/unicode/no-invisible":"warn","sukka/no-redundant-variable":"error","sukka/no-single-return":"warn","sukka/prefer-early-return":["error",{maximumStatements:16}],"sukka/prefer-fetch":"error","sukka/prefer-timer-id":"warn"},d.collectRules(c.eslint_plugin_sukka.configs.recommended),{"sukka/prefer-single-boolean-return":"off"})},recommended_unicorn:{name:"@eslint-sukka/eslint-plugin-sukka-full recommended unicorn preset",plugins:{get sukka(){return Au}},rules:{"sukka/unicorn/no-lonely-if":"error","sukka/unicorn/no-negated-condition":"warn","sukka/unicorn/catch-error-name":["error",{ignore:[/^(?:e|err|error|\w+Err|\w+Error)[\d_]?$/]}],"sukka/unicorn/custom-error-definition":"error","sukka/unicorn/require-array-join-separator":"warn","sukka/unicorn/no-thenable":"error","sukka/unicorn/no-invalid-remove-event-listener":"error","sukka/unicorn/consistent-function-scoping":"warn","sukka/unicorn/prefer-event-target":"warn","sukka/unicorn/prefer-keyboard-event-key":"warn","sukka/unicorn/prefer-text-content":"warn","sukka/unicorn/no-console-spaces":"warn","sukka/unicorn/no-empty-file":"warn","sukka/unicorn/no-useless-fallback-in-spread":"warn","sukka/unicorn/no-useless-length-check":"warn","sukka/unicorn/no-useless-promise-resolve-reject":"warn","sukka/unicorn/no-zero-fractions":"warn","sukka/unicorn/prefer-export-from":["warn",{checkUsedVariables:!1}],"sukka/unicorn/prefer-native-coercion-functions":"warn","sukka/unicorn/prefer-negative-index":"warn","sukka/unicorn/no-document-cookie":"error","sukka/unicorn/prefer-add-event-listener":"warn","sukka/unicorn/prefer-array-index-of":"warn","sukka/unicorn/prefer-blob-reading-methods":"warn","sukka/unicorn/prefer-date-now":"warn","sukka/unicorn/dom-node-dataset":"warn","sukka/unicorn/prefer-modern-math-apis":"warn","sukka/unicorn/number-literal-case":"error","sukka/unicorn/prefer-number-properties":["warn",{checkInfinity:!1}],"sukka/unicorn/prefer-reflect-apply":"warn","sukka/unicorn/prefer-set-size":"warn","sukka/unicorn/prefer-string-replace-all":"warn","sukka/unicorn/prefer-string-slice":"warn","sukka/unicorn/prefer-string-trim-start-end":"warn","sukka/unicorn/no-unreadable-iife":"warn","sukka/unicorn/throw-new-error":"warn","sukka/unicorn/escape-case":"warn","sukka/unicorn/prefer-unicode-code-point-escapes":"warn","sukka/unicorn/prefer-prototype-methods":"warn","sukka/unicorn/error-message":"error","sukka/unicorn/no-instanceof-builtins":["error",{strategy:"loose"}],"sukka/unicorn/prefer-type-error":"error","sukka/unicorn/consistent-destructuring":"warn","sukka/unicorn/new-for-builtins":"warn","sukka/unicorn/prefer-single-call":"warn","sukka/unicorn/no-static-only-class":"warn","sukka/unicorn/no-unreadable-array-destructuring":"error","sukka/unicorn/no-useless-spread":"error","sukka/unicorn/no-useless-switch-case":"warn","sukka/unicorn/no-useless-undefined":["error",{checkArguments:!1}],"sukka/unicorn/numeric-separators-style":["warn",{onlyIfContainsSeparator:!1,number:{minimumDigits:7,groupLength:3},binary:{minimumDigits:9,groupLength:4},octal:{minimumDigits:9,groupLength:4},hexadecimal:{minimumDigits:5,groupLength:2}}],"sukka/unicorn/prefer-array-find":"warn","sukka/unicorn/prefer-array-flat-map":"warn","sukka/unicorn/prefer-array-flat":"warn","sukka/unicorn/prefer-array-some":"warn","sukka/unicorn/prefer-default-parameters":"warn","sukka/unicorn/prefer-logical-operator-over-ternary":"warn","sukka/unicorn/prefer-optional-catch-binding":"error","sukka/unicorn/prefer-regexp-test":"warn","sukka/unicorn/prefer-set-has":"error","sukka/unicorn/prefer-switch":"warn","sukka/unicorn/require-number-to-fixed-digits-argument":"warn","sukka/unicorn/prefer-string-raw":"warn","sukka/unicorn/no-single-promise-in-promise-methods":"error","sukka/unicorn/no-await-in-promise-methods":"error","sukka/unicorn/no-magic-array-flat-depth":"error","sukka/unicorn/no-object-as-default-parameter":"error","sukka/unicorn/template-indent":["warn",{tags:["outdent","dedent","gql","sql","html","styled","css"],functions:["dedent","stripIndent","strip_indent","stripTags","striptags","strip_tags","stripHtml","stripHTML","strip_html"],selectors:[],comments:["HTML","html","CSS","css","indent"]}],"sukka/unicorn/no-negation-in-equality-check":"error","sukka/unicorn/no-unnecessary-slice-end":"error","sukka/unicorn/consistent-date-clone":"error","sukka/unicorn/no-accessor-recursion":"error","sukka/unicorn/no-unnecessary-array-flat-depth":"error","sukka/unicorn/no-unnecessary-array-splice-count":"error","sukka/unicorn/no-useless-error-capture-stack-trace":"error","sukka/unicorn/prefer-class-fields":"error","sukka/unicorn/prefer-bigint-literals":"error","sukka/unicorn/prefer-classlist-toggle":"warn","sukka/unicorn/require-module-attributes":"error","sukka/unicorn/no-immediate-mutation":"error","sukka/unicorn/no-useless-collection-argument":"error","sukka/unicorn/prefer-response-static-json":"error","sukka/unicorn/consistent-template-literal-escape":"error","sukka/unicorn/no-useless-iterator-to-array":"error","sukka/unicorn/prefer-simple-condition-first":"error","sukka/unicorn/switch-case-break-position":"error","sukka/unicorn/better-dom-traversing":"warn","sukka/unicorn/no-blob-to-file":"error","sukka/unicorn/no-canvas-to-image":"warn","sukka/unicorn/no-confusing-array-splice":"error","sukka/unicorn/no-duplicate-set-values":"error","sukka/unicorn/no-incorrect-query-selector":"error","sukka/unicorn/no-invalid-file-input-accept":"error","sukka/unicorn/no-late-current-target-access":"error","sukka/unicorn/no-unused-array-method-return":"error","sukka/unicorn/prefer-array-last-methods":"warn","sukka/unicorn/prefer-math-abs":"warn","sukka/unicorn/prefer-split-limit":"error","sukka/unicorn/prefer-queue-microtask":"warn","sukka/unicorn/prefer-string-pad-start-end":"warn","sukka/unicorn/require-css-escape":"warn","sukka/unicorn/require-passive-events":"warn","sukka/unicorn/class-reference-in-static-methods":["warn",{preferThis:!1,preferSuper:!1}],"sukka/unicorn/consistent-optional-chaining":"error","sukka/unicorn/explicit-timer-delay":"error","sukka/unicorn/no-confusing-array-with":"error","sukka/unicorn/no-duplicate-loops":"warn","sukka/unicorn/no-declarations-before-early-exit":"error","sukka/unicorn/no-optional-chaining-on-undeclared-variable":"error","sukka/unicorn/no-object-methods-with-collections":"error","sukka/unicorn/no-subtraction-comparison":"warn","sukka/unicorn/no-unnecessary-global-this":"warn","sukka/unicorn/no-useless-else":"error","sukka/unicorn/no-useless-recursion":"error","sukka/unicorn/prefer-add-event-listener-options":"warn","sukka/unicorn/prefer-direct-iteration":"warn","sukka/unicorn/prefer-number-is-safe-integer":"warn","sukka/unicorn/prefer-object-define-properties":"error","sukka/unicorn/prefer-object-destructuring-defaults":"warn","sukka/unicorn/prefer-single-object-destructuring":"warn","sukka/unicorn/prefer-smaller-scope":"warn","sukka/unicorn/prefer-single-array-predicate":"warn","sukka/unicorn/prefer-url-href":"error","sukka/unicorn/require-proxy-trap-boolean-return":"error","sukka/unicorn/logical-assignment-operators":"error","sukka/unicorn/no-useless-coercion":"error","sukka/unicorn/no-useless-boolean-cast":"warn","sukka/unicorn/no-useless-continue":"error","sukka/unicorn/no-useless-override":"error","sukka/unicorn/prefer-has-check":"warn","sukka/unicorn/consistent-conditional-object-spread":"error","sukka/unicorn/no-boolean-sort-comparator":"error","sukka/unicorn/no-chained-comparison":"error","sukka/unicorn/no-constant-zero-expression":"error","sukka/unicorn/no-duplicate-logical-operands":"error","sukka/unicorn/no-impossible-length-comparison":"error","sukka/unicorn/no-invalid-character-comparison":"error","sukka/unicorn/no-loop-iterable-mutation":"error","sukka/unicorn/no-selector-as-dom-name":"error","sukka/unicorn/no-array-concat-in-loop":"error","sukka/unicorn/no-array-front-mutation":"warn","sukka/unicorn/no-array-sort-for-min-max":"error","sukka/unicorn/no-useless-compound-assignment":"warn","sukka/unicorn/no-useless-delete-check":"warn","sukka/unicorn/no-useless-logical-operand":"error","sukka/unicorn/prefer-boolean-return":"warn","sukka/unicorn/prefer-flat-math-min-max":"warn","sukka/unicorn/prefer-hoisting-branch-code":"warn","sukka/unicorn/prefer-single-replace":"warn","sukka/unicorn/no-invalid-well-known-symbol-methods":"error","sukka/unicorn/no-late-event-control":"error","sukka/unicorn/prefer-abort-signal-timeout":"warn","sukka/unicorn/prefer-aggregate-error":"warn","sukka/unicorn/prefer-observer-apis":"warn","sukka/unicorn/prefer-set-methods":"warn","sukka/unicorn/prefer-toggle-attribute":"warn","sukka/unicorn/prefer-url-search-parameters":"warn","sukka/unicorn/no-unsafe-promise-all-settled-values":"error","sukka/unicorn/prefer-abort-signal-any":"warn","sukka/unicorn/prefer-block-statement-over-iife":"warn","sukka/unicorn/no-multiple-promise-resolver-calls":"error","sukka/unicorn/no-unnecessary-string-trim":"error","sukka/unicorn/no-useless-re-export":"warn","sukka/unicorn/iteration-fallback-style":"warn"}},stylistic_unicorn:{name:"@eslint-sukka/eslint-plugin-sukka-full stylistic unicorn preset",plugins:{get sukka(){return Au}},rules:{"sukka/unicorn/no-nested-ternary":"warn","sukka/unicorn/filename-case":["error",{cases:{kebabCase:!0,snakeCase:!0},ignore:[/fixtures/i,/^_/,/^\./,/rc$/i,/\.(md|json|yaml|toml|yml|ini|conf|jsonc|json5)$/i]}],"sukka/unicorn/no-unnecessary-nested-ternary":"error","sukka/unicorn/no-unreadable-object-destructuring":"error","sukka/unicorn/consistent-compound-words":"warn","sukka/unicorn/default-export-style":"warn"}},recommended_extra_with_typed_lint:{...c.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint,plugins:{get sukka(){return Au}},rules:Object.assign({"sukka/string/no-unneeded-to-string":"error","sukka/type/no-force-cast-via-top-type":"error","sukka/type/no-wrapper-type-reference":"error","sukka/require-project-reference":"off","sukka/no-default-error":"off","sukka/unicorn/consistent-tuple-labels":"warn"},d.collectRules(c.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint))},recommended_react:{...c.eslint_plugin_sukka.configs.recommended_react,plugins:{get sukka(){return Au}}}},rules:Object.assign(c.eslint_plugin_sukka.rules,{"array/no-unneeded-flat-map":N,"browser/prefer-location-assign":M,"jsx/no-template-literal":q,"jsx/no-unneeded-nested":U,"string/no-locale-case":V,"string/no-simple-template-literal":_,"unicode/no-bidi":H,"unicode/no-invisible":Z,"no-redundant-variable":ee,"no-single-return":er,"prefer-early-return":eo,"prefer-fetch":ea,"prefer-timer-id":el,"string/no-unneeded-to-string":eu,"type/no-force-cast-via-top-type":ep,"type/no-wrapper-type-reference":ed,"no-default-error":em,"require-project-reference":ey},Object.fromEntries(Object.entries({"unicorn/catch-error-name":{create:e=>{let t=e.options[0],{name:r}=t,n=t.ignore.map(e=>v.isRegExp(e)?e:RegExp(e,"u")),o=e=>e===r||n.some(t=>t.test(e))||e.endsWith(r)||e.endsWith(iy(r));e.on("Identifier",t=>{if(("CatchClause"!==t.parent.type||t.parent.param!==t)&&!(("FunctionExpression"===t.parent.type||"ArrowFunctionExpression"===t.parent.type)&&t.parent.params[0]===t&&(tR(t.parent.parent,{method:"then",argumentsLength:2,optionalCall:!1})||tR(t.parent.parent,{method:"catch",argumentsLength:1,optionalCall:!1}))&&t.parent.parent.arguments.at(-1)===t.parent))return;let n=t.name;if(o(n)||o(n.replaceAll(/_+$/g,"")))return;let a=eS(e.sourceCode.getScope(t),t);if(!a||"_"===n&&0===a.references.length)return;let i=rS(r,[a.scope,...a.references.map(({from:e})=>e)]),s={node:t,messageId:d0,data:{originalName:n,fixedName:i||r}};return i&&(s.fix=t=>i0(a,i,e,t)),s})},meta:{type:"suggestion",docs:{description:"Enforce a specific parameter name in catch clauses.",recommended:!0},fixable:"code",schema:d1,defaultOptions:[{name:"error",ignore:[]}],messages:{[d0]:"The catch parameter `{{originalName}}` should be named `{{fixedName}}`."},languages:["js/js"]}},"unicorn/custom-error-definition":{create:e=>{e.on("ClassDeclaration",t=>mm(e,t)),e.on("AssignmentExpression",t=>{if("ClassExpression"===t.right.type)return mm(e,t.right)}),e.on("AssignmentExpression",e=>{if("MemberExpression"===e.left.type&&"Identifier"===e.left.object.type&&"exports"===e.left.object.name){let t=e.right;if("ClassExpression"!==t.type||!mt(t)||!t.id)return;let r=t.id.name;return e.left.property.name!==r?{node:e.left.property,messageId:d2,fix:t=>t.replaceText(e.left.property,r)}:void 0}})},meta:{type:"problem",docs:{description:"Enforce correct `Error` subclassing.",recommended:!1},fixable:"code",messages:{[d2]:"Exported error name should match error class",[d3]:"Do not pass the error message to `super()` when the class defines a `message` accessor.",[d8]:"Do not assign to `this.message` when the class defines a `message` getter without a setter.",[d6]:"Error constructors should accept `options` as the second parameter.",[d9]:"Error constructors should use `options` as the second parameter.",[d5]:"Pass the error message to `super()` as the first argument.",[d4]:"Pass `options` to `super()` as the second argument."},languages:["js/js"]}},"unicorn/no-nested-ternary":{create:e=>{e.on("ConditionalExpression",t=>{if([t.test,t.consequent,t.alternate].some(e=>"ConditionalExpression"===e.type))return;let{sourceCode:r}=e,n=r.getAncestors(t).toReversed(),o=n.findIndex(e=>"ConditionalExpression"!==e.type);return 1!==o||ta(t,e)?o>1?{node:o>2?n[o-3]:t,messageId:ix}:void 0:{node:t,messageId:ib,fix:e=>[e.insertTextBefore(t,"("),e.insertTextAfter(t,")")]}})},meta:{type:"suggestion",docs:{description:"Disallow nested ternary expressions.",recommended:!0},fixable:"code",messages:{[ix]:"Do not nest ternary expressions.",[ib]:"Nested ternary expression should be parenthesized."},languages:["js/js"]}},"unicorn/prefer-event-target":{create:e=>{e.on("Identifier",t=>{if("EventEmitter"!==t.name||("ClassDeclaration"!==t.parent.type&&"ClassExpression"!==t.parent.type||t.parent.superClass!==t)&&("NewExpression"!==t.parent.type||t.parent.callee!==t))return;let r=e.sourceCode.getScope(t);if(!function(e){if(!e)return!1;let t=function(e,t){let r=e=>e.type===t;for(;e.parent;e=e.parent)if(r(e))return e}(e,"ImportDeclaration");return!!(iv.has(t?.source.value)||"Property"===e.parent.type&&e.parent.value===e&&"Identifier"===e.parent.key.type&&"EventEmitter"===e.parent.key.name&&"ObjectPattern"===e.parent.parent.type&&e.parent.parent.properties.includes(e.parent)&&iS(e.parent.parent)&&iC(e.parent.parent.parent.init))||!!(iS(e)&&tF(e.parent.init,{property:"EventEmitter",optional:!1,computed:!1})&&iC(e.parent.init.object))}(eS(r,t)?.defs[0]?.name))return{node:t,messageId:iE}})},meta:{type:"suggestion",docs:{description:"Prefer `EventTarget` over `EventEmitter`.",recommended:"unopinionated"},messages:{[iE]:"Prefer `EventTarget` over `EventEmitter`."},languages:["js/js"]}},"unicorn/prefer-keyboard-event-key":{create:e=>{e.on("Identifier",t=>{if(iw.has(t.name)){for(let r of iB(e,t))if(r.references?.some(e=>iF(t,e.identifier)))return iR(t,r)}}),e.on("Property",t=>{let r;if("Identifier"===t.key.type&&iw.has(t.key.name)&&"Property"===(r=t.key).parent.type&&r.parent.key===r&&"ObjectPattern"===r.parent.parent.type&&!r.parent.computed){for(let r of iB(e,t))if(iL(t.key,r))return iR(t.key,r);for(let r of iB(e,t))if(iP(t.key,r))return iR(t.key,r)}})},meta:{type:"suggestion",docs:{description:"Prefer `KeyboardEvent#key` over deprecated keyboard event properties.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[iT]:"Use `.key` instead of `.{{name}}`.",[iA]:"Use `.key` with `{{key}}`."},languages:["js/js"]}},"unicorn/prefer-text-content":{create:e=>{e.on("MemberExpression",t=>{if(!tF(t,{property:"innerText"})||nz(t.object,e))return;let r=t.property;return{node:r,messageId:iN,suggest:[{messageId:i$,fix:e=>e.replaceText(r,"textContent")}]}}),e.on("Identifier",t=>{if("innerText"===t.name&&"Property"===t.parent.type&&t.parent.key===t&&!t.parent.computed&&"init"===t.parent.kind&&"ObjectPattern"===t.parent.parent.type&&t.parent.parent.properties.includes(t.parent)&&!((e,t)=>{if(nz(e,t))return!0;let{parent:r}=e;return"VariableDeclarator"===r.type?r.id===e&&r.init&&nz(r.init,t):"AssignmentExpression"===r.type&&r.left===e&&nz(r.right,t)})(t.parent.parent,e))return{node:t,messageId:iN,suggest:[{messageId:i$,fix:e=>e.replaceText(t,t.parent.shorthand?"textContent: innerText":"textContent")}]}})},meta:{type:"suggestion",docs:{description:"Prefer `.textContent` over `.innerText`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[iN]:"Prefer `.textContent` over `.innerText`.",[i$]:"Switch to `.textContent`."},languages:["js/js"]}},"unicorn/require-array-join-separator":{create:e=>{e.on("CallExpression",t=>{if(!(tR(t,{method:"join",argumentsLength:0,optionalCall:!1})||tR(t,{method:"call",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&tU(t.callee.object,{property:"join"}))||0===t.arguments.length&&nL(t.callee.object,e))return;let{sourceCode:r}=e,[n,o]=r.getLastTokens(t,2),a=1===t.arguments.length;return{loc:{start:r.getLoc(n)[a?"end":"start"],end:r.getLoc(o).end},messageId:i3,fix:r=>iO(r,t,"','",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the separator argument with `Array#join()`.",recommended:"unopinionated"},fixable:"code",messages:{[i3]:"Missing the separator argument."},languages:["js/js"]}},"unicorn/no-thenable":{create:e=>{for(let{selector:t,selectors:r,messageId:n,getNodes:o}of i7)e.on(t??r,function*(t){for(let r of o(t,e))yield{node:r,messageId:n}})},meta:{type:"problem",docs:{description:"Disallow `then` property.",recommended:"unopinionated"},messages:{[i8]:"Do not add `then` to an object.",[i6]:"Do not export `then`.",[i9]:"Do not add `then` to a class."},languages:["js/js"]}},"unicorn/no-invalid-remove-event-listener":{create:e=>{e.on("CallExpression",t=>{if(!(tR(t,{method:"removeEventListener",minimumArguments:2,optionalCall:!1})&&"SpreadElement"!==t.arguments[0].type&&("FunctionExpression"===t.arguments[1].type||"ArrowFunctionExpression"===t.arguments[1].type||tR(t.arguments[1],{method:"bind",optionalCall:!1,optionalMember:!1}))))return;let[,r]=t.arguments;return["ArrowFunctionExpression","FunctionExpression"].includes(r.type)?{node:r,loc:eR(r,e.sourceCode),messageId:se}:{node:r.callee.property,messageId:se}})},meta:{type:"problem",docs:{description:"Prevent calling `EventTarget#removeEventListener()` with the result of an expression.",recommended:"unopinionated"},messages:{[se]:"The listener argument should be a function reference."},languages:["js/js"]}},"unicorn/consistent-function-scoping":sl,"unicorn/no-new-buffer":{create:e=>{let{sourceCode:t}=e;e.on("NewExpression",r=>{if(!tE(r,{name:"Buffer"}))return;let n=((e,t)=>{if(1!==e.length)return"from";let[r]=e;if("SpreadElement"===r.type)return;if("ArrayExpression"===r.type||"TemplateLiteral"===r.type)return"from";if(n2(r,t))return"alloc";let n=eV(r,t);if(n){let{value:e}=n;if("string"==typeof e||Array.isArray(e))return"from"}})(r.arguments,t.getScope(r));return n?{node:r,messageId:su,data:{method:n},fix:sd(r,e,n)}:{node:r,messageId:sp,suggest:["from","alloc"].map(t=>({messageId:sc,data:{replacement:t},fix:sd(r,e,t)}))}})},meta:{type:"problem",docs:{description:"Enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[su]:"`new Buffer()` is deprecated, use `Buffer.{{method}}()` instead.",[sp]:"`new Buffer()` is deprecated, use `Buffer.alloc()` or `Buffer.from()` instead.",[sc]:"Switch to `Buffer.{{replacement}}()`."},languages:["js/js"]}},"unicorn/no-console-spaces":{create:e=>{let{sourceCode:t}=e,r=(r,n,o)=>{let[a,i]=t.getRange(r),s="leading"===o?a+1:i-2,l=[s,s+1];return{loc:ic(l,e),messageId:sm,data:{method:n,position:o},fix:e=>e.removeRange(l)}};e.on("CallExpression",function*(e){if(!tR(e,{object:"console",methods:["log","debug","info","warn","error"],minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let n=e.callee.property.name,{arguments:o}=e,{length:a}=o;for(let[e,i]of o.entries()){if(!ts(i)&&"TemplateLiteral"!==i.type)continue;let o=t.getText(i).slice(1,-1);0!==e&&sf(o)&&(yield r(i,n,"leading")),e!==a-1&&sg(o)&&(yield r(i,n,"trailing"))}})},meta:{type:"suggestion",docs:{description:"Do not use leading/trailing space between `console.log` parameters.",recommended:"unopinionated"},fixable:"code",messages:{[sm]:"Do not use {{position}} space between `console.{{method}}` parameters."},languages:["js/js"]}},"unicorn/no-empty-file":sh,"unicorn/no-useless-fallback-in-spread":{create:e=>{e.on("ObjectExpression",t=>{if(tD(t)&&"LogicalExpression"===t.parent.type&&t.parent.right===t&&("||"===t.parent.operator||"??"===t.parent.operator)&&"SpreadElement"===t.parent.parent.type&&t.parent.parent.argument===t.parent&&"ObjectExpression"===t.parent.parent.parent.type&&t.parent.parent.parent.properties.includes(t.parent.parent))return{node:t,messageId:sx,*fix(r,{abort:n}){let{sourceCode:o}=e,a=t.parent;if(o.getCommentsInside(a).length>0)return n();let{left:i}=a,s=ta(i,e),[,l]=s?tn(i,e):o.getRange(i),[,u]=o.getRange(a);yield r.removeRange([l,u]),(s||"SequenceExpression"!==i.type)&&(yield iM(a,r,e))}}})},meta:{type:"suggestion",docs:{description:"Disallow useless fallback when spreading in object literals.",recommended:"unopinionated"},fixable:"code",messages:{[sx]:"The empty object is useless."},languages:["js/js"]}},"unicorn/no-useless-length-check":{create:e=>{let t=[],r=new i,n=new i,o=(t,r,n)=>tR(t,{method:r,optionalCall:!1,optionalMember:!1})&&rk(n.left.object,t.callee.object)&&!nB(t.callee.object,e);e.on("BinaryExpression",e=>{if(!("BinaryExpression"===e.type&&"Literal"===e.right.type&&"0"===e.right.raw&&tF(e.left,{property:"length",optional:!1})&&tW(e.parent)))return;let{operator:t}=e;"==="===t?r.add(e):(">"===t||"!=="===t)&&n.add(e)}),e.on("LogicalExpression",e=>{tW(e)&&t.push(e)}),e.on("Program:exit",function*(){let a=new i(t.flatMap(e=>(function(e){let{operator:t}=e;return(function e(t){return[t.left,t.right].flatMap(r=>"LogicalExpression"===r.type&&r.operator===t.operator?e(r):[r])})(e).filter((e,a,i)=>(function({node:e,operator:t,siblings:a}){return"||"===t&&r.has(e)&&a.some(t=>o(t,"every",e))||"&&"===t&&n.has(e)&&a.some(t=>o(t,"some",e))})({node:e,operator:t,siblings:[i[a-1],i[a+1]].filter(Boolean)}))})(e))),{sourceCode:s}=e;for(let t of a)yield{loc:{start:s.getLoc(t.left.property).start,end:s.getLoc(t).end},messageId:r.has(t)?"zero":"non-zero",fix(r){let{left:n,right:o}=t.parent,a=tn(n,e),i=tn(o,e),s=[];return n===t?(s[0]=a[0],s[1]=i[0]):(s[0]=a[1],s[1]=i[1]),r.removeRange(s)}}})},meta:{type:"suggestion",docs:{description:"Disallow useless array length check.",recommended:"unopinionated"},fixable:"code",messages:{"non-zero":"The non-empty check is useless as `Array#some()` returns `false` for an empty array.",zero:"The empty check is useless as `Array#every()` returns `true` for an empty array."},languages:["js/js"]}},"unicorn/no-useless-promise-resolve-reject":{create:e=>{e.on("CallExpression",t=>{let{expression:r,parent:n}=sb(t);if(!(tR(t,{object:"Promise",methods:["resolve","reject"],optionalCall:!1,optionalMember:!1})&&("ArrowFunctionExpression"===n.type&&n.body===r||"ReturnStatement"===n.type&&n.argument===r||"YieldExpression"===n.type&&!n.delegate&&n.argument===r)))return;let{functionNode:o,isInTryStatement:a}=function(e){let t,r=!1;for(;e;e=e.parent){if(tw(e)){t=e;break}"TryStatement"===e.type&&(r=!0)}return{functionNode:t,isInTryStatement:r}}(t);if(o&&(o.async||function(e){if("CallExpression"===e.parent.type&&"MemberExpression"===e.parent.callee.type&&!e.parent.callee.computed&&"Identifier"===e.parent.callee.property.type){let{callee:{property:t},arguments:r}=e.parent;if(1===r.length&&["then","catch","finally"].includes(t.name)&&r[0]===e||2===r.length&&"then"===t.name&&(r[0]===e||"SpreadElement"!==r[0].type&&r[1]===e))return!0}return!1}(o)))return function(e,t){let{callee:r}=e,n=r.property.name,{parent:o}=sb(e);return{node:r,messageId:n,data:{type:"YieldExpression"===o.type?"yield":"return"},fix:t}}(t,function(e,t,r){if(e.arguments.length>1)return;let{callee:n,arguments:o}=e,{expression:a,parent:i,isAwaited:s}=sb(e),[l]=o;if(l?.type==="SpreadElement")return;let u="reject"===n.property.name,p="YieldExpression"===i.type;if(u&&(t||p&&"ExpressionStatement"!==i.parent.type))return;let c=function({callExpression:e,parent:t,expression:r,isAwaited:n,isReject:o,context:a}){return n&&!o?tn(e,a):o&&"YieldExpression"===t.type?tn(t,a):"ArrowFunctionExpression"===t.type?o?tn(r,a):e:t}({callExpression:e,parent:i,expression:a,isAwaited:s,isReject:u,context:r});if(!rU(r,c,l?[l]:[]))return function(t){let n="ArrowFunctionExpression"===i.type,o=sE(l,r);if(u){if(o||="undefined",o=`throw ${o}`,p)return t.replaceTextRange(tn(i,r),o);if(o+=";",n)return o=`{ ${o} }`,t.replaceTextRange(tn(a,r),o)}else{if(s){var c;let n;return t.replaceTextRange(tn(e,r),(n=sE(c=l,r)||"undefined",c&&"SequenceExpression"!==c.type&&16>a5(c)?`(${n})`:n))}p?o=`yield${o?" ":""}${o}`:"ReturnStatement"===i.type?o=`return${o?" ":""}${o};`:(l?.type==="ObjectExpression"&&(o=`(${o})`),o||="{}")}return t.replaceText(n?e:i,o)}}(t,a,e))})},meta:{type:"suggestion",docs:{description:"Disallow returning/yielding `Promise.resolve/reject()` in async functions or promise callbacks",recommended:"unopinionated"},fixable:"code",messages:{resolve:"Prefer `{{type}} value` over `{{type}} Promise.resolve(value)`.",reject:"Prefer `throw error` over `{{type}} Promise.reject(error)`."},languages:["js/js"]}},"unicorn/no-zero-fractions":{create:e=>{e.on("Literal",t=>{if(!tp(t))return;let{raw:r}=t,n=r.match(/^(?<before>[\d_]*)(?<dotAndFractions>\.[\d_]*)(?<after>.*)$/);if(!n)return;let{before:o,dotAndFractions:a,after:i}=n.groups,s=(o+a.replaceAll(/[.0_]+$/g,"")||"0")+i;if(s===r)return;let l="."===a,{sourceCode:u}=e,p=u.getRange(t)[0]+o.length+a.length;return{loc:ic([p-(r.length-s.length),p],e),messageId:l?sS:sv,*fix(r){let n=s;"MemberExpression"===t.parent.type&&t.parent.object===t&&a7.test(s)&&!ta(t,e)&&(n=`(${n})`,aL(u.getTokenBefore(t),e,n)&&(n=`;${n}`)),yield r.replaceText(t,n),yield iG(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow number literals with zero fractions or dangling dots.",recommended:"unopinionated"},fixable:"code",messages:{[sv]:"Don't use a zero fraction in the number.",[sS]:"Don't use a dangling dot in the number."},languages:["js/js"]}},"unicorn/prefer-export-from":sF,"unicorn/prefer-native-coercion-functions":{create:e=>{e.on(tA,t=>{if(t.async||t.generator||t.returnType?.type==="TSTypeAnnotation"&&"TSTypePredicate"===t.returnType.typeAnnotation.type||0===t.params.length||"Identifier"!==t.params[0].type||("MethodDefinition"===t.parent.type&&("constructor"===t.parent.kind||"set"===t.parent.kind)||"Property"===t.parent.type&&"set"===t.parent.kind)&&t.parent.value===t)return;let r=function(e){if(("ArrowFunctionExpression"===e.type&&"Identifier"===e.body.type&&e.body.name===e.params[0].name||"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type&&e.body.body[0].argument?.type==="Identifier"&&e.body.body[0].argument.name===e.params[0].name)&&"CallExpression"===e.parent.type&&!e.parent.optional&&e.parent.arguments[0]===e&&"MemberExpression"===e.parent.callee.type&&!e.parent.callee.computed&&!e.parent.callee.optional&&"Identifier"===e.parent.callee.property.type&&sP.has(e.parent.callee.property.name))return{replacementFunction:"Boolean",fix:t=>t.replaceText(e,"Boolean")}}(t)||function(e){let t,r=(t=e.params[0].name,"ArrowFunctionExpression"===e.type&&sL(e.body,t)?e.body:"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type&&sL(e.body.body[0].argument,t)?e.body.body[0].argument:void 0);if(!r)return;let{name:n}=r.callee,o={replacementFunction:n};return"FunctionDeclaration"===e.type||1!==r.arguments.length||(o.fix=t=>{let r=n;return"Property"===e.parent.type&&e.parent.method&&e.parent.value===e?r=`: ${r}`:"MethodDefinition"===e.parent.type&&(r=` = ${r};`),t.replaceText(e,r)}),o}(t);if(!r)return;let{sourceCode:n}=e,{replacementFunction:o,fix:a}=r;return r={node:t,loc:eR(t,n),messageId:sB,data:{functionNameWithKind:eK(t,n),replacementFunction:o}},!a||1!==t.params.length||n.getCommentsInside(t).length>0||(r.fix=a),r})},meta:{type:"suggestion",docs:{description:"Prefer using `String`, `Number`, `BigInt`, `Boolean`, and `Symbol` directly.",recommended:"unopinionated"},fixable:"code",messages:{[sB]:"{{functionNameWithKind}} is equivalent to `{{replacementFunction}}`. Use `{{replacementFunction}}` directly."},languages:["js/js"]}},"unicorn/no-document-cookie":{create(e){sq.listen({context:e})},meta:{type:"problem",docs:{description:"Do not use `document.cookie` directly.",recommended:"unopinionated"},messages:{[sO]:"Do not use `document.cookie` directly."},languages:["js/js"]}},"unicorn/prefer-add-event-listener":s_,"unicorn/prefer-array-index-of":sH,"unicorn/prefer-blob-reading-methods":{create:e=>{e.on("CallExpression",e=>{if(!tR(e,{methods:["readAsText","readAsArrayBuffer"],argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let t=e.callee.property,r=t.name;return{node:t,messageId:sQ,data:{method:r,replacement:"readAsArrayBuffer"===r?"arrayBuffer":"text"}}})},meta:{type:"suggestion",docs:{description:"Prefer `Blob#arrayBuffer()` over `FileReader#readAsArrayBuffer(…)` and `Blob#text()` over `FileReader#readAsText(…)`.",recommended:"unopinionated"},messages:{[sQ]:"Prefer `Blob#{{replacement}}()` over `FileReader#{{method}}(blob)`."},languages:["js/js"]}},"unicorn/prefer-date-now":{create:e=>{e.on("CallExpression",e=>{if(tR(e,{methods:["getTime","valueOf"],argumentsLength:0,optionalCall:!1,optionalMember:!1})&&s2(e.callee.object)){let t=e.callee.property;return s3(e,{node:t,messageId:s0,data:{method:t.name}})}if(tb(e,{names:["Number","BigInt"],argumentsLength:1,optional:!1},ty)&&s2(e.arguments[0])){let{name:t}=e.callee;return"Number"===t?s3(e,{messageId:s1}):s3(e.arguments[0])}}),e.on("UnaryExpression",t=>{if(("+"===t.operator||"-"===t.operator)&&s2(t.argument))return s3("-"===t.operator?t.argument:t,{},e)}),e.on("AssignmentExpression",e=>{if(("-="===e.operator||"*="===e.operator||"/="===e.operator||"%="===e.operator||"**="===e.operator)&&s2(e.right))return s3(e.right)}),e.on("BinaryExpression",function*(e){if("-"===e.operator||"*"===e.operator||"/"===e.operator||"%"===e.operator||"**"===e.operator)for(let t of[e.left,e.right])s2(t)&&(yield s3(t))})},meta:{type:"suggestion",docs:{description:"Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.",recommended:"unopinionated"},fixable:"code",messages:{[sZ]:"Prefer `Date.now()` over `new Date()`.",[s0]:"Prefer `Date.now()` over `Date#{{method}}()`.",[s1]:"Prefer `Date.now()` over `Number(new Date())`."},languages:["js/js"]}},"unicorn/dom-node-dataset":ln,"unicorn/prefer-modern-math-apis":{create:e=>{let t=[];e.on("CallExpression",t=>{if(!tR(t,{object:"Math",method:"sqrt",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let r=lp(t.arguments[0]);if(r.some(e=>!("BinaryExpression"===e.type&&("*"===e.operator&&rk(e.left,e.right)||"**"===e.operator&&ti(e.right,2)))))return;let n=1===r.length?"abs":"hypot",o=new i(1===r.length?[]:r.map(e=>e.parent));return{node:t.callee.property,messageId:lo,data:{replacement:`Math.${n}(…)`,description:"Math.sqrt(…)"},*fix(a){let{sourceCode:i}=e;for(let r of(yield a.replaceText(t.callee.property,n),o)){let t=i.getTokenAfter(r.left,e=>"Punctuator"===e.type&&"+"===e.value);yield i2(t,",",a,e),yield iM(r,a,e)}for(let t of r)yield a.removeRange([tn(t.left,e)[1],i.getRange(t)[1]])}}}),e.on("BinaryExpression",e=>{t.push(e)}),e.on("Program:exit",function*(){for(let r of t)for(let t of lu){let n=t(r,e);n&&(yield n)}})},meta:{type:"suggestion",docs:{description:"Prefer modern `Math` APIs over legacy patterns.",recommended:"unopinionated"},fixable:"code",messages:{[lo]:"Prefer `{{replacement}}` over `{{description}}`."},languages:["js/js"]}},"unicorn/number-literal-case":lm,"unicorn/prefer-number-properties":lb,"unicorn/prefer-reflect-apply":{create:e=>{e.on("CallExpression",t=>{if(!tR(t,{optionalCall:!1,optionalMember:!1})||"Literal"===t.callee.object.type||"ArrayExpression"===t.callee.object.type||"ObjectExpression"===t.callee.object.type)return;let{sourceCode:r}=e,n=((e,t)=>{if("apply"===ez(e.callee)&&2===e.arguments.length&&lv(e.arguments[0],e.arguments[1]))return r=>r.replaceText(e,lS(t,e.callee.object,e.arguments[0],e.arguments[1]))})(t,r)||((e,t)=>{if("call"===ez(e.callee)&&"apply"===ez(e.callee.object)&&"prototype"===ez(e.callee.object.object)&&e.callee.object.object.object?.type==="Identifier"&&"Function"===e.callee.object.object.object.name&&3===e.arguments.length&&lv(e.arguments[1],e.arguments[2]))return r=>r.replaceText(e,lS(t,e.arguments[0],e.arguments[1],e.arguments[2]))})(t,r);if(n)return{node:t,messageId:lE,fix:n}})},meta:{type:"suggestion",docs:{description:"Prefer `Reflect.apply()` over `Function#apply()`.",recommended:"unopinionated"},fixable:"code",messages:{[lE]:"Prefer `Reflect.apply()` over `Function#apply()`."},languages:["js/js"]}},"unicorn/prefer-set-size":{create:e=>{e.on("MemberExpression",t=>{var r;if(!tF(t,{property:"length",optional:!1}))return;let n="ArrayExpression"===(r=t.object).type&&1===r.elements.length&&r.elements[0]?.type==="SpreadElement"?r.elements[0].argument:tR(r,{object:"Array",method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})?r.arguments[0]:void 0;if(n&&nq(n,e))return{node:t.property,messageId:lC,fix:function(e,t,r){let{sourceCode:n}=e,{object:o,property:a}=t;if(!(n.getCommentsInside(o).length>n.getCommentsInside(r).length))return function*(i){yield i.replaceText(a,"size");let s=n.getText(r);it(r,e)&&(s=`(${s})`),yield i.replaceText(o,s),"ArrayExpression"===o.type&&(yield iG(i,t,e))}}(e,t,n)}})},meta:{type:"suggestion",docs:{description:"Prefer using `Set#size` instead of `Array#length`.",recommended:"unopinionated"},fixable:"code",messages:{[lC]:"Prefer using `Set#size` instead of `Array#length`."},languages:["js/js"]}},"unicorn/prefer-string-replace-all":{create:e=>{e.on("CallExpression",t=>{let r,n,o=((e,t)=>{let r;if(!tR(e,{method:"join",argumentsLength:1,optionalCall:!1,optionalMember:!1})||!tR(e.callee.object,{method:"split",argumentsLength:1,optionalCall:!1,optionalMember:!1})||t.sourceCode.getCommentsInside(e).length>0)return;let n=e.callee.object;if(of(n.callee.object,t))return;let[o]=n.arguments,[a]=e.arguments,i=tu(o);if("string"==typeof i){if(0===i.length)return;r=tQ(i)}else if(!(r=(e=>{if(!tc(e)||e.regex.flags.includes("y"))return;let t=lM(e);if(!t||lU(t)||0===lq(t))return;let{pattern:r,flags:n}=e.regex;return`/${r}/${n.includes("g")?n:`g${n}`}`})(o)))return;let s=tu(a);if("string"==typeof s)return`${to(n.callee.object,t)}.replaceAll(${r}, ${tQ(s.replaceAll("$","$$$$"))})`})(t,e);if(o)return{node:t.callee.property,messageId:lF,fix:e=>e.replaceText(t,o)};if(!tR(t,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1})||tR(t,{method:"replace",argumentsLength:2,optionalCall:!1,optionalMember:!1})&&tc(r=t.arguments[0])&&r.regex.flags.includes("g")&&!r.regex.flags.includes("y")&&(e=>{if(!e.startsWith("[")||!e.endsWith("]")||e.startsWith("[^"))return;let t=new i,r=e.slice(1,-1);for(let e=0;e<r.length;e++){let n=r[e],o=!1;if("\\"===n&&(n=r[++e],o=!0,!n)||"-"===n&&!o&&0!==e&&e!==r.length-1||"]"===n&&!o&&0!==e||!lw.has(n))return;t.add(n)}return t})(r.regex.pattern)?.size>=8&&ts(n=t.arguments[1])&&n.value===lA)return;let{arguments:a,callee:{property:s}}=t;if(of(t.callee.object,e))return;let[l]=a;if(!((e,t)=>{if(tc(e))return e.regex.flags.includes("g");if(tE(e,{name:"RegExp"})&&e.arguments[0]?.type!=="SpreadElement"&&e.arguments[1]?.type==="Literal"&&"string"==typeof e.arguments[1].value)return e.arguments[1].value.includes("g");let r=eV(e,t);if(!r)return!1;let{value:n}=r;return"[object RegExp]"===Object.prototype.toString.call(n)&&n.global})(l,e.sourceCode.getScope(l)))return;let u=s.name,p=function(e){if(!tc(e))return;let t=lM(e);if(!t)return;let{flags:r}=e.regex;if(!function(e){if(!e.includes("g"))return!1;for(let t of e)if(lB.has(t))return!1;return!0}(r))return;let n="alternative"===t.type?l$(t.body):lN(t);if(n)return"'"+n+"'"}(l);if("replaceAll"===u){if(!p)return;return{node:l,messageId:lj,data:{replacement:p.length<20?p:"a string literal"},fix:e=>e.replaceText(l,p)}}return{node:s,messageId:lI,*fix(e){yield e.insertTextAfter(s,"All"),p&&(yield e.replaceText(l,p))}}})},meta:{type:"suggestion",docs:{description:"Prefer `String#replaceAll()` over regex searches with the global flag and `String#split().join()`.",recommended:"unopinionated"},fixable:"code",messages:{[lI]:"Prefer `String#replaceAll()` over `String#replace()`.",[lj]:"This pattern can be replaced with {{replacement}}.",[lF]:"Prefer `String#replaceAll()` over `String#split().join()`."},languages:["js/js"]}},"unicorn/prefer-string-slice":{create:e=>{e.on("CallExpression",t=>{if(!tR(t,{methods:["substr","substring"]})||of(t.callee.object,e))return;let r=t.callee.property.name;if(!("substring"===r&&(e=>{if(!tR(e,{method:"substring",argumentsLength:2}))return;let[t,r]=e.arguments;if(lW(t)&&lW(r)&&1===Math.abs(t.value-r.value))return t.value<r.value?t:r;let n=(e=>{if("BinaryExpression"===e.type&&"-"===e.operator&&ti(e.right,1))return e.left})(t);return lV(r,t)??(lV(t,r)?r:void 0)??(n&&rk(n,r)?t:void 0)})(t)))return{node:t,messageId:r,*fix(n,{abort:o}){if(yield n.replaceText(t.callee.property,"slice"),0!==t.arguments.length){if(t.arguments.length>2||t.arguments.some(e=>"SpreadElement"===e.type))return o();yield("substr"===r?function*({node:e,fixer:t,context:r,abort:n}){let o=e.arguments,[a,i]=o;if(!i)return;let{sourceCode:s}=r,l=eV(a,s.getScope(e)),u=tn(i,r);if(l?.value===0){let n=((e,t,r)=>{let n,o,{sourceCode:a}=r;if(!("BinaryExpression"!==e.type||"-"!==e.operator||!(tp(n=e.right)&&Number.isSafeInteger(n.value)&&n.value>0)||!lz(e.left)||!("Identifier"===t.type||ts(t))||!rk(e.left.object,t)||(o=((e,t)=>{let[r,n]=tn(e,t),o=t.sourceCode.getTokenByRangeStart(r),a=t.sourceCode.getTokenBefore(o);return[t.sourceCode.getRange(a)[1],n]})(e,r),a.getAllComments().some(e=>{let t=a.getRange(e);return t[0]>=o[0]&&t[1]<=o[1]}))))return`-${e.right.raw}`})(i,e.callee.object,r);if(n)return void(yield iU(t,i,n,r));if(tp(i)||lz(i))return;let o=l_(i);return"number"==typeof o?void(yield iU(t,i,String(Math.max(0,o)),r)):(yield t.insertTextBeforeRange(u,"Math.max(0, "),void(yield t.insertTextAfterRange(u,")")))}if(o.every(e=>tp(e))){let e;return void(yield(e=String(a.value+i.value),iU(t,i,e,r)))}return n()}:function*({node:e,fixer:t,context:r,abort:n}){let[o,a]=e.arguments,i=o?l_(o):void 0;if(!a){if(lz(o))return;if(void 0!==i)return void(yield iU(t,o,String(Math.max(0,i)),r));let e=tn(o,r);return yield t.insertTextBeforeRange(e,"Math.max(0, "),void(yield t.insertTextAfterRange(e,")"))}let s=l_(a);if(void 0!==i&&void 0!==s){let e=[Math.max(0,i),Math.max(0,s)];i>s&&e.reverse(),e[0]!==i&&(yield iU(t,o,String(e[0]),r)),e[1]!==s&&(yield iU(t,a,String(e[1]),r));return}if(0===i||0===s){let e=to(o,r),n=to(a,r);yield iU(t,o,"0",r),yield iU(t,a,`Math.max(0, ${0===i?n:e})`,r);return}return n()})({node:t,fixer:n,context:e,abort:o})}}}})},meta:{type:"suggestion",docs:{description:"Prefer `String#slice()` over `String#substr()` and `String#substring()`.",recommended:"unopinionated"},fixable:"code",messages:{substr:"Prefer `String#slice()` over `String#substr()`.",substring:"Prefer `String#slice()` over `String#substring()`."},languages:["js/js"]}},"unicorn/prefer-string-trim-start-end":{create:e=>{e.on("CallExpression",t=>{if(!tR(t,{methods:["trimLeft","trimRight"],argumentsLength:0,optionalCall:!1})||of(t.callee.object,e))return;let r=t.callee.property,n=r.name,o="trimLeft"===n?"trimStart":"trimEnd";return{node:r,messageId:lK,data:{method:n,replacement:o},fix:e=>e.replaceText(r,o)}})},meta:{type:"suggestion",docs:{description:"Prefer `String#trimStart()` / `String#trimEnd()` over `String#trimLeft()` / `String#trimRight()`.",recommended:"unopinionated"},fixable:"code",messages:{[lK]:"Prefer `String#{{replacement}}()` over `String#{{method}}()`."},languages:["js/js"]}},"unicorn/no-unreadable-iife":{create:e=>{e.on("CallExpression",t=>{if("ArrowFunctionExpression"!==t.callee.type||"BlockStatement"===t.callee.body.type||!ta(t.callee.body,e))return;let{body:r}=t.callee,n={node:t,loc:ic(tn(r,e),e),messageId:lG};return!function(e,t){let{sourceCode:r}=t,[n,o]=tn(e,t),[a,i]=r.getRange(e);return r.getCommentsInside(e.parent).some(e=>{let[t,s]=r.getRange(e);return t>=n&&s<=o&&(t<a||s>i)})}(r,e)&&(n.suggest=[{messageId:lJ,fix:t=>t.replaceTextRange(tn(r,e),`{ return ${e.sourceCode.getText(r)}; }`)}]),n})},meta:{type:"suggestion",docs:{description:"Disallow unreadable IIFEs.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[lG]:"IIFE with parenthesized arrow function body is considered unreadable.",[lJ]:"Use a block statement body."},languages:["js/js"]}},"unicorn/throw-new-error":{create:e=>{e.on("CallExpression",t=>{if("Decorator"===t.parent.type)return;let{callee:r}=t;if(!(t.optional||r3(r))&&("Identifier"===r.type&&lY.test(r.name)||"MemberExpression"===r.type&&!r.computed&&"Identifier"===r.property.type&&lY.test(r.property.name))&&!tF(r,{object:"Data",property:"TaggedError",computed:!1}))return{node:t,messageId:lX,fix:r=>iJ(t,e,r)}})},meta:{type:"suggestion",docs:{description:"Require `new` when creating an error.",recommended:"unopinionated"},fixable:"code",messages:{[lX]:"Use `new` when creating an error."},languages:["js/js"]}},"unicorn/escape-case":{create:e=>{let t="lowercase"===e.options[0];e.on("Literal",e=>{if(ts(e))return l1({node:e,original:e.raw,lowercase:t})}),e.on("Literal",e=>{if(tc(e))return l1({node:e,original:e.raw,regex:l0,lowercase:t})}),e.on("TemplateElement",r=>{if(!tO(r.parent))return l1({node:r,original:r.value.raw,lowercase:t,fix:(t,n)=>i1(r,n,e,t)})})},meta:{type:"suggestion",docs:{description:"Require escape sequences to use uppercase or lowercase values.",recommended:"unopinionated"},fixable:"code",schema:[{enum:["uppercase","lowercase"],description:"The case style for escape sequences."}],defaultOptions:["uppercase"],messages:{[lH]:"Use uppercase characters for the value of the escape sequence.",[lQ]:"Use lowercase characters for the value of the escape sequence."},languages:["js/js"]}},"unicorn/prefer-unicode-code-point-escapes":{create:e=>{e.on("Literal",e=>ts(e)?ui(e,e.raw):tc(e)?function(e){let t,{raw:r}=e,{pattern:n,flags:o}=(t=r.lastIndexOf("/"),{pattern:r.slice(1,t),flags:r.slice(t+1)}),{fixed:i,hasReplacement:s}=ua(n,{isRegex:!0,supportsNestedCharacterClasses:o.includes("v")}),l=o.includes("u")||o.includes("v"),u=function(e){for(let t=0;t<e.length;t++)if(void 0!==function(e,t){var r;if(!e.startsWith(l8,t))return;let n=t+l8.length;for(;r=e[n],l6.test(r);)n++;if(n===t+l8.length||"}"!==e[n])return;let o=Number.parseInt(e.slice(t+l8.length,n),16);if(!(o>1114111))return o}(e,t)&&l7(e,t))return!0;return!1}(n);if(!s&&(l||!u))return;let p=`/${s?i:n}/${us(o)}`;return l?{node:e,messageId:l2,fix:t=>t.replaceText(e,p)}:!function(e,t){try{return new a(e,t),!0}catch{return!1}}(s?i:n,us(o))?{node:e,messageId:l2}:{node:e,messageId:l2,suggest:[{messageId:l3,fix:t=>t.replaceText(e,p)}]}}(e):void 0),e.on("TemplateElement",t=>{if(!tO(t.parent))return ui(t,t.value.raw,(r,n)=>i1(t,n,e,r))})},meta:{type:"suggestion",docs:{description:"Prefer Unicode code point escapes over legacy escape sequences.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[l2]:"Prefer Unicode code point escapes.",[l3]:"Use Unicode code point escapes and add the `u` flag."},languages:["js/js"]}},"unicorn/prefer-prototype-methods":{create:function(e){let{sourceCode:t}=e,r=[];e.on("CallExpression",e=>{r.push(e)}),e.onExit("Program",function*(n){let o=new s;for(let{node:e,path:r}of new e5(t.getScope(n)).iterateGlobalReferences(Object.fromEntries(ul.map(e=>[e,{[e5.READ]:!0}]))))o.set(e,r);for(let t of r)yield function(e,{context:t,globalReferences:r}){let n;tR(e,{object:"Reflect",method:"apply",minimumArguments:1,optionalCall:!1,optionalMember:!1})?n=e.arguments[0]:tR(e,{methods:["apply","bind","call"],optionalCall:!1,optionalMember:!1})&&(n=e.callee.object);let{isGlobalReference:o,constructorName:a,methodName:i}=function(e,{context:t,globalReferences:r}){if(!e)return;if(r.has(e))return{isGlobalReference:!0,constructorName:"Object",methodName:r.get(e).at(-1)};if(!tF(e,{optional:!1}))return;let n=e.object;if(tC(n)||tD(n))return{constructorName:"ArrayExpression"===n.type?"Array":"Object",methodName:ez(e,t.sourceCode.getScope(e))}}(n,{context:t,globalReferences:r})??{};if(a)return{node:n,messageId:i?"known-method":"unknown-method",data:{constructorName:a,methodName:i},*fix(r){if(o)return void(yield r.replaceText(n,`${a}.prototype.${i}`));if(tF(n)){let o=n.object;yield r.replaceText(o,`${a}.prototype`),("ArrayExpression"===o.type||"ObjectExpression"===o.type)&&(yield iG(r,e,t))}}}}(t,{context:e,globalReferences:o})})},meta:{type:"suggestion",docs:{description:"Prefer borrowing methods from the prototype instead of the instance.",recommended:"unopinionated"},fixable:"code",messages:{"known-method":"Prefer using `{{constructorName}}.prototype.{{methodName}}`.","unknown-method":"Prefer using method from `{{constructorName}}.prototype`."},languages:["js/js"]}},"unicorn/error-message":{create:e=>{e.on(["CallExpression","NewExpression"],t=>{if(!(tb(t,{names:uu,optional:!1},tx)&&e.sourceCode.isGlobalReference(t.callee)))return;let r=t.callee.name,n=um.has(r)?um.get(r):0,o=t.arguments;if(o.some((e,t)=>t<=n&&"SpreadElement"===e.type))return;let a=o[n];if(!a)return{node:t,messageId:up,data:{constructorName:r}};if("ArrayExpression"===a.type||"ObjectExpression"===a.type)return{node:a,messageId:ud};let i=eV(a,e.sourceCode.getScope(a));if(!i)return;let{value:s}=i;return"string"!=typeof s?{node:a,messageId:ud}:""===s?{node:a,messageId:uc}:void 0})},meta:{type:"problem",docs:{description:"Enforce passing a `message` value when creating a built-in error.",recommended:"unopinionated"},messages:{[up]:"Pass a message to the `{{constructorName}}` constructor.",[uc]:"Error message should not be an empty string.",[ud]:"Error message should be a string."},languages:["js/js"]}},"unicorn/no-instanceof-builtins":uS,"unicorn/prefer-type-error":{create:e=>{e.on("ThrowStatement",e=>{let t;if(!(tE(e.argument,{name:"Error"})&&e.parent&&e.parent.body&&1===e.parent.body.length&&e.parent.parent&&"IfStatement"===(t=e.parent.parent).type&&uj(t.test)))return;let r=e.argument.callee;return{node:r,messageId:uC,fix:e=>e.insertTextBefore(r,"Type")}})},meta:{type:"suggestion",docs:{description:"Enforce throwing `TypeError` in type checking conditions.",recommended:"unopinionated"},fixable:"code",messages:{[uC]:"`new Error()` is too unspecific for a type check. Use `new TypeError()` instead."},languages:["js/js"]}},"unicorn/consistent-destructuring":{create:e=>{let{sourceCode:t}=e,r=new o,n=[],a=[],i=e=>{let r=rN(e.object);if(e.computed||"Identifier"!==e.property.type||!["Identifier","ThisExpression"].includes(r.type))return;let n=t.getScope(e);a.push({propertyName:e.property.name,rootIdentifierName:"Identifier"===r.type?r.name:void 0,rootVariable:"Identifier"===r.type?eS(n,r):void 0,thisScopeBoundary:"ThisExpression"===r.type?uP(r):void 0,start:t.getRange(e)[0],scope:n})},s=e=>{switch(e.type){case"MemberExpression":i(e);break;case"AssignmentPattern":s(e.left);break;case"RestElement":s(e.argument);break;case"ObjectPattern":for(let t of e.properties)s("Property"===t.type?t.value:t.argument);break;case"ArrayPattern":for(let t of e.elements)t&&s(t)}};e.on("AssignmentExpression",e=>{s(e.left)}),e.on(["ForInStatement","ForOfStatement"],e=>{"VariableDeclaration"!==e.left.type&&s(e.left)}),e.on("UpdateExpression",e=>{"MemberExpression"===e.argument.type&&i(e.argument)}),e.on("UnaryExpression",e=>{"delete"===e.operator&&"MemberExpression"===e.argument.type&&i(e.argument)}),e.on("VariableDeclarator",e=>{let n;if(!("ObjectPattern"===e.id.type&&"const"===e.parent.kind&&e.init&&("Identifier"===(n=e.init).type||"ThisExpression"===n.type)))return;let o="Identifier"===e.init.type?e.init:void 0,a={scope:t.getScope(e),object:e.init,rootIdentifierName:o?.name,rootVariable:o&&eS(t.getScope(e),o),thisScopeBoundary:"ThisExpression"===e.init.type?uP(e.init):void 0,objectPattern:e.id},i=t.getText(e.init);r.set(i,[...r.get(i)??[],a])});let l=e=>{let n,o;if((o=e).computed||tb(o.parent,void 0,tx)&&o.parent.callee===o||"TaggedTemplateExpression"===o.parent.type&&o.parent.tag===o||nG(o))return;let i=rN(e.object),s=r.get(t.getText(i));if(!s)return;let l=t.getScope(e),u="Identifier"===i.type?i:void 0,p=u&&eS(l,u),c="ThisExpression"===i.type?uP(i):void 0,d=t.getText(e.property);for(let r of s.toReversed())if(u$({declaration:r,memberExpressionNode:e,memberScope:l,memberRootIdentifier:u,memberRootVariable:p,memberThisScopeBoundary:c,memberExpressionWrites:a,sourceCode:t})&&(n=uN(r.objectPattern.properties.filter(e=>uL(e)&&"Identifier"===e.value.type),d,l,t)))break;if(!n||((e,t)=>{let r=e,{parent:n}=e;for(;n&&!uq(n);){if(uO(n,r,e,t))return!0;r=n,n=n.parent}return!1})(e,t))return;if("MemberExpression"===e.parent.type)return{node:e,messageId:uF};let m=t.getText(e),f=n.value.name;return{node:e,messageId:uF,suggest:[{messageId:uB,data:{expression:m,property:f},fix:t=>t.replaceText(e,f)}]}};e.on("MemberExpression",e=>{n.push(e)}),e.onExit("Program",function*(){for(let e of n){let t=l(e);t&&(yield t)}})},meta:{type:"suggestion",docs:{description:"Use destructured variables over properties.",recommended:!1},hasSuggestions:!0,messages:{[uF]:"Use destructured variables over properties.",[uB]:"Replace `{{expression}}` with destructured property `{{property}}`."},languages:["js/js"]}},"unicorn/new-for-builtins":{create:e=>{uK.listen({context:e}),uG.listen({context:e}),uJ.listen({context:e}),uX.listen({context:e})},meta:{type:"suggestion",docs:{description:"Enforce correct use of `new` for builtin constructors.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{enforce:"Use `new {{name}}()` instead of `{{name}}()`.",disallow:"Use `{{name}}()` instead of `new {{name}}()`.",disallowCallOrNew:"`{{name}}` is not a function or constructor.",[uV]:"Use `String(new Date())` instead of `Date()`.",[u_]:"Switch to `String(new Date())`."},languages:["js/js"]}},"unicorn/prefer-single-call":u1,"unicorn/no-process-exit":{create:e=>{if(0===e.sourceCode.lines[0].indexOf("#!"))return;let t=0,r=!1,n=[],o=e=>tR(e,{object:"process",methods:["on","once"],minimumArguments:1,optionalCall:!1,optionalMember:!1});e.on("CallExpression",e=>{tN(e)&&u3(e.arguments[0])&&(r=!0)}),e.on("ImportDeclaration",e=>{"Literal"===e.source.type&&u3(e.source)&&(r=!0)}),e.on("CallExpression",e=>{o(e)&&t++}),e.onExit("CallExpression",e=>{o(e)&&t--}),e.on("CallExpression",e=>{0===t&&tR(e,{object:"process",method:"exit",optionalCall:!1,optionalMember:!1})&&n.push(e)}),e.onExit("Program",function*(){if(!r)for(let e of n)yield{node:e,messageId:u2}})},meta:{type:"suggestion",docs:{description:"Disallow `process.exit()`.",recommended:"unopinionated"},messages:{[u2]:"Only use `process.exit()` in CLI apps. Throw an error instead."},languages:["js/js"]}},"unicorn/no-static-only-class":{create:function(e){e.on(["ClassDeclaration","ClassExpression"],t=>{if(!(t.superClass||t.decorators&&t.decorators.length>0||"ClassBody"!==t.body.type||0===t.body.body.length||t.body.body.some(e=>!function(e){let{private:t,static:r,declare:n,readonly:o,accessibility:a,decorators:i,key:s}=e;return(!!pn(e)||"MethodDefinition"===e.type)&&!!r&&!t&&"PrivateIdentifier"!==s.type&&!(n||o||void 0!==a||Array.isArray(i)&&i.length>0)}(e))))return{node:t,loc:function(e,t){let{sourceCode:r}=t,{body:n}=e,o=r.getTokenBefore(n),{start:a}=r.getLoc(e),{end:i}=r.getLoc(o);return{start:a,end:i}}(t,e),messageId:pt,fix:function(e,t){let{type:r,id:n,body:o,declare:a,abstract:i,implements:s,parent:l}=e;if(a||i||Array.isArray(s)&&s.length>0||"ClassExpression"===r&&n)return;let u="ClassDeclaration"===e.type&&"ExportDefaultDeclaration"===e.parent.type&&e.parent.declaration===e;if(u&&n)return;let{sourceCode:p}=t;for(let e of o.body)if(pn(e)&&(e.typeAnnotation||e.value&&p.getText(e.value).includes("this")))return;return function*(n){let a=p.getFirstToken(e);if(tX(a,{expected:{type:"Keyword",value:"class"},ruleId:"no-static-only-class"}),u||"ClassExpression"===r)if("ClassExpression"===r&&"ReturnStatement"===l.type&&p.getLoc(o).start.line!==p.getLoc(l).start.line&&p.text.slice(p.getRange(a)[1],p.getRange(o)[0]).trim()){yield n.replaceText(a,"{");let e=p.getFirstToken(o);yield n.remove(e)}else yield n.replaceText(a,""),yield i_(a,t,n);else yield n.replaceText(a,"const"),yield n.insertTextBefore(o,"= "),yield n.insertTextAfter(o,";");for(let e of o.body)yield function*(e,t,r){let{sourceCode:n}=t,o=n.getFirstToken(e);tX(o,{expected:{type:"Keyword",value:"static"},ruleId:"no-static-only-class"}),yield r.remove(o),yield i_(o,t,r);let a=pn(e)?n.getLastToken(e):n.getTokenAfter(e),i=eA(a);if(pn(e)){let{key:t,value:o}=e;if(o){let e=n.getTokenAfter(t,pr);yield r.replaceText(e,":")}else i?yield r.insertTextBefore(a,": undefined"):yield r.insertTextAfter(e,": undefined")}yield i?r.replaceText(a,","):r.insertTextAfter(e,",")}(e,t,n)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Disallow classes that only have static members.",recommended:"unopinionated"},fixable:"code",messages:{[pt]:"Use an object instead of a class with only static members."},languages:["js/js"]}},"unicorn/no-unreadable-array-destructuring":pi,"unicorn/no-useless-spread":{create:e=>{let{sourceCode:t}=e;e.on(["ArrayExpression","ObjectExpression"],r=>{if(!("SpreadElement"===r.parent.type&&r.parent.argument===r&&("ObjectExpression"===r.type&&"ObjectExpression"===r.parent.parent.type&&r.parent.parent.properties.includes(r.parent)||"ArrayExpression"===r.type&&("ArrayExpression"===r.parent.parent.type&&r.parent.parent.elements.includes(r.parent)||tb(r.parent.parent,void 0,tx)&&r.parent.parent.arguments.includes(r.parent)))))return;let n=r.parent,o=t.getFirstToken(n),a=n.parent.type,i={node:o,messageId:ps,data:{argumentType:"ArrayExpression"===r.type?"array":"object",parentDescription:pb[a]}};return"NewExpression"===a&&px(r)&&tE(n.parent,{names:pg,argumentsLength:1,allowSpreadElement:!0})?i:{...i,*fix(i){let s;yield i.remove(o),yield iM(r,i,e);let l=t.getFirstToken(r);yield i.remove(l);let[u,p]=t.getLastTokens(r,2);if(yield i.remove(p),eT(u)&&(yield i.remove(u)),tC(r)||tD(r)){let e=t.getTokenAfter(n);eT(e)&&(yield i.remove(e))}if("CallExpression"===a||"NewExpression"===a)for(let[e,n]of(s=t.getFirstToken(r),r.elements.map((e,n,o)=>{if(n===o.length-1){let e=t.getLastToken(r,{skip:1});return eT(e)?e:void 0}let a=t.getTokenAfter(e||s,eT);return s=a,a})).entries())null===r.elements[e]&&(yield i.insertTextBefore(n,"undefined"))}}}),e.on("ObjectExpression",r=>{if(!("ObjectExpression"===r.type&&r.properties.length>0&&r.properties.every(e=>"SpreadElement"===e.type&&"ObjectExpression"!==e.argument.type)))return;let n=r.parent;if(!tR(n,{object:"Object",method:"assign",minimumArguments:2,optionalMember:!1,optionalCall:!1}))return;let o=n.arguments.indexOf(r),a=n.arguments.slice(0,o).some(e=>"SpreadElement"!==e.type);if(o<=0||!a)return;let i={node:t.getFirstToken(r.properties[0]),messageId:pd};return t.getCommentsInside(r).length>0?i:{...i,suggest:[{messageId:pf,fix:t=>t.replaceText(r,r.properties.map(t=>to(t.argument,e)).join(", "))}]}}),e.on("NewExpression",e=>{if(tE(e,{names:pg,argumentsLength:1,allowSpreadElement:!0})&&"SpreadElement"===e.arguments[0].type&&"ArrayExpression"!==e.arguments[0].argument.type)return{node:e.arguments[0],messageId:pc,data:{constructorName:`new ${e.callee.name}(…)`}}}),e.on("ArrayExpression",t=>{if(!px(t))return;let{parent:r}=t;if(!("ForOfStatement"===r.type&&r.right===t||"YieldExpression"===r.type&&r.delegate&&r.argument===t||(tE(r,{names:pg,argumentsLength:1})||tE(r,{names:r9,minimumArguments:1})||tR(r,{object:"Promise",methods:["all","allSettled","any","race"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||tR(r,{objects:["Array",...r9],method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})||tR(r,{object:"Object",method:"fromEntries",argumentsLength:1,optionalCall:!1,optionalMember:!1}))&&r.arguments[0]===t))return;let n="",o=pl;switch(r.type){case"ForOfStatement":o=pu;break;case"YieldExpression":o=pp;break;case"NewExpression":n=`new ${r.callee.name}(…)`;break;case"CallExpression":n=`${r.callee.object.name}.${r.callee.property.name}(…)`}return{node:t,messageId:o,data:{parentDescription:n},fix:r=>pE(r,t,e)}}),e.on("ArrayExpression",t=>{if(!px(t))return;let r=t.elements[0].argument,n=!!tR(r,{methods:ph,optionalCall:!1,optionalMember:!1})&&nj(r.callee.object,e)&&nj(r,e);if(!n&&!(!nF(r,e)&&(tR(r,{methods:py,optionalCall:!1,optionalMember:!1})?!pv(r,e):tR(r,{method:"concat",optionalCall:!1,optionalMember:!1})?!("Identifier"===r.callee.object.type&&"Iterator"===r.callee.object.name||pv(r,e)):tR(r,{method:"split",optionalCall:!1,optionalMember:!1})||tR(r,{object:"Object",methods:["keys","values"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||"AwaitExpression"===r.type&&tR(r.argument,{object:"Promise",methods:["all","allSettled"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||tR(r,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1})||tE(r,{name:"Array"}))))return;let o={node:t,messageId:pm};return tE(r,{name:"Array"})||tR(r,{method:"slice",optionalCall:!1,optionalMember:!1})&&!n?o:Object.assign(o,{fix:r=>pE(r,t,e)})})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary spread.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[ps]:"Spread an {{argumentType}} literal in {{parentDescription}} is unnecessary.",[pl]:"`{{parentDescription}}` accepts an iterable as an argument, it's unnecessary to convert to an array.",[pu]:"`for…of` can iterate over an iterable, it's unnecessary to convert to an array.",[pp]:"`yield*` can delegate to an iterable, it's unnecessary to convert to an array.",[pc]:"`{{constructorName}}` accepts a single iterable argument, spreading is misleading.",[pd]:"`Object.assign(…)` source object with only spread properties is unnecessary.",[pm]:"Unnecessarily cloning an array.",[pf]:"Remove the object literal wrapper."},languages:["js/js"]}},"unicorn/no-useless-switch-case":{create:e=>{let t=rQ(e.physicalFilename);e.on("SwitchStatement",function*(r){let{cases:n}=r;if(!(n.length<2)&&null===n.at(-1).test)for(let r=n.length-2;r>=0;r--){let o=n[r];if(!pD(o))break;t&&pT(o)||(yield{node:o,loc:function(e,t){let{sourceCode:r}=t,n=e.test||r.getFirstToken(e),o=r.getTokenAfter(n,ew);return{start:r.getLoc(e).start,end:r.getLoc(o).end}}(o,e),messageId:pS,suggest:[{messageId:pC,fix:e=>e.remove(o)}]})}})},meta:{type:"suggestion",docs:{description:"Disallow useless case in switch statements.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[pS]:"Useless case in switch statement.",[pC]:"Remove this case."},languages:["js/js"]}},"unicorn/no-useless-undefined":pz,"unicorn/numeric-separators-style":pX,"unicorn/prefer-array-find":ci,"unicorn/prefer-array-flat-map":{create:e=>{e.on("CallExpression",t=>{if(!(tR(t,{method:"flat",optionalCall:!1,optionalMember:!1})&&(0===t.arguments.length||1===t.arguments.length&&"Literal"===t.arguments[0].type&&"1"===t.arguments[0].raw)&&tR(t.callee.object,{method:"map",optionalCall:!1})))return;let r=t.callee.object;if(tM(r.callee.object,cp)||nL(r.callee.object,e))return;let{sourceCode:n}=e,o=r.callee.property,a=rU(e,t,[r])||t.typeArguments||t.typeParameters||r.typeArguments||r.typeParameters?void 0:function*(r){yield iH(r,t,e),yield r.replaceText(o,"flatMap")};return{node:t,loc:{start:n.getLoc(o).start,end:n.getLoc(t).end},messageId:cs,fix:a}}),e.on("CallExpression",t=>{let r;if(!tR(t,{method:"flatMap",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||t.typeArguments||t.typeParameters)return;let n=t.callee.object;if(!tR(n,{method:"filter",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||n.typeArguments||n.typeParameters||r3(n.callee.object)||nB(n.callee.object,e))return;let{sourceCode:o}=e;if(o.getCommentsInside(t).length>0)return;let[a]=n.arguments,[i]=t.arguments;if(!cd(a)||!cd(i)||!("ArrayExpression"===(r=i.body).type&&r.elements.length>1))return;let[s]=a.params,[l]=i.params;if(!oT(s,l))return;let u=function(e,t){if(ta(e,t))return to(e,t);let r=t.sourceCode.getText(e);return it(e,t)?`(${r})`:r}(n.callee.object,e),p=o.getText(s),c=function(e,t){if(ta(e,t))return to(e,t);let r=t.sourceCode.getText(e);return cc.has(e.type)?`(${r})`:r}(a.body,e),d=o.getText(i.body);return{node:t.callee.property,messageId:cl,suggest:[{messageId:cu,fix:e=>e.replaceText(t,`${u}.flatMap(${p} => ${c} ? ${d} : [])`)}]}})},meta:{type:"suggestion",docs:{description:"Prefer `.flatMap(…)` over `.map(…).flat()` and `.filter(…).flatMap(…)`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[cs]:"Prefer `.flatMap(…)` over `.map(…).flat()`.",[cl]:"Prefer a single `.flatMap(…)` over `.filter(…).flatMap(…)`.",[cu]:"Replace `.filter(…).flatMap(…)` with a single `.flatMap(…)`."},languages:["js/js"]}},"unicorn/prefer-array-flat":cv,"unicorn/prefer-array-some":cT,"unicorn/prefer-default-parameters":{create:e=>{let{sourceCode:t}=e,r=[],n=(e,n,o,a)=>{let i,s=r.at(-1);if(!s||!n||!o||"Identifier"!==n.type||"LogicalExpression"!==o.type||"||"!==o.operator&&"??"!==o.operator||"Identifier"!==o.left.type||"Literal"!==o.right.type)return;let{name:l}=n,{left:{name:u},right:{raw:p}}=o;if(a&&l!==u)return;let c=eS(t.getScope(e),u);if(!c)return;let{references:d}=c,{params:m}=s,f=m.find(e=>"Identifier"===e.type&&e.name===u);if(((e,t,r)=>{for(let n of t.body.body){if(n===r)break;if(cI(e,n))return!0}return!1})(t,s,e)||a&&d[0].identifier!==n||!a&&d.length>1||(i=m.at(-1),!f||f!==i))return;let g=((e,t)=>{if("ArrowFunctionExpression"!==t.type||t.params.length>1)return!1;let[r]=t.params,n=e.getTokenBefore(r),o=e.getTokenAfter(r);return!o||!n||"("!==n.value||")"!==o.value})(t,s)?`(${l} = ${p})`:`${l} = ${p}`;return{node:e,messageId:cA,suggest:[{messageId:cw,fix:r=>[r.replaceText(f,g),((e,t,r)=>{let{line:n}=t.getLoc(r).start,{column:o}=t.getLoc(r).end,a=t.getText(r),i=t.lines[n-1];if(i.trim()===a)return e.removeRange([t.getIndexFromLoc({line:n,column:0}),t.getIndexFromLoc({line:n+1,column:0})]);if(" "===i[o]){let[n,o]=t.getRange(r);return e.removeRange([n,o+1])}return e.remove(r)})(r,t,e)]}]}};e.on(tA,e=>{r.push(e)}),e.onExit(tA,()=>{r.pop()}),e.on("AssignmentExpression",e=>{if("ExpressionStatement"===e.parent.type&&e.parent.expression===e)return n(e.parent,e.left,e.right,!0)}),e.on("VariableDeclarator",e=>{if("VariableDeclaration"===e.parent.type&&e.parent.declarations[0]===e)return n(e.parent,e.id,e.init,!1)})},meta:{type:"suggestion",docs:{description:"Prefer default parameters over reassignment.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[cA]:"Prefer default parameters over reassignment.",[cw]:"Replace reassignment with default parameter."},languages:["js/js"]}},"unicorn/prefer-logical-operator-over-ternary":{create:e=>{let{sourceCode:t}=e;e.on("ConditionalExpression",r=>{let{test:n,consequent:o,alternate:a}=r,i=function(e,t){let{test:r,consequent:n,alternate:o}=e,a=function(e,t){let r=cO(e);if(r?.kind==="nullish")return r;if("LogicalExpression"!==e.type)return;let n=cO(e.left),o=cO(e.right);if(n&&o&&cN(n.reference,o.reference,t)){if("||"===e.operator&&n.isTrueWhenNullish&&o.isTrueWhenNullish&&cq(n,o))return{reference:n.reference,isTrueWhenNullish:!0};if("&&"===e.operator&&!n.isTrueWhenNullish&&!o.isTrueWhenNullish&&cq(n,o))return{reference:n.reference,isTrueWhenNullish:!1}}}(r,t.sourceCode);if(!a||t.sourceCode.getCommentsInside(e).length>0)return;let{reference:i}=a;if(a.isTrueWhenNullish&&cN(i,o,t.sourceCode))return c$({context:t,conditionalExpression:e,left:o,right:n,operators:["??"]});if(!a.isTrueWhenNullish&&cN(i,n,t.sourceCode))return c$({context:t,conditionalExpression:e,left:n,right:o,operators:["??"]});let s=a.isTrueWhenNullish?n:o,l=a.isTrueWhenNullish?o:n;if(!tq(s)||!tF(l)||l.optional||!rk(rN(i),rN(l.object))||function(e){let t=e,{parent:r}=t;for(;rL(r)&&r.expression===t;)r=(t=r).parent;return"UnaryExpression"===r.type&&"delete"===r.operator&&r.argument===t||"CallExpression"===r.type&&r.callee===t||"TaggedTemplateExpression"===r.type&&r.tag===t}(e))return;let u=function(e,t){let{sourceCode:r}=t,n=rX(e,t);if(rV(t,n))return;let[o,a]=r.getRange(e),[i,s]=n;return r.text.slice(o,i)+(e.computed?"?.[":"?.")+r.text.slice(s,a)}(l,t);if(u)return{node:e,messageId:cF,suggest:[{messageId:cR,fix(r){let n=u;return aL(t.sourceCode.getTokenBefore(e),t,n)&&(n=`;${n}`),r.replaceText(e,n)}}]}}(r,e);return i||(cN(n,o,t)?c$({context:e,conditionalExpression:r,left:n,right:a}):"UnaryExpression"===n.type&&"!"===n.operator&&n.prefix&&cN(n.argument,a,t)?c$({context:e,conditionalExpression:r,left:n.argument,right:o}):void 0)})},meta:{type:"suggestion",docs:{description:"Prefer using a logical operator over a ternary.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[cj]:"Prefer using a logical operator over a ternary.",[cF]:"Prefer using optional chaining over a ternary.",[cB]:"Switch to `{{operator}}` operator.",[cR]:"Switch to optional chaining."},languages:["js/js"]}},"unicorn/prefer-optional-catch-binding":{create:e=>{e.on("CatchClause",t=>{let r=t.param;if(!r)return;let{sourceCode:n}=e;if(n.getDeclaredVariables(r.parent).some(e=>e.references.length>0))return;let{type:o,name:a,parent:i}=r,s=n.getCommentsInside(r).length>0;return{node:r,messageId:"Identifier"===o?cU:cW,data:{name:a},fix:s?void 0:function*(e){let t=n.getTokenBefore(r);tX(t,{test:ek,expected:"(",ruleId:"prefer-optional-catch-binding"});let o=n.getTokenAfter(r);tX(o,{test:eI,expected:")",ruleId:"prefer-optional-catch-binding"}),yield e.remove(t),yield e.remove(r),yield e.remove(o);let[,a]=n.getRange(o),[s]=n.getRange(i.body),l=n.text.slice(a,s),u=l.length-l.trimStart().length;0!==u&&(yield e.removeRange([a,a+u]))}}})},meta:{type:"suggestion",docs:{description:"Prefer omitting the `catch` binding parameter.",recommended:"unopinionated"},fixable:"code",messages:{[cU]:"Remove unused catch binding `{{name}}`.",[cW]:"Remove unused catch binding."},languages:["js/js"]}},"unicorn/prefer-regexp-test":du,"unicorn/prefer-set-has":dC,"unicorn/prefer-string-raw":{create:e=>{e.on("Literal",t=>{if(!ts(t)||function(e){let{parent:t}=e,{type:r}=t;return tv(t)||["Property","PropertyDefinition","MethodDefinition","AccessorProperty"].includes(r)&&!t.computed&&t.key===e||["TSAbstractPropertyDefinition","TSAbstractMethodDefinition","TSAbstractAccessorProperty","TSPropertySignature"].includes(r)&&t.key===e||["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"].includes(r)&&t.source===e||"ImportAttribute"===r&&(t.key===e||t.value===e)||"ImportSpecifier"===r&&t.imported===e||"ExportSpecifier"===r&&(t.local===e||t.exported===e)||"ExportAllDeclaration"===r&&t.exported===e||"JSXAttribute"===r&&t.value===e||"TSEnumMember"===r&&(t.initializer===e||t.id===e)||"TSModuleDeclaration"===r&&t.id===e||"TSExternalModuleReference"===r&&t.expression===e||"TSLiteralType"===r&&t.literal===e||"TSImportType"===r&&t.source===e}(t)||dD(t))return;let{sourceCode:r}=e,{raw:n}=t;if("\\"===n.at(-2)||!n.includes("\\\\")||n.includes("`")||n.includes("${")||r.getLoc(t).start.line!==r.getLoc(t).end.line)return;let o=dw(n.slice(1,-1),n.charAt(0));if(o===t.value)return{node:t,messageId:dT,*fix(r){yield iG(r,t,e),yield r.replaceText(t,`String.raw\`${o}\``)}}}),e.on("TemplateLiteral",t=>{if(!("TaggedTemplateExpression"===t.parent.type&&t.parent.quasi===t||t.quasis.every(({value:{cooked:e,raw:t}})=>e===t)||t.quasis.some(({value:{cooked:e,raw:t}})=>"\\"===e.at(-1)||dw(t)!==e)||dD(t)))return{node:t,messageId:dT,*fix(r){for(let n of(yield iG(r,t,e),yield r.insertTextBefore(t,"String.raw"),t.quasis)){let{cooked:t,raw:o}=n.value;t!==o&&(yield i1(n,t,e,r))}}}}),e.on("TaggedTemplateExpression",t=>{let{quasi:r,tag:n,parent:o}=t,{sourceCode:a}=e;if(!tF(n,{object:"String",property:"raw",optional:!1})||!a.isGlobalReference(n.object)||r.quasis.some(e=>e.value.raw.includes("\\")))return;let i=a.getText(r),s=r.expressions.length>0||/\r?\n/.test(i)?i:`'${i.slice(1,-1).replaceAll("'",()=>String.raw`\'`)}'`;return{node:n,messageId:dA,*fix(r){let n=a.getTokenBefore(t);aL(n,e,s)&&(yield r.insertTextBefore(t,";")),"ReturnStatement"!==o.type&&"ThrowStatement"!==o.type||oS(n,t.quasi,e)||ta(t,e)||(yield iV(r,o,e)),"YieldExpression"!==o.type||o.delegate||o.argument!==t||oS(n,t.quasi,e)||ta(t,e)||(yield r.insertTextBefore(t,"("),yield r.insertTextAfter(t,")")),yield r.replaceText(t.quasi,s),yield iM(t.tag,r,e),yield r.remove(t.tag)}}})},meta:{type:"suggestion",docs:{description:"Prefer using the `String.raw` tag to avoid escaping `\\`.",recommended:"unopinionated"},fixable:"code",messages:{[dT]:"`String.raw` should be used to avoid escaping `\\`.",[dA]:"Using `String.raw` is unnecessary as the string does not contain any `\\`."},languages:["js/js"]}},"unicorn/prefer-switch":dP,"unicorn/require-number-to-fixed-digits-argument":{create:e=>{e.on("CallExpression",t=>{if(!tR(t,{method:"toFixed",argumentsLength:0,optionalCall:!1})||"NewExpression"===t.callee.object.type)return;let{sourceCode:r}=e,[n,o]=r.getLastTokens(t,2);return{loc:{start:r.getLoc(n).start,end:r.getLoc(o).end},messageId:dL,fix:r=>iO(r,t,"0",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the digits argument with `Number#toFixed()`.",recommended:"unopinionated"},fixable:"code",messages:{[dL]:"Missing the digits argument."},languages:["js/js"]}},"unicorn/template-indent":{create:e=>{let{sourceCode:t}=e,r={...e.options[0]},n=(e=>{let t=new i,r=[e.ast];for(;r.length>0;){let n=r.pop();if(n){if("TemplateLiteral"===n.type){let{start:{line:r},end:{line:o}}=e.getLoc(n);for(let e=r+1;e<=o;e++)t.add(e)}for(let t of e.visitorKeys[n.type]??[]){let e=n[t];Array.isArray(e)?r.push(...e):r.push(e)}}}return t})(t);r.comments=r.comments.map(e=>e.toLowerCase());let o=new l,a=a=>{let i;if("TemplateLiteral"!==a.type||o.has(a))return;o.add(a);let s="__PLACEHOLDER__"+Math.random(),l=a.quasis.map(e=>t.getText(e).slice(1,e.tail?-1:-2)).join(s),u=l.match(/\r?\n/);if(!u)return;let p=u[0],c=t.getLoc(a),d=t.lines[c.start.line-1].match(/^(\s*)\S/),m=d?d[1]:"";i="string"==typeof r.indent?r.indent:"number"==typeof r.indent?" ".repeat(r.indent):((e,t,r,n)=>{if(""===r){let r;return dU(dV(e.lines,t)).indent||dU(dN(r=dV(n.split(/\r?\n/)))).indent||dU(r).indent||" "}return r.startsWith(" ")?" ":" "})(t,n,m,l);let f=dN(l).replaceAll(RegExp(`^${p}|${p}[ ]*$`,"g"),""),g=p+d$(f,1,{indent:m+i})+p+m;if(g!==l)return{node:a,messageId:dW,fix:t=>g.split(s).map((r,n)=>i1(a.quasis[n],r,e,t))}};e.on("TemplateLiteral",e=>{if((e=>{if(r.comments.length>0){let n=t.getTokenBefore(e,{includeComments:!0});if(n?.type==="Block"&&r.comments.includes(n.value.trim().toLowerCase()))return!0}return!!(dD(e)||r.tags.length>0&&tO(e,r.tags))||!!(r.functions.length>0&&"CallExpression"===e.parent.type&&e.parent.arguments.includes(e)&&tM(e.parent.callee,r.functions))})(e))return a(e)}),e.on(r.selectors,e=>a(e))},meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation.",recommended:!0},fixable:"code",schema:d_,defaultOptions:[{tags:["outdent","dedent","gql","sql","html","styled"],functions:["dedent","stripIndent"],selectors:[],comments:["HTML","indent"]}],messages:{[dW]:"Templates should be properly indented."},languages:["js/js"]}},"unicorn/no-single-promise-in-promise-methods":{create:e=>{e.on("CallExpression",t=>{if(!(tR(t,{object:"Promise",methods:u5,optionalMember:!1,optionalCall:!1,argumentsLength:1})&&"ArrayExpression"===t.arguments[0].type&&1===t.arguments[0].elements.length&&t.arguments[0].elements[0]&&"SpreadElement"!==t.arguments[0].elements[0].type))return;let r=t.callee.property.name,n={node:t.arguments[0],messageId:u8,data:{method:r}},{sourceCode:o}=e;if("AwaitExpression"===t.parent.type&&t.parent.argument===t&&("all"!==r||tT(t.parent.parent)))return n.fix=r=>r.replaceText(t,u4(t,e)),n;return"all"===r?(n.fix=((e,t)=>{let{sourceCode:r}=t;if(u7(r,e))return;let n=e.parent;if("AwaitExpression"!==n.type||n.argument!==e)return;let o=(e=>{let{parent:t}=e;return"VariableDeclarator"===t.type&&t.init===e&&pe(t.id)?t.id:"AssignmentExpression"===t.type&&t.right===e&&pe(t.left)&&tT(t.parent)?t.left:void 0})(n);if(o){if(u7(r,o))return;return function*(n){yield n.replaceText(o,r.getText(o.elements[0])),yield n.replaceText(e,u4(e,t))}}let a=n.parent;if("MemberExpression"===a.type&&a.computed&&ti(a.property,0)&&a.object===n&&("VariableDeclarator"===a.parent.type&&a.parent.init===a||"AssignmentExpression"===a.parent.type&&a.parent.right===a)&&!u7(r,a))return r=>r.replaceText(a,`await ${u4(e,t)}`)})(t,e),n):(n.suggest=[{messageId:u6,fix:r=>{let[n]=t.arguments[0].elements,o=to(n,e);return ta(n,e)||"Identifier"===n.type||"MemberExpression"===n.type||(o=`(${o})`),aL(e.sourceCode.getTokenBefore(t),e,o)&&(o=`;${o}`),r.replaceText(t,o)}},{messageId:u9,fix:function*(e){let r=t.callee.property;yield e.replaceText(r,"resolve");let[n]=t.arguments,a=o.getFirstToken(n),[i,s]=o.getLastTokens(n,2);yield e.remove(a),yield e.remove(s),eT(i)&&(yield e.remove(i))}}],n)})},meta:{type:"suggestion",docs:{description:"Disallow passing single-element arrays to `Promise` methods.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[u8]:"Wrapping single-element array with `Promise.{{method}}()` is unnecessary.",[u6]:"Use the value directly.",[u9]:"Switch to `Promise.resolve(…)`."},languages:["js/js"]}},"unicorn/no-await-in-promise-methods":{create:e=>{e.on("CallExpression",function*(t){if(tR(t,{object:"Promise",methods:dG,optionalMember:!1,optionalCall:!1,argumentsLength:1})&&"ArrayExpression"===t.arguments[0].type)for(let r of t.arguments[0].elements)r?.type==="AwaitExpression"&&(yield{node:r,messageId:dz,data:{method:t.callee.property.name},suggest:[{messageId:dK,*fix(t){let n=e.sourceCode.getFirstToken(r);yield t.remove(n),yield i_(n,e,t)}}]})})},meta:{type:"suggestion",docs:{description:"Disallow using `await` in `Promise` method parameters.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[dz]:"Promise in `Promise.{{method}}()` should not be awaited.",[dK]:"Remove `await`."},languages:["js/js"]}},"unicorn/no-negation-in-equality-check":{create:e=>{e.on("BinaryExpression",t=>{let{operator:r,left:n}=t;if(!("BinaryExpression"===t.type&&dY.has(t.operator)&&dH(n))||dH(n.argument))return;let{sourceCode:o}=e,a=o.getFirstToken(n),i=`${r.startsWith("!")?"=":"!"}${r.slice(1)}`;return{node:a,messageId:dJ,suggest:[{messageId:dX,data:{operator:i},*fix(s){yield iG(s,t,e);let l=o.getTokenAfter(a),{parent:u}=t;("ReturnStatement"===u.type||"ThrowStatement"===u.type)&&!ta(t,e)&&(oS(o.getFirstToken(u),l,e)||(yield iV(s,u,e))),yield s.remove(a),aL(o.getTokenBefore(a),e,l.value)&&(yield s.insertTextAfter(a,";"));let p=o.getTokenAfter(n,e=>"Punctuator"===e.type&&e.value===r);yield s.replaceText(p,i)}}]}})},meta:{type:"problem",docs:{description:"Disallow negated expression in equality check.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[dJ]:"Negated expression is not allowed in equality check.",[dX]:"Switch to '{{operator}}' check."},languages:["js/js"]}},"unicorn/no-unnecessary-slice-end":{create(e){dQ(e,{methods:["slice"],messageId:dZ})},meta:{type:"suggestion",docs:{description:"Disallow using `.length` or `Infinity` as the `end` argument of `{Array,String,TypedArray}#slice()`.",recommended:"unopinionated"},fixable:"code",messages:{[dZ]:"Passing `{{description}}` as the `end` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-lonely-if":{create:e=>{e.on("IfStatement",t=>{if(mg(t)&&("BlockStatement"===t.parent.type&&1===t.parent.body.length&&t.parent.body[0]===t&&mg(t.parent.parent)&&t.parent.parent.consequent===t.parent||mg(t.parent)&&t.parent.consequent===t))return{node:t,messageId:mf,fix:function(e,t){let{sourceCode:r}=t;return n=>{var o,a;let i=("BlockStatement"===e.parent.type?e.parent:e).parent,s={...i,...my(i,r)},l={...e,...my(e,r)},u=mE(s,r),p=mv(s,t,r),c=mb(mx(mE(l,r)),mv(l,t,r)),d=function(e,t,r,n){let o=[...n.getRange(e)];if("BlockStatement"===t.type)return o;let a=n.getLastToken(t);if(eB(a)){let t=n.getTokenAfter(e);t&&aL(a,r,t.value)&&(o[1]=n.getRange(t)[0])}return o}(i,l.consequent,t,r),m={outerConditionGap:s.openingBraceToken?mx(mh(s.closingParenthesisToken,s.openingBraceToken,r)):"",outerLeadingContent:s.openingBraceToken?mx(mh(s.openingBraceToken,l.ifToken,r)):mx(mh(s.closingParenthesisToken,l.ifToken,r)),outerTrailingContent:s.openingBraceToken?mx(mh(l,s.closingBraceToken,r)):""},f=(o=m.outerConditionGap,a=m.outerLeadingContent,o.trimStart().startsWith("//")?{leadingStatementText:mx(a).trimStart(),conditionSuffixText:o}:{leadingStatementText:mx(mb(o,a)).trimStart(),conditionSuffixText:""}),{leadingStatementText:g}=f,y=function({outerIfStatement:e,inner:t,replacementRange:r,sourceCode:n,consequentTextPieces:o,outerConditionGapTextPieces:a}){let{outerTrailingContent:i}=o,{conditionSuffixText:s}=a;if("BlockStatement"===t.consequent.type){let e=mh(t.closingParenthesisToken,t.openingBraceToken,n),r=mh(t.openingBraceToken,t.closingBraceToken,n);return`${s}${e}{${r}${i}}`}let l=mh(t.closingParenthesisToken,t.consequent,n),u=`${s}${l}${((e,t)=>{let[r,n]=t.getRange(e);return t.text.slice(r,n)})(t.consequent,n)}${i}`;return`${u}${((e,t,r)=>{let[,n]=r.getRange(e);if(t[1]===n)return"";let o=r.text.slice(n,t[1]);return""===o.trim()?o.includes("\n")?`;${o}`:";":`;${o}`})(e,r,n)}`}({outerIfStatement:i,inner:l,replacementRange:d,sourceCode:r,consequentTextPieces:m,outerConditionGapTextPieces:f});return n.replaceTextRange(d,`${g}if${u}(${p} && ${c})${y}`)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Disallow `if` statements as the only statement in `if` blocks without `else`.",recommended:"unopinionated"},fixable:"code",messages:{[mf]:"Unexpected `if` as the only statement in a `if` block without `else`."},languages:["js/js"]}},"unicorn/no-magic-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!tR(t,{method:"flat",argumentsLength:1,optionalCall:!1}))return;let[r]=t.arguments;if(!tp(r)||1===r.value)return;let{sourceCode:n}=e,{openingParenthesisToken:o,closingParenthesisToken:a}=rD(t,e);if(!(n.commentsExistBetween(o,a)||nL(t.callee.object,e)))return{node:r,messageId:mS}})},meta:{type:"suggestion",docs:{description:"Disallow a magic number as the `depth` argument in `Array#flat(…).`",recommended:"unopinionated"},messages:{[mS]:"Magic number as depth is not allowed."},languages:["js/js"]}},"unicorn/no-negated-condition":{create:e=>{e.on(["IfStatement","ConditionalExpression"],t=>{if("IfStatement"===t.type&&(!t.alternate||"IfStatement"===t.alternate.type))return;let{test:r}=t;if("UnaryExpression"===r.type&&"!"===r.operator||"BinaryExpression"===r.type&&("!="===r.operator||"!=="===r.operator))return{node:r,messageId:mC,*fix(n){if(yield function*(e,t,r){let{sourceCode:n}=r,{test:o}=t;if("UnaryExpression"===o.type){let a=n.getFirstToken(o);"IfStatement"===t.type&&(yield iM(o.argument,e,r)),yield e.remove(a);return}let a=n.getTokenAfter(o.left,e=>"Punctuator"===e.type&&e.value===o.operator);yield e.replaceText(a,"="+a.value.slice(1))}(n,t,e),yield function*(e,t,r){let n="IfStatement"===t.type,[o,a]=[t.consequent,t.alternate].map(e=>{let t=tn(e,r),o=r.sourceCode.text.slice(...t);return n&&"BlockStatement"!==e.type&&(o=`{${o}}`),{range:t,text:o}});if(o.text===a.text)return;let{sourceCode:i}=r;yield e.replaceTextRange(i.getRange(o),a.text),yield e.replaceTextRange(i.getRange(a),o.text)}(n,t,e),"ConditionalExpression"!==t.type||"UnaryExpression"!==r.type)return;yield iG(n,t,e);let{sourceCode:o}=e,{parent:a}=t,[i,s]=o.getFirstTokens(r,2);"ReturnStatement"!==a.type&&"ThrowStatement"!==a.type||a.argument!==t||oS(i,s,e)||ta(t,e)||ta(r,e)?aL(o.getTokenBefore(t),e,s.value)&&(yield n.insertTextBefore(t,";")):yield iV(n,a,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow negated conditions.",recommended:"unopinionated"},fixable:"code",messages:{[mC]:"Unexpected negated condition."},languages:["js/js"]}},"unicorn/no-object-as-default-parameter":{create:e=>{e.on("AssignmentPattern",e=>{if(!("ObjectExpression"===e.right.type&&e.right.properties.length>0&&tw(e.parent)&&e.parent.params.includes(e)))return;let{left:t,right:r}=e;return"Identifier"===t.type?{node:t,messageId:mD,data:{parameter:t.name}}:{node:r,messageId:mT}})},meta:{type:"problem",docs:{description:"Disallow the use of objects as default parameters.",recommended:"unopinionated"},messages:{[mD]:"Do not use an object literal as default for parameter `{{parameter}}`.",[mT]:"Do not use an object literal as default."},languages:["js/js"]}},"unicorn/prefer-negative-index":{create:e=>{e.on("CallExpression",t=>{if("MemberExpression"!==t.callee.type)return;let r=function(e){let{callee:t,arguments:r}=e,n=t.property.name,o=t.object,a=r;if(mw.has(n))return{method:n,target:o,argumentsNodes:a};if("call"!==n&&"apply"!==n||(n=mk(t.object),!mw.has(n)))return;let i="apply"===t.property.name,{supportObjects:s}=mw.get(n),l=t.object.object;if(tC(l)||"slice"===n&&ti(l,"")||"prototype"===mk(l)&&"Identifier"===l.object.type&&s.has(l.object.name)){if([o]=r,i){let[,e]=r;if(!e||"ArrayExpression"!==e.type)return;a=e.elements}else a=r.slice(1);return{method:n,target:o,argumentsNodes:a}}}(t);if(!r)return;let{method:n,target:o,argumentsNodes:a}=r,{argumentsIndexes:i}=mw.get(n),s=i.map(e=>(function e(t,r){let n;if(!t)return;let{type:o,operator:a,left:i,right:s}=t=rN(t);if("BinaryExpression"===o&&"-"===a&&tp(n=rN(s))&&n.value>0)return pF(i,r)?i:e(i,r)})(a[e],o)).filter(Boolean);if(0!==s.length)return{node:t,messageId:mA,data:{method:n},*fix(t){for(let r of s)yield function(e,t,r){let[n,o]=tn(e,r);return t.removeRange([n,o+r.sourceCode.text.slice(o).match(/\S|$/).index])}(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Prefer negative index over `.length - index` when possible.",recommended:"unopinionated"},fixable:"code",messages:{[mA]:"Prefer negative index over length minus index for `{{method}}`."},languages:["js/js"]}},"unicorn/prefer-node-protocol":{create:e=>{e.on("Literal",t=>{if(!(["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration","ImportExpression","TSImportType"].includes(t.parent.type)&&t.parent.source===t||(tR(t.parent,{object:"process",method:"getBuiltinModule",argumentsLength:1,optionalCall:!1,optionalMember:!1})||tN(t.parent))&&t.parent.arguments[0]===t))return;let{value:r}=t;if(!("string"==typeof r&&!r.startsWith(mB)&&mj(r)&&mj(`${mB}${r}`)))return;let n=e.sourceCode.getRange(t)[0]+1;return{node:t,messageId:mF,data:{moduleName:r},fix:e=>e.insertTextAfterRange([n,n],mB)}})},meta:{type:"suggestion",docs:{description:"Prefer using the `node:` protocol when importing Node.js builtin modules.",recommended:"unopinionated"},fixable:"code",messages:{[mF]:"Prefer `node:{{moduleName}}` over `{{moduleName}}`."},languages:["js/js"]}},"unicorn/consistent-date-clone":{create:e=>{e.on("NewExpression",t=>{if(!tE(t,{name:"Date",argumentsLength:1}))return;let[r]=t.arguments;if(!tR(r,{method:"getTime",argumentsLength:0,optionalCall:!1,optionalMember:!1}))return;let{sourceCode:n}=e;return{node:r,loc:{start:n.getLoc(r.callee.property).start,end:n.getLoc(r).end},messageId:mR,fix:t=>iH(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Prefer passing `Date` directly to the constructor when cloning.",recommended:"unopinionated"},fixable:"code",messages:{[mR]:"Unnecessary `.getTime()` call."},languages:["js/js"]}},"unicorn/no-accessor-recursion":{create:e=>{let{sourceCode:t}=e;e.on("ThisExpression",e=>{let r=((e,t)=>{for(let r=e.getScope(t);r;r=r.upper){if("class"===r.type)return;if("function"===r.type&&"ArrowFunctionExpression"!==r.block.type)return r}})(t,e);if(!r)return;let n=r.block.parent;if(["Property","MethodDefinition"].includes(n?.type)&&!n.computed&&["set","get"].includes(n.kind)&&mL(n.key)&&("get"===n.kind&&(m$(e,n)||"VariableDeclarator"===e.parent.type&&e.parent.init===e&&"ObjectPattern"===e.parent.id.type&&e.parent.id.properties.some(e=>"Property"===e.type&&!e.computed&&mN(e.key,n.key)))||"set"===n.kind&&((e,t)=>{if(!m$(e,t))return!1;let r=e.parent,{parent:n}=r;return("AssignmentExpression"===n.type||"AssignmentPattern"===n.type)&&n.left===r||"UpdateExpression"===n.type&&n.argument===r||"ArrayPattern"===n.type&&n.elements.includes(r)||"RestElement"===n.type&&n.argument===r||("ForOfStatement"===n.type||"ForInStatement"===n.type)&&n.left===r||"Property"===n.type&&n.value===r&&"ObjectPattern"===n.parent.type&&n.parent.properties.includes(r.parent)})(e,n)))return{node:e.parent,messageId:mP,data:{kind:n.kind}}})},meta:{type:"problem",docs:{description:"Disallow recursive access to `this` within getters and setters.",recommended:"unopinionated"},defaultOptions:[],messages:{[mP]:"Disallow recursive access to `this` within {{kind}}ters."},languages:["js/js"]}},"unicorn/prefer-import-meta-properties":{create:function(e){let{sourceCode:t}=e;e.on("MetaProperty",function*(e){if("MetaProperty"!==e.type||"import"!==e.meta.name||"meta"!==e.property.name)return;let r=e.parent;if(!tF(r,{properties:["url","filename"],computed:!1,optional:!1}))return;let n=r.property.name;if("url"===n){if(mU(r.parent,t)&&r.parent.arguments[0]===r)return void(yield a(r.parent,{reportFilenameNode:!0}));if(tE(r.parent,{name:"URL",minimumArguments:1,maximumArguments:2})){var o;let e=r.parent,n=e.parent;if(1===e.arguments.length&&e.arguments[0]===r&&mU(n,t)&&n.arguments[0]===e)return void(yield a(n,{reportFilenameNode:!0}));2===e.arguments.length&&(o=e.arguments[0],o?.type==="Literal"&&("."===o.value||"./"===o.value))&&e.arguments[1]===r&&mU(n,t)&&n.arguments[0]===e&&(yield i(n,"dirname"))}return}function*a(e,{reportFilenameNode:r=!1}={}){let{parent:n}=e;if(mW(n,t)&&n.arguments[0]===e)return void(yield i(n,"dirname"));if(r&&(yield i(e,"filename")),"VariableDeclarator"!==n.type||n.init!==e||"Identifier"!==n.id.type||"VariableDeclaration"!==n.parent.type||"const"!==n.parent.kind)return;let o=eS(t.getScope(n.id),n.id);if(o)for(let e of o.references){if(!e.isReadOnly())continue;let{parent:r}=e.identifier;mW(r,t)&&r.arguments[0]===e.identifier&&(yield i(r,"dirname"))}}function i(e,t){return{node:e,messageId:"dirname"===t?mM:mO,fix:r=>r.replaceText(e,`import.meta.${t}`)}}"filename"===n&&(yield a(r))})},meta:{type:"suggestion",docs:{description:"Prefer `import.meta.{dirname,filename}` over legacy techniques for getting file paths.",recommended:!1},fixable:"code",messages:{[mM]:"Do not construct dirname.",[mO]:"Do not construct filename using `fileURLToPath()`."},languages:["js/js"]}},"unicorn/no-unnecessary-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!(tR(t,{method:"flat",argumentsLength:1,optionalCall:!1})&&ti(t.arguments[0],1))||nL(t.callee.object,e))return;let[r]=t.arguments;return{node:r,messageId:mV,fix:t=>iq(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Disallow using `1` as the `depth` argument of `Array#flat()`.",recommended:"unopinionated"},fixable:"code",messages:{[mV]:"Passing `1` as the `depth` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-unnecessary-array-splice-count":{create(e){dQ(e,{methods:["splice","toSpliced"],messageId:m_,checkArrayReceiver:!0})},meta:{type:"suggestion",docs:{description:"Disallow using `.length` or `Infinity` as the `deleteCount` or `skipCount` argument of `Array#{splice,toSpliced}()`.",recommended:"unopinionated"},fixable:"code",messages:{[m_]:"Passing `{{description}}` as the `{{argumentName}}` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-useless-error-capture-stack-trace":{create:e=>{let t=[],r=[];e.on(["ClassDeclaration","ClassExpression"],e=>{t.push(e),r.push(e)}),e.onExit(["ClassDeclaration","ClassExpression"],()=>{t.pop(),r.pop()}),e.on(["FunctionDeclaration","FunctionExpression"],e=>{r.push(e)}),e.onExit(["FunctionDeclaration","FunctionExpression"],()=>{r.pop()}),e.on("CallExpression",n=>{let o,a=t.at(-1);if(!(a?.superClass&&"Identifier"===a.superClass.type&&uu.includes(a.superClass.name)&&e.sourceCode.isGlobalReference(a.superClass)&&(o=r.at(-1),o&&"MethodDefinition"===o.parent.type&&"constructor"===o.parent.kind&&o.parent.value===o&&a.body.body.includes(o.parent))&&tR(n,{object:"Error",method:"captureStackTrace",argumentsLength:2,optionalMember:!1})&&e.sourceCode.isGlobalReference(n.callee.object)))return;let[i,s]=n.arguments;if("ThisExpression"!==i.type||!((e,t,r)=>{if("MetaProperty"===e.type&&"Identifier"===e.meta.type&&"new"===e.meta.name&&"Identifier"===e.property.type&&"target"===e.property.name||tF(e,{property:"constructor",computed:!1,optional:!1})&&"ThisExpression"===e.object.type)return!0;if("Identifier"!==e.type||!t.id)return!1;let n=eS(r.sourceCode.getScope(e),e);return n&&1===n.defs.length&&"ClassName"===n.defs[0].type&&n.defs[0].node===t})(s,a,e))return;let l={node:n,messageId:mz},u="ChainExpression"===n.parent.type?n.parent.parent:n.parent;return"ExpressionStatement"===u.type&&"BlockStatement"===u.parent.type&&(l.fix=e=>e.remove(u)),l})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Error.captureStackTrace(…)`.",recommended:"unopinionated"},fixable:"code",messages:{[mz]:"Unnecessary `Error.captureStackTrace(…)` call."},languages:["js/js"]}},"unicorn/prefer-class-fields":{create:e=>{let{sourceCode:t}=e;e.on("ClassBody",r=>{let n=r.body.find(e=>"constructor"===e.kind&&!e.computed&&!e.static&&"MethodDefinition"===e.type&&"FunctionExpression"===e.value.type);if(!n)return;let o=n.value.body.body.find(e=>"EmptyStatement"!==e.type);if(!(o?.type==="ExpressionStatement"&&"AssignmentExpression"===o.expression.type&&"="===o.expression.operator&&"MemberExpression"===o.expression.left.type&&"ThisExpression"===o.expression.left.object.type&&!o.expression.left.computed&&["Identifier","PrivateIdentifier"].includes(o.expression.left.property.type)&&"Literal"===o.expression.right.type))return;let a=o.expression.left.property.name,i=o.expression.right.raw,s=o.expression.left.property.type,l=r.body.find(e=>"PropertyDefinition"===e.type&&!e.computed&&!e.static&&e.key.type===s&&e.key.name===a),u={node:o,messageId:mK};function*p(s){if(yield((e,t,r)=>{let{line:n}=t.getLoc(e).start,o=t.getText(e);return t.lines[n-1].trim()===o?r.removeRange([t.getIndexFromLoc({line:n,column:0}),t.getIndexFromLoc({line:n+1,column:0})]):r.remove(e)})(o,t,s),l){if(l.value)return void(yield s.replaceText(l.value,i));let e=` = ${i}`,r=t.getLastToken(l);return eA(r)?void(yield s.insertTextBefore(r,e)):void(yield s.insertTextAfter(l,`${e};`))}let u=t.getLastToken(r),p=rR(n,e),c=`${p}${a} = ${i};
|
|
47
|
+
${s}${c}${n}`)}for(let e of t)yield l.removeRange(S9(e,{leading:r,trailing:n,isStart:o},a))}}({ifStatement:e,blocks:t,leading:r,trailing:n,isStart:o},a);!o||function(e,t){for(let r=e;r?.type==="IfStatement";r=r.alternate)if(S3(r.test,t))return!1;return!0}(e,s)&&u.every(e=>"ExpressionStatement"===e.type&&!S3(e,s))?c.fix=i:c.suggest=[{messageId:S1,fix:i}]}return c}let{parse:S4}=lT,S7="prefer-single-replace",Ce=new i(["g","m","s"]),Ct=new o([["\\",String.raw`\\`],["]",String.raw`\]`],["\n",String.raw`\n`],["\r",String.raw`\r`],[" ",String.raw`\t`],["\f",String.raw`\f`],["\v",String.raw`\v`],["\u2028",String.raw`\u2028`],["\u2029",String.raw`\u2029`]]);function Cr(e){if(!tR(e,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1,optionalMember:!1,computed:!1}))return;let[t]=e.arguments;if(ts(t)){if("replaceAll"!==e.callee.property.name)return;return 1===t.value.length?t.value:void 0}if(tc(t))return function({pattern:e,flags:t}){let r;if(t.includes("g")){for(let e of t)if(!Ce.has(e))return;try{r=S4(e,t,{namedGroups:!0,lookbehind:!0})}catch{return}return function e(t){return"value"===t.type?String.fromCodePoint(t.codePoint):("alternative"!==t.type||1!==t.body.length)&&("characterClass"!==t.type||t.negative||1!==t.body.length)?void 0:e(t.body[0])}(r)}}(t.regex)}let Cn="consistent-tuple-labels",Co="no-invalid-well-known-symbol-methods/async-dispose",Ca="no-invalid-well-known-symbol-methods/dispose-generator",Ci="no-invalid-well-known-symbol-methods/sync-iterator",Cs="no-invalid-well-known-symbol-methods/async-iterator",Cl="no-invalid-well-known-symbol-methods/suggestion",Cu=new i(["Promise","PromiseLike"]),Cp=new i(["dispose","iterator","asyncIterator"]);function Cc(e){return"TSTypeReference"===e.type&&"Identifier"===e.typeName.type&&Cu.has(e.typeName.name)}function Cd(e,t){let r,n=function(e){if(e.computed&&"MemberExpression"===e.key.type&&!e.key.computed&&"Identifier"===e.key.object.type&&"Symbol"===e.key.object.name&&"Identifier"===e.key.property.type)return e.key.property.name}(e);if(!Cp.has(n))return;let o=function(e){if("get"!==e.kind&&"set"!==e.kind&&("MethodDefinition"===e.type||"PropertyDefinition"===e.type||"Property"===e.type))return e.value}(e);if(o?.type!=="FunctionExpression"&&o?.type!=="ArrowFunctionExpression")return;if("dispose"===n&&o.generator)return{node:e.key,messageId:Ca};let a=!o.async&&(!!(r=o.returnType?.typeAnnotation)&&("TSTypeReference"===r.type?Cc(r):"TSUnionType"===r.type&&r.types.some(e=>Cc(e)))||function(e,t){let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let t=r.program.getTypeChecker(),n=r.esTreeNodeToTSNodeMap.get(e),o=t.getSignatureFromDeclaration(n);if(o)return!0===oC(t.getReturnTypeOfSignature(o),t);return r.getTypeAtLocation(e).getCallSignatures().some(e=>!0===oC(t.getReturnTypeOfSignature(e),t))}catch{return!1}}(o,t));if("dispose"===n&&(o.async||a))return{node:e.key,messageId:Co,fix:t=>t.replaceText(e.key.property,"asyncDispose")};if("iterator"===n&&(o.async||a)){let t={node:e.key,messageId:Ci};return o.generator&&(t.suggest=[{messageId:Cl,data:{replacement:"asyncIterator"},fix:t=>t.replaceText(e.key.property,"asyncIterator")}]),t}if("asyncIterator"===n&&!o.generator&&(o.async||a))return{node:e.key,messageId:Cs}}let Cm="after-suspension",Cf="in-generator",Cg="in-nested-function",Cy=["preventDefault","stopImmediatePropagation","stopPropagation"],Ch="prefer-abort-signal-timeout",Cx="prefer-abort-signal-timeout/suggestion",Cb=new i(["reason","throwIfAborted"]),CE=(e,t)=>{let r,{parent:n}=e;if(!(!tF(n,{property:"signal",computed:!1,optional:!1})||n.object!==e||nG(n)||("ForInStatement"===n.parent.type||"ForOfStatement"===n.parent.type)&&n.parent.left===n||tF(n.parent)&&n.parent.object===n&&(r=n.parent,Cb.has(ez(r,t.sourceCode.getScope(r))))||(e=>{let{expression:t,parent:r}=(e=>{let t=e,{parent:r}=e;for(;rL(r);)t=r,r=r.parent;return{expression:t,parent:r}})(e);return"VariableDeclarator"===r.type&&r.init===t||"AssignmentExpression"===r.type&&r.right===t})(n)||rV(t,t.sourceCode.getRange(n))))return n},Cv=(e,t,r,n)=>{let o=eS(n.sourceCode.getScope(r),e);return o&&o!==t},CS="prefer-aggregate-error",CC=/[Ee]rrors$|[Ee]rror(?:List|Array|Collection)$/u,CD=new i(uu);function CT(e){for(;e?.type==="ParenthesizedExpression";)e=e.expression;return rN(e)}function CA(e){if("Identifier"===e.type)return e.name;if("TSQualifiedName"===e.type){let t=CA(e.left);return t?`${t}.${e.right.name}`:void 0}}function Cw(e){return e=e?.type==="TSTypeAnnotation"?e.typeAnnotation:e,e?.type==="TSTypeOperator"&&"readonly"===e.operator&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType"?Cw(e.typeAnnotation):e}function Ck(e,t,r,n=new i){switch(e=Cw(e),e?.type){case"TSTypeReference":{let o=CA(e.typeName);if(!o)return!1;let a=aM(o,t);if(CD.has(o)&&!((a?.defs.length??0)>0))return!0;if(n.has(o))return!1;n.add(o);let[i]=a?.defs??[],s=i?r.sourceCode.getScope(i.name):t,l=i?.type==="Type"&&"TSTypeAliasDeclaration"===i.node.type&&Ck(i.node.typeAnnotation,s,r,n);return n.delete(o),l}case"TSUnionType":return e.types.every(e=>Ck(e,t,r,n));case"TSIntersectionType":return e.types.some(e=>Ck(e,t,r,n));default:return!1}}function CI(e,t){let r;if(tF(e=CT(e),{property:"length",optional:!1})&&"Identifier"===e.object.type&&(r=e.object.name,CC.test(r))&&nj(e.object,t)&&function(e,t){let r=aM(e.name,t.sourceCode.getScope(e)),[n]=r?.defs??[],o=n?t.sourceCode.getScope(n.name):t.sourceCode.getScope(e);return function e(t,r,n,o=new i){switch(t=Cw(t),t?.type){case"TSArrayType":return Ck(t.elementType,r,n,o);case"TSTupleType":return t.elementTypes.length>0&&t.elementTypes.every(e=>Ck("TSNamedTupleMember"===e.type?e.elementType:"TSRestType"===e.type?e.typeAnnotation:e,r,n,o));case"TSTypeReference":return function(t,r,n,o){let a=CA(t.typeName),i=t.typeArguments?.params??t.typeParameters?.params;if(("Array"===a||"ReadonlyArray"===a)&&i?.length===1)return Ck(i[0],r,n,o);if(!a||o.has(a))return!1;o.add(a);let s=aM(a,r),[l]=s?.defs??[],u=l?n.sourceCode.getScope(l.name):r,p=l?.type==="Type"&&"TSTypeAliasDeclaration"===l.node.type&&e(l.node.typeAnnotation,u,n,o);return o.delete(a),p}(t,r,n,o);case"TSUnionType":return t.types.every(t=>e(t,r,n,o));case"TSIntersectionType":return t.types.some(t=>e(t,r,n,o));default:return!1}}(n?.name?.typeAnnotation,o,t)||function(e,t){let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let{program:t}=r;return function e(t,r,n,o=new i){if(!t||o.has(t))return!1;if(o.add(t),t.isUnion())return t.types.every(t=>e(t,r,n,o));if(t.isIntersection())return t.types.some(t=>e(t,r,n,o));let a=r.getBaseConstraintOfType(t);if(a&&a!==t)return e(a,r,n,o);if(!(r.isArrayType(t)||r.isTupleType(t)))return!1;let s=r.getTypeArguments(t);return s.length>0&&s.every(e=>(function e(t,r,n,o=new i){if(!t||o.has(t))return!1;if(o.add(t),t.isUnion())return t.types.every(t=>e(t,r,n,o));if(t.isIntersection())return t.types.some(t=>e(t,r,n,o));let a=r.getBaseConstraintOfType(t);if(a&&a!==t)return e(a,r,n,o);let s=r7(t);return!!(CD.has(s?.getName())&&ne(s,n))||nt(t,r).some(t=>e(t,r,n,o))})(e,r,n))}(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{return!1}}(e,t)}(e.object,t))return e.object}let Cj=(e,t,r)=>{var n;if(("!=="===e||"!="===e)&&ti(CT(t),0))return!0;let o=(n=CT(n=t),n?.type==="Literal"&&"number"==typeof n.value?n.value:void 0);return void 0!==o&&(r?">"===e&&o>=0||">="===e&&o>=1:"<"===e&&o>=0||"<="===e&&o>=1)},CF=e=>"LogicalExpression"!==(e=CT(e)).type||"&&"!==e.operator?[e]:[...CF(e.left),...CF(e.right)],CB={resize:"Prefer ResizeObserver over a resize listener with layout reads.",scroll:"Prefer IntersectionObserver over a scroll listener with layout reads."},CR=new i(Object.keys(CB)),CP=new i(["globalThis","self","window"]),CL=new i(["getBoundingClientRect","getClientRects"]),CN=new i(["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetParent","offsetTop","offsetWidth","scrollHeight","scrollWidth"]),C$=new i(["innerHeight","innerWidth"]),CM=new i(["height","width"]),CO=new i(["Window"]),Cq=new i(["VisualViewport"]),CU=new i(["Document","Element","HTMLElement","Node","SVGElement","VisualViewport","Window"]),CW=(e,t,r)=>{let n;if(r5.has(e.intrinsicName))return!1;if(r4.has(e.intrinsicName)||e.intrinsicName)return!0;if(e.isUnion()||e.isIntersection())return e.types.every(e=>CW(e,t,r));let o=t.getBaseConstraintOfType(e);if(o&&o!==e)return CW(o,t,r);let a=r7(e);return!(!a||nt(e,t).some(e=>!CW(e,t,r)))&&(!ne(a,r)||(n=a.getName(),!(CU.has(n)||/^HTML\w*Element$/.test(n)||/^SVG\w*Element$/.test(n))))},CV=(e,t,r,n)=>{if(r5.has(e.intrinsicName)||r4.has(e.intrinsicName))return!1;if(e.isUnion()){let o=e.types.filter(e=>!r4.has(e.intrinsicName));return o.length>0&&o.every(e=>CV(e,t,r,n))}if(e.isIntersection())return e.types.some(e=>CV(e,t,r,n));let o=t.getBaseConstraintOfType(e);if(o&&o!==e)return CV(o,t,r,n);let a=r7(e);return!!(a&&ne(a,r)&&n.has(a.getName()))||nt(e,t).some(e=>CV(e,t,r,n))},C_=(e,t,r)=>{let{parserServices:n}=t.sourceCode;if(!n?.program)return!1;try{let{program:t}=n,o=t.getTypeChecker();return CV(n.getTypeAtLocation(e),o,t,r)}catch{return!1}},Cz=(e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let{program:t}=r,n=t.getTypeChecker();return CW(r.getTypeAtLocation(e),n,t)}catch{return!1}},CK=e=>e.computed||"Identifier"!==e.property.type?tu(rN(e.property)):e.property.name,CG=(e,t)=>e.properties.some(e=>t.has((e=>{if("Property"===e.type)return e.computed||"Identifier"!==e.key.type?tu(rN(e.key)):e.key.name})(e))),CJ=(e,t)=>"Identifier"===e.type&&CP.has(e.name)&&oA(e,t),CX=e=>nG(e)&&"UpdateExpression"!==e.parent.type&&("AssignmentExpression"!==e.parent.type||e.parent.left!==e||"="===e.parent.operator),CY=(e,t)=>"Identifier"===(e=rN(e)).type?"visualViewport"===e.name&&oA(e,t):"MemberExpression"===e.type&&"visualViewport"===CK(e)&&CJ(rN(e.object),t),CH=(e,t)=>{var r;return CJ(e=rN(e),t)||("Identifier"===(r=rN(r=e)).type?"document"===r.name&&oA(r,t):"MemberExpression"===r.type&&"document"===CK(r)&&CJ(rN(r.object),t))||CY(e,t)},CQ=(e,t,r)=>{let n=rN(t);return CG(e,C$)&&(CJ(n,r)||C_(t,r,CO))||CG(e,CM)&&(CY(n,r)||C_(t,r,Cq))||CG(e,CN)&&!CH(n,r)&&!Cz(t,r)},CZ=(e,t,r=e)=>{let n,o,a,i;if(!e||e!==r&&tw(e))return!1;if(a=e,i=t,tb(a,void 0,ty)&&"MemberExpression"===a.callee.type&&CL.has(CK(a.callee))&&!CH(a.callee.object,i)&&!Cz(a.callee.object,i)||tL(e)&&C$.has(e.name)&&!CX(e)&&oA(e,t)||"MemberExpression"===e.type&&!CX(e)&&(n=CK(e),o=rN(e.object),C$.has(n)&&(CJ(o,t)||C_(e.object,t,CO))||CM.has(n)&&(CY(o,t)||C_(e.object,t,Cq))||CN.has(CK(e))&&!CH(e.object,t)&&!Cz(e.object,t))||("VariableDeclarator"===e.type&&"ObjectPattern"===e.id.type&&e.init?CQ(e.id,e.init,t):"AssignmentExpression"===e.type&&"ObjectPattern"===e.left.type&&CQ(e.left,e.right,t)))return!0;for(let n of t.sourceCode.visitorKeys[e.type]??[]){let o=e[n];if(Array.isArray(o)){if(o.some(e=>CZ(e,t,r)))return!0;continue}if(CZ(o,t,r))return!0}return!1},C0="prefer-set-methods/union",C1="prefer-set-methods/intersection",C2="prefer-set-methods/intersection-suggestion",C3="prefer-set-methods/difference",C8="prefer-set-methods/difference-suggestion",C6=(e,t)=>tE(e,{name:"Set",argumentsLength:1})&&oA(e.callee,t),C9=(e,t)=>{let r=to(e,t);return it(e,t)&&!ta(e,t)?`(${r})`:r},C5=(e,t,r)=>((e,t)=>{let r=e;for(;r.parent;){if("ExpressionStatement"===r.parent.type)return t.sourceCode.getRange(t.sourceCode.getFirstToken(r.parent.expression))[0]===t.sourceCode.getRange(t.sourceCode.getFirstToken(e))[0];r=r.parent}return!1})(e,r)&&aL(r.sourceCode.getTokenBefore(e),r,t)?`;${t}`:t,C4=(e,t)=>("ParenthesizedExpression"===e.type||rL(e))&&e.expression===t,C7=e=>{for(;e.parent;){let{parent:t}=e;if(C4(t,e)){e=t;continue}break}return e},De=(e,t)=>e?.type==="SpreadElement"&&"Set"===aY(e.argument,t),Dt=(e,t,r)=>{if(!(!tR(e,{method:"has",argumentsLength:1,optionalCall:!1,optionalMember:!1})||!rk(e.arguments[0],t)||rk(e.callee.object,t))&&"Set"===aY(e.callee.object,r))return e.callee.object},Dr=(e,t,r)=>{var n;if(r.sourceCode.getCommentsInside(t).length>0||(n=C7(n=e),n.parent?.type==="MemberExpression"&&n.parent.object===n)||e===t&&rL(e.parent))return;let o=((e,t)=>{if(!tR(e,{method:"filter",argumentsLength:1,optionalCall:!1,optionalMember:!1})||t.sourceCode.getCommentsInside(e).length>0)return;let r=((e,t)=>{if("ArrayExpression"===e.type&&1===e.elements.length&&De(e.elements[0],t))return e.elements[0].argument})(e.callee.object,t);if(!r)return;let[n]=e.arguments;if("ArrowFunctionExpression"!==n.type||n.async||1!==n.params.length||"Identifier"!==n.params[0].type)return;let o=((e,t,r)=>{let n=Dt(e,t,r);if(n)return{method:"intersection",messageId:C1,suggestionMessageId:C2,otherSet:n};if("UnaryExpression"!==e.type||"!"!==e.operator||!e.prefix)return;let o=Dt(e.argument,t,r);if(o)return{method:"difference",messageId:C3,suggestionMessageId:C8,otherSet:o}})(n.body,n.params[0],t);if(!(!o||eH(o.otherSet,t.sourceCode,{considerGetters:!0})))return{messageId:o.messageId,suggestionMessageId:o.suggestionMessageId,replacement:`${C9(r,t)}.${o.method}(${to(o.otherSet,t)})`}})(e,r);if(o)return{node:t,messageId:o.messageId,suggest:[{messageId:o.suggestionMessageId,fix:e=>e.replaceText(t,C5(t,o.replacement,r))}]}},Dn="prefer-toggle-attribute/error",Do="prefer-toggle-attribute/suggestion",Da=(e,t,r)=>{let n=to(e,t);return r?"UnaryExpression"===e.type&&"!"===e.operator&&e.prefix&&t.sourceCode.getCommentsInside(e).length===t.sourceCode.getCommentsInside(e.argument).length?Da(e.argument,t,!1):(!ta(e,t.sourceCode)&&ia(e,"!")&&(n=`(${n})`),`!${n}`):ta(e,t.sourceCode)||"SequenceExpression"!==e.type?n:`(${n})`},Di=(e,t,r)=>tR(e,{methods:t,argumentsLength:r,optionalCall:!1,computed:!1});function Ds(e){if(e?.type==="ChainExpression"&&(e=e.expression),Di(e,["removeAttribute","hasAttribute"],1)||Di(e,["setAttribute"],2)){let{callee:t}=e,[r,n]=e.arguments;if(tu(r)?.toLowerCase().startsWith("data-"))return;let o=t.property.name;return{node:e,method:o,receiver:t.object,attributeName:r,attributeValue:n,isOptional:!!t.optional,hasEmptyAttributeValue:"setAttribute"!==o||ti(n,"")}}}function Dl(e){if(e){if("BlockStatement"===e.type){if(1!==e.body.length)return;e=e.body[0]}return"ExpressionStatement"===e.type&&(e=e.expression),Ds(e)}}let Du=(e,t)=>e.isOptional===t.isOptional&&rk(e.receiver,t.receiver)&&rk(e.attributeName,t.attributeName),Dp=(e,t)=>oh(e.receiver)||nz(e.receiver,t),Dc="prefer-url-search-parameters/error",Dd="prefer-url-search-parameters/suggestion",Dm=new i(["node:url","url"]),Df=e=>"Type"===e.type||"ImportBinding"===e.type&&aN(e.node),Dg=(e,t,r)=>{let n=eS(r.sourceCode.getScope(t),e);return!n||n.defs.every(e=>Df(e))},Dy=(e,t)=>tu(rN(e))===t,Dh=(e,t)=>{let r=t.sourceCode.getText(e);return"SequenceExpression"===e.type?`(${r})`:r},Dx=(e,t)=>{if(!tR(e=rN(e),{method:"map",argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1})||e.typeArguments||e.typeParameters)return;let r=((e,t)=>{var r;let n;if(tR(e=rN(e),{method:"split",argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1})&&!(!Dy(e.arguments[0],"&")||of(e.callee.object,t)||(n=eV(r=e.callee.object,t.sourceCode.getScope(r)))&&"string"!=typeof n.value))return e})(e.callee.object,t);if(!r)return;let[n]=e.arguments,o="ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type||n.async||n.generator||1!==n.params.length||"Identifier"!==n.params[0].type?void 0:"BlockStatement"!==n.body.type?{parameter:n.params[0],returnExpression:n.body}:1===n.body.body.length&&"ReturnStatement"===n.body.body[0].type&&n.body.body[0].argument?{parameter:n.params[0],returnExpression:n.body.body[0].argument}:void 0;if(o&&((e,t,r)=>{let n;return!!tR(e=rN(e),{method:"split",minimumArguments:1,maximumArguments:2,computed:!1,optionalCall:!1,optionalMember:!1})&&!!oT(rN(e.callee.object),t)&&!!Dy(e.arguments[0],"=")&&(1===e.arguments.length||2===(n=e.arguments[1],eV(n,r.sourceCode.getScope(n))?.value))})(o.returnExpression,o.parameter,t))return{node:e,query:r.callee.object}},Db=(e,t)=>`new URLSearchParams(${Dh(e,t)})`,DE=(e,t,r,n)=>{let{sourceCode:o}=n,[a,i]=o.getRange(e),[s,l]=tn(t,n);return o.text.slice(a,s)+r+o.text.slice(l,i)},Dv=(e,t,r)=>{let[n,o]=r.sourceCode.getRange(e),[a,i]=tn(t,r);return[[n,a],[i,o]]},DS=({node:e,query:t,replacement:r,preservedNodes:n=[t]},o)=>{let a=(({node:e,replacement:t,preservedNodes:r},n)=>{let o;if(!(!(!(o=eS(n.sourceCode.getScope(e),"URLSearchParams"))||o.defs.every(e=>Df(e))||o.defs.some(e=>(e=>{if("ImportBinding"!==e.type)return!1;let{node:t,parent:r}=e;return Dm.has(r.source.value)&&"type"!==r.importKind&&"ImportSpecifier"===t.type&&"type"!==t.importKind&&"Identifier"===t.imported.type&&"URLSearchParams"===t.imported.name})(e)))||rU(n,e,r)))return[{messageId:Dd,data:{replacement:t},fix:r=>r.replaceText(e,t)}]})({node:e,replacement:r,preservedNodes:n},o);if(a)return{node:e,messageId:Dc,suggest:a}},DC="no-unsafe-promise-all-settled-values",DD=new i(["PromiseSettledResult","PromiseRejectedResult"]),DT=new i(["PromiseFulfilledResult"]),DA=new i(["ChainExpression","ParenthesizedExpression","TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),Dw=e=>e?.type==="ArrowFunctionExpression"||e?.type==="FunctionExpression"||e?.type==="FunctionDeclaration",Dk=e=>{for(;e&&DA.has(e.type);)e=e.expression;return e},DI=e=>tR(Dk(e),{object:"Promise",method:"allSettled",argumentsLength:1,optionalCall:!1,optionalMember:!1}),Dj=e=>e?.parent.type==="ReturnStatement"&&e.parent.argument===e,DF=e=>tR(Dk(e),{method:"filter",minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1});function DB(e){return"Identifier"===e.type?e.name:"TSQualifiedName"===e.type?DB(e.right):void 0}function DR(e){for(e=e?.type==="TSTypeAnnotation"?e.typeAnnotation:e;e?.type==="TSParenthesizedType"||e?.type==="TSTypeOperator";)e=e.typeAnnotation;return e?.type==="TSArrayType"?e.elementType:e?.type==="TSTypeReference"&&"Identifier"===e.typeName.type&&("Array"===e.typeName.name||"ReadonlyArray"===e.typeName.name)?e.typeArguments?.params[0]??e.typeParameters?.params[0]:void 0}function DP(e){return function e(t){if(t?.type==="TSTypeReference"){let e=DB(t.typeName);return DD.has(e)}return t?.type==="TSUnionType"&&t.types.some(t=>e(t))}(DR(e))}function DL(e){return function e(t){if(t?.type==="TSTypeReference"){let e=DB(t.typeName);return DT.has(e)}return t?.type==="TSUnionType"&&t.types.every(t=>e(t))}(DR(e))}function DN(e){if(e.isUnion())return e.types.every(e=>DN(e));let t=e.aliasSymbol??e.getSymbol();return DT.has(t?.getName())}function D$(e,t){if((e=t.getNonNullableType(e)).isUnion()){let r=e.types.map(e=>D$(e,t));return r.every(Boolean)?t.getUnionType(r):void 0}if(t.isArrayType(e)||t.isTupleType(e))return t.getTypeArguments(e)[0]}function DM(e,t){let{parserServices:r}=t.sourceCode;if(r?.program)try{return{checker:r.program.getTypeChecker(),type:r.getTypeAtLocation(e)}}catch{}}let DO=e=>e?.type==="TSAsExpression"||e?.type==="TSTypeAssertion";function Dq(e,t,r=new i){var n;let o;return!!(DO(o=e)&&DP(o.typeAnnotation))||!!(e=Dk(e))&&(n=Dk(n=e),!!(n?.type==="AwaitExpression"&&DI(n.argument)||DP(e.typeAnnotation)||function(e,t){let r=DM(e,t);if(!r)return!1;let{type:n,checker:o}=r,a=D$(n,o);return!!(a&&function e(t){if(t.isUnion())return t.types.some(t=>e(t));let r=t.aliasSymbol??t.getSymbol();return DD.has(r?.getName())}(a))}(e,t))||(DF(e)?Dq(e.callee.object,t,r):"Identifier"===e.type&&function(e,t,r){let n=eS(t.sourceCode.getScope(e),e);if(!n||r.has(n)||1!==n.defs.length)return!1;r.add(n);let[o]=n.defs,a=!!(DP(o.name?.typeAnnotation)||"Variable"===o.type&&"const"===o.parent.kind&&o.node.id===o.name&&o.node.init&&Dq(o.node.init,t,r));return r.delete(n),a}(e,t,r)))}let DU=e=>(e=Dk(e),e?.type==="Identifier"?e.name:void 0),DW=e=>{if(e=Dk(e),e?.type==="ObjectPattern"){for(let t of e.properties)if("Property"===t.type&&!t.computed&&"status"===ez(t)&&"Identifier"===t.value.type)return t.value}},DV=e=>{if(e?.type==="Literal"&&("fulfilled"===e.value||"rejected"===e.value))return e.value};function D_(e,t){return e=Dk(e),!!(t.statusVariable&&D0(e,t.statusVariable,t.context)||!t.statusVariable&&t.statusName&&e?.type==="Identifier"&&e.name===t.statusName||t.entryVariable&&e?.type==="MemberExpression"&&D0(e.object,t.entryVariable,t.context)&&"status"===ez(e))||!!(!t.entryVariable&&t.entryName&&e?.type==="MemberExpression"&&DU(e.object)===t.entryName&&"status"===ez(e))}function Dz(e,t){if(e=Dk(e),e?.type!=="BinaryExpression"||!["===","==","!==","!="].includes(e.operator))return;let r=D_(e.left,t)?DV(e.right):D_(e.right,t)?DV(e.left):void 0;if(!r)return;let n="==="===e.operator||"=="===e.operator;return n&&"fulfilled"===r||!n&&"rejected"===r?"fulfilled":"unfulfilled"}function DK(e,t){return"fulfilled"===Dz(e=Dk(e),t)||e?.type==="LogicalExpression"&&"&&"===e.operator&&(DK(e.left,t)||DK(e.right,t))}function DG(e,t){return"unfulfilled"===Dz(e=Dk(e),t)||e?.type==="LogicalExpression"&&"||"===e.operator&&(DG(e.left,t)||DG(e.right,t))}let DJ=(e,t,r)=>"ConditionalExpression"===e.type&&(e.consequent===t&&DK(e.test,r)||e.alternate===t&&DG(e.test,r)),DX=(e,t,r)=>"LogicalExpression"===e.type&&("&&"===e.operator&&e.right===t&&DK(e.left,r)||"||"===e.operator&&e.right===t&&DG(e.left,r)),DY=(e,t,r)=>"IfStatement"===e.type&&(e.consequent===t&&DK(e.test,r)||e.alternate===t&&DG(e.test,r)),DH=e=>{let t;if(!Dw(e)||0===e.params.length)return!1;let r={entryName:DU(e.params[0]),statusName:(t=e.params[0],DW(t)?.name)},n=Dk(e.body);if(n?.type==="BlockStatement"){let[e]=n.body;return 1===n.body.length&&"ReturnStatement"===e.type&&e.argument&&DK(e.argument,r)}return DK(n,r)};function DQ(e){if(e=Dk(e),e?.type==="ObjectPattern"){for(let t of e.properties)if("Property"===t.type&&!t.computed&&"value"===ez(t))return t}}let DZ=(e,t)=>"MemberExpression"===e.type&&"property"===t&&!e.computed||["Property","PropertyDefinition","MethodDefinition"].includes(e.type)&&"key"===t&&!e.computed;function D0(e,t,r){return e=Dk(e),e?.type==="Identifier"&&t&&eS(r.sourceCode.getScope(e),e)===t}function D1(e){for(e=Dk(e);DF(e);){if(DH(e.arguments[0]))return!0;e=Dk(e.callee.object)}return!1}function D2(e,t,{knownPromiseSettledResultArray:r=!1,branchAlwaysExits:n}={}){let o,a;if(!tR(e,{method:"map",minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1})||!r&&!Dq(e.callee.object,t)||function e(t,r,n=new i){return!!(DO(t)&&DL(t.typeAnnotation)||function(e,t){let r=DM(e,t);if(!r)return!1;let{type:n,checker:o}=r,a=D$(n,o);return!!(a&&DN(a))}(t=Dk(t),r))||("Identifier"===t.type?function(t,r,n){let o=eS(r.sourceCode.getScope(t),t);if(!o||n.has(o)||1!==o.defs.length)return!1;n.add(o);let[a]=o.defs,i=!!(DL(a.name?.typeAnnotation)||"Variable"===a.type&&"const"===a.parent.kind&&a.node.id===a.name&&a.node.init&&e(a.node.init,r,n));return n.delete(o),i}(t,r,n):DF(t)&&D1(t)&&Dq(t,r))}(e.callee.object,t))return;let[s]=e.arguments;if(!Dw(s)||0===s.params.length)return;let[l]=s.params;if(function(e,t){let r=DM(e,t);if(!r)return!1;let{type:n}=r;return DN(n)}(l,t))return;let u=DQ(l);if(u&&"Identifier"!==u.value.type)return{node:u.key,messageId:DC};let p=DU(l),c=p&&eS(t.sourceCode.getScope(l),l),d=(o=DQ(l),a=o?.value,a?.type==="Identifier"?a:a?.type==="AssignmentPattern"&&"Identifier"===a.left.type?a.left:void 0),m=d&&eS(t.sourceCode.getScope(d),d),f=DW(l),g=f?.name,y=f&&eS(t.sourceCode.getScope(f),f),h=function e(t,r){var n;if(n=t=Dk(t),n=Dk(n),(n?.type==="MemberExpression"&&D0(n.object,r.entryVariable,r.context)&&"value"===ez(n)||n?.type==="Identifier"&&D0(n,r.valueVariable,r.context))&&!function(e,t){for(let r=e,n=e.parent;n&&"ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type;r=n,n=n.parent){if(DJ(n,r,t)||DX(n,r,t)||DY(n,r,t)||function(e,t,r,n){let o,a=e.parent?.body;if(!Array.isArray(a))return!1;let i=a.indexOf(e),s=a[i-1];return s?.type==="IfStatement"&&!s.alternate&&DG(s.test,t)&&(o=s.consequent,aA(o,r,e=>{var t;return t=Dk(t=e),t?.type==="ReturnStatement"||t?.type==="ThrowStatement"||n(e)})||af(o,r))}(n,t,t.context,t.branchAlwaysExits))return!0;if(Dj(n))break}return!1}(t,r))return t;for(let[n,o]of Object.entries(t)){if("parent"===n||DZ(t,n)||!o||"object"!=typeof o)continue;let a=function(t,r){for(let n of t){if(!n?.type||Dw(n)||"ClassExpression"===n.type||"ClassDeclaration"===n.type)continue;let t=e(n,r);if(t)return t}}(Array.isArray(o)?o:[o],r);if(a)return a}}(s.body,{entryName:p,entryVariable:c,statusName:g,statusVariable:y,valueVariable:m,context:t,branchAlwaysExits:n});if(h)return{node:h,messageId:DC}}let D3="prefer-abort-signal-any",D8="prefer-abort-signal-any/suggestion",D6=new i(["reason","throwIfAborted"]),D9=new i(["capture","once","passive"]),D5=new i(["TSAsExpression","TSTypeAssertion","TSSatisfiesExpression"]),D4=e=>{let t=Array.isArray(e.parent.body)?e.parent.body:Array.isArray(e.parent.consequent)?e.parent.consequent:void 0;if(t)return t[t.indexOf(e)+1]},D7=(e,t,r)=>{let{sourceCode:n}=e,[,o]=n.getRange(t),[a]=n.getRange(r);return n.getAllComments().some(e=>{let[t,r]=n.getRange(e);return t>=o&&r<=a})},Te=e=>{let t=e,{parent:r}=e;for(;rL(r);)t=r,r=r.parent;return{expression:t,parent:r}},Tt=(e,t)=>{let{parent:r}=e;if(!(!tF(r,{property:"signal",computed:!1,optional:!1})||r.object!==e||nG(r)||("ForInStatement"===r.parent.type||"ForOfStatement"===r.parent.type)&&r.parent.left===r||((e,t)=>{let{expression:r,parent:n}=Te(e);return tF(n)&&n.object===r&&D6.has(ez(n,t.sourceCode.getScope(n)))})(r,t)||(e=>{let{expression:t,parent:r}=Te(e);return"VariableDeclarator"===r.type&&r.init===t||"AssignmentExpression"===r.type&&r.right===t})(r)||rV(t,t.sourceCode.getRange(r))))return r},Tr=(e,t,r)=>{if(r5.has(e.intrinsicName))return;if(r4.has(e.intrinsicName))return!1;if(e.isUnion()){let n=e.types.filter(e=>!r4.has(e.intrinsicName));if(0===n.length)return!1;let o=n.map(e=>Tr(e,t,r));return!!o.every(Boolean)||!o.every(e=>!1===e)&&void 0}if(e.isIntersection()){let n=e.types.map(e=>Tr(e,t,r));return!!n.some(Boolean)||!n.every(e=>!1===e)&&void 0}let n=t.getBaseConstraintOfType(e);if(n&&n!==e)return Tr(n,t,r);let o=r7(e);if(o&&ne(o,r))return"AbortSignal"===o.getName();let a=nt(e,t).map(e=>Tr(e,t,r));return!!a.some(Boolean)||!(a.length>0&&a.every(e=>!1===e))&&void 0},Tn=(e,t)=>tb(e,{optional:!1},ty)&&tF(e.callee,{object:"AbortSignal",properties:t,computed:!1,optional:!1}),To=e=>Tn(e,["any","timeout"]),Ta=e=>Tn(e,["any"]),Ti=(e,t)=>{if("Identifier"!==(e=rN(e)).type)return;let r=eS(t.sourceCode.getScope(e),e),n=r?.defs[0];if(r&&1===r.defs.length&&"Variable"===n.type&&"const"===n.parent.kind)return n.node.init},Ts=(e,t)=>{if("Identifier"!==(e=rN(e)).type)return!1;let r=eS(t.sourceCode.getScope(e),e),n=r?.defs[0];if(!r||1!==r.defs.length||"Variable"!==n.type||"const"!==n.parent.kind||!n.node.init)return!1;let[,o]=t.sourceCode.getRange(n.node.init),[a]=t.sourceCode.getRange(e);return r.references.some(r=>{if(r.init||r.identifier===e)return!1;let[n]=t.sourceCode.getRange(r.identifier);return n>o&&n<a})},Tl=(e,t,r)=>tb(e,{optional:!1},ty)&&tF(e.callee,{object:"Array",property:t,computed:!1,optional:!1})&&oA(e.callee.object,r),Tu=(e,t)=>(tb(e,{name:"Array",optional:!1},ty)||tE(e,{name:"Array"}))&&oA(e.callee,t),Tp=(e,t,r=new i)=>{if(e=rN(e),r.has(e))return!1;if(r.add(e),"SpreadElement"===e.type)return!0;if("ArrayExpression"===e.type)return e.elements.some(e=>e&&Tp(e,t,r));if(Tl(e,"of",t)||Tu(e,t))return e.arguments.some(e=>Tp(e,t,r));if(Tl(e,"from",t)){if(1!==e.arguments.length)return!0;let[n]=e.arguments;if("SpreadElement"===n.type)return!0;let o=Ti(n,t);if(o)return!!(!nj(o,t)||Ts(n,t))||Tp(o,t,r);let a=rN(n);return"ArrayExpression"!==a.type||Tp(a,t,r)}if(Ta(e))return e.arguments[0]&&Tp(e.arguments[0],t,r);let n=Ti(e,t);return n?!!(nj(n,t)&&Ts(e,t))||Tp(n,t,r):Tn(rN(e),["abort"])},Tc=(e,t,r,n=new i)=>{var o;if(e=rN(e),n.has(e))return!1;if(n.add(e),"SpreadElement"===e.type)return!0;if("ArrayExpression"===e.type)return e.elements.some(e=>e&&Tc(e,t,r,n));if(Tl(e,"of",r)||Tu(e,r))return e.arguments.some(e=>Tc(e,t,r,n));if(Tl(e,"from",r)){if(1!==e.arguments.length)return!0;let[o]=e.arguments;if("SpreadElement"===o.type)return!0;let a=Ti(o,r);if(a)return!!(!nj(a,r)||Ts(o,r))||Tc(a,t,r,n);let i=rN(o);return"ArrayExpression"!==i.type||Tc(i,t,r,n)}if(Ta(e))return e.arguments[0]&&Tc(e.arguments[0],t,r,n);let a=Ti(e,r);return a?!!(nj(a,r)&&Ts(e,r))||Tc(a,t,r,n):tF(o=rN(o=e),{property:"signal",computed:!1,optional:!1})&&"Identifier"===o.object.type&&o.object.name===t},Td=(e,t)=>{let r=((e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{let{program:t}=r;return Tr(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{}})(e=rN(e),t);if(!0===r)return!0;if(!1===r||t.sourceCode.parserServices?.program)return!1;if("Identifier"===e.type){let t;return"signal"===(t=e.name)||t.endsWith("Signal")}return To(e)},Tm=(e,t)=>"Identifier"===(e=rN(e)).type?Td(e,t):To(e)&&e.arguments.every(e=>"SpreadElement"!==e.type&&!eH(e,t.sourceCode)),Tf=(e,t)=>{if(!Tl(e,"from",t)||1!==e.arguments.length)return;let[r]=e.arguments;if("SpreadElement"===r.type)return;let n=rN(r);if("ArrayExpression"===n.type)return n;let o=Ti(r,t);if(o&&nj(o,t)&&!Ts(r,t))return o},Tg=(e,t,r=new i)=>{if(e=rN(e),r.has(e))return;if(r.add(e),"ArrayExpression"===e.type)return e.elements.every(e=>e&&"SpreadElement"!==e.type)?e.elements:void 0;if(Tl(e,"of",t)||Tu(e,t))return e.arguments.every(e=>"SpreadElement"!==e.type)?e.arguments:void 0;let n=Tf(e,t);if(n)return Tg(n,t,r);let o=Ti(e,t);if(o&&nj(o,t)&&!Ts(e,t))return Tg(o,t,r)},Ty=(e,t,r=new i)=>{if(e=rN(e),r.has(e))return!1;if(r.add(e),"Identifier"===e.type||"ArrayExpression"===e.type||Tl(e,"of",t)||Tu(e,t))return!0;let n=Tf(e,t);return!!n&&Ty(n,t,r)},Th=e=>"Identifier"===e.type?e.name:"TSQualifiedName"===e.type?Th(e.right):void 0,Tx=(e,t,r=new i)=>{if(e?.type==="TSTypeAnnotation"&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType")return Tx(e.typeAnnotation,t,r);if(e?.type!=="TSTypeReference")return!1;var n=e;let o=Th(n.typeName);if("AbortSignal"===o)return!0;if(!o||"Identifier"!==n.typeName.type||r.has(n.typeName.name))return!1;r.add(n.typeName.name);let a=eS(t.sourceCode.getScope(n),n.typeName),s=a?.defs[0],l=s?.type==="Type"&&"TSTypeAliasDeclaration"===s.node.type&&Tx(s.node.typeAnnotation,t,r);return r.delete(n.typeName.name),l},Tb=(e,t,r=new i)=>(e?.type==="TSTypeAnnotation"&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType")?Tb(e.typeAnnotation,t,r):e?.type==="TSTypeOperator"?"readonly"===e.operator?Tb(e.typeAnnotation,t,r):void 0:e?.type==="TSArrayType"?Tx(e.elementType,t,r):e?.type==="TSTupleType"?e.elementTypes.length>0&&e.elementTypes.every(e=>Tx("TSNamedTupleMember"===e.type?e.elementType:e,t,r)):e?.type==="TSTypeReference"?((e,t,r)=>{let n,o=Th(e.typeName),a=e.typeArguments?.params??e.typeParameters?.params;if(("Array"===o||"ReadonlyArray"===o)&&a?.length===1)return Tx(a[0],t,r);if(!o||"Identifier"!==e.typeName.type||r.has(e.typeName.name))return!1;r.add(e.typeName.name);let i=eS(t.sourceCode.getScope(e),e.typeName),s=i?.defs[0];return s?.type==="Type"&&"TSTypeAliasDeclaration"===s.node.type&&(n=Tb(s.node.typeAnnotation,t,r)),r.delete(e.typeName.name),n})(e,t,r):void 0,TE=(e,t,r=new i)=>{if(e?.type==="TSTypeAnnotation"&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType")return TE(e.typeAnnotation,t,r);if(e?.type==="TSTypeOperator")return"readonly"===e.operator&&("TSArrayType"===e.typeAnnotation.type||"TSTupleType"===e.typeAnnotation.type);if(e?.type!=="TSTypeReference")return!1;if("ReadonlyArray"===Th(e.typeName))return!0;if("Identifier"!==e.typeName.type||r.has(e.typeName.name))return!1;r.add(e.typeName.name);let n=eS(t.sourceCode.getScope(e),e.typeName),o=n?.defs[0];return o?.type==="Type"&&"TSTypeAliasDeclaration"===o.node.type&&TE(o.node.typeAnnotation,t,r)},Tv=(e,t,r,n=new i)=>{if(!e||r5.has(e.intrinsicName)||r4.has(e.intrinsicName)||n.has(e))return!1;if(n.add(e),e.isUnion()||e.isIntersection())return e.types.some(e=>Tv(e,t,r,n));let o=t.getBaseConstraintOfType(e);if(o&&o!==e)return Tv(o,t,r,n);let a=r7(e);if(a&&ne(a,r)&&"ReadonlyArray"===a.getName())return!0;let s=t.typeToString(e);return!!(s.startsWith("readonly ")||s.startsWith("ReadonlyArray<"))||nt(e,t).some(e=>Tv(e,t,r,n))},TS=(e,t)=>{if(D5.has(e.type)){let r;return r=e.typeAnnotation,r?.type==="TSTypeReference"&&"const"===Th(r.typeName)||TE(e.typeAnnotation,t)||TS(e.expression,t)}if("Identifier"!==(e=rN(e)).type)return!1;let r=eS(t.sourceCode.getScope(e),e),n=r?.defs[0];return!!(n?.name?.typeAnnotation&&TE(n.name.typeAnnotation,t)||n?.type==="Variable"&&n.node.init&&TS(n.node.init,t)||((e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let{program:t}=r;return Tv(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{return!1}})(e,t))},TC=(e,t,r=new i)=>{if(r.has(e))return!1;if(r.add(e),D5.has(e.type))return Tb(e.typeAnnotation,t)??TC(e.expression,t,r);if("Identifier"===(e=rN(e)).type){let n=eS(t.sourceCode.getScope(e),e),o=n?.defs[0];if(o?.name?.typeAnnotation){let e=Tb(o.name.typeAnnotation,t);if(void 0!==e)return e}if(o?.type==="Variable"&&o.node.init&&TC(o.node.init,t,r))return!0}return nj(e,t)},TD=(e,t,r,n)=>{var o,a;let i,s=!e||"ArrowFunctionExpression"!==e.type&&"FunctionExpression"!==e.type||e.async||e.generator||e.params.length>0?void 0:"BlockStatement"!==e.body.type?e.body:1===e.body.body.length&&"ExpressionStatement"===e.body.body[0].type?e.body.body[0].expression:void 0;if(tb(s,{optional:!1},ty)&&tF(s.callee,{property:"abort",computed:!1,optional:!1})&&"Identifier"===s.callee.object.type&&s.callee.object.name===t&&(0===s.arguments.length||1===s.arguments.length&&(i=s.arguments[0],tF(i,{property:"reason",computed:!1,optional:!1})&&(o=i.object,a=r,o=rN(o),a=rN(a),"Identifier"===o.type&&"Identifier"===a.type&&o.name===a.name&&eS(n.sourceCode.getScope(o),o)===eS(n.sourceCode.getScope(a),a)))))return s.callee.object},TT=e=>{var t;if(e?.type!=="ExpressionStatement")return;let{expression:r}=e;if(tb(r,{minimumArguments:2,maximumArguments:3,optional:!1},ty)&&tF(r.callee,{property:"addEventListener",computed:!1,optional:!1})&&"abort"===tu(rN(r.arguments[0]))&&(!(t=r.arguments[2])||"Literal"===(t=rN(t)).type&&"boolean"==typeof t.value||"ObjectExpression"===t.type&&t.properties.every(e=>{if("Property"!==e.type||e.computed||"init"!==e.kind||e.method||e.shorthand||"Literal"!==e.value.type||"boolean"!=typeof e.value.value)return!1;let t="Identifier"===e.key.type?e.key.name:e.key.value;return D9.has(t)})))return{call:r,sourceSignal:r.callee.object}},TA=(e,t)=>!rV(t,t.sourceCode.getRange(e))&&!rW(t,e),Tw=(e,t,r,n)=>{let o=eS(n.sourceCode.getScope(r),e);return o&&o!==t},Tk="prefer-block-statement-over-iife",TI=e=>"ThisExpression"===e.type||"MetaProperty"===e.type&&"new"===e.meta.name&&"target"===e.property.name||"Identifier"===e.type&&"arguments"===e.name,Tj=(e,t)=>e!==t&&tw(e),TF=(e,t)=>Tj(e,t)&&"ArrowFunctionExpression"!==e.type;function TB(e,t,r,n=Tj){return function o(a){if(r(a))return!0;if(n(a,e))return!1;for(let e of t[a.type]??[]){let t=a[e];for(let e of Array.isArray(t)?t:[t])if(e?.type&&o(e))return!0}return!1}(e)}let TR=(e,t)=>{let[r,n]=t.getRange(e),o=t.getLastToken(e);return[r,eA(o)?t.getRange(o)[1]:n]},TP="no-multiple-promise-resolver-calls",TL=e=>rL(e)||e?.type==="TSInstantiationExpression",TN=e=>"ReturnStatement"===e.type||"ThrowStatement"===e.type;function T$(e){for(;TL(e.parent)&&e.parent.expression===e;)e=e.parent;return e}function TM(e){for(;TL(e);)e=e.expression;return e}let TO=(e,t)=>{if(!(("FunctionExpression"===e.type||"ArrowFunctionExpression"===e.type)&&!e.generator))return!1;let r=T$(e);return tE(r.parent,{name:"Promise",argumentsLength:1})&&r.parent.arguments[0]===r&&oA(r.parent.callee,t)},Tq=e=>e.references.some(e=>e.isWrite()),TU=(e,t)=>{if("CallExpression"!==e.type)return;let r=TM(e.callee);return"Identifier"===r.type?t.get(r):void 0},TW=(e,t)=>"ExpressionStatement"===e.type&&"CallExpression"===e.expression.type&&0===e.expression.arguments.length&&!!TU(e.expression,t);function TV(e){let t=[];return e.traverseSegments(e=>{e.reachable&&t.push(e)}),t}let T_=({isTerminated:e=!1,resolverUncalled:t=!1,resolverCalled:r=!1,catchClausesAfterResolverCall:n=new i,pendingFinallyBlocksByCatchClause:a=new o}={})=>({isTerminated:e,resolverUncalled:t,resolverCalled:r,catchClausesAfterResolverCall:n,pendingFinallyBlocksByCatchClause:a}),Tz=e=>T_({isTerminated:e.isTerminated,resolverUncalled:e.resolverUncalled,resolverCalled:e.resolverCalled,catchClausesAfterResolverCall:new i(e.catchClausesAfterResolverCall),pendingFinallyBlocksByCatchClause:function(e){let t=new o;for(let[r,n]of e)t.set(r,new i(n));return t}(e.pendingFinallyBlocksByCatchClause)}),TK=(e,t,r)=>{if(e.isTerminated)return e;if(t.executor===r){let r=Tz(e);for(let[e,n]of r.pendingFinallyBlocksByCatchClause)t.finallyBlocks.some(e=>n.has(e))&&r.catchClausesAfterResolverCall.add(e);return r.resolverCalled=e.resolverUncalled||e.resolverCalled,r.resolverUncalled=!1,r}if(t.executor)return e;let n=Tz(e);if(t.catchClause){if(e.resolverUncalled){let e=n.pendingFinallyBlocksByCatchClause.get(t.catchClause);for(let r of(e||(e=new i,n.pendingFinallyBlocksByCatchClause.set(t.catchClause,e)),t.finallyBlocks))e.add(r)}e.resolverCalled&&n.catchClausesAfterResolverCall.add(t.catchClause)}return n};function TG(e,t){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}let TJ=(e,t)=>void 0!==t&&e.isTerminated===t.isTerminated&&e.resolverUncalled===t.resolverUncalled&&e.resolverCalled===t.resolverCalled&&TG(e.catchClausesAfterResolverCall,t.catchClausesAfterResolverCall)&&function(e,t){if(e.size!==t.size)return!1;for(let[r,n]of e){let e=t.get(r);if(!e||!TG(n,e))return!1}return!0}(e.pendingFinallyBlocksByCatchClause,t.pendingFinallyBlocksByCatchClause);function TX(e){let t=[],r=e,{parent:n}=e;for(;n&&!tw(n);){if("TryStatement"===n.type){if(n.block===r&&n.handler)return{catchClause:n.handler,finallyBlocks:t};n.finalizer&&(n.block===r||n.handler===r)&&t.push(n.finalizer)}r=n,{parent:n}=n}return{catchClause:void 0,finallyBlocks:t}}function TY(e,t,r){let n=T_({isTerminated:e!==r.codePath.initialSegment,resolverUncalled:e===r.codePath.initialSegment});for(let o of e.prevSegments){let a=function(e,t,r,n){if(!t.reachable||n.terminatedSegments.has(t)||e.isTerminated||n.ignoredLoopEdges.some(e=>e.previousSegment===t&&e.segment===r))return T_({isTerminated:!0});let o=n.catchClausesBySegment.get(r);return o?T_({resolverUncalled:e.pendingFinallyBlocksByCatchClause.has(o),resolverCalled:e.catchClausesAfterResolverCall.has(o)}):e}(t.get(o)??T_(),o,e,r);if(!a.isTerminated){for(let e of(n.isTerminated=!1,n.resolverUncalled||=a.resolverUncalled,n.resolverCalled||=a.resolverCalled,a.catchClausesAfterResolverCall))n.catchClausesAfterResolverCall.add(e);for(let[e,t]of a.pendingFinallyBlocksByCatchClause){let r=n.pendingFinallyBlocksByCatchClause.get(e);for(let o of(r||(r=new i,n.pendingFinallyBlocksByCatchClause.set(e,r)),t))r.add(o)}}}return n}let TH=e=>{let t=TM(e.test);return t?.type==="Literal"&&!t.value},TQ=e=>{let t=T$(e);return t.parent?.type==="AwaitExpression"&&t.parent.argument===t};function TZ(e,t){let r=e,{parent:n}=e;for(;n;){if("AssignmentPattern"===n.type&&n.right===r&&TO(n.parent,t)&&n.parent.params.slice(0,2).includes(n))return!0;r=n,{parent:n}=n}return!1}let T0=(e,t,r)=>"SequenceExpression"===e.type&&e.expressions.includes(t)||"LogicalExpression"===e.type&&e.left===t||"BinaryExpression"===e.type&&(e.left===t||e.right===t)||"UnaryExpression"===e.type&&e.argument===t||"AwaitExpression"===e.type&&e.argument===t||"ConditionalExpression"===e.type&&aA(e,r,TN)||TL(e)&&e.expression===t||"CallExpression"===e.type&&(e.callee===t||e.arguments.includes(t)&&!e.optional&&!oZ(e.callee))||"NewExpression"===e.type&&(e.callee===t||e.arguments.includes(t))||"MemberExpression"===e.type&&(e.object===t||e.computed&&e.property===t&&!e.optional&&!oZ(e.object)),T1=(e,t)=>af(e,t),T2=(e,t)=>"class-static-block"===e.origin||"class-field-initializer"===e.origin&&t.parent?.type==="PropertyDefinition"&&t.parent.value===t&&t.parent.static,T3="no-unnecessary-string-trim",T8=["startsWith","endsWith"],T6=new i(["bigint","boolean","number","string","undefined"]),T9=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]),T5=(e,t)=>eV(e=rN(e),t.sourceCode.getScope(e)),T4="no-useless-re-export",T7=e=>"Identifier"===e.type?e.name:e.value;function Ae(e,t){let r=e.attributes??[];return`${e.source.value}\u0000${r.map(e=>t.getText(e)).join("\0")}`}let At="preferGuard",Ar="preferFallback",An="guard",Ao="fallback",Aa=["keys","values","entries"],Ai=e=>{if("ForInStatement"===e.type)return;let t=rN(e.right);if(tR(t,{object:"Object",methods:Aa,argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1}))return t},As=e=>Ai(e)?.arguments[0]??e.right,Al=e=>"ForInStatement"===e.type||!!Ai(e),Au={configs:{node:{name:"@eslint-sukka/eslint-plugin-sukka-full node preset",plugins:{get sukka(){return Au}},rules:{"sukka/unicorn/prefer-node-protocol":"error","sukka/unicorn/prefer-import-meta-properties":"error","no-process-exit":"off","sukka/unicorn/no-process-exit":"warn","no-buffer-constructor":"off","sukka/unicorn/no-new-buffer":"error"}},recommended:{...c.eslint_plugin_sukka.configs.recommended,plugins:{get sukka(){return Au}},rules:Object.assign({"sukka/array/no-unneeded-flat-map":"error","sukka/browser/prefer-location-assign":"warn","sukka/jsx/no-template-literal":"error","sukka/jsx/no-unneeded-nested":"error","sukka/string/no-locale-case":"warn","sukka/string/no-simple-template-literal":"error","sukka/unicode/no-bidi":"warn","sukka/unicode/no-invisible":"warn","sukka/no-redundant-variable":"error","sukka/no-single-return":"warn","sukka/prefer-early-return":["error",{maximumStatements:16}],"sukka/prefer-fetch":"error","sukka/prefer-timer-id":"warn"},d.collectRules(c.eslint_plugin_sukka.configs.recommended),{"sukka/prefer-single-boolean-return":"off"})},recommended_unicorn:{name:"@eslint-sukka/eslint-plugin-sukka-full recommended unicorn preset",plugins:{get sukka(){return Au}},rules:{"sukka/unicorn/no-lonely-if":"error","sukka/unicorn/no-negated-condition":"warn","sukka/unicorn/catch-error-name":["error",{ignore:[/^(?:e|err|error|\w+Err|\w+Error)[\d_]?$/]}],"sukka/unicorn/custom-error-definition":"error","sukka/unicorn/require-array-join-separator":"warn","sukka/unicorn/no-thenable":"error","sukka/unicorn/no-invalid-remove-event-listener":"error","sukka/unicorn/consistent-function-scoping":"warn","sukka/unicorn/prefer-event-target":"warn","sukka/unicorn/prefer-keyboard-event-key":"warn","sukka/unicorn/prefer-text-content":"warn","sukka/unicorn/no-console-spaces":"warn","sukka/unicorn/no-empty-file":"warn","sukka/unicorn/no-useless-fallback-in-spread":"warn","sukka/unicorn/no-useless-length-check":"warn","sukka/unicorn/no-useless-promise-resolve-reject":"warn","sukka/unicorn/no-zero-fractions":"warn","sukka/unicorn/prefer-export-from":["warn",{checkUsedVariables:!1}],"sukka/unicorn/prefer-native-coercion-functions":"warn","sukka/unicorn/prefer-negative-index":"warn","sukka/unicorn/no-document-cookie":"error","sukka/unicorn/prefer-add-event-listener":"warn","sukka/unicorn/prefer-array-index-of":"warn","sukka/unicorn/prefer-blob-reading-methods":"warn","sukka/unicorn/prefer-date-now":"warn","sukka/unicorn/dom-node-dataset":"warn","sukka/unicorn/prefer-modern-math-apis":"warn","sukka/unicorn/number-literal-case":"error","sukka/unicorn/prefer-number-properties":["warn",{checkInfinity:!1}],"sukka/unicorn/prefer-reflect-apply":"warn","sukka/unicorn/prefer-set-size":"warn","sukka/unicorn/prefer-string-replace-all":"warn","sukka/unicorn/prefer-string-slice":"warn","sukka/unicorn/prefer-string-trim-start-end":"warn","sukka/unicorn/no-unreadable-iife":"warn","sukka/unicorn/throw-new-error":"warn","sukka/unicorn/escape-case":"warn","sukka/unicorn/prefer-unicode-code-point-escapes":"warn","sukka/unicorn/prefer-prototype-methods":"warn","sukka/unicorn/error-message":"error","sukka/unicorn/no-instanceof-builtins":["error",{strategy:"loose"}],"sukka/unicorn/prefer-type-error":"error","sukka/unicorn/consistent-destructuring":"warn","sukka/unicorn/new-for-builtins":"warn","sukka/unicorn/prefer-single-call":"warn","sukka/unicorn/no-static-only-class":"warn","sukka/unicorn/no-unreadable-array-destructuring":"error","sukka/unicorn/no-useless-spread":"error","sukka/unicorn/no-useless-switch-case":"warn","sukka/unicorn/no-useless-undefined":["error",{checkArguments:!1}],"sukka/unicorn/numeric-separators-style":["warn",{onlyIfContainsSeparator:!1,number:{minimumDigits:7,groupLength:3},binary:{minimumDigits:9,groupLength:4},octal:{minimumDigits:9,groupLength:4},hexadecimal:{minimumDigits:5,groupLength:2}}],"sukka/unicorn/prefer-array-find":"warn","sukka/unicorn/prefer-array-flat-map":"warn","sukka/unicorn/prefer-array-flat":"warn","sukka/unicorn/prefer-array-some":"warn","sukka/unicorn/prefer-default-parameters":"warn","sukka/unicorn/prefer-logical-operator-over-ternary":"warn","sukka/unicorn/prefer-optional-catch-binding":"error","sukka/unicorn/prefer-regexp-test":"warn","sukka/unicorn/prefer-set-has":"error","sukka/unicorn/prefer-switch":"warn","sukka/unicorn/require-number-to-fixed-digits-argument":"warn","sukka/unicorn/prefer-string-raw":"warn","sukka/unicorn/no-single-promise-in-promise-methods":"error","sukka/unicorn/no-await-in-promise-methods":"error","sukka/unicorn/no-magic-array-flat-depth":"error","sukka/unicorn/no-object-as-default-parameter":"error","sukka/unicorn/template-indent":["warn",{tags:["outdent","dedent","gql","sql","html","styled","css"],functions:["dedent","stripIndent","strip_indent","stripTags","striptags","strip_tags","stripHtml","stripHTML","strip_html"],selectors:[],comments:["HTML","html","CSS","css","indent"]}],"sukka/unicorn/no-negation-in-equality-check":"error","sukka/unicorn/no-unnecessary-slice-end":"error","sukka/unicorn/consistent-date-clone":"error","sukka/unicorn/no-accessor-recursion":"error","sukka/unicorn/no-unnecessary-array-flat-depth":"error","sukka/unicorn/no-unnecessary-array-splice-count":"error","sukka/unicorn/no-useless-error-capture-stack-trace":"error","sukka/unicorn/prefer-class-fields":"error","sukka/unicorn/prefer-bigint-literals":"error","sukka/unicorn/prefer-classlist-toggle":"warn","sukka/unicorn/require-module-attributes":"error","sukka/unicorn/no-immediate-mutation":"error","sukka/unicorn/no-useless-collection-argument":"error","sukka/unicorn/prefer-response-static-json":"error","sukka/unicorn/consistent-template-literal-escape":"error","sukka/unicorn/no-useless-iterator-to-array":"error","sukka/unicorn/prefer-simple-condition-first":"error","sukka/unicorn/switch-case-break-position":"error","sukka/unicorn/better-dom-traversing":"warn","sukka/unicorn/no-blob-to-file":"error","sukka/unicorn/no-canvas-to-image":"warn","sukka/unicorn/no-confusing-array-splice":"error","sukka/unicorn/no-duplicate-set-values":"error","sukka/unicorn/no-incorrect-query-selector":"error","sukka/unicorn/no-invalid-file-input-accept":"error","sukka/unicorn/no-late-current-target-access":"error","sukka/unicorn/no-unused-array-method-return":"error","sukka/unicorn/prefer-array-last-methods":"warn","sukka/unicorn/prefer-math-abs":"warn","sukka/unicorn/prefer-split-limit":"error","sukka/unicorn/prefer-queue-microtask":"warn","sukka/unicorn/prefer-string-pad-start-end":"warn","sukka/unicorn/require-css-escape":"warn","sukka/unicorn/require-passive-events":"warn","sukka/unicorn/class-reference-in-static-methods":["warn",{preferThis:!1,preferSuper:!1}],"sukka/unicorn/consistent-optional-chaining":"error","sukka/unicorn/explicit-timer-delay":"error","sukka/unicorn/no-confusing-array-with":"error","sukka/unicorn/no-duplicate-loops":"warn","sukka/unicorn/no-declarations-before-early-exit":"error","sukka/unicorn/no-optional-chaining-on-undeclared-variable":"error","sukka/unicorn/no-object-methods-with-collections":"error","sukka/unicorn/no-subtraction-comparison":"warn","sukka/unicorn/no-unnecessary-global-this":"warn","sukka/unicorn/no-useless-else":"error","sukka/unicorn/no-useless-recursion":"error","sukka/unicorn/prefer-add-event-listener-options":"warn","sukka/unicorn/prefer-direct-iteration":"warn","sukka/unicorn/prefer-number-is-safe-integer":"warn","sukka/unicorn/prefer-object-define-properties":"error","sukka/unicorn/prefer-object-destructuring-defaults":"warn","sukka/unicorn/prefer-single-object-destructuring":"warn","sukka/unicorn/prefer-smaller-scope":"warn","sukka/unicorn/prefer-single-array-predicate":"warn","sukka/unicorn/prefer-url-href":"error","sukka/unicorn/require-proxy-trap-boolean-return":"error","sukka/unicorn/logical-assignment-operators":"error","sukka/unicorn/no-useless-coercion":"error","sukka/unicorn/no-useless-boolean-cast":"warn","sukka/unicorn/no-useless-continue":"error","sukka/unicorn/no-useless-override":"error","sukka/unicorn/prefer-has-check":"warn","sukka/unicorn/consistent-conditional-object-spread":"error","sukka/unicorn/no-boolean-sort-comparator":"error","sukka/unicorn/no-chained-comparison":"error","sukka/unicorn/no-constant-zero-expression":"error","sukka/unicorn/no-duplicate-logical-operands":"error","sukka/unicorn/no-impossible-length-comparison":"error","sukka/unicorn/no-invalid-character-comparison":"error","sukka/unicorn/no-loop-iterable-mutation":"error","sukka/unicorn/no-selector-as-dom-name":"error","sukka/unicorn/no-array-concat-in-loop":"error","sukka/unicorn/no-array-front-mutation":"warn","sukka/unicorn/no-array-sort-for-min-max":"error","sukka/unicorn/no-useless-compound-assignment":"warn","sukka/unicorn/no-useless-delete-check":"warn","sukka/unicorn/no-useless-logical-operand":"error","sukka/unicorn/prefer-boolean-return":"warn","sukka/unicorn/prefer-flat-math-min-max":"warn","sukka/unicorn/prefer-hoisting-branch-code":"warn","sukka/unicorn/prefer-single-replace":"warn","sukka/unicorn/no-invalid-well-known-symbol-methods":"error","sukka/unicorn/no-late-event-control":"error","sukka/unicorn/prefer-abort-signal-timeout":"warn","sukka/unicorn/prefer-aggregate-error":"warn","sukka/unicorn/prefer-observer-apis":"warn","sukka/unicorn/prefer-set-methods":"warn","sukka/unicorn/prefer-toggle-attribute":"warn","sukka/unicorn/prefer-url-search-parameters":"warn","sukka/unicorn/no-unsafe-promise-all-settled-values":"error","sukka/unicorn/prefer-abort-signal-any":"warn","sukka/unicorn/prefer-block-statement-over-iife":"warn","sukka/unicorn/no-multiple-promise-resolver-calls":"error","sukka/unicorn/no-unnecessary-string-trim":"error","sukka/unicorn/no-useless-re-export":"warn","sukka/unicorn/iteration-fallback-style":"warn"}},stylistic_unicorn:{name:"@eslint-sukka/eslint-plugin-sukka-full stylistic unicorn preset",plugins:{get sukka(){return Au}},rules:{"sukka/unicorn/no-nested-ternary":"warn","sukka/unicorn/filename-case":["error",{cases:{kebabCase:!0,snakeCase:!0},ignore:[/fixtures/i,/^_/,/^\./,/rc$/i,/\.(md|json|yaml|toml|yml|ini|conf|jsonc|json5)$/i]}],"sukka/unicorn/no-unnecessary-nested-ternary":"error","sukka/unicorn/no-unreadable-object-destructuring":"error","sukka/unicorn/consistent-compound-words":"warn","sukka/unicorn/default-export-style":"warn"}},recommended_extra_with_typed_lint:{...c.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint,plugins:{get sukka(){return Au}},rules:Object.assign({"sukka/string/no-unneeded-to-string":"error","sukka/type/no-force-cast-via-top-type":"error","sukka/type/no-wrapper-type-reference":"error","sukka/require-project-reference":"off","sukka/no-default-error":"off","sukka/unicorn/consistent-tuple-labels":"warn"},d.collectRules(c.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint))},recommended_react:{...c.eslint_plugin_sukka.configs.recommended_react,plugins:{get sukka(){return Au}}}},rules:Object.assign(c.eslint_plugin_sukka.rules,{"array/no-unneeded-flat-map":N,"browser/prefer-location-assign":M,"jsx/no-template-literal":q,"jsx/no-unneeded-nested":U,"string/no-locale-case":V,"string/no-simple-template-literal":_,"unicode/no-bidi":H,"unicode/no-invisible":Z,"no-redundant-variable":ee,"no-single-return":er,"prefer-early-return":eo,"prefer-fetch":ea,"prefer-timer-id":el,"string/no-unneeded-to-string":eu,"type/no-force-cast-via-top-type":ep,"type/no-wrapper-type-reference":ed,"no-default-error":em,"require-project-reference":ey},Object.fromEntries(Object.entries({"unicorn/catch-error-name":{create:e=>{let t=e.options[0],{name:r}=t,n=t.ignore.map(e=>v.isRegExp(e)?e:RegExp(e,"u")),o=e=>e===r||n.some(t=>t.test(e))||e.endsWith(r)||e.endsWith(iy(r));e.on("Identifier",t=>{if(("CatchClause"!==t.parent.type||t.parent.param!==t)&&!(("FunctionExpression"===t.parent.type||"ArrowFunctionExpression"===t.parent.type)&&t.parent.params[0]===t&&(tR(t.parent.parent,{method:"then",argumentsLength:2,optionalCall:!1})||tR(t.parent.parent,{method:"catch",argumentsLength:1,optionalCall:!1}))&&t.parent.parent.arguments.at(-1)===t.parent))return;let n=t.name;if(o(n)||o(n.replaceAll(/_+$/g,"")))return;let a=eS(e.sourceCode.getScope(t),t);if(!a||"_"===n&&0===a.references.length)return;let i=rS(r,[a.scope,...a.references.map(({from:e})=>e)]),s={node:t,messageId:d0,data:{originalName:n,fixedName:i||r}};return i&&(s.fix=t=>i0(a,i,e,t)),s})},meta:{type:"suggestion",docs:{description:"Enforce a specific parameter name in catch clauses.",recommended:!0},fixable:"code",schema:d1,defaultOptions:[{name:"error",ignore:[]}],messages:{[d0]:"The catch parameter `{{originalName}}` should be named `{{fixedName}}`."},languages:["js/js"]}},"unicorn/custom-error-definition":{create:e=>{e.on("ClassDeclaration",t=>mm(e,t)),e.on("AssignmentExpression",t=>{if("ClassExpression"===t.right.type)return mm(e,t.right)}),e.on("AssignmentExpression",e=>{if("MemberExpression"===e.left.type&&"Identifier"===e.left.object.type&&"exports"===e.left.object.name){let t=e.right;if("ClassExpression"!==t.type||!mt(t)||!t.id)return;let r=t.id.name;return e.left.property.name!==r?{node:e.left.property,messageId:d2,fix:t=>t.replaceText(e.left.property,r)}:void 0}})},meta:{type:"problem",docs:{description:"Enforce correct `Error` subclassing.",recommended:!1},fixable:"code",messages:{[d2]:"Exported error name should match error class",[d3]:"Do not pass the error message to `super()` when the class defines a `message` accessor.",[d8]:"Do not assign to `this.message` when the class defines a `message` getter without a setter.",[d6]:"Error constructors should accept `options` as the second parameter.",[d9]:"Error constructors should use `options` as the second parameter.",[d5]:"Pass the error message to `super()` as the first argument.",[d4]:"Pass `options` to `super()` as the second argument."},languages:["js/js"]}},"unicorn/no-nested-ternary":{create:e=>{e.on("ConditionalExpression",t=>{if([t.test,t.consequent,t.alternate].some(e=>"ConditionalExpression"===e.type))return;let{sourceCode:r}=e,n=r.getAncestors(t).toReversed(),o=n.findIndex(e=>"ConditionalExpression"!==e.type);return 1!==o||ta(t,e)?o>1?{node:o>2?n[o-3]:t,messageId:ix}:void 0:{node:t,messageId:ib,fix:e=>[e.insertTextBefore(t,"("),e.insertTextAfter(t,")")]}})},meta:{type:"suggestion",docs:{description:"Disallow nested ternary expressions.",recommended:!0},fixable:"code",messages:{[ix]:"Do not nest ternary expressions.",[ib]:"Nested ternary expression should be parenthesized."},languages:["js/js"]}},"unicorn/prefer-event-target":{create:e=>{e.on("Identifier",t=>{if("EventEmitter"!==t.name||("ClassDeclaration"!==t.parent.type&&"ClassExpression"!==t.parent.type||t.parent.superClass!==t)&&("NewExpression"!==t.parent.type||t.parent.callee!==t))return;let r=e.sourceCode.getScope(t);if(!function(e){if(!e)return!1;let t=function(e,t){let r=e=>e.type===t;for(;e.parent;e=e.parent)if(r(e))return e}(e,"ImportDeclaration");return!!(iv.has(t?.source.value)||"Property"===e.parent.type&&e.parent.value===e&&"Identifier"===e.parent.key.type&&"EventEmitter"===e.parent.key.name&&"ObjectPattern"===e.parent.parent.type&&e.parent.parent.properties.includes(e.parent)&&iS(e.parent.parent)&&iC(e.parent.parent.parent.init))||!!(iS(e)&&tF(e.parent.init,{property:"EventEmitter",optional:!1,computed:!1})&&iC(e.parent.init.object))}(eS(r,t)?.defs[0]?.name))return{node:t,messageId:iE}})},meta:{type:"suggestion",docs:{description:"Prefer `EventTarget` over `EventEmitter`.",recommended:"unopinionated"},messages:{[iE]:"Prefer `EventTarget` over `EventEmitter`."},languages:["js/js"]}},"unicorn/prefer-keyboard-event-key":{create:e=>{e.on("Identifier",t=>{if(iw.has(t.name)){for(let r of iB(e,t))if(r.references?.some(e=>iF(t,e.identifier)))return iR(t,r)}}),e.on("Property",t=>{let r;if("Identifier"===t.key.type&&iw.has(t.key.name)&&"Property"===(r=t.key).parent.type&&r.parent.key===r&&"ObjectPattern"===r.parent.parent.type&&!r.parent.computed){for(let r of iB(e,t))if(iL(t.key,r))return iR(t.key,r);for(let r of iB(e,t))if(iP(t.key,r))return iR(t.key,r)}})},meta:{type:"suggestion",docs:{description:"Prefer `KeyboardEvent#key` over deprecated keyboard event properties.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[iT]:"Use `.key` instead of `.{{name}}`.",[iA]:"Use `.key` with `{{key}}`."},languages:["js/js"]}},"unicorn/prefer-text-content":{create:e=>{e.on("MemberExpression",t=>{if(!tF(t,{property:"innerText"})||nz(t.object,e))return;let r=t.property;return{node:r,messageId:iN,suggest:[{messageId:i$,fix:e=>e.replaceText(r,"textContent")}]}}),e.on("Identifier",t=>{if("innerText"===t.name&&"Property"===t.parent.type&&t.parent.key===t&&!t.parent.computed&&"init"===t.parent.kind&&"ObjectPattern"===t.parent.parent.type&&t.parent.parent.properties.includes(t.parent)&&!((e,t)=>{if(nz(e,t))return!0;let{parent:r}=e;return"VariableDeclarator"===r.type?r.id===e&&r.init&&nz(r.init,t):"AssignmentExpression"===r.type&&r.left===e&&nz(r.right,t)})(t.parent.parent,e))return{node:t,messageId:iN,suggest:[{messageId:i$,fix:e=>e.replaceText(t,t.parent.shorthand?"textContent: innerText":"textContent")}]}})},meta:{type:"suggestion",docs:{description:"Prefer `.textContent` over `.innerText`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[iN]:"Prefer `.textContent` over `.innerText`.",[i$]:"Switch to `.textContent`."},languages:["js/js"]}},"unicorn/require-array-join-separator":{create:e=>{e.on("CallExpression",t=>{if(!(tR(t,{method:"join",argumentsLength:0,optionalCall:!1})||tR(t,{method:"call",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&tU(t.callee.object,{property:"join"}))||0===t.arguments.length&&nL(t.callee.object,e))return;let{sourceCode:r}=e,[n,o]=r.getLastTokens(t,2),a=1===t.arguments.length;return{loc:{start:r.getLoc(n)[a?"end":"start"],end:r.getLoc(o).end},messageId:i3,fix:r=>iO(r,t,"','",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the separator argument with `Array#join()`.",recommended:"unopinionated"},fixable:"code",messages:{[i3]:"Missing the separator argument."},languages:["js/js"]}},"unicorn/no-thenable":{create:e=>{for(let{selector:t,selectors:r,messageId:n,getNodes:o}of i7)e.on(t??r,function*(t){for(let r of o(t,e))yield{node:r,messageId:n}})},meta:{type:"problem",docs:{description:"Disallow `then` property.",recommended:"unopinionated"},messages:{[i8]:"Do not add `then` to an object.",[i6]:"Do not export `then`.",[i9]:"Do not add `then` to a class."},languages:["js/js"]}},"unicorn/no-invalid-remove-event-listener":{create:e=>{e.on("CallExpression",t=>{if(!(tR(t,{method:"removeEventListener",minimumArguments:2,optionalCall:!1})&&"SpreadElement"!==t.arguments[0].type&&("FunctionExpression"===t.arguments[1].type||"ArrowFunctionExpression"===t.arguments[1].type||tR(t.arguments[1],{method:"bind",optionalCall:!1,optionalMember:!1}))))return;let[,r]=t.arguments;return["ArrowFunctionExpression","FunctionExpression"].includes(r.type)?{node:r,loc:eR(r,e.sourceCode),messageId:se}:{node:r.callee.property,messageId:se}})},meta:{type:"problem",docs:{description:"Prevent calling `EventTarget#removeEventListener()` with the result of an expression.",recommended:"unopinionated"},messages:{[se]:"The listener argument should be a function reference."},languages:["js/js"]}},"unicorn/consistent-function-scoping":sl,"unicorn/no-new-buffer":{create:e=>{let{sourceCode:t}=e;e.on("NewExpression",r=>{if(!tE(r,{name:"Buffer"}))return;let n=((e,t)=>{if(1!==e.length)return"from";let[r]=e;if("SpreadElement"===r.type)return;if("ArrayExpression"===r.type||"TemplateLiteral"===r.type)return"from";if(n2(r,t))return"alloc";let n=eV(r,t);if(n){let{value:e}=n;if("string"==typeof e||Array.isArray(e))return"from"}})(r.arguments,t.getScope(r));return n?{node:r,messageId:su,data:{method:n},fix:sd(r,e,n)}:{node:r,messageId:sp,suggest:["from","alloc"].map(t=>({messageId:sc,data:{replacement:t},fix:sd(r,e,t)}))}})},meta:{type:"problem",docs:{description:"Enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[su]:"`new Buffer()` is deprecated, use `Buffer.{{method}}()` instead.",[sp]:"`new Buffer()` is deprecated, use `Buffer.alloc()` or `Buffer.from()` instead.",[sc]:"Switch to `Buffer.{{replacement}}()`."},languages:["js/js"]}},"unicorn/no-console-spaces":{create:e=>{let{sourceCode:t}=e,r=(r,n,o)=>{let[a,i]=t.getRange(r),s="leading"===o?a+1:i-2,l=[s,s+1];return{loc:ic(l,e),messageId:sm,data:{method:n,position:o},fix:e=>e.removeRange(l)}};e.on("CallExpression",function*(e){if(!tR(e,{object:"console",methods:["log","debug","info","warn","error"],minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let n=e.callee.property.name,{arguments:o}=e,{length:a}=o;for(let[e,i]of o.entries()){if(!ts(i)&&"TemplateLiteral"!==i.type)continue;let o=t.getText(i).slice(1,-1);0!==e&&sf(o)&&(yield r(i,n,"leading")),e!==a-1&&sg(o)&&(yield r(i,n,"trailing"))}})},meta:{type:"suggestion",docs:{description:"Do not use leading/trailing space between `console.log` parameters.",recommended:"unopinionated"},fixable:"code",messages:{[sm]:"Do not use {{position}} space between `console.{{method}}` parameters."},languages:["js/js"]}},"unicorn/no-empty-file":sh,"unicorn/no-useless-fallback-in-spread":{create:e=>{e.on("ObjectExpression",t=>{if(tD(t)&&"LogicalExpression"===t.parent.type&&t.parent.right===t&&("||"===t.parent.operator||"??"===t.parent.operator)&&"SpreadElement"===t.parent.parent.type&&t.parent.parent.argument===t.parent&&"ObjectExpression"===t.parent.parent.parent.type&&t.parent.parent.parent.properties.includes(t.parent.parent))return{node:t,messageId:sx,*fix(r,{abort:n}){let{sourceCode:o}=e,a=t.parent;if(o.getCommentsInside(a).length>0)return n();let{left:i}=a,s=ta(i,e),[,l]=s?tn(i,e):o.getRange(i),[,u]=o.getRange(a);yield r.removeRange([l,u]),(s||"SequenceExpression"!==i.type)&&(yield iM(a,r,e))}}})},meta:{type:"suggestion",docs:{description:"Disallow useless fallback when spreading in object literals.",recommended:"unopinionated"},fixable:"code",messages:{[sx]:"The empty object is useless."},languages:["js/js"]}},"unicorn/no-useless-length-check":{create:e=>{let t=[],r=new i,n=new i,o=(t,r,n)=>tR(t,{method:r,optionalCall:!1,optionalMember:!1})&&rk(n.left.object,t.callee.object)&&!nB(t.callee.object,e);e.on("BinaryExpression",e=>{if(!("BinaryExpression"===e.type&&"Literal"===e.right.type&&"0"===e.right.raw&&tF(e.left,{property:"length",optional:!1})&&tW(e.parent)))return;let{operator:t}=e;"==="===t?r.add(e):(">"===t||"!=="===t)&&n.add(e)}),e.on("LogicalExpression",e=>{tW(e)&&t.push(e)}),e.on("Program:exit",function*(){let a=new i(t.flatMap(e=>(function(e){let{operator:t}=e;return(function e(t){return[t.left,t.right].flatMap(r=>"LogicalExpression"===r.type&&r.operator===t.operator?e(r):[r])})(e).filter((e,a,i)=>(function({node:e,operator:t,siblings:a}){return"||"===t&&r.has(e)&&a.some(t=>o(t,"every",e))||"&&"===t&&n.has(e)&&a.some(t=>o(t,"some",e))})({node:e,operator:t,siblings:[i[a-1],i[a+1]].filter(Boolean)}))})(e))),{sourceCode:s}=e;for(let t of a)yield{loc:{start:s.getLoc(t.left.property).start,end:s.getLoc(t).end},messageId:r.has(t)?"zero":"non-zero",fix(r){let{left:n,right:o}=t.parent,a=tn(n,e),i=tn(o,e),s=[];return n===t?(s[0]=a[0],s[1]=i[0]):(s[0]=a[1],s[1]=i[1]),r.removeRange(s)}}})},meta:{type:"suggestion",docs:{description:"Disallow useless array length check.",recommended:"unopinionated"},fixable:"code",messages:{"non-zero":"The non-empty check is useless as `Array#some()` returns `false` for an empty array.",zero:"The empty check is useless as `Array#every()` returns `true` for an empty array."},languages:["js/js"]}},"unicorn/no-useless-promise-resolve-reject":{create:e=>{e.on("CallExpression",t=>{let{expression:r,parent:n}=sb(t);if(!(tR(t,{object:"Promise",methods:["resolve","reject"],optionalCall:!1,optionalMember:!1})&&("ArrowFunctionExpression"===n.type&&n.body===r||"ReturnStatement"===n.type&&n.argument===r||"YieldExpression"===n.type&&!n.delegate&&n.argument===r)))return;let{functionNode:o,isInTryStatement:a}=function(e){let t,r=!1;for(;e;e=e.parent){if(tw(e)){t=e;break}"TryStatement"===e.type&&(r=!0)}return{functionNode:t,isInTryStatement:r}}(t);if(o&&(o.async||function(e){if("CallExpression"===e.parent.type&&"MemberExpression"===e.parent.callee.type&&!e.parent.callee.computed&&"Identifier"===e.parent.callee.property.type){let{callee:{property:t},arguments:r}=e.parent;if(1===r.length&&["then","catch","finally"].includes(t.name)&&r[0]===e||2===r.length&&"then"===t.name&&(r[0]===e||"SpreadElement"!==r[0].type&&r[1]===e))return!0}return!1}(o)))return function(e,t){let{callee:r}=e,n=r.property.name,{parent:o}=sb(e);return{node:r,messageId:n,data:{type:"YieldExpression"===o.type?"yield":"return"},fix:t}}(t,function(e,t,r){if(e.arguments.length>1)return;let{callee:n,arguments:o}=e,{expression:a,parent:i,isAwaited:s}=sb(e),[l]=o;if(l?.type==="SpreadElement")return;let u="reject"===n.property.name,p="YieldExpression"===i.type;if(u&&(t||p&&"ExpressionStatement"!==i.parent.type))return;let c=function({callExpression:e,parent:t,expression:r,isAwaited:n,isReject:o,context:a}){return n&&!o?tn(e,a):o&&"YieldExpression"===t.type?tn(t,a):"ArrowFunctionExpression"===t.type?o?tn(r,a):e:t}({callExpression:e,parent:i,expression:a,isAwaited:s,isReject:u,context:r});if(!rU(r,c,l?[l]:[]))return function(t){let n="ArrowFunctionExpression"===i.type,o=sE(l,r);if(u){if(o||="undefined",o=`throw ${o}`,p)return t.replaceTextRange(tn(i,r),o);if(o+=";",n)return o=`{ ${o} }`,t.replaceTextRange(tn(a,r),o)}else{if(s){var c;let n;return t.replaceTextRange(tn(e,r),(n=sE(c=l,r)||"undefined",c&&"SequenceExpression"!==c.type&&16>a5(c)?`(${n})`:n))}p?o=`yield${o?" ":""}${o}`:"ReturnStatement"===i.type?o=`return${o?" ":""}${o};`:(l?.type==="ObjectExpression"&&(o=`(${o})`),o||="{}")}return t.replaceText(n?e:i,o)}}(t,a,e))})},meta:{type:"suggestion",docs:{description:"Disallow returning/yielding `Promise.resolve/reject()` in async functions or promise callbacks",recommended:"unopinionated"},fixable:"code",messages:{resolve:"Prefer `{{type}} value` over `{{type}} Promise.resolve(value)`.",reject:"Prefer `throw error` over `{{type}} Promise.reject(error)`."},languages:["js/js"]}},"unicorn/no-zero-fractions":{create:e=>{e.on("Literal",t=>{if(!tp(t))return;let{raw:r}=t,n=r.match(/^(?<before>[\d_]*)(?<dotAndFractions>\.[\d_]*)(?<after>.*)$/);if(!n)return;let{before:o,dotAndFractions:a,after:i}=n.groups,s=(o+a.replaceAll(/[.0_]+$/g,"")||"0")+i;if(s===r)return;let l="."===a,{sourceCode:u}=e,p=u.getRange(t)[0]+o.length+a.length;return{loc:ic([p-(r.length-s.length),p],e),messageId:l?sS:sv,*fix(r){let n=s;"MemberExpression"===t.parent.type&&t.parent.object===t&&a7.test(s)&&!ta(t,e)&&(n=`(${n})`,aL(u.getTokenBefore(t),e,n)&&(n=`;${n}`)),yield r.replaceText(t,n),yield iG(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow number literals with zero fractions or dangling dots.",recommended:"unopinionated"},fixable:"code",messages:{[sv]:"Don't use a zero fraction in the number.",[sS]:"Don't use a dangling dot in the number."},languages:["js/js"]}},"unicorn/prefer-export-from":sF,"unicorn/prefer-native-coercion-functions":{create:e=>{e.on(tA,t=>{if(t.async||t.generator||t.returnType?.type==="TSTypeAnnotation"&&"TSTypePredicate"===t.returnType.typeAnnotation.type||0===t.params.length||"Identifier"!==t.params[0].type||("MethodDefinition"===t.parent.type&&("constructor"===t.parent.kind||"set"===t.parent.kind)||"Property"===t.parent.type&&"set"===t.parent.kind)&&t.parent.value===t)return;let r=function(e){if(("ArrowFunctionExpression"===e.type&&"Identifier"===e.body.type&&e.body.name===e.params[0].name||"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type&&e.body.body[0].argument?.type==="Identifier"&&e.body.body[0].argument.name===e.params[0].name)&&"CallExpression"===e.parent.type&&!e.parent.optional&&e.parent.arguments[0]===e&&"MemberExpression"===e.parent.callee.type&&!e.parent.callee.computed&&!e.parent.callee.optional&&"Identifier"===e.parent.callee.property.type&&sP.has(e.parent.callee.property.name))return{replacementFunction:"Boolean",fix:t=>t.replaceText(e,"Boolean")}}(t)||function(e){let t,r=(t=e.params[0].name,"ArrowFunctionExpression"===e.type&&sL(e.body,t)?e.body:"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type&&sL(e.body.body[0].argument,t)?e.body.body[0].argument:void 0);if(!r)return;let{name:n}=r.callee,o={replacementFunction:n};return"FunctionDeclaration"===e.type||1!==r.arguments.length||(o.fix=t=>{let r=n;return"Property"===e.parent.type&&e.parent.method&&e.parent.value===e?r=`: ${r}`:"MethodDefinition"===e.parent.type&&(r=` = ${r};`),t.replaceText(e,r)}),o}(t);if(!r)return;let{sourceCode:n}=e,{replacementFunction:o,fix:a}=r;return r={node:t,loc:eR(t,n),messageId:sB,data:{functionNameWithKind:eK(t,n),replacementFunction:o}},!a||1!==t.params.length||n.getCommentsInside(t).length>0||(r.fix=a),r})},meta:{type:"suggestion",docs:{description:"Prefer using `String`, `Number`, `BigInt`, `Boolean`, and `Symbol` directly.",recommended:"unopinionated"},fixable:"code",messages:{[sB]:"{{functionNameWithKind}} is equivalent to `{{replacementFunction}}`. Use `{{replacementFunction}}` directly."},languages:["js/js"]}},"unicorn/no-document-cookie":{create(e){sq.listen({context:e})},meta:{type:"problem",docs:{description:"Do not use `document.cookie` directly.",recommended:"unopinionated"},messages:{[sO]:"Do not use `document.cookie` directly."},languages:["js/js"]}},"unicorn/prefer-add-event-listener":s_,"unicorn/prefer-array-index-of":sH,"unicorn/prefer-blob-reading-methods":{create:e=>{e.on("CallExpression",e=>{if(!tR(e,{methods:["readAsText","readAsArrayBuffer"],argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let t=e.callee.property,r=t.name;return{node:t,messageId:sQ,data:{method:r,replacement:"readAsArrayBuffer"===r?"arrayBuffer":"text"}}})},meta:{type:"suggestion",docs:{description:"Prefer `Blob#arrayBuffer()` over `FileReader#readAsArrayBuffer(…)` and `Blob#text()` over `FileReader#readAsText(…)`.",recommended:"unopinionated"},messages:{[sQ]:"Prefer `Blob#{{replacement}}()` over `FileReader#{{method}}(blob)`."},languages:["js/js"]}},"unicorn/prefer-date-now":{create:e=>{e.on("CallExpression",e=>{if(tR(e,{methods:["getTime","valueOf"],argumentsLength:0,optionalCall:!1,optionalMember:!1})&&s2(e.callee.object)){let t=e.callee.property;return s3(e,{node:t,messageId:s0,data:{method:t.name}})}if(tb(e,{names:["Number","BigInt"],argumentsLength:1,optional:!1},ty)&&s2(e.arguments[0])){let{name:t}=e.callee;return"Number"===t?s3(e,{messageId:s1}):s3(e.arguments[0])}}),e.on("UnaryExpression",t=>{if(("+"===t.operator||"-"===t.operator)&&s2(t.argument))return s3("-"===t.operator?t.argument:t,{},e)}),e.on("AssignmentExpression",e=>{if(("-="===e.operator||"*="===e.operator||"/="===e.operator||"%="===e.operator||"**="===e.operator)&&s2(e.right))return s3(e.right)}),e.on("BinaryExpression",function*(e){if("-"===e.operator||"*"===e.operator||"/"===e.operator||"%"===e.operator||"**"===e.operator)for(let t of[e.left,e.right])s2(t)&&(yield s3(t))})},meta:{type:"suggestion",docs:{description:"Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.",recommended:"unopinionated"},fixable:"code",messages:{[sZ]:"Prefer `Date.now()` over `new Date()`.",[s0]:"Prefer `Date.now()` over `Date#{{method}}()`.",[s1]:"Prefer `Date.now()` over `Number(new Date())`."},languages:["js/js"]}},"unicorn/dom-node-dataset":ln,"unicorn/prefer-modern-math-apis":{create:e=>{let t=[];e.on("CallExpression",t=>{if(!tR(t,{object:"Math",method:"sqrt",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let r=lp(t.arguments[0]);if(r.some(e=>!("BinaryExpression"===e.type&&("*"===e.operator&&rk(e.left,e.right)||"**"===e.operator&&ti(e.right,2)))))return;let n=1===r.length?"abs":"hypot",o=new i(1===r.length?[]:r.map(e=>e.parent));return{node:t.callee.property,messageId:lo,data:{replacement:`Math.${n}(…)`,description:"Math.sqrt(…)"},*fix(a){let{sourceCode:i}=e;for(let r of(yield a.replaceText(t.callee.property,n),o)){let t=i.getTokenAfter(r.left,e=>"Punctuator"===e.type&&"+"===e.value);yield i2(t,",",a,e),yield iM(r,a,e)}for(let t of r)yield a.removeRange([tn(t.left,e)[1],i.getRange(t)[1]])}}}),e.on("BinaryExpression",e=>{t.push(e)}),e.on("Program:exit",function*(){for(let r of t)for(let t of lu){let n=t(r,e);n&&(yield n)}})},meta:{type:"suggestion",docs:{description:"Prefer modern `Math` APIs over legacy patterns.",recommended:"unopinionated"},fixable:"code",messages:{[lo]:"Prefer `{{replacement}}` over `{{description}}`."},languages:["js/js"]}},"unicorn/number-literal-case":lm,"unicorn/prefer-number-properties":lb,"unicorn/prefer-reflect-apply":{create:e=>{e.on("CallExpression",t=>{if(!tR(t,{optionalCall:!1,optionalMember:!1})||"Literal"===t.callee.object.type||"ArrayExpression"===t.callee.object.type||"ObjectExpression"===t.callee.object.type)return;let{sourceCode:r}=e,n=((e,t)=>{if("apply"===ez(e.callee)&&2===e.arguments.length&&lv(e.arguments[0],e.arguments[1]))return r=>r.replaceText(e,lS(t,e.callee.object,e.arguments[0],e.arguments[1]))})(t,r)||((e,t)=>{if("call"===ez(e.callee)&&"apply"===ez(e.callee.object)&&"prototype"===ez(e.callee.object.object)&&e.callee.object.object.object?.type==="Identifier"&&"Function"===e.callee.object.object.object.name&&3===e.arguments.length&&lv(e.arguments[1],e.arguments[2]))return r=>r.replaceText(e,lS(t,e.arguments[0],e.arguments[1],e.arguments[2]))})(t,r);if(n)return{node:t,messageId:lE,fix:n}})},meta:{type:"suggestion",docs:{description:"Prefer `Reflect.apply()` over `Function#apply()`.",recommended:"unopinionated"},fixable:"code",messages:{[lE]:"Prefer `Reflect.apply()` over `Function#apply()`."},languages:["js/js"]}},"unicorn/prefer-set-size":{create:e=>{e.on("MemberExpression",t=>{var r;if(!tF(t,{property:"length",optional:!1}))return;let n="ArrayExpression"===(r=t.object).type&&1===r.elements.length&&r.elements[0]?.type==="SpreadElement"?r.elements[0].argument:tR(r,{object:"Array",method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})?r.arguments[0]:void 0;if(n&&nq(n,e))return{node:t.property,messageId:lC,fix:function(e,t,r){let{sourceCode:n}=e,{object:o,property:a}=t;if(!(n.getCommentsInside(o).length>n.getCommentsInside(r).length))return function*(i){yield i.replaceText(a,"size");let s=n.getText(r);it(r,e)&&(s=`(${s})`),yield i.replaceText(o,s),"ArrayExpression"===o.type&&(yield iG(i,t,e))}}(e,t,n)}})},meta:{type:"suggestion",docs:{description:"Prefer using `Set#size` instead of `Array#length`.",recommended:"unopinionated"},fixable:"code",messages:{[lC]:"Prefer using `Set#size` instead of `Array#length`."},languages:["js/js"]}},"unicorn/prefer-string-replace-all":{create:e=>{e.on("CallExpression",t=>{let r,n,o=((e,t)=>{let r;if(!tR(e,{method:"join",argumentsLength:1,optionalCall:!1,optionalMember:!1})||!tR(e.callee.object,{method:"split",argumentsLength:1,optionalCall:!1,optionalMember:!1})||t.sourceCode.getCommentsInside(e).length>0)return;let n=e.callee.object;if(of(n.callee.object,t))return;let[o]=n.arguments,[a]=e.arguments,i=tu(o);if("string"==typeof i){if(0===i.length)return;r=tQ(i)}else if(!(r=(e=>{if(!tc(e)||e.regex.flags.includes("y"))return;let t=lM(e);if(!t||lU(t)||0===lq(t))return;let{pattern:r,flags:n}=e.regex;return`/${r}/${n.includes("g")?n:`g${n}`}`})(o)))return;let s=tu(a);if("string"==typeof s)return`${to(n.callee.object,t)}.replaceAll(${r}, ${tQ(s.replaceAll("$","$$$$"))})`})(t,e);if(o)return{node:t.callee.property,messageId:lF,fix:e=>e.replaceText(t,o)};if(!tR(t,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1})||tR(t,{method:"replace",argumentsLength:2,optionalCall:!1,optionalMember:!1})&&tc(r=t.arguments[0])&&r.regex.flags.includes("g")&&!r.regex.flags.includes("y")&&(e=>{if(!e.startsWith("[")||!e.endsWith("]")||e.startsWith("[^"))return;let t=new i,r=e.slice(1,-1);for(let e=0;e<r.length;e++){let n=r[e],o=!1;if("\\"===n&&(n=r[++e],o=!0,!n)||"-"===n&&!o&&0!==e&&e!==r.length-1||"]"===n&&!o&&0!==e||!lw.has(n))return;t.add(n)}return t})(r.regex.pattern)?.size>=8&&ts(n=t.arguments[1])&&n.value===lA)return;let{arguments:a,callee:{property:s}}=t;if(of(t.callee.object,e))return;let[l]=a;if(!((e,t)=>{if(tc(e))return e.regex.flags.includes("g");if(tE(e,{name:"RegExp"})&&e.arguments[0]?.type!=="SpreadElement"&&e.arguments[1]?.type==="Literal"&&"string"==typeof e.arguments[1].value)return e.arguments[1].value.includes("g");let r=eV(e,t);if(!r)return!1;let{value:n}=r;return"[object RegExp]"===Object.prototype.toString.call(n)&&n.global})(l,e.sourceCode.getScope(l)))return;let u=s.name,p=function(e){if(!tc(e))return;let t=lM(e);if(!t)return;let{flags:r}=e.regex;if(!function(e){if(!e.includes("g"))return!1;for(let t of e)if(lB.has(t))return!1;return!0}(r))return;let n="alternative"===t.type?l$(t.body):lN(t);if(n)return"'"+n+"'"}(l);if("replaceAll"===u){if(!p)return;return{node:l,messageId:lj,data:{replacement:p.length<20?p:"a string literal"},fix:e=>e.replaceText(l,p)}}return{node:s,messageId:lI,*fix(e){yield e.insertTextAfter(s,"All"),p&&(yield e.replaceText(l,p))}}})},meta:{type:"suggestion",docs:{description:"Prefer `String#replaceAll()` over regex searches with the global flag and `String#split().join()`.",recommended:"unopinionated"},fixable:"code",messages:{[lI]:"Prefer `String#replaceAll()` over `String#replace()`.",[lj]:"This pattern can be replaced with {{replacement}}.",[lF]:"Prefer `String#replaceAll()` over `String#split().join()`."},languages:["js/js"]}},"unicorn/prefer-string-slice":{create:e=>{e.on("CallExpression",t=>{if(!tR(t,{methods:["substr","substring"]})||of(t.callee.object,e))return;let r=t.callee.property.name;if(!("substring"===r&&(e=>{if(!tR(e,{method:"substring",argumentsLength:2}))return;let[t,r]=e.arguments;if(lW(t)&&lW(r)&&1===Math.abs(t.value-r.value))return t.value<r.value?t:r;let n=(e=>{if("BinaryExpression"===e.type&&"-"===e.operator&&ti(e.right,1))return e.left})(t);return lV(r,t)??(lV(t,r)?r:void 0)??(n&&rk(n,r)?t:void 0)})(t)))return{node:t,messageId:r,*fix(n,{abort:o}){if(yield n.replaceText(t.callee.property,"slice"),0!==t.arguments.length){if(t.arguments.length>2||t.arguments.some(e=>"SpreadElement"===e.type))return o();yield("substr"===r?function*({node:e,fixer:t,context:r,abort:n}){let o=e.arguments,[a,i]=o;if(!i)return;let{sourceCode:s}=r,l=eV(a,s.getScope(e)),u=tn(i,r);if(l?.value===0){let n=((e,t,r)=>{let n,o,{sourceCode:a}=r;if(!("BinaryExpression"!==e.type||"-"!==e.operator||!(tp(n=e.right)&&Number.isSafeInteger(n.value)&&n.value>0)||!lz(e.left)||!("Identifier"===t.type||ts(t))||!rk(e.left.object,t)||(o=((e,t)=>{let[r,n]=tn(e,t),o=t.sourceCode.getTokenByRangeStart(r),a=t.sourceCode.getTokenBefore(o);return[t.sourceCode.getRange(a)[1],n]})(e,r),a.getAllComments().some(e=>{let t=a.getRange(e);return t[0]>=o[0]&&t[1]<=o[1]}))))return`-${e.right.raw}`})(i,e.callee.object,r);if(n)return void(yield iU(t,i,n,r));if(tp(i)||lz(i))return;let o=l_(i);return"number"==typeof o?void(yield iU(t,i,String(Math.max(0,o)),r)):(yield t.insertTextBeforeRange(u,"Math.max(0, "),void(yield t.insertTextAfterRange(u,")")))}if(o.every(e=>tp(e))){let e;return void(yield(e=String(a.value+i.value),iU(t,i,e,r)))}return n()}:function*({node:e,fixer:t,context:r,abort:n}){let[o,a]=e.arguments,i=o?l_(o):void 0;if(!a){if(lz(o))return;if(void 0!==i)return void(yield iU(t,o,String(Math.max(0,i)),r));let e=tn(o,r);return yield t.insertTextBeforeRange(e,"Math.max(0, "),void(yield t.insertTextAfterRange(e,")"))}let s=l_(a);if(void 0!==i&&void 0!==s){let e=[Math.max(0,i),Math.max(0,s)];i>s&&e.reverse(),e[0]!==i&&(yield iU(t,o,String(e[0]),r)),e[1]!==s&&(yield iU(t,a,String(e[1]),r));return}if(0===i||0===s){let e=to(o,r),n=to(a,r);yield iU(t,o,"0",r),yield iU(t,a,`Math.max(0, ${0===i?n:e})`,r);return}return n()})({node:t,fixer:n,context:e,abort:o})}}}})},meta:{type:"suggestion",docs:{description:"Prefer `String#slice()` over `String#substr()` and `String#substring()`.",recommended:"unopinionated"},fixable:"code",messages:{substr:"Prefer `String#slice()` over `String#substr()`.",substring:"Prefer `String#slice()` over `String#substring()`."},languages:["js/js"]}},"unicorn/prefer-string-trim-start-end":{create:e=>{e.on("CallExpression",t=>{if(!tR(t,{methods:["trimLeft","trimRight"],argumentsLength:0,optionalCall:!1})||of(t.callee.object,e))return;let r=t.callee.property,n=r.name,o="trimLeft"===n?"trimStart":"trimEnd";return{node:r,messageId:lK,data:{method:n,replacement:o},fix:e=>e.replaceText(r,o)}})},meta:{type:"suggestion",docs:{description:"Prefer `String#trimStart()` / `String#trimEnd()` over `String#trimLeft()` / `String#trimRight()`.",recommended:"unopinionated"},fixable:"code",messages:{[lK]:"Prefer `String#{{replacement}}()` over `String#{{method}}()`."},languages:["js/js"]}},"unicorn/no-unreadable-iife":{create:e=>{e.on("CallExpression",t=>{if("ArrowFunctionExpression"!==t.callee.type||"BlockStatement"===t.callee.body.type||!ta(t.callee.body,e))return;let{body:r}=t.callee,n={node:t,loc:ic(tn(r,e),e),messageId:lG};return!function(e,t){let{sourceCode:r}=t,[n,o]=tn(e,t),[a,i]=r.getRange(e);return r.getCommentsInside(e.parent).some(e=>{let[t,s]=r.getRange(e);return t>=n&&s<=o&&(t<a||s>i)})}(r,e)&&(n.suggest=[{messageId:lJ,fix:t=>t.replaceTextRange(tn(r,e),`{ return ${e.sourceCode.getText(r)}; }`)}]),n})},meta:{type:"suggestion",docs:{description:"Disallow unreadable IIFEs.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[lG]:"IIFE with parenthesized arrow function body is considered unreadable.",[lJ]:"Use a block statement body."},languages:["js/js"]}},"unicorn/throw-new-error":{create:e=>{e.on("CallExpression",t=>{if("Decorator"===t.parent.type)return;let{callee:r}=t;if(!(t.optional||r3(r))&&("Identifier"===r.type&&lY.test(r.name)||"MemberExpression"===r.type&&!r.computed&&"Identifier"===r.property.type&&lY.test(r.property.name))&&!tF(r,{object:"Data",property:"TaggedError",computed:!1}))return{node:t,messageId:lX,fix:r=>iJ(t,e,r)}})},meta:{type:"suggestion",docs:{description:"Require `new` when creating an error.",recommended:"unopinionated"},fixable:"code",messages:{[lX]:"Use `new` when creating an error."},languages:["js/js"]}},"unicorn/escape-case":{create:e=>{let t="lowercase"===e.options[0];e.on("Literal",e=>{if(ts(e))return l1({node:e,original:e.raw,lowercase:t})}),e.on("Literal",e=>{if(tc(e))return l1({node:e,original:e.raw,regex:l0,lowercase:t})}),e.on("TemplateElement",r=>{if(!tO(r.parent))return l1({node:r,original:r.value.raw,lowercase:t,fix:(t,n)=>i1(r,n,e,t)})})},meta:{type:"suggestion",docs:{description:"Require escape sequences to use uppercase or lowercase values.",recommended:"unopinionated"},fixable:"code",schema:[{enum:["uppercase","lowercase"],description:"The case style for escape sequences."}],defaultOptions:["uppercase"],messages:{[lH]:"Use uppercase characters for the value of the escape sequence.",[lQ]:"Use lowercase characters for the value of the escape sequence."},languages:["js/js"]}},"unicorn/prefer-unicode-code-point-escapes":{create:e=>{e.on("Literal",e=>ts(e)?ui(e,e.raw):tc(e)?function(e){let t,{raw:r}=e,{pattern:n,flags:o}=(t=r.lastIndexOf("/"),{pattern:r.slice(1,t),flags:r.slice(t+1)}),{fixed:i,hasReplacement:s}=ua(n,{isRegex:!0,supportsNestedCharacterClasses:o.includes("v")}),l=o.includes("u")||o.includes("v"),u=function(e){for(let t=0;t<e.length;t++)if(void 0!==function(e,t){var r;if(!e.startsWith(l8,t))return;let n=t+l8.length;for(;r=e[n],l6.test(r);)n++;if(n===t+l8.length||"}"!==e[n])return;let o=Number.parseInt(e.slice(t+l8.length,n),16);if(!(o>1114111))return o}(e,t)&&l7(e,t))return!0;return!1}(n);if(!s&&(l||!u))return;let p=`/${s?i:n}/${us(o)}`;return l?{node:e,messageId:l2,fix:t=>t.replaceText(e,p)}:!function(e,t){try{return new a(e,t),!0}catch{return!1}}(s?i:n,us(o))?{node:e,messageId:l2}:{node:e,messageId:l2,suggest:[{messageId:l3,fix:t=>t.replaceText(e,p)}]}}(e):void 0),e.on("TemplateElement",t=>{if(!tO(t.parent))return ui(t,t.value.raw,(r,n)=>i1(t,n,e,r))})},meta:{type:"suggestion",docs:{description:"Prefer Unicode code point escapes over legacy escape sequences.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[l2]:"Prefer Unicode code point escapes.",[l3]:"Use Unicode code point escapes and add the `u` flag."},languages:["js/js"]}},"unicorn/prefer-prototype-methods":{create:function(e){let{sourceCode:t}=e,r=[];e.on("CallExpression",e=>{r.push(e)}),e.onExit("Program",function*(n){let o=new s;for(let{node:e,path:r}of new e5(t.getScope(n)).iterateGlobalReferences(Object.fromEntries(ul.map(e=>[e,{[e5.READ]:!0}]))))o.set(e,r);for(let t of r)yield function(e,{context:t,globalReferences:r}){let n;tR(e,{object:"Reflect",method:"apply",minimumArguments:1,optionalCall:!1,optionalMember:!1})?n=e.arguments[0]:tR(e,{methods:["apply","bind","call"],optionalCall:!1,optionalMember:!1})&&(n=e.callee.object);let{isGlobalReference:o,constructorName:a,methodName:i}=function(e,{context:t,globalReferences:r}){if(!e)return;if(r.has(e))return{isGlobalReference:!0,constructorName:"Object",methodName:r.get(e).at(-1)};if(!tF(e,{optional:!1}))return;let n=e.object;if(tC(n)||tD(n))return{constructorName:"ArrayExpression"===n.type?"Array":"Object",methodName:ez(e,t.sourceCode.getScope(e))}}(n,{context:t,globalReferences:r})??{};if(a)return{node:n,messageId:i?"known-method":"unknown-method",data:{constructorName:a,methodName:i},*fix(r){if(o)return void(yield r.replaceText(n,`${a}.prototype.${i}`));if(tF(n)){let o=n.object;yield r.replaceText(o,`${a}.prototype`),("ArrayExpression"===o.type||"ObjectExpression"===o.type)&&(yield iG(r,e,t))}}}}(t,{context:e,globalReferences:o})})},meta:{type:"suggestion",docs:{description:"Prefer borrowing methods from the prototype instead of the instance.",recommended:"unopinionated"},fixable:"code",messages:{"known-method":"Prefer using `{{constructorName}}.prototype.{{methodName}}`.","unknown-method":"Prefer using method from `{{constructorName}}.prototype`."},languages:["js/js"]}},"unicorn/error-message":{create:e=>{e.on(["CallExpression","NewExpression"],t=>{if(!(tb(t,{names:uu,optional:!1},tx)&&e.sourceCode.isGlobalReference(t.callee)))return;let r=t.callee.name,n=um.has(r)?um.get(r):0,o=t.arguments;if(o.some((e,t)=>t<=n&&"SpreadElement"===e.type))return;let a=o[n];if(!a)return{node:t,messageId:up,data:{constructorName:r}};if("ArrayExpression"===a.type||"ObjectExpression"===a.type)return{node:a,messageId:ud};let i=eV(a,e.sourceCode.getScope(a));if(!i)return;let{value:s}=i;return"string"!=typeof s?{node:a,messageId:ud}:""===s?{node:a,messageId:uc}:void 0})},meta:{type:"problem",docs:{description:"Enforce passing a `message` value when creating a built-in error.",recommended:"unopinionated"},messages:{[up]:"Pass a message to the `{{constructorName}}` constructor.",[uc]:"Error message should not be an empty string.",[ud]:"Error message should be a string."},languages:["js/js"]}},"unicorn/no-instanceof-builtins":uS,"unicorn/prefer-type-error":{create:e=>{e.on("ThrowStatement",e=>{let t;if(!(tE(e.argument,{name:"Error"})&&e.parent&&e.parent.body&&1===e.parent.body.length&&e.parent.parent&&"IfStatement"===(t=e.parent.parent).type&&uj(t.test)))return;let r=e.argument.callee;return{node:r,messageId:uC,fix:e=>e.insertTextBefore(r,"Type")}})},meta:{type:"suggestion",docs:{description:"Enforce throwing `TypeError` in type checking conditions.",recommended:"unopinionated"},fixable:"code",messages:{[uC]:"`new Error()` is too unspecific for a type check. Use `new TypeError()` instead."},languages:["js/js"]}},"unicorn/consistent-destructuring":{create:e=>{let{sourceCode:t}=e,r=new o,n=[],a=[],i=e=>{let r=rN(e.object);if(e.computed||"Identifier"!==e.property.type||!["Identifier","ThisExpression"].includes(r.type))return;let n=t.getScope(e);a.push({propertyName:e.property.name,rootIdentifierName:"Identifier"===r.type?r.name:void 0,rootVariable:"Identifier"===r.type?eS(n,r):void 0,thisScopeBoundary:"ThisExpression"===r.type?uP(r):void 0,start:t.getRange(e)[0],scope:n})},s=e=>{switch(e.type){case"MemberExpression":i(e);break;case"AssignmentPattern":s(e.left);break;case"RestElement":s(e.argument);break;case"ObjectPattern":for(let t of e.properties)s("Property"===t.type?t.value:t.argument);break;case"ArrayPattern":for(let t of e.elements)t&&s(t)}};e.on("AssignmentExpression",e=>{s(e.left)}),e.on(["ForInStatement","ForOfStatement"],e=>{"VariableDeclaration"!==e.left.type&&s(e.left)}),e.on("UpdateExpression",e=>{"MemberExpression"===e.argument.type&&i(e.argument)}),e.on("UnaryExpression",e=>{"delete"===e.operator&&"MemberExpression"===e.argument.type&&i(e.argument)}),e.on("VariableDeclarator",e=>{let n;if(!("ObjectPattern"===e.id.type&&"const"===e.parent.kind&&e.init&&("Identifier"===(n=e.init).type||"ThisExpression"===n.type)))return;let o="Identifier"===e.init.type?e.init:void 0,a={scope:t.getScope(e),object:e.init,rootIdentifierName:o?.name,rootVariable:o&&eS(t.getScope(e),o),thisScopeBoundary:"ThisExpression"===e.init.type?uP(e.init):void 0,objectPattern:e.id},i=t.getText(e.init);r.set(i,[...r.get(i)??[],a])});let l=e=>{let n,o;if((o=e).computed||tb(o.parent,void 0,tx)&&o.parent.callee===o||"TaggedTemplateExpression"===o.parent.type&&o.parent.tag===o||nG(o))return;let i=rN(e.object),s=r.get(t.getText(i));if(!s)return;let l=t.getScope(e),u="Identifier"===i.type?i:void 0,p=u&&eS(l,u),c="ThisExpression"===i.type?uP(i):void 0,d=t.getText(e.property);for(let r of s.toReversed())if(u$({declaration:r,memberExpressionNode:e,memberScope:l,memberRootIdentifier:u,memberRootVariable:p,memberThisScopeBoundary:c,memberExpressionWrites:a,sourceCode:t})&&(n=uN(r.objectPattern.properties.filter(e=>uL(e)&&"Identifier"===e.value.type),d,l,t)))break;if(!n||((e,t)=>{let r=e,{parent:n}=e;for(;n&&!uq(n);){if(uO(n,r,e,t))return!0;r=n,n=n.parent}return!1})(e,t))return;if("MemberExpression"===e.parent.type)return{node:e,messageId:uF};let m=t.getText(e),f=n.value.name;return{node:e,messageId:uF,suggest:[{messageId:uB,data:{expression:m,property:f},fix:t=>t.replaceText(e,f)}]}};e.on("MemberExpression",e=>{n.push(e)}),e.onExit("Program",function*(){for(let e of n){let t=l(e);t&&(yield t)}})},meta:{type:"suggestion",docs:{description:"Use destructured variables over properties.",recommended:!1},hasSuggestions:!0,messages:{[uF]:"Use destructured variables over properties.",[uB]:"Replace `{{expression}}` with destructured property `{{property}}`."},languages:["js/js"]}},"unicorn/new-for-builtins":{create:e=>{uK.listen({context:e}),uG.listen({context:e}),uJ.listen({context:e}),uX.listen({context:e})},meta:{type:"suggestion",docs:{description:"Enforce correct use of `new` for builtin constructors.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{enforce:"Use `new {{name}}()` instead of `{{name}}()`.",disallow:"Use `{{name}}()` instead of `new {{name}}()`.",disallowCallOrNew:"`{{name}}` is not a function or constructor.",[uV]:"Use `String(new Date())` instead of `Date()`.",[u_]:"Switch to `String(new Date())`."},languages:["js/js"]}},"unicorn/prefer-single-call":u1,"unicorn/no-process-exit":{create:e=>{if(0===e.sourceCode.lines[0].indexOf("#!"))return;let t=0,r=!1,n=[],o=e=>tR(e,{object:"process",methods:["on","once"],minimumArguments:1,optionalCall:!1,optionalMember:!1});e.on("CallExpression",e=>{tN(e)&&u3(e.arguments[0])&&(r=!0)}),e.on("ImportDeclaration",e=>{"Literal"===e.source.type&&u3(e.source)&&(r=!0)}),e.on("CallExpression",e=>{o(e)&&t++}),e.onExit("CallExpression",e=>{o(e)&&t--}),e.on("CallExpression",e=>{0===t&&tR(e,{object:"process",method:"exit",optionalCall:!1,optionalMember:!1})&&n.push(e)}),e.onExit("Program",function*(){if(!r)for(let e of n)yield{node:e,messageId:u2}})},meta:{type:"suggestion",docs:{description:"Disallow `process.exit()`.",recommended:"unopinionated"},messages:{[u2]:"Only use `process.exit()` in CLI apps. Throw an error instead."},languages:["js/js"]}},"unicorn/no-static-only-class":{create:function(e){e.on(["ClassDeclaration","ClassExpression"],t=>{if(!(t.superClass||t.decorators&&t.decorators.length>0||"ClassBody"!==t.body.type||0===t.body.body.length||t.body.body.some(e=>!function(e){let{private:t,static:r,declare:n,readonly:o,accessibility:a,decorators:i,key:s}=e;return(!!pn(e)||"MethodDefinition"===e.type)&&!!r&&!t&&"PrivateIdentifier"!==s.type&&!(n||o||void 0!==a||Array.isArray(i)&&i.length>0)}(e))))return{node:t,loc:function(e,t){let{sourceCode:r}=t,{body:n}=e,o=r.getTokenBefore(n),{start:a}=r.getLoc(e),{end:i}=r.getLoc(o);return{start:a,end:i}}(t,e),messageId:pt,fix:function(e,t){let{type:r,id:n,body:o,declare:a,abstract:i,implements:s,parent:l}=e;if(a||i||Array.isArray(s)&&s.length>0||"ClassExpression"===r&&n)return;let u="ClassDeclaration"===e.type&&"ExportDefaultDeclaration"===e.parent.type&&e.parent.declaration===e;if(u&&n)return;let{sourceCode:p}=t;for(let e of o.body)if(pn(e)&&(e.typeAnnotation||e.value&&p.getText(e.value).includes("this")))return;return function*(n){let a=p.getFirstToken(e);if(tX(a,{expected:{type:"Keyword",value:"class"},ruleId:"no-static-only-class"}),u||"ClassExpression"===r)if("ClassExpression"===r&&"ReturnStatement"===l.type&&p.getLoc(o).start.line!==p.getLoc(l).start.line&&p.text.slice(p.getRange(a)[1],p.getRange(o)[0]).trim()){yield n.replaceText(a,"{");let e=p.getFirstToken(o);yield n.remove(e)}else yield n.replaceText(a,""),yield i_(a,t,n);else yield n.replaceText(a,"const"),yield n.insertTextBefore(o,"= "),yield n.insertTextAfter(o,";");for(let e of o.body)yield function*(e,t,r){let{sourceCode:n}=t,o=n.getFirstToken(e);tX(o,{expected:{type:"Keyword",value:"static"},ruleId:"no-static-only-class"}),yield r.remove(o),yield i_(o,t,r);let a=pn(e)?n.getLastToken(e):n.getTokenAfter(e),i=eA(a);if(pn(e)){let{key:t,value:o}=e;if(o){let e=n.getTokenAfter(t,pr);yield r.replaceText(e,":")}else i?yield r.insertTextBefore(a,": undefined"):yield r.insertTextAfter(e,": undefined")}yield i?r.replaceText(a,","):r.insertTextAfter(e,",")}(e,t,n)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Disallow classes that only have static members.",recommended:"unopinionated"},fixable:"code",messages:{[pt]:"Use an object instead of a class with only static members."},languages:["js/js"]}},"unicorn/no-unreadable-array-destructuring":pi,"unicorn/no-useless-spread":{create:e=>{let{sourceCode:t}=e;e.on(["ArrayExpression","ObjectExpression"],r=>{if(!("SpreadElement"===r.parent.type&&r.parent.argument===r&&("ObjectExpression"===r.type&&"ObjectExpression"===r.parent.parent.type&&r.parent.parent.properties.includes(r.parent)||"ArrayExpression"===r.type&&("ArrayExpression"===r.parent.parent.type&&r.parent.parent.elements.includes(r.parent)||tb(r.parent.parent,void 0,tx)&&r.parent.parent.arguments.includes(r.parent)))))return;let n=r.parent,o=t.getFirstToken(n),a=n.parent.type,i={node:o,messageId:ps,data:{argumentType:"ArrayExpression"===r.type?"array":"object",parentDescription:pb[a]}};return"NewExpression"===a&&px(r)&&tE(n.parent,{names:pg,argumentsLength:1,allowSpreadElement:!0})?i:{...i,*fix(i){let s;yield i.remove(o),yield iM(r,i,e);let l=t.getFirstToken(r);yield i.remove(l);let[u,p]=t.getLastTokens(r,2);if(yield i.remove(p),eT(u)&&(yield i.remove(u)),tC(r)||tD(r)){let e=t.getTokenAfter(n);eT(e)&&(yield i.remove(e))}if("CallExpression"===a||"NewExpression"===a)for(let[e,n]of(s=t.getFirstToken(r),r.elements.map((e,n,o)=>{if(n===o.length-1){let e=t.getLastToken(r,{skip:1});return eT(e)?e:void 0}let a=t.getTokenAfter(e||s,eT);return s=a,a})).entries())null===r.elements[e]&&(yield i.insertTextBefore(n,"undefined"))}}}),e.on("ObjectExpression",r=>{if(!("ObjectExpression"===r.type&&r.properties.length>0&&r.properties.every(e=>"SpreadElement"===e.type&&"ObjectExpression"!==e.argument.type)))return;let n=r.parent;if(!tR(n,{object:"Object",method:"assign",minimumArguments:2,optionalMember:!1,optionalCall:!1}))return;let o=n.arguments.indexOf(r),a=n.arguments.slice(0,o).some(e=>"SpreadElement"!==e.type);if(o<=0||!a)return;let i={node:t.getFirstToken(r.properties[0]),messageId:pd};return t.getCommentsInside(r).length>0?i:{...i,suggest:[{messageId:pf,fix:t=>t.replaceText(r,r.properties.map(t=>to(t.argument,e)).join(", "))}]}}),e.on("NewExpression",e=>{if(tE(e,{names:pg,argumentsLength:1,allowSpreadElement:!0})&&"SpreadElement"===e.arguments[0].type&&"ArrayExpression"!==e.arguments[0].argument.type)return{node:e.arguments[0],messageId:pc,data:{constructorName:`new ${e.callee.name}(…)`}}}),e.on("ArrayExpression",t=>{if(!px(t))return;let{parent:r}=t;if(!("ForOfStatement"===r.type&&r.right===t||"YieldExpression"===r.type&&r.delegate&&r.argument===t||(tE(r,{names:pg,argumentsLength:1})||tE(r,{names:r9,minimumArguments:1})||tR(r,{object:"Promise",methods:["all","allSettled","any","race"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||tR(r,{objects:["Array",...r9],method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})||tR(r,{object:"Object",method:"fromEntries",argumentsLength:1,optionalCall:!1,optionalMember:!1}))&&r.arguments[0]===t))return;let n="",o=pl;switch(r.type){case"ForOfStatement":o=pu;break;case"YieldExpression":o=pp;break;case"NewExpression":n=`new ${r.callee.name}(…)`;break;case"CallExpression":n=`${r.callee.object.name}.${r.callee.property.name}(…)`}return{node:t,messageId:o,data:{parentDescription:n},fix:r=>pE(r,t,e)}}),e.on("ArrayExpression",t=>{if(!px(t))return;let r=t.elements[0].argument,n=!!tR(r,{methods:ph,optionalCall:!1,optionalMember:!1})&&nj(r.callee.object,e)&&nj(r,e);if(!n&&!(!nF(r,e)&&(tR(r,{methods:py,optionalCall:!1,optionalMember:!1})?!pv(r,e):tR(r,{method:"concat",optionalCall:!1,optionalMember:!1})?!("Identifier"===r.callee.object.type&&"Iterator"===r.callee.object.name||pv(r,e)):tR(r,{method:"split",optionalCall:!1,optionalMember:!1})||tR(r,{object:"Object",methods:["keys","values"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||"AwaitExpression"===r.type&&tR(r.argument,{object:"Promise",methods:["all","allSettled"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||tR(r,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1})||tE(r,{name:"Array"}))))return;let o={node:t,messageId:pm};return tE(r,{name:"Array"})||tR(r,{method:"slice",optionalCall:!1,optionalMember:!1})&&!n?o:Object.assign(o,{fix:r=>pE(r,t,e)})})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary spread.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[ps]:"Spread an {{argumentType}} literal in {{parentDescription}} is unnecessary.",[pl]:"`{{parentDescription}}` accepts an iterable as an argument, it's unnecessary to convert to an array.",[pu]:"`for…of` can iterate over an iterable, it's unnecessary to convert to an array.",[pp]:"`yield*` can delegate to an iterable, it's unnecessary to convert to an array.",[pc]:"`{{constructorName}}` accepts a single iterable argument, spreading is misleading.",[pd]:"`Object.assign(…)` source object with only spread properties is unnecessary.",[pm]:"Unnecessarily cloning an array.",[pf]:"Remove the object literal wrapper."},languages:["js/js"]}},"unicorn/no-useless-switch-case":{create:e=>{let t=rQ(e.physicalFilename);e.on("SwitchStatement",function*(r){let{cases:n}=r;if(!(n.length<2)&&null===n.at(-1).test)for(let r=n.length-2;r>=0;r--){let o=n[r];if(!pD(o))break;t&&pT(o)||(yield{node:o,loc:function(e,t){let{sourceCode:r}=t,n=e.test||r.getFirstToken(e),o=r.getTokenAfter(n,ew);return{start:r.getLoc(e).start,end:r.getLoc(o).end}}(o,e),messageId:pS,suggest:[{messageId:pC,fix:e=>e.remove(o)}]})}})},meta:{type:"suggestion",docs:{description:"Disallow useless case in switch statements.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[pS]:"Useless case in switch statement.",[pC]:"Remove this case."},languages:["js/js"]}},"unicorn/no-useless-undefined":pz,"unicorn/numeric-separators-style":pX,"unicorn/prefer-array-find":ci,"unicorn/prefer-array-flat-map":{create:e=>{e.on("CallExpression",t=>{if(!(tR(t,{method:"flat",optionalCall:!1,optionalMember:!1})&&(0===t.arguments.length||1===t.arguments.length&&"Literal"===t.arguments[0].type&&"1"===t.arguments[0].raw)&&tR(t.callee.object,{method:"map",optionalCall:!1})))return;let r=t.callee.object;if(tM(r.callee.object,cp)||nL(r.callee.object,e))return;let{sourceCode:n}=e,o=r.callee.property,a=rU(e,t,[r])||t.typeArguments||t.typeParameters||r.typeArguments||r.typeParameters?void 0:function*(r){yield iH(r,t,e),yield r.replaceText(o,"flatMap")};return{node:t,loc:{start:n.getLoc(o).start,end:n.getLoc(t).end},messageId:cs,fix:a}}),e.on("CallExpression",t=>{let r;if(!tR(t,{method:"flatMap",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||t.typeArguments||t.typeParameters)return;let n=t.callee.object;if(!tR(n,{method:"filter",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||n.typeArguments||n.typeParameters||r3(n.callee.object)||nB(n.callee.object,e))return;let{sourceCode:o}=e;if(o.getCommentsInside(t).length>0)return;let[a]=n.arguments,[i]=t.arguments;if(!cd(a)||!cd(i)||!("ArrayExpression"===(r=i.body).type&&r.elements.length>1))return;let[s]=a.params,[l]=i.params;if(!oT(s,l))return;let u=function(e,t){if(ta(e,t))return to(e,t);let r=t.sourceCode.getText(e);return it(e,t)?`(${r})`:r}(n.callee.object,e),p=o.getText(s),c=function(e,t){if(ta(e,t))return to(e,t);let r=t.sourceCode.getText(e);return cc.has(e.type)?`(${r})`:r}(a.body,e),d=o.getText(i.body);return{node:t.callee.property,messageId:cl,suggest:[{messageId:cu,fix:e=>e.replaceText(t,`${u}.flatMap(${p} => ${c} ? ${d} : [])`)}]}})},meta:{type:"suggestion",docs:{description:"Prefer `.flatMap(…)` over `.map(…).flat()` and `.filter(…).flatMap(…)`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[cs]:"Prefer `.flatMap(…)` over `.map(…).flat()`.",[cl]:"Prefer a single `.flatMap(…)` over `.filter(…).flatMap(…)`.",[cu]:"Replace `.filter(…).flatMap(…)` with a single `.flatMap(…)`."},languages:["js/js"]}},"unicorn/prefer-array-flat":cv,"unicorn/prefer-array-some":cT,"unicorn/prefer-default-parameters":{create:e=>{let{sourceCode:t}=e,r=[],n=(e,n,o,a)=>{let i,s=r.at(-1);if(!s||!n||!o||"Identifier"!==n.type||"LogicalExpression"!==o.type||"||"!==o.operator&&"??"!==o.operator||"Identifier"!==o.left.type||"Literal"!==o.right.type)return;let{name:l}=n,{left:{name:u},right:{raw:p}}=o;if(a&&l!==u)return;let c=eS(t.getScope(e),u);if(!c)return;let{references:d}=c,{params:m}=s,f=m.find(e=>"Identifier"===e.type&&e.name===u);if(((e,t,r)=>{for(let n of t.body.body){if(n===r)break;if(cI(e,n))return!0}return!1})(t,s,e)||a&&d[0].identifier!==n||!a&&d.length>1||(i=m.at(-1),!f||f!==i))return;let g=((e,t)=>{if("ArrowFunctionExpression"!==t.type||t.params.length>1)return!1;let[r]=t.params,n=e.getTokenBefore(r),o=e.getTokenAfter(r);return!o||!n||"("!==n.value||")"!==o.value})(t,s)?`(${l} = ${p})`:`${l} = ${p}`;return{node:e,messageId:cA,suggest:[{messageId:cw,fix:r=>[r.replaceText(f,g),((e,t,r)=>{let{line:n}=t.getLoc(r).start,{column:o}=t.getLoc(r).end,a=t.getText(r),i=t.lines[n-1];if(i.trim()===a)return e.removeRange([t.getIndexFromLoc({line:n,column:0}),t.getIndexFromLoc({line:n+1,column:0})]);if(" "===i[o]){let[n,o]=t.getRange(r);return e.removeRange([n,o+1])}return e.remove(r)})(r,t,e)]}]}};e.on(tA,e=>{r.push(e)}),e.onExit(tA,()=>{r.pop()}),e.on("AssignmentExpression",e=>{if("ExpressionStatement"===e.parent.type&&e.parent.expression===e)return n(e.parent,e.left,e.right,!0)}),e.on("VariableDeclarator",e=>{if("VariableDeclaration"===e.parent.type&&e.parent.declarations[0]===e)return n(e.parent,e.id,e.init,!1)})},meta:{type:"suggestion",docs:{description:"Prefer default parameters over reassignment.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[cA]:"Prefer default parameters over reassignment.",[cw]:"Replace reassignment with default parameter."},languages:["js/js"]}},"unicorn/prefer-logical-operator-over-ternary":{create:e=>{let{sourceCode:t}=e;e.on("ConditionalExpression",r=>{let{test:n,consequent:o,alternate:a}=r,i=function(e,t){let{test:r,consequent:n,alternate:o}=e,a=function(e,t){let r=cO(e);if(r?.kind==="nullish")return r;if("LogicalExpression"!==e.type)return;let n=cO(e.left),o=cO(e.right);if(n&&o&&cN(n.reference,o.reference,t)){if("||"===e.operator&&n.isTrueWhenNullish&&o.isTrueWhenNullish&&cq(n,o))return{reference:n.reference,isTrueWhenNullish:!0};if("&&"===e.operator&&!n.isTrueWhenNullish&&!o.isTrueWhenNullish&&cq(n,o))return{reference:n.reference,isTrueWhenNullish:!1}}}(r,t.sourceCode);if(!a||t.sourceCode.getCommentsInside(e).length>0)return;let{reference:i}=a;if(a.isTrueWhenNullish&&cN(i,o,t.sourceCode))return c$({context:t,conditionalExpression:e,left:o,right:n,operators:["??"]});if(!a.isTrueWhenNullish&&cN(i,n,t.sourceCode))return c$({context:t,conditionalExpression:e,left:n,right:o,operators:["??"]});let s=a.isTrueWhenNullish?n:o,l=a.isTrueWhenNullish?o:n;if(!tq(s)||!tF(l)||l.optional||!rk(rN(i),rN(l.object))||function(e){let t=e,{parent:r}=t;for(;rL(r)&&r.expression===t;)r=(t=r).parent;return"UnaryExpression"===r.type&&"delete"===r.operator&&r.argument===t||"CallExpression"===r.type&&r.callee===t||"TaggedTemplateExpression"===r.type&&r.tag===t}(e))return;let u=function(e,t){let{sourceCode:r}=t,n=rX(e,t);if(rV(t,n))return;let[o,a]=r.getRange(e),[i,s]=n;return r.text.slice(o,i)+(e.computed?"?.[":"?.")+r.text.slice(s,a)}(l,t);if(u)return{node:e,messageId:cF,suggest:[{messageId:cR,fix(r){let n=u;return aL(t.sourceCode.getTokenBefore(e),t,n)&&(n=`;${n}`),r.replaceText(e,n)}}]}}(r,e);return i||(cN(n,o,t)?c$({context:e,conditionalExpression:r,left:n,right:a}):"UnaryExpression"===n.type&&"!"===n.operator&&n.prefix&&cN(n.argument,a,t)?c$({context:e,conditionalExpression:r,left:n.argument,right:o}):void 0)})},meta:{type:"suggestion",docs:{description:"Prefer using a logical operator over a ternary.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[cj]:"Prefer using a logical operator over a ternary.",[cF]:"Prefer using optional chaining over a ternary.",[cB]:"Switch to `{{operator}}` operator.",[cR]:"Switch to optional chaining."},languages:["js/js"]}},"unicorn/prefer-optional-catch-binding":{create:e=>{e.on("CatchClause",t=>{let r=t.param;if(!r)return;let{sourceCode:n}=e;if(n.getDeclaredVariables(r.parent).some(e=>e.references.length>0))return;let{type:o,name:a,parent:i}=r,s=n.getCommentsInside(r).length>0;return{node:r,messageId:"Identifier"===o?cU:cW,data:{name:a},fix:s?void 0:function*(e){let t=n.getTokenBefore(r);tX(t,{test:ek,expected:"(",ruleId:"prefer-optional-catch-binding"});let o=n.getTokenAfter(r);tX(o,{test:eI,expected:")",ruleId:"prefer-optional-catch-binding"}),yield e.remove(t),yield e.remove(r),yield e.remove(o);let[,a]=n.getRange(o),[s]=n.getRange(i.body),l=n.text.slice(a,s),u=l.length-l.trimStart().length;0!==u&&(yield e.removeRange([a,a+u]))}}})},meta:{type:"suggestion",docs:{description:"Prefer omitting the `catch` binding parameter.",recommended:"unopinionated"},fixable:"code",messages:{[cU]:"Remove unused catch binding `{{name}}`.",[cW]:"Remove unused catch binding."},languages:["js/js"]}},"unicorn/prefer-regexp-test":du,"unicorn/prefer-set-has":dC,"unicorn/prefer-string-raw":{create:e=>{e.on("Literal",t=>{if(!ts(t)||function(e){let{parent:t}=e,{type:r}=t;return tv(t)||["Property","PropertyDefinition","MethodDefinition","AccessorProperty"].includes(r)&&!t.computed&&t.key===e||["TSAbstractPropertyDefinition","TSAbstractMethodDefinition","TSAbstractAccessorProperty","TSPropertySignature"].includes(r)&&t.key===e||["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"].includes(r)&&t.source===e||"ImportAttribute"===r&&(t.key===e||t.value===e)||"ImportSpecifier"===r&&t.imported===e||"ExportSpecifier"===r&&(t.local===e||t.exported===e)||"ExportAllDeclaration"===r&&t.exported===e||"JSXAttribute"===r&&t.value===e||"TSEnumMember"===r&&(t.initializer===e||t.id===e)||"TSModuleDeclaration"===r&&t.id===e||"TSExternalModuleReference"===r&&t.expression===e||"TSLiteralType"===r&&t.literal===e||"TSImportType"===r&&t.source===e}(t)||dD(t))return;let{sourceCode:r}=e,{raw:n}=t;if("\\"===n.at(-2)||!n.includes("\\\\")||n.includes("`")||n.includes("${")||r.getLoc(t).start.line!==r.getLoc(t).end.line)return;let o=dw(n.slice(1,-1),n.charAt(0));if(o===t.value)return{node:t,messageId:dT,*fix(r){yield iG(r,t,e),yield r.replaceText(t,`String.raw\`${o}\``)}}}),e.on("TemplateLiteral",t=>{if(!("TaggedTemplateExpression"===t.parent.type&&t.parent.quasi===t||t.quasis.every(({value:{cooked:e,raw:t}})=>e===t)||t.quasis.some(({value:{cooked:e,raw:t}})=>"\\"===e.at(-1)||dw(t)!==e)||dD(t)))return{node:t,messageId:dT,*fix(r){for(let n of(yield iG(r,t,e),yield r.insertTextBefore(t,"String.raw"),t.quasis)){let{cooked:t,raw:o}=n.value;t!==o&&(yield i1(n,t,e,r))}}}}),e.on("TaggedTemplateExpression",t=>{let{quasi:r,tag:n,parent:o}=t,{sourceCode:a}=e;if(!tF(n,{object:"String",property:"raw",optional:!1})||!a.isGlobalReference(n.object)||r.quasis.some(e=>e.value.raw.includes("\\")))return;let i=a.getText(r),s=r.expressions.length>0||/\r?\n/.test(i)?i:`'${i.slice(1,-1).replaceAll("'",()=>String.raw`\'`)}'`;return{node:n,messageId:dA,*fix(r){let n=a.getTokenBefore(t);aL(n,e,s)&&(yield r.insertTextBefore(t,";")),"ReturnStatement"!==o.type&&"ThrowStatement"!==o.type||oS(n,t.quasi,e)||ta(t,e)||(yield iV(r,o,e)),"YieldExpression"!==o.type||o.delegate||o.argument!==t||oS(n,t.quasi,e)||ta(t,e)||(yield r.insertTextBefore(t,"("),yield r.insertTextAfter(t,")")),yield r.replaceText(t.quasi,s),yield iM(t.tag,r,e),yield r.remove(t.tag)}}})},meta:{type:"suggestion",docs:{description:"Prefer using the `String.raw` tag to avoid escaping `\\`.",recommended:"unopinionated"},fixable:"code",messages:{[dT]:"`String.raw` should be used to avoid escaping `\\`.",[dA]:"Using `String.raw` is unnecessary as the string does not contain any `\\`."},languages:["js/js"]}},"unicorn/prefer-switch":dP,"unicorn/require-number-to-fixed-digits-argument":{create:e=>{e.on("CallExpression",t=>{if(!tR(t,{method:"toFixed",argumentsLength:0,optionalCall:!1})||"NewExpression"===t.callee.object.type)return;let{sourceCode:r}=e,[n,o]=r.getLastTokens(t,2);return{loc:{start:r.getLoc(n).start,end:r.getLoc(o).end},messageId:dL,fix:r=>iO(r,t,"0",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the digits argument with `Number#toFixed()`.",recommended:"unopinionated"},fixable:"code",messages:{[dL]:"Missing the digits argument."},languages:["js/js"]}},"unicorn/template-indent":{create:e=>{let{sourceCode:t}=e,r={...e.options[0]},n=(e=>{let t=new i,r=[e.ast];for(;r.length>0;){let n=r.pop();if(n){if("TemplateLiteral"===n.type){let{start:{line:r},end:{line:o}}=e.getLoc(n);for(let e=r+1;e<=o;e++)t.add(e)}for(let t of e.visitorKeys[n.type]??[]){let e=n[t];Array.isArray(e)?r.push(...e):r.push(e)}}}return t})(t);r.comments=r.comments.map(e=>e.toLowerCase());let o=new l,a=a=>{let i;if("TemplateLiteral"!==a.type||o.has(a))return;o.add(a);let s="__PLACEHOLDER__"+Math.random(),l=a.quasis.map(e=>t.getText(e).slice(1,e.tail?-1:-2)).join(s),u=l.match(/\r?\n/);if(!u)return;let p=u[0],c=t.getLoc(a),d=t.lines[c.start.line-1].match(/^(\s*)\S/),m=d?d[1]:"";i="string"==typeof r.indent?r.indent:"number"==typeof r.indent?" ".repeat(r.indent):((e,t,r,n)=>{if(""===r){let r;return dU(dV(e.lines,t)).indent||dU(dN(r=dV(n.split(/\r?\n/)))).indent||dU(r).indent||" "}return r.startsWith(" ")?" ":" "})(t,n,m,l);let f=dN(l).replaceAll(RegExp(`^${p}|${p}[ ]*$`,"g"),""),g=p+d$(f,1,{indent:m+i})+p+m;if(g!==l)return{node:a,messageId:dW,fix:t=>g.split(s).map((r,n)=>i1(a.quasis[n],r,e,t))}};e.on("TemplateLiteral",e=>{if((e=>{if(r.comments.length>0){let n=t.getTokenBefore(e,{includeComments:!0});if(n?.type==="Block"&&r.comments.includes(n.value.trim().toLowerCase()))return!0}return!!(dD(e)||r.tags.length>0&&tO(e,r.tags))||!!(r.functions.length>0&&"CallExpression"===e.parent.type&&e.parent.arguments.includes(e)&&tM(e.parent.callee,r.functions))})(e))return a(e)}),e.on(r.selectors,e=>a(e))},meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation.",recommended:!0},fixable:"code",schema:d_,defaultOptions:[{tags:["outdent","dedent","gql","sql","html","styled"],functions:["dedent","stripIndent"],selectors:[],comments:["HTML","indent"]}],messages:{[dW]:"Templates should be properly indented."},languages:["js/js"]}},"unicorn/no-single-promise-in-promise-methods":{create:e=>{e.on("CallExpression",t=>{if(!(tR(t,{object:"Promise",methods:u5,optionalMember:!1,optionalCall:!1,argumentsLength:1})&&"ArrayExpression"===t.arguments[0].type&&1===t.arguments[0].elements.length&&t.arguments[0].elements[0]&&"SpreadElement"!==t.arguments[0].elements[0].type))return;let r=t.callee.property.name,n={node:t.arguments[0],messageId:u8,data:{method:r}},{sourceCode:o}=e;if("AwaitExpression"===t.parent.type&&t.parent.argument===t&&("all"!==r||tT(t.parent.parent)))return n.fix=r=>r.replaceText(t,u4(t,e)),n;return"all"===r?(n.fix=((e,t)=>{let{sourceCode:r}=t;if(u7(r,e))return;let n=e.parent;if("AwaitExpression"!==n.type||n.argument!==e)return;let o=(e=>{let{parent:t}=e;return"VariableDeclarator"===t.type&&t.init===e&&pe(t.id)?t.id:"AssignmentExpression"===t.type&&t.right===e&&pe(t.left)&&tT(t.parent)?t.left:void 0})(n);if(o){if(u7(r,o))return;return function*(n){yield n.replaceText(o,r.getText(o.elements[0])),yield n.replaceText(e,u4(e,t))}}let a=n.parent;if("MemberExpression"===a.type&&a.computed&&ti(a.property,0)&&a.object===n&&("VariableDeclarator"===a.parent.type&&a.parent.init===a||"AssignmentExpression"===a.parent.type&&a.parent.right===a)&&!u7(r,a))return r=>r.replaceText(a,`await ${u4(e,t)}`)})(t,e),n):(n.suggest=[{messageId:u6,fix:r=>{let[n]=t.arguments[0].elements,o=to(n,e);return ta(n,e)||"Identifier"===n.type||"MemberExpression"===n.type||(o=`(${o})`),aL(e.sourceCode.getTokenBefore(t),e,o)&&(o=`;${o}`),r.replaceText(t,o)}},{messageId:u9,fix:function*(e){let r=t.callee.property;yield e.replaceText(r,"resolve");let[n]=t.arguments,a=o.getFirstToken(n),[i,s]=o.getLastTokens(n,2);yield e.remove(a),yield e.remove(s),eT(i)&&(yield e.remove(i))}}],n)})},meta:{type:"suggestion",docs:{description:"Disallow passing single-element arrays to `Promise` methods.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[u8]:"Wrapping single-element array with `Promise.{{method}}()` is unnecessary.",[u6]:"Use the value directly.",[u9]:"Switch to `Promise.resolve(…)`."},languages:["js/js"]}},"unicorn/no-await-in-promise-methods":{create:e=>{e.on("CallExpression",function*(t){if(tR(t,{object:"Promise",methods:dG,optionalMember:!1,optionalCall:!1,argumentsLength:1})&&"ArrayExpression"===t.arguments[0].type)for(let r of t.arguments[0].elements)r?.type==="AwaitExpression"&&(yield{node:r,messageId:dz,data:{method:t.callee.property.name},suggest:[{messageId:dK,*fix(t){let n=e.sourceCode.getFirstToken(r);yield t.remove(n),yield i_(n,e,t)}}]})})},meta:{type:"suggestion",docs:{description:"Disallow using `await` in `Promise` method parameters.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[dz]:"Promise in `Promise.{{method}}()` should not be awaited.",[dK]:"Remove `await`."},languages:["js/js"]}},"unicorn/no-negation-in-equality-check":{create:e=>{e.on("BinaryExpression",t=>{let{operator:r,left:n}=t;if(!("BinaryExpression"===t.type&&dY.has(t.operator)&&dH(n))||dH(n.argument))return;let{sourceCode:o}=e,a=o.getFirstToken(n),i=`${r.startsWith("!")?"=":"!"}${r.slice(1)}`;return{node:a,messageId:dJ,suggest:[{messageId:dX,data:{operator:i},*fix(s){yield iG(s,t,e);let l=o.getTokenAfter(a),{parent:u}=t;("ReturnStatement"===u.type||"ThrowStatement"===u.type)&&!ta(t,e)&&(oS(o.getFirstToken(u),l,e)||(yield iV(s,u,e))),yield s.remove(a),aL(o.getTokenBefore(a),e,l.value)&&(yield s.insertTextAfter(a,";"));let p=o.getTokenAfter(n,e=>"Punctuator"===e.type&&e.value===r);yield s.replaceText(p,i)}}]}})},meta:{type:"problem",docs:{description:"Disallow negated expression in equality check.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[dJ]:"Negated expression is not allowed in equality check.",[dX]:"Switch to '{{operator}}' check."},languages:["js/js"]}},"unicorn/no-unnecessary-slice-end":{create(e){dQ(e,{methods:["slice"],messageId:dZ})},meta:{type:"suggestion",docs:{description:"Disallow using `.length` or `Infinity` as the `end` argument of `{Array,String,TypedArray}#slice()`.",recommended:"unopinionated"},fixable:"code",messages:{[dZ]:"Passing `{{description}}` as the `end` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-lonely-if":{create:e=>{e.on("IfStatement",t=>{if(mg(t)&&("BlockStatement"===t.parent.type&&1===t.parent.body.length&&t.parent.body[0]===t&&mg(t.parent.parent)&&t.parent.parent.consequent===t.parent||mg(t.parent)&&t.parent.consequent===t))return{node:t,messageId:mf,fix:function(e,t){let{sourceCode:r}=t;return n=>{var o,a;let i=("BlockStatement"===e.parent.type?e.parent:e).parent,s={...i,...my(i,r)},l={...e,...my(e,r)},u=mE(s,r),p=mv(s,t,r),c=mb(mx(mE(l,r)),mv(l,t,r)),d=function(e,t,r,n){let o=[...n.getRange(e)];if("BlockStatement"===t.type)return o;let a=n.getLastToken(t);if(eB(a)){let t=n.getTokenAfter(e);t&&aL(a,r,t.value)&&(o[1]=n.getRange(t)[0])}return o}(i,l.consequent,t,r),m={outerConditionGap:s.openingBraceToken?mx(mh(s.closingParenthesisToken,s.openingBraceToken,r)):"",outerLeadingContent:s.openingBraceToken?mx(mh(s.openingBraceToken,l.ifToken,r)):mx(mh(s.closingParenthesisToken,l.ifToken,r)),outerTrailingContent:s.openingBraceToken?mx(mh(l,s.closingBraceToken,r)):""},f=(o=m.outerConditionGap,a=m.outerLeadingContent,o.trimStart().startsWith("//")?{leadingStatementText:mx(a).trimStart(),conditionSuffixText:o}:{leadingStatementText:mx(mb(o,a)).trimStart(),conditionSuffixText:""}),{leadingStatementText:g}=f,y=function({outerIfStatement:e,inner:t,replacementRange:r,sourceCode:n,consequentTextPieces:o,outerConditionGapTextPieces:a}){let{outerTrailingContent:i}=o,{conditionSuffixText:s}=a;if("BlockStatement"===t.consequent.type){let e=mh(t.closingParenthesisToken,t.openingBraceToken,n),r=mh(t.openingBraceToken,t.closingBraceToken,n);return`${s}${e}{${r}${i}}`}let l=mh(t.closingParenthesisToken,t.consequent,n),u=`${s}${l}${((e,t)=>{let[r,n]=t.getRange(e);return t.text.slice(r,n)})(t.consequent,n)}${i}`;return`${u}${((e,t,r)=>{let[,n]=r.getRange(e);if(t[1]===n)return"";let o=r.text.slice(n,t[1]);return""===o.trim()?o.includes("\n")?`;${o}`:";":`;${o}`})(e,r,n)}`}({outerIfStatement:i,inner:l,replacementRange:d,sourceCode:r,consequentTextPieces:m,outerConditionGapTextPieces:f});return n.replaceTextRange(d,`${g}if${u}(${p} && ${c})${y}`)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Disallow `if` statements as the only statement in `if` blocks without `else`.",recommended:"unopinionated"},fixable:"code",messages:{[mf]:"Unexpected `if` as the only statement in a `if` block without `else`."},languages:["js/js"]}},"unicorn/no-magic-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!tR(t,{method:"flat",argumentsLength:1,optionalCall:!1}))return;let[r]=t.arguments;if(!tp(r)||1===r.value)return;let{sourceCode:n}=e,{openingParenthesisToken:o,closingParenthesisToken:a}=rD(t,e);if(!(n.commentsExistBetween(o,a)||nL(t.callee.object,e)))return{node:r,messageId:mS}})},meta:{type:"suggestion",docs:{description:"Disallow a magic number as the `depth` argument in `Array#flat(…).`",recommended:"unopinionated"},messages:{[mS]:"Magic number as depth is not allowed."},languages:["js/js"]}},"unicorn/no-negated-condition":{create:e=>{e.on(["IfStatement","ConditionalExpression"],t=>{if("IfStatement"===t.type&&(!t.alternate||"IfStatement"===t.alternate.type))return;let{test:r}=t;if("UnaryExpression"===r.type&&"!"===r.operator||"BinaryExpression"===r.type&&("!="===r.operator||"!=="===r.operator))return{node:r,messageId:mC,*fix(n){if(yield function*(e,t,r){let{sourceCode:n}=r,{test:o}=t;if("UnaryExpression"===o.type){let a=n.getFirstToken(o);"IfStatement"===t.type&&(yield iM(o.argument,e,r)),yield e.remove(a);return}let a=n.getTokenAfter(o.left,e=>"Punctuator"===e.type&&e.value===o.operator);yield e.replaceText(a,"="+a.value.slice(1))}(n,t,e),yield function*(e,t,r){let n="IfStatement"===t.type,[o,a]=[t.consequent,t.alternate].map(e=>{let t=tn(e,r),o=r.sourceCode.text.slice(...t);return n&&"BlockStatement"!==e.type&&(o=`{${o}}`),{range:t,text:o}});if(o.text===a.text)return;let{sourceCode:i}=r;yield e.replaceTextRange(i.getRange(o),a.text),yield e.replaceTextRange(i.getRange(a),o.text)}(n,t,e),"ConditionalExpression"!==t.type||"UnaryExpression"!==r.type)return;yield iG(n,t,e);let{sourceCode:o}=e,{parent:a}=t,[i,s]=o.getFirstTokens(r,2);"ReturnStatement"!==a.type&&"ThrowStatement"!==a.type||a.argument!==t||oS(i,s,e)||ta(t,e)||ta(r,e)?aL(o.getTokenBefore(t),e,s.value)&&(yield n.insertTextBefore(t,";")):yield iV(n,a,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow negated conditions.",recommended:"unopinionated"},fixable:"code",messages:{[mC]:"Unexpected negated condition."},languages:["js/js"]}},"unicorn/no-object-as-default-parameter":{create:e=>{e.on("AssignmentPattern",e=>{if(!("ObjectExpression"===e.right.type&&e.right.properties.length>0&&tw(e.parent)&&e.parent.params.includes(e)))return;let{left:t,right:r}=e;return"Identifier"===t.type?{node:t,messageId:mD,data:{parameter:t.name}}:{node:r,messageId:mT}})},meta:{type:"problem",docs:{description:"Disallow the use of objects as default parameters.",recommended:"unopinionated"},messages:{[mD]:"Do not use an object literal as default for parameter `{{parameter}}`.",[mT]:"Do not use an object literal as default."},languages:["js/js"]}},"unicorn/prefer-negative-index":{create:e=>{e.on("CallExpression",t=>{if("MemberExpression"!==t.callee.type)return;let r=function(e){let{callee:t,arguments:r}=e,n=t.property.name,o=t.object,a=r;if(mw.has(n))return{method:n,target:o,argumentsNodes:a};if("call"!==n&&"apply"!==n||(n=mk(t.object),!mw.has(n)))return;let i="apply"===t.property.name,{supportObjects:s}=mw.get(n),l=t.object.object;if(tC(l)||"slice"===n&&ti(l,"")||"prototype"===mk(l)&&"Identifier"===l.object.type&&s.has(l.object.name)){if([o]=r,i){let[,e]=r;if(!e||"ArrayExpression"!==e.type)return;a=e.elements}else a=r.slice(1);return{method:n,target:o,argumentsNodes:a}}}(t);if(!r)return;let{method:n,target:o,argumentsNodes:a}=r,{argumentsIndexes:i}=mw.get(n),s=i.map(e=>(function e(t,r){let n;if(!t)return;let{type:o,operator:a,left:i,right:s}=t=rN(t);if("BinaryExpression"===o&&"-"===a&&tp(n=rN(s))&&n.value>0)return pF(i,r)?i:e(i,r)})(a[e],o)).filter(Boolean);if(0!==s.length)return{node:t,messageId:mA,data:{method:n},*fix(t){for(let r of s)yield function(e,t,r){let[n,o]=tn(e,r);return t.removeRange([n,o+r.sourceCode.text.slice(o).match(/\S|$/).index])}(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Prefer negative index over `.length - index` when possible.",recommended:"unopinionated"},fixable:"code",messages:{[mA]:"Prefer negative index over length minus index for `{{method}}`."},languages:["js/js"]}},"unicorn/prefer-node-protocol":{create:e=>{e.on("Literal",t=>{if(!(["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration","ImportExpression","TSImportType"].includes(t.parent.type)&&t.parent.source===t||(tR(t.parent,{object:"process",method:"getBuiltinModule",argumentsLength:1,optionalCall:!1,optionalMember:!1})||tN(t.parent))&&t.parent.arguments[0]===t))return;let{value:r}=t;if(!("string"==typeof r&&!r.startsWith(mB)&&mj(r)&&mj(`${mB}${r}`)))return;let n=e.sourceCode.getRange(t)[0]+1;return{node:t,messageId:mF,data:{moduleName:r},fix:e=>e.insertTextAfterRange([n,n],mB)}})},meta:{type:"suggestion",docs:{description:"Prefer using the `node:` protocol when importing Node.js builtin modules.",recommended:"unopinionated"},fixable:"code",messages:{[mF]:"Prefer `node:{{moduleName}}` over `{{moduleName}}`."},languages:["js/js"]}},"unicorn/consistent-date-clone":{create:e=>{e.on("NewExpression",t=>{if(!tE(t,{name:"Date",argumentsLength:1}))return;let[r]=t.arguments;if(!tR(r,{method:"getTime",argumentsLength:0,optionalCall:!1,optionalMember:!1}))return;let{sourceCode:n}=e;return{node:r,loc:{start:n.getLoc(r.callee.property).start,end:n.getLoc(r).end},messageId:mR,fix:t=>iH(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Prefer passing `Date` directly to the constructor when cloning.",recommended:"unopinionated"},fixable:"code",messages:{[mR]:"Unnecessary `.getTime()` call."},languages:["js/js"]}},"unicorn/no-accessor-recursion":{create:e=>{let{sourceCode:t}=e;e.on("ThisExpression",e=>{let r=((e,t)=>{for(let r=e.getScope(t);r;r=r.upper){if("class"===r.type)return;if("function"===r.type&&"ArrowFunctionExpression"!==r.block.type)return r}})(t,e);if(!r)return;let n=r.block.parent;if(["Property","MethodDefinition"].includes(n?.type)&&!n.computed&&["set","get"].includes(n.kind)&&mL(n.key)&&("get"===n.kind&&(m$(e,n)||"VariableDeclarator"===e.parent.type&&e.parent.init===e&&"ObjectPattern"===e.parent.id.type&&e.parent.id.properties.some(e=>"Property"===e.type&&!e.computed&&mN(e.key,n.key)))||"set"===n.kind&&((e,t)=>{if(!m$(e,t))return!1;let r=e.parent,{parent:n}=r;return("AssignmentExpression"===n.type||"AssignmentPattern"===n.type)&&n.left===r||"UpdateExpression"===n.type&&n.argument===r||"ArrayPattern"===n.type&&n.elements.includes(r)||"RestElement"===n.type&&n.argument===r||("ForOfStatement"===n.type||"ForInStatement"===n.type)&&n.left===r||"Property"===n.type&&n.value===r&&"ObjectPattern"===n.parent.type&&n.parent.properties.includes(r.parent)})(e,n)))return{node:e.parent,messageId:mP,data:{kind:n.kind}}})},meta:{type:"problem",docs:{description:"Disallow recursive access to `this` within getters and setters.",recommended:"unopinionated"},defaultOptions:[],messages:{[mP]:"Disallow recursive access to `this` within {{kind}}ters."},languages:["js/js"]}},"unicorn/prefer-import-meta-properties":{create:function(e){let{sourceCode:t}=e;e.on("MetaProperty",function*(e){if("MetaProperty"!==e.type||"import"!==e.meta.name||"meta"!==e.property.name)return;let r=e.parent;if(!tF(r,{properties:["url","filename"],computed:!1,optional:!1}))return;let n=r.property.name;if("url"===n){if(mU(r.parent,t)&&r.parent.arguments[0]===r)return void(yield a(r.parent,{reportFilenameNode:!0}));if(tE(r.parent,{name:"URL",minimumArguments:1,maximumArguments:2})){var o;let e=r.parent,n=e.parent;if(1===e.arguments.length&&e.arguments[0]===r&&mU(n,t)&&n.arguments[0]===e)return void(yield a(n,{reportFilenameNode:!0}));2===e.arguments.length&&(o=e.arguments[0],o?.type==="Literal"&&("."===o.value||"./"===o.value))&&e.arguments[1]===r&&mU(n,t)&&n.arguments[0]===e&&(yield i(n,"dirname"))}return}function*a(e,{reportFilenameNode:r=!1}={}){let{parent:n}=e;if(mW(n,t)&&n.arguments[0]===e)return void(yield i(n,"dirname"));if(r&&(yield i(e,"filename")),"VariableDeclarator"!==n.type||n.init!==e||"Identifier"!==n.id.type||"VariableDeclaration"!==n.parent.type||"const"!==n.parent.kind)return;let o=eS(t.getScope(n.id),n.id);if(o)for(let e of o.references){if(!e.isReadOnly())continue;let{parent:r}=e.identifier;mW(r,t)&&r.arguments[0]===e.identifier&&(yield i(r,"dirname"))}}function i(e,t){return{node:e,messageId:"dirname"===t?mM:mO,fix:r=>r.replaceText(e,`import.meta.${t}`)}}"filename"===n&&(yield a(r))})},meta:{type:"suggestion",docs:{description:"Prefer `import.meta.{dirname,filename}` over legacy techniques for getting file paths.",recommended:!1},fixable:"code",messages:{[mM]:"Do not construct dirname.",[mO]:"Do not construct filename using `fileURLToPath()`."},languages:["js/js"]}},"unicorn/no-unnecessary-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!(tR(t,{method:"flat",argumentsLength:1,optionalCall:!1})&&ti(t.arguments[0],1))||nL(t.callee.object,e))return;let[r]=t.arguments;return{node:r,messageId:mV,fix:t=>iq(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Disallow using `1` as the `depth` argument of `Array#flat()`.",recommended:"unopinionated"},fixable:"code",messages:{[mV]:"Passing `1` as the `depth` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-unnecessary-array-splice-count":{create(e){dQ(e,{methods:["splice","toSpliced"],messageId:m_,checkArrayReceiver:!0})},meta:{type:"suggestion",docs:{description:"Disallow using `.length` or `Infinity` as the `deleteCount` or `skipCount` argument of `Array#{splice,toSpliced}()`.",recommended:"unopinionated"},fixable:"code",messages:{[m_]:"Passing `{{description}}` as the `{{argumentName}}` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-useless-error-capture-stack-trace":{create:e=>{let t=[],r=[];e.on(["ClassDeclaration","ClassExpression"],e=>{t.push(e),r.push(e)}),e.onExit(["ClassDeclaration","ClassExpression"],()=>{t.pop(),r.pop()}),e.on(["FunctionDeclaration","FunctionExpression"],e=>{r.push(e)}),e.onExit(["FunctionDeclaration","FunctionExpression"],()=>{r.pop()}),e.on("CallExpression",n=>{let o,a=t.at(-1);if(!(a?.superClass&&"Identifier"===a.superClass.type&&uu.includes(a.superClass.name)&&e.sourceCode.isGlobalReference(a.superClass)&&(o=r.at(-1),o&&"MethodDefinition"===o.parent.type&&"constructor"===o.parent.kind&&o.parent.value===o&&a.body.body.includes(o.parent))&&tR(n,{object:"Error",method:"captureStackTrace",argumentsLength:2,optionalMember:!1})&&e.sourceCode.isGlobalReference(n.callee.object)))return;let[i,s]=n.arguments;if("ThisExpression"!==i.type||!((e,t,r)=>{if("MetaProperty"===e.type&&"Identifier"===e.meta.type&&"new"===e.meta.name&&"Identifier"===e.property.type&&"target"===e.property.name||tF(e,{property:"constructor",computed:!1,optional:!1})&&"ThisExpression"===e.object.type)return!0;if("Identifier"!==e.type||!t.id)return!1;let n=eS(r.sourceCode.getScope(e),e);return n&&1===n.defs.length&&"ClassName"===n.defs[0].type&&n.defs[0].node===t})(s,a,e))return;let l={node:n,messageId:mz},u="ChainExpression"===n.parent.type?n.parent.parent:n.parent;return"ExpressionStatement"===u.type&&"BlockStatement"===u.parent.type&&(l.fix=e=>e.remove(u)),l})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Error.captureStackTrace(…)`.",recommended:"unopinionated"},fixable:"code",messages:{[mz]:"Unnecessary `Error.captureStackTrace(…)` call."},languages:["js/js"]}},"unicorn/prefer-class-fields":{create:e=>{let{sourceCode:t}=e;e.on("ClassBody",r=>{let n=r.body.find(e=>"constructor"===e.kind&&!e.computed&&!e.static&&"MethodDefinition"===e.type&&"FunctionExpression"===e.value.type);if(!n)return;let o=n.value.body.body.find(e=>"EmptyStatement"!==e.type);if(!(o?.type==="ExpressionStatement"&&"AssignmentExpression"===o.expression.type&&"="===o.expression.operator&&"MemberExpression"===o.expression.left.type&&"ThisExpression"===o.expression.left.object.type&&!o.expression.left.computed&&["Identifier","PrivateIdentifier"].includes(o.expression.left.property.type)&&"Literal"===o.expression.right.type))return;let a=o.expression.left.property.name,i=o.expression.right.raw,s=o.expression.left.property.type,l=r.body.find(e=>"PropertyDefinition"===e.type&&!e.computed&&!e.static&&e.key.type===s&&e.key.name===a),u={node:o,messageId:mK};function*p(s){if(yield((e,t,r)=>{let{line:n}=t.getLoc(e).start,o=t.getText(e);return t.lines[n-1].trim()===o?r.removeRange([t.getIndexFromLoc({line:n,column:0}),t.getIndexFromLoc({line:n+1,column:0})]):r.remove(e)})(o,t,s),l){if(l.value)return void(yield s.replaceText(l.value,i));let e=` = ${i}`,r=t.getLastToken(l);return eA(r)?void(yield s.insertTextBefore(r,e)):void(yield s.insertTextAfter(l,`${e};`))}let u=t.getLastToken(r),p=rR(n,e),c=`${p}${a} = ${i};
|
|
48
48
|
`;"\n"!==t.getText()[t.getRange(u)[0]-1]&&(c=`
|
|
49
49
|
${c}`);let d=r.body.at(-1);"PropertyDefinition"===d.type&&";"!==t.getLastToken(d).value&&(c=`;${c}`),yield s.insertTextBefore(u,c)}return l?.value?u.suggest=[{messageId:mG,fix:p}]:u.fix=p,u})},meta:{type:"suggestion",docs:{description:"Prefer class field declarations over `this` assignments in constructors.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[mK]:"Prefer class field declaration over `this` assignment in constructor for static values.",[mG]:"Encountered same-named class field declaration and `this` assignment in constructor. Replace the class field declaration with the value from `this` assignment."},languages:["js/js"]}},"unicorn/prefer-bigint-literals":{create:e=>{e.on("CallExpression",t=>{if(!tb(t,{name:"BigInt",argumentsLength:1,optional:!1},ty))return;let[r]=t.arguments,n=function(e){let t,r;if(ts(e)){let t,r=e.raw.slice(1,-1);try{t=BigInt(r)}catch{return}let n=0n===t?"0":r.trim();return n.startsWith("+")&&(n=n.slice(1).trim()),{shouldUseSuggestion:r.includes("+"),text:`${n}n`,bigint:t}}let n=!1,o=!1;for(;"UnaryExpression"===e.type&&e.prefix;)if("+"===e.operator)n=!0,e=e.argument;else{if("-"!==e.operator)return;o=!o,e=e.argument}let{value:a,raw:i}=e;if(Number.isInteger(a)){try{t=BigInt(a)}catch{return}return(e=>{let t=e.raw.replaceAll("_","").toLowerCase();if(t.includes("."))return!1;let{value:r}=e;for(let{prefix:e,base:n}of[{prefix:"0b",base:2},{prefix:"0o",base:8},{prefix:"0x",base:16}])if(t.startsWith(e))return t.slice(2)===r.toString(n);return!t.includes("e")&&t===String(r)})(e)?r=`${i}n`:(r=`${t}n`,n=!0),o&&0n!==t&&(r=`-${r}`,t=-t),{shouldUseSuggestion:n,text:r,bigint:t}}}(r);if(!n)return;let o={node:t,messageId:mJ},{shouldUseSuggestion:a,text:i,bigint:s}=n,l=r=>{let n=i;return!ta(t,e)&&s<0n&&(n=`(${n})`,aL(e.sourceCode.getTokenBefore(t),e,n)&&(n=`;${n}`)),r.replaceText(t,n)};return a||e.sourceCode.getCommentsInside(t).length>0?o.suggest=[{messageId:mX,data:{replacement:i.length<20?`\`${i}\``:"a bigint literal"},fix:l}]:o.fix=l,o})},meta:{type:"suggestion",docs:{description:"Prefer `BigInt` literals over the constructor.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[mJ]:"Prefer using bigint literal over `BigInt(…)`.",[mX]:"Replace with {{replacement}}."},languages:["js/js"]}},"unicorn/prefer-classlist-toggle":{create:e=>{let{sourceCode:t}=e;e.on(["IfStatement","ConditionalExpression"],r=>{let n=[r.consequent,r.alternate].map(e=>{if(e)return"BlockStatement"===e.type&&1===e.body.length&&(e=e.body[0]),"ExpressionStatement"===e.type&&(e=e.expression),"ChainExpression"===e.type&&(e=e.expression),e});if(n.some(e=>!m1(e,["add","remove"])))return;let[o,a]=n;if(o.callee.property.name!==a.callee.property.name&&m2(o,a))return mZ(r,function*(n){let i=to(o.callee.object.object,e),s=to(o.arguments[0],e),l="ConditionalExpression"===r.type,u="remove"===o.callee.property.name,p=r.test,c=m3(p,u,o),d=c?"":m0(p,e,u),m=o.callee.object.optional||a.callee.object.optional||c?.callee.object.optional,f=`${i}${m?"?":""}.classList.toggle(${s}${d?`, ${d}`:""})`;l||(f+=";"),aL(t.getTokenBefore(r),e,f)&&(f=`;${f}`),yield n.replaceText(r,f),l&&(yield iG(n,r,e))})}),e.on("ConditionalExpression",t=>{let r=[t.consequent,t.alternate];if(!(r.every(e=>ts(e)&&("add"===e.value||"remove"===e.value))&&r[0].value!==r[1].value&&"MemberExpression"===t.parent.type&&t.parent.computed&&!t.parent.optional&&t.parent.property===t&&mQ(t.parent.object)&&tb(t.parent.parent,{optional:!1,argumentsLength:1},ty)&&t.parent.parent.callee===t.parent))return;let n=t.parent,o=n.parent;return mZ(o,function*(r){let a="remove"===t.consequent.value,i=t.test,s=m3(i,a,o)?"":m0(i,e,a);s&&(yield r.insertTextAfter(o.arguments[0],`, ${s}`)),yield iX(r,n,e,".toggle")},t)})},meta:{type:"suggestion",docs:{description:"Prefer using `Element#classList.toggle()` to toggle class names.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[mY]:"Prefer using `Element#classList.toggle()` to toggle class names.",[mH]:"Replace with `Element#classList.toggle()`."},languages:["js/js"]}},"unicorn/require-module-attributes":{create:e=>{let{sourceCode:t}=e;e.on(["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"],e=>{let{source:r,attributes:n}=e;if(!r||Array.isArray(n)&&n.length>0)return;let o=t.getTokenAfter(r);if(o?.type!=="Keyword"||"with"!==o.value)return;let a=t.getTokenAfter(o),i=t.getTokenAfter(a);return{node:e,loc:{start:t.getLoc(a).start,end:t.getLoc(i).end},messageId:m8,data:{type:"ImportDeclaration"===e.type?"import statement":"export statement"},fix:e=>[o,i,a].map(t=>e.remove(t))}}),e.on("ImportExpression",r=>{let{options:n}=r;if(n?.type!=="ObjectExpression")return;let o=n.properties.find(e=>"Property"===e.type&&!e.method&&!e.shorthand&&!e.computed&&"init"===e.kind&&("Identifier"===e.key.type&&"with"===e.key.name||"Literal"===e.key.type&&"with"===e.key.value)&&tD(e.value)),a=0===n.properties.length||o&&1===n.properties.length?n:o;if(!a)return;let i="Property"===a.type;return{node:o?.value??a,messageId:m8,data:{type:"import expression"},fix:r=>i?function*(e,t,r){let{sourceCode:n}=r;for(let r of n.getTokens(t))yield e.remove(r);let o=n.getTokenAfter(t);if(eT(o))yield e.remove(o);else{let{properties:r}=t.parent;if(r.length>1&&r.at(-1)===t){let r=n.getTokenBefore(t);yield e.remove(r)}}}(r,a,e):[t.getTokenBefore(a,eT),...t.getTokens(a),...tr(a,e)].map(e=>r.remove(e))}})},meta:{type:"suggestion",docs:{description:"Require non-empty module attributes for imports and exports",recommended:"unopinionated"},fixable:"code",messages:{[m8]:"{{type}} with empty attribute list is not allowed."},languages:["js/js"]}},"unicorn/no-immediate-mutation":{create:e=>{for(let t of fi)e.on(["VariableDeclarator","AssignmentExpression"],r=>(function(e,t,{testValue:r,getProblematicNode:n,getProblem:o,getFix:a}){let i,s="AssignmentExpression"===t.type,[l,u]=(s?["left","right"]:["id","init"]).map(e=>t[e]);if(!("Identifier"===l.type&&r(u)))return;let p=t.parent;if(!(s&&"="===t.operator&&"ExpressionStatement"===p.type&&p.expression===t||!s&&"VariableDeclaration"===(i=t.parent).type&&i.declarations.at(-1)===t))return;let c=ig(p,e);if(c?.type!=="ExpressionStatement")return;let d="VariableDeclarator"===t.type?e.sourceCode.getDeclaredVariables(t).find(e=>1===e.defs.length&&e.defs[0].name===t.id):eS(e.sourceCode.getScope(t),t.left.name);if(!d)return;let m={context:e,variable:d,variableNode:l,valueNode:u,statement:p,nextExpressionStatement:c,assignType:s?"assignment":"declaration",getFix:a},f=n(m);if(f)return o(f,m)})(e,r,t))},meta:{type:"suggestion",docs:{description:"Disallow immediate mutation after variable assignment.",recommended:!0},fixable:"code",hasSuggestions:!0,messages:{[m6]:"Immediate mutation on {{objectType}} is not allowed.",[m9]:"{{operation}} the elements to the {{assignType}}.",[m5]:"Move this property to the {{assignType}}.",[m4]:"{{description}} the {{assignType}}.",[m7]:"Move the element to the {{assignType}}.",[fe]:"Move the entry to the {{assignType}}."},languages:["js/js"]}},"unicorn/no-useless-collection-argument":{create:e=>{e.on("NewExpression",t=>{var r;let n;if(!tE(t,{names:["Set","Map","WeakSet","WeakMap"],argumentsLength:1}))return;let[o]=t.arguments,a="LogicalExpression"===o.type&&"??"===o.operator,i=a?o.right:o,s=tC(r=i)?"empty array":ti(r,"")?"empty string":td(r)?"`null`":tq(r)?"`undefined`":void 0;if(!s)return;let l=!1;if(a)n=function*(t){let{sourceCode:r}=e,n=i.parent,{left:o}=n,a=ta(o,e),[,s]=a?tn(o,e):r.getRange(o),[,l]=r.getRange(n);yield t.removeRange([s,l]),(a||"SequenceExpression"!==o.type)&&(yield iM(n,t,e))};else e.sourceCode.getCommentsInside(i).length>0&&(l=!0),n=t=>iq(t,i,e);let u={node:i,messageId:fs,data:{description:s}};return l?u.suggest=[{messageId:fl,fix:n}]:u.fix=n,u})},meta:{type:"suggestion",docs:{description:"Disallow useless values or fallbacks in `Set`, `Map`, `WeakSet`, or `WeakMap`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[fs]:"The {{description}} is useless.",[fl]:"Remove the {{description}}"},languages:["js/js"]}},"unicorn/prefer-response-static-json":{create:e=>{e.on("NewExpression",t=>{if(!tE(t,{name:"Response",minimumArguments:1}))return;let[r]=t.arguments;if(tR(r,{object:"JSON",method:"stringify",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return{node:r.callee,messageId:fu,*fix(n){yield n.insertTextAfter(t.callee,".json"),yield iz(t,e,n);let[o]=r.arguments,a=tn(r,e),i=tn(o,e);yield n.removeRange([a[0],i[0]]),yield n.removeRange([i[1],a[1]]),!ta(t,e)&&ta(t.callee,e)&&aL(e.sourceCode.getTokenBefore(t),e,"(")&&(yield n.insertTextBefore(t,";"))}}})},meta:{type:"suggestion",docs:{description:"Prefer `Response.json()` over `new Response(JSON.stringify())`.",recommended:"unopinionated"},fixable:"code",messages:{[fu]:"Prefer using `Response.json(…)` over `JSON.stringify()`."},languages:["js/js"]}},"unicorn/filename-case":{create:e=>{let t=e.physicalFilename;if("<input>"===t||"<text>"===t)return;let r=e.options[0]||{},n=function(e){if(e.case)return[e.case];if(e.cases){let t=Object.keys(e.cases).filter(t=>e.cases[t]);return t.length>0?t:["kebabCase"]}return["kebabCase"]}(r),o=(r.ignore||[]).map(e=>v.isRegExp(e)?e:RegExp(e,"u")),a=!1!==r.multipleFileExtensions,i=!1!==r.checkDirectories,s=n.map(e=>fL[e].fn);e.on(rZ,r=>{if("Document"!==r.type||r.parent?.type!=="Program")return(()=>{var r;let l,u,p=(r=e.cwd,""===(l=S.relative(r,S.resolve(r,t)))||".."===l||l.startsWith(`..${S.sep}`)||S.isAbsolute(l)?[S.basename(t)]:l.split(S.sep).filter(e=>"."!==e)),{basename:c,filename:d,middle:m,extension:f}=function(e,{multipleFileExtensions:t}){let r=S.extname(e),n=S.basename(e,r),o={basename:n+r,filename:n,middle:"",extension:r};if(t){let[e]=n.split(".",1);Object.assign(o,{filename:e,middle:n.slice(e.length)})}return o}(p.at(-1),{multipleFileExtensions:a});if(p.some(e=>o.some(t=>t.test(e))))return;if(i)for(let e of p.slice(0,-1)){let t=function(e,t,r){let n,{leading:o,words:a}=fO(e);if(e.startsWith("$")||fN(a,r))return;let i=f$(a,r,{leading:o,trailing:""});return{loc:{column:0,line:1},messageId:fT,data:{directory:e,chosenCases:fq(t),renamedDirectories:(n=i.map(e=>`\`${e}\``),fI.format(n))}}}(e,n,s);if(t)return t}if(fk.has(c))return;let{leading:g,words:y}=fO(d);if(d.startsWith("$")||fN(y,s))return f!==f.toLowerCase()?{loc:{column:0,line:1},messageId:fA,data:{filename:d+m+f.toLowerCase(),extension:f}}:void 0;let h=f$(y,s,{leading:g,trailing:m+f.toLowerCase()});return{loc:{column:0,line:1},messageId:fD,data:{chosenCases:fq(n),renamedFilenames:(u=h.map(e=>`\`${e}\``),fI.format(u))}}})()})},meta:{type:"suggestion",docs:{description:"Enforce a case style for filenames and directory names.",recommended:!0},schema:fU,defaultOptions:[],messages:{[fD]:"Filename is not in {{chosenCases}}. Rename it to {{renamedFilenames}}.",[fT]:"Directory name `{{directory}}` is not in {{chosenCases}}. Rename it to {{renamedDirectories}}.",[fA]:"File extension `{{extension}}` is not in lowercase. Rename it to `{{filename}}`."},languages:["*"]}},"unicorn/consistent-template-literal-escape":{create:e=>{e.on("TemplateElement",t=>{if(tO(t.parent))return;let{raw:r}=t.value,n=r.replaceAll(/(?<=(?:^|[^\\])(?:\\\\)*)\\?\$\\{/g,"\\${");if(r!==n)return{node:t,messageId:fW,fix:r=>i1(t,n,e,r)}})},meta:{type:"suggestion",docs:{description:"Enforce consistent style for escaping `${` in template literals.",recommended:!0},fixable:"code",messages:{[fW]:"Use `\\${` instead of `$\\{` to escape in template literals."},languages:["js/js"]}},"unicorn/no-useless-iterator-to-array":{create:e=>{e.on("NewExpression",t=>{if(!(tE(t,{names:["Map","WeakMap","Set","WeakSet"],argumentsLength:1})||tE(t,{names:r9,minimumArguments:1}))||!f8(t.arguments[0]))return;let r=t.arguments[0],n=1===t.arguments.length?f6(r,e):void 0,o=t.arguments.length>1?f9(r,e,f0):void 0;return{node:r.callee.property,messageId:fX,data:{description:`new ${t.callee.name}(…)`},...n&&{fix:n},...o&&{suggest:[o]}}}),e.on("CallExpression",t=>((e,t)=>{if(!tR(e,{objects:["Array",...r9],method:"from",minimumArguments:1,optionalCall:!1,optionalMember:!1})||!f8(e.arguments[0]))return;let r=e.arguments[0],n=1===e.arguments.length?f6(r,t):void 0,o=e.arguments.length>1?f9(r,t,f0):void 0;return{node:r.callee.property,messageId:fX,data:{description:`${e.callee.object.name}.${e.callee.property.name}(…)`},...n&&{fix:n},...o&&{suggest:[o]}}})(t,e)??((e,t)=>{if(!tR(e,{object:"Object",method:"fromEntries",minimumArguments:1,optionalCall:!1,optionalMember:!1})||!f8(e.arguments[0]))return;let r=e.arguments[0],n=1===e.arguments.length?f6(r,t):void 0,o=e.arguments.length>1?f9(r,t,f0):void 0;return{node:r.callee.property,messageId:fX,data:{description:`${e.callee.object.name}.${e.callee.property.name}(…)`},...n&&{fix:n},...o&&{suggest:[o]}}})(t,e)??((e,t)=>{if(!tR(e,{object:"Promise",methods:["all","allSettled","any","race"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||!f8(e.arguments[0]))return;let r=e.arguments[0],n=f9(r,t,f0);return{node:r.callee.property,messageId:fX,data:{description:`${e.callee.object.name}.${e.callee.property.name}(…)`},...n&&{suggest:[n]}}})(t,e)??((e,t)=>{var r,n;if(!(tR(e,{methods:f2,maximumArguments:1,optionalCall:!1,optionalMember:!1})||tR(e,{method:f3,minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1}))||!f8(e.callee.object))return;let o=e.arguments[0],a=e.callee.property.name,i=a===f3;if(r=o,n=i?3:2,r&&("ArrowFunctionExpression"===(r=fJ(r)).type||"FunctionExpression"===r.type)&&(r.params.length>n||r.params.at(-1)?.type==="RestElement"||"FunctionExpression"===r.type&&t.sourceCode.getTokens(r).some(e=>"Identifier"===e.type&&"arguments"===e.value)))return;let s=e.callee.object,l=f9(s,t,f1,{method:a});return{node:s.callee.property,messageId:fZ,data:{method:a},...l&&{suggest:[l]}}})(t,e)),e.on("ForOfStatement",t=>{if(!f8(t.right))return;let r=f6(t.right,e);return{node:t.right.callee.property,messageId:fY,...r&&{fix:r}}}),e.on("YieldExpression",t=>{if(!t.delegate||!f8(t.argument))return;let r=f6(t.argument,e);return{node:t.argument.callee.property,messageId:fH,...r&&{fix:r}}}),e.on("SpreadElement",t=>{if(!f8(t.argument))return;let{parent:r}=t;if("ArrayExpression"!==r.type&&"CallExpression"!==r.type&&"NewExpression"!==r.type)return;let n=f6(t.argument,e);return{node:t.argument.callee.property,messageId:fQ,...n&&{fix:n}}})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `.toArray()` on iterators.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[fX]:"`{{description}}` accepts an iterable, `.toArray()` is unnecessary.",[fY]:"`for…of`/`for await…of` can iterate over an iterable, `.toArray()` is unnecessary.",[fH]:"`yield*` can delegate to an iterable, `.toArray()` is unnecessary.",[fQ]:"Spread works on iterables, `.toArray()` is unnecessary.",[fZ]:"`Iterator` has a `.{{method}}()` method, `.toArray()` is unnecessary.",[f0]:"Remove `.toArray()`.",[f1]:"Remove `.toArray()` and use `Iterator#{{method}}()`."},languages:["js/js"]}},"unicorn/prefer-simple-condition-first":{create:e=>{let{sourceCode:t}=e;e.on("LogicalExpression",r=>{if("&&"!==r.operator&&"||"!==r.operator||function(e){let{operator:t}=e,{parent:r}=e;for(;rL(r)&&r.expression===e;)r=(e=r).parent;return r?.type==="LogicalExpression"&&r.operator===t}(r)||!function e(t,r){if(tG(t,r)||tJ(t))return!0;let{parent:n}=t;return rL(n)&&n.expression===t&&e(n,r)}(r,e))return;let n=function e(t,r,n=[]){let o=rN(t);return"LogicalExpression"!==o.type||o.operator!==r?n.push(t):(e(o.left,r,n),e(o.right,r,n)),n}(r,r.operator),o=n.map(e=>({operand:e,isSimple:gt(e)})),a=o.findIndex(({isSimple:e})=>!e),i=o.findIndex(({isSimple:e},t)=>e&&t>a);if(-1===a||-1===i)return;let s=[...o.filter(({isSimple:e})=>e),...o.filter(({isSimple:e})=>!e)].map(({operand:e})=>e),l=o.findLastIndex(({isSimple:e})=>e),u=o.every(({operand:e,isSimple:t},r)=>{var n;return t||r>l||gt(n=e)||function e(t){let r=rN(t);return"ConditionalExpression"===r.type&&[r.test,r.consequent,r.alternate].every(t=>gt(t)||ge(t)||e(t))}(n)}),p=u&&!function e(t,r){if(rL(t)){let e=rN(t);return"LogicalExpression"===e.type&&e.operator===r}return"LogicalExpression"===t.type&&t.operator===r&&(e(t.left,r)||e(t.right,r))}(r,r.operator)&&!function(e,t,r){let{sourceCode:n}=r;if(n.getCommentsInside(e).length>0)return!0;let[o]=t,a=t.at(-1),[i]=tn(o,r),[,s]=tn(a,r),l={range:[i,s]};return eF(n.getTokenBefore(l,{includeComments:!0}))||eF(n.getTokenAfter(l,{includeComments:!0}))}(r,n,e)?n=>n.replaceTextRange(t.getRange(r),s.map((t,n)=>(function(e,t,{operator:r,property:n}){let o=ta(e,t),a=o?to(e,t):t.sourceCode.getText(e);return!o&&ii(e,{operator:r,property:n})&&(a=`(${a})`),a})(t,e,{operator:r.operator,property:0===n?"left":"right"})).join(` ${r.operator} `)):void 0;return{node:r,loc:t.getLoc(n[i]),messageId:u?f5:f4,data:{operator:r.operator},...p&&{fix:p}}})},meta:{type:"suggestion",docs:{description:"Prefer simple conditions first in logical expressions.",recommended:!0},fixable:"code",messages:{[f5]:"Prefer this simple condition first in the `{{operator}}` expression.",[f4]:"Consider moving this simple condition first after verifying short-circuit behavior."},languages:["js/js"]}},"unicorn/switch-case-break-position":{create:e=>{let{sourceCode:t}=e;e.on("SwitchCase",r=>{let{consequent:n}=r;if(n.length<2)return;let o=n.at(-1);if(!gn.has(o.type))return;let a=n.slice(0,-1);if(1!==a.length||"BlockStatement"!==a[0].type)return;let i=a[0];if(0===i.body.length)return;let s=function(e){switch(e.type){case"BreakStatement":return"break";case"ReturnStatement":return"return";case"ContinueStatement":return"continue";case"ThrowStatement":return"throw"}}(o);return{node:o,loc:t.getLoc(o),messageId:gr,data:{keyword:s},..."ReturnStatement"!==o.type&&"ThrowStatement"!==o.type&&{*fix(r){let n=t.getLastToken(i);if(t.getTokensBetween(n,o,{includeComments:!0}).some(e=>eF(e)))return;let a=t.getLoc(i);if(a.start.line===a.end.line||rW(e,o))return;let s=i.body.at(-1),l=t.getText(o),u=rR(s,e),p=t.getTokenBefore(n,{includeComments:!0});yield r.insertTextAfter(p,`
|
|
50
50
|
${u}${l}`);let c=t.getRange(n)[1],d=t.getRange(o)[1];yield r.removeRange([c,d])}}}})},meta:{type:"layout",docs:{description:"Enforce consistent `break`/`return`/`continue`/`throw` position in `case` clauses.",recommended:!0},fixable:"code",messages:{[gr]:"Move `{{keyword}}` inside the block statement."},languages:["js/js"]}},"unicorn/better-dom-traversing":{create:e=>{e.on("MemberExpression",t=>{let r,n=(e=>{if(gf(e)){if(gm(e.object,"childNodes"))return"childNodes";if(gm(e.object,"children"))return"children"}})(t);if(!n||oh(t.object.object)||"children"===n&&gm(r=t.object,"children")&&("Identifier"===r.object.type&&"props"===r.object.name||tF(r.object,{property:"props",optional:!1,computed:!1}))||t.parent?.type==="MemberExpression"&&t.parent.object===t&&gm(t.parent,"children")&&gf(t.parent.parent))return;let o=t.property.value;return"childNodes"===n&&0===o?{node:t,messageId:go,suggest:gy(t,"firstChild",gu,e)}:"children"===n&&0===o?{node:t,messageId:ga,suggest:gy(t,"firstElementChild",gp,e)}:"children"===n?{node:t,messageId:gi}:void 0}),e.on("MemberExpression",e=>{if(!(!gh(e)||!gh(e.object)||!(!gh(e.parent)||e.parent.object!==e)||oh((e=>{for(;gh(e);)e=e.object;return e})(e))))return{node:e,messageId:gs}}),e.on("CallExpression",t=>{if(!gb(t)||t.parent?.type==="MemberExpression"&&t.parent.object===t&&t.parent.parent?.callee===t.parent&&gb(t.parent.parent)&&gx(t.parent.parent.arguments[0])||(e=>{for(;e.parent?.type==="MemberExpression"&&e.parent.object===e||e.parent?.type==="CallExpression"&&e.parent.callee===e;)e=e.parent;return e.parent?.type==="ChainExpression"})(t))return;let r=(e=>{let t=[];for(;gb(e);){let[r]=e.arguments;if(!gx(r))break;t.push(e),e=e.callee.object}if(t.length<2||"ChainExpression"===e.type||oh(e))return;let r=[];for(let e of t)r.unshift(tu(e.arguments[0]));return{root:e,selectors:r,quoteNode:t.at(-1).arguments[0]}})(t);if(r)return{node:t,messageId:gl,suggest:((e,t,r)=>{let n,o,{sourceCode:a}=r;if(gg(e,a)||!t.selectors.every(e=>!e.includes(",")&&!e.includes(":scope")))return;let i=to(t.root,r),s=`${"Identifier"===(n=t.root).type&&"document"===n.name||"MemberExpression"===n.type&&!n.computed&&"Identifier"===n.object.type&&["globalThis","window"].includes(n.object.name)&&"Identifier"===n.property.type&&"document"===n.property.name?"":":scope "}${t.selectors.join(" ")}`,l=`${i}.querySelector(${tQ(s,"Literal"===(o=t.quoteNode).type&&o.raw.startsWith('"')?'"':"'")})`;return[{messageId:gc,fix:t=>t.replaceText(e,l)}]})(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Prefer better DOM traversal APIs.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[go]:"Prefer `.firstChild` over `.childNodes[0]`.",[ga]:"Prefer `.firstElementChild` over `.children[0]`.",[gi]:"Consider `.querySelector()` over positional child traversal.",[gs]:"Consider `.closest()` over chaining `.parentElement`.",[gl]:"Consider merging chained `.querySelector()` calls.",[gu]:"Switch to `.firstChild`.",[gp]:"Switch to `.firstElementChild`.",[gc]:"Merge the `.querySelector()` calls."},languages:["js/js"]}},"unicorn/consistent-compound-words":{create:e=>{let t=(({checkProperties:e=!1,checkVariables:t=!0,checkDefaultAndNamespaceImports:r="internal",checkShorthandImports:n="internal",checkShorthandProperties:a=!1,extendDefaultReplacements:s=!0,replacements:l={},allowList:u={}}={})=>{let p=new o(Object.entries(s?{...gT,...l}:l).filter(([,e])=>!1!==e));return{checkProperties:e,checkVariables:t,checkDefaultAndNamespaceImports:r,checkShorthandImports:n,checkShorthandProperties:a,replacements:p,replacementRegExp:p.size>0?(e=>{let t=[],r=[];for(let n of e.keys())t.push(gw(n)),r.push(gw(iy(n)));return RegExp(`(?:^(?:${t.join("|")})|(?:${r.join("|")}))${gk}`,"gv")})(p):void 0,allowList:new i(Object.keys(u))}})(e.options[0]),r=new s,n=new s,a=(e,t)=>t.every(t=>{let r=n.get(t);return!r||!r.has(e)}),l=e=>{if((e=>{if(1!==e.defs.length)return!1;let[t]=e.defs;return"ClassName"===t.type})(e)){if("class"===e.scope.type){let[t]=e.defs,n=r.get(t.name);return n?u({name:e.name,scope:e.scope,defs:e.defs,identifiers:e.identifiers,references:[...e.references,...n.references]}):u(e)}let[t]=e.defs;return void r.set(t.name,e)}return u(e)},u=r=>{var o;if(0===r.defs.length)return;let s=gI(r.name,t);if(!s)return;let[l]=r.defs;if(!(!("ImportDefaultSpecifier"===(o=l.name).parent.type&&o.parent.local===o||"ImportNamespaceSpecifier"===o.parent.type&&o.parent.local===o||"ImportSpecifier"===o.parent.type&&o.parent.local===o&&"Identifier"===o.parent.imported.type&&"default"===o.parent.imported.name||"VariableDeclarator"===o.parent.type&&o.parent.id===o&&tN(o.parent.init))||t.checkDefaultAndNamespaceImports&&("internal"!==t.checkDefaultAndNamespaceImports||gS(l)))||!(!ak(l.name,e)||t.checkShorthandImports&&("internal"!==t.checkShorthandImports||gS(l)))||!t.checkShorthandProperties&&aF(l.name))return;let u=[...r.references.map(e=>e.from),r.scope],p=r$(s)?rS(s,u,a):void 0,c=gj(l.name,p??s);if(p&&r1(r).every(e=>!("VariableDeclarator"===e.parent.type&&e.parent.id===e?"VariableDeclaration"===e.parent.parent.type&&"ExportNamedDeclaration"===e.parent.parent.parent.type:!!gE.has(e.parent.type)&&e.parent.id===e&&"ExportNamedDeclaration"===e.parent.parent.type)&&"JSXIdentifier"!==e.type)&&r.references.every(e=>!e.vueUsedInTemplate)){for(let e of u)n.has(e)||n.set(e,new i),n.get(e).add(p);c.suggest=[{messageId:gD,data:{replacement:p},fix:t=>i0(r,p,e,t)}]}e.report(c)},p=e=>{for(let t of e.variables)l(t)},c=r=>{if(!t.checkProperties||"__proto__"===r.name)return;let n=gI(r.name,t);if(!n||"ExportSpecifier"===r.parent.type||(t.checkVariables||("TSParameterProperty"===r.parent.type?r.parent.parameter!==r:"AssignmentPattern"!==r.parent.type||r.parent.left!==r||"TSParameterProperty"!==r.parent.parent.type||r.parent.parent.parameter!==r.parent))&&!("MemberExpression"===r.parent.type&&r.parent.property===r&&!r.parent.computed&&("AssignmentExpression"===r.parent.parent.type&&r.parent.parent.left===r.parent||"UpdateExpression"===r.parent.parent.type&&r.parent.parent.argument===r.parent)||"Property"===r.parent.type&&r.parent.key===r&&!r.parent.computed&&!r.parent.shorthand&&"ObjectExpression"===r.parent.parent.type||"ExportSpecifier"===r.parent.type&&r.parent.exported===r&&r.parent.local!==r||gv.has(r.parent.type)&&r.parent.key===r&&!r.parent.computed))return;let o=gj(r,n);e.report(o)};e.on("Identifier",c),e.on("PrivateIdentifier",c),e.on("Program:exit",r=>{if(t.checkVariables)for(let t of ry(e.sourceCode.getScope(r)))p(t)})},meta:{type:"suggestion",docs:{description:"Enforce consistent spelling of compound words in identifiers.",recommended:"unopinionated"},hasSuggestions:!0,schema:gF,defaultOptions:[{}],messages:{[gC]:"Prefer `{{replacement}}` over `{{name}}`.",[gD]:"Rename to `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-blob-to-file":{create:e=>{e.on("VariableDeclarator",t=>(function(e,t){let{sourceCode:r}=t,{id:n,init:o}=e;if("Identifier"!==n.type||"VariableDeclaration"!==e.parent.type||"const"!==e.parent.kind||1!==e.parent.declarations.length||"Program"!==e.parent.parent.type&&"BlockStatement"!==e.parent.parent.type)return;let a=function(e,t){if(!tE(e,{name:"File",minimumArguments:2,maximumArguments:2})||!gP(e.callee,t))return;let[r]=e.arguments,[,n]=e.arguments;if("ArrayExpression"!==r.type||1!==r.elements.length||r.elements[0]?.type==="SpreadElement"||void 0===tu(n))return;let[o]=r.elements;if(function(e,t,r){let n=gL(e,r);if(!n||r.sourceCode.getRange(n)[0]>r.sourceCode.getRange(t)[0])return!1;let o=n.init;return(tE(o,{name:"Blob",maximumArguments:1})||tE(o,{name:"File",minimumArguments:2,maximumArguments:2}))&&gP(o.callee,r)}(o,e,t))return o}(o,t);if(!a)return;let i=eS(r.getScope(n),n);if(!i)return;let s=r1(i).filter(e=>e!==n);if(1!==s.length)return;let[l]=s,u=function(e,t){let r,{parent:n}=e;return tR(n,{object:"URL",method:"createObjectURL",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&n.arguments[0]===e&&gP(n.callee.object,t)?{call:n,kind:"blobArgument"}:tR(n,{methods:["append","set"],minimumArguments:2,maximumArguments:3,optionalCall:!1,optionalMember:!1})&&n.arguments[1]===e&&(r=gL(n.callee.object,t)?.init,tE(r,{name:"FormData",argumentsLength:0})&&gP(r.callee,t))?{call:n,kind:"formData"}:void 0}(l,t);if(!u)return;let p=function(e){let[,t]=e.arguments;return t}(o);if(!(!function(e,t,r){if("Identifier"!==e.type)return!0;let{sourceCode:n}=r;return eS(n.getScope(e),e)===eS(n.getScope(t),e)}(a,l,t)||function(e,t){let{sourceCode:r}=t;return r.getCommentsInside(e).length>0||r.getCommentsBefore(e).some(t=>r.getLoc(t).end.line===r.getLoc(e).start.line||r.getLoc(t).end.line===r.getLoc(e).start.line-1)||rW(t,e)}(e.parent,t))&&("formData"!==u.kind||2!==u.call.arguments.length||p))return{node:o,messageId:gB,suggest:[{messageId:gR,*fix(n){yield iQ(e.parent,t,n),yield n.replaceText(l,r.getText(a)),"formData"===u.kind&&2===u.call.arguments.length&&(yield n.insertTextAfter(l,`, ${r.getText(p)}`))}}]}})(t,e))},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Blob` to `File` conversion.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[gB]:"Use the original `Blob` instead of converting it to a `File`.",[gR]:"Replace the `File` with the original `Blob`."},languages:["js/js"]}},"unicorn/no-canvas-to-image":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",e=>{var r,n,o;if(!tR(e,{method:"drawImage",minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let[a]=e.arguments;if("SpreadElement"!==a.type&&(r=gM(a,t),r?.type==="CallExpression"&&!r.optional&&"Identifier"===r.callee.type&&"loadImage"===r.callee.name&&r.arguments.length>0&&"SpreadElement"!==r.arguments[0].type&&tR(n=r.arguments[0],{method:"toDataURL",optionalCall:!1,optionalMember:!1})&&("Identifier"===(o=n.callee.object).type?gO(o.name):"MemberExpression"===o.type&&!o.computed&&"Identifier"===o.property.type&&gO(o.property.name))))return{node:a,messageId:gN}}),e.on("CallExpression",e=>{if(!tR(e,{method:"putImageData",minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let[r]=e.arguments;if("SpreadElement"!==r.type&&tR(gM(r,t),{method:"getImageData",optionalCall:!1,optionalMember:!1}))return{node:r,messageId:gN}})},meta:{type:"suggestion",docs:{description:"Prefer drawing canvases directly instead of converting them to images.",recommended:"unopinionated"},messages:{[gN]:"Prefer drawing the canvas directly with `drawImage()`."},languages:["js/js"]}},"unicorn/no-confusing-array-splice":{create:e=>{e.on("CallExpression",t=>{if(!tR(t,{methods:["splice","toSpliced"],argumentsLength:3,optionalCall:!1,optionalMember:!1}))return;let r=function([e,t]){let r=function(e){let t=ie(e);if("number"==typeof t)return Math.max(Math.trunc(t),0)}(t);return 1===r?gq:-1===Math.trunc(ie(e))&&0===r?gU:void 0}(t.arguments);if(!r||nL(t.callee.object,e))return;let n={node:t.callee.property,messageId:r,data:{method:t.callee.property.name}},o=function(e,t,r){let{sourceCode:n}=r,{object:o,property:a}=e.callee,[i,,s]=e.arguments,l=a.name,u=to(o,r),p=n.getText(i),c=n.getText(s);if(t===gq){if(gz(e,n))return;if("toSpliced"===l){if(0>Math.trunc(ie(i))||pF(i,o))return;return{messageId:gW,fix:t=>t.replaceText(e,`${u}.with(${p}, ${c})`)}}return"ExpressionStatement"===e.parent.type&&g_(o)&&(ie(i)??0)>=0?{messageId:gW,fix:t=>t.replaceText(e,`${u}[${p}] = ${c}`)}:void 0}if(t===gU&&g_(o)&&!gz(i,n))return{messageId:gV,fix:e=>e.replaceText(i,`Math.max(${u}.length - 1, 0)`)}}(t,r,e);return o&&(n.suggest=[o]),n})},meta:{type:"suggestion",docs:{description:"Disallow confusing uses of `Array#{splice,toSpliced}()`.",recommended:!0},hasSuggestions:!0,messages:{[gq]:"Prefer a direct element replacement instead of `{{method}}()`.",[gU]:"Avoid using `{{method}}()` to insert at `-1`.",[gW]:"Use direct element replacement.",[gV]:"Resolve the insertion index explicitly."},languages:["js/js"]}},"unicorn/no-duplicate-set-values":{create:e=>{let{sourceCode:t}=e;e.on("NewExpression",r=>{if(!tE(r,{name:"Set",argumentsLength:1}))return;let[n]=r.arguments;if("ArrayExpression"===n.type)return rB(n.elements,e).map(e=>({node:e??n,messageId:gK,data:{value:e?t.getText(e):"undefined"}}))})},meta:{type:"suggestion",docs:{description:"Disallow duplicate values in `Set` constructor array literals.",recommended:!0},messages:{[gK]:"Remove duplicate value `{{value}}` from the Set."},languages:["js/js"]}},"unicorn/no-incorrect-query-selector":{create:e=>{let{sourceCode:t}=e;e.on("MemberExpression",r=>{if(!g0(r)||g2(r))return;let n=r.object;if(!g3(r,n,t,e))return g9(r,n,e)}),e.on("CallExpression",r=>{let n;if(g1(r)){if(g2(r))return;let n=r.callee.object;if(g3(r,n,t,e))return;return g9(r,n,e)}let o=g6(r,e);if(o)return o;if(gZ(r)&&!(g0(n=r.parent)||g1(n)||"MemberExpression"===r.parent.type&&r.parent.object===r&&g1(r.parent.parent))){let e;if(e=tu(r.arguments[0]),/^#[\-A-Z_a-z][\w\-]*$/v.test(e))return{node:r.callee.property,messageId:gJ}}}),e.on("BinaryExpression",r=>((e,t)=>{let{sourceCode:r}=t;if(g4(e,gZ,r))return{node:e,messageId:gY}})(r,e)??((e,t)=>{let r=g4(e,gQ,t);if(r&&("==="===e.operator||"!=="===e.operator)&&tq(r.value))return{node:e,messageId:gH}})(r,t)),e.on("Identifier",t=>g6(t,e))},meta:{type:"suggestion",docs:{description:"Disallow incorrect `querySelector()` and `querySelectorAll()` usage.",recommended:!0},fixable:"code",schema:[],messages:{[gG]:"Prefer `.querySelector()` when only the first match is used.",[gJ]:"Prefer `.querySelector()` for a simple ID selector.",[gX]:"Check `.length` instead of the `NodeList` object itself.",[gY]:"Check `.length` instead of comparing the `NodeList` object with `null` or `undefined`.",[gH]:"Compare the result of `.querySelector()` with `null` instead of `undefined`."},languages:["js/js"]}},"unicorn/no-invalid-file-input-accept":{create:e=>{e.on("JSXOpeningElement",t=>{if("input"!==ys(t.name))return;let r=((e,t)=>{if(t?.value){if(ts(t.value))return t.value.value;if("JSXExpressionContainer"===t.value.type)return yu(e,t.value.expression)}})(e,yl(t,"type"));if(r?.toLowerCase()!=="file")return;let n=yl(t,"accept");if(!n)return;let o=((e,t)=>{if(!t.value)return{node:t,missing:!0};if(ts(t.value))return{node:t.value,value:t.value.value,fixable:!0};if("JSXExpressionContainer"!==t.value.type)return{node:t.value,dynamic:!0};let r=yu(e,t.value.expression);return void 0===r?{node:t.value,dynamic:!0}:{node:t.value,value:r,fixable:!1}})(e,n);return yy({valueInfo:o,fix:t=>r=>{let n;return n=o.node,r.replaceTextRange([e.sourceCode.getRange(n)[0]+1,e.sourceCode.getRange(n)[1]-1],t)}})}),e.on("Tag",t=>{if("input"!==t.name.toLowerCase())return;let r=yg(e,t,"type")?.value;if(r?.toLowerCase()!=="file")return;let n=((e,t,r)=>{let n=yg(e,t,r);if(!n)return;let o=t.attributes.find(e=>"Attribute"===e.type&&e.key?.value?.toLowerCase()===r);return n.missing?{node:o??t,missing:!0}:o?.value?.parts?.length>0?{node:o.value,dynamic:!0}:yo.test(n.value)?void 0:{node:o?.value??t,value:n.value,fixable:!0,valueRange:n.valueRange,isReplacementFixable:e=>n.isQuoted||!/\s/v.test(e)}})(e,t,"accept");if(n)return yy({valueInfo:n,fix:e=>t=>t.replaceTextRange(n.valueRange,e)})})},meta:{type:"problem",docs:{description:"Disallow invalid `accept` values on file inputs.",recommended:!1},fixable:"code",messages:{[g7]:"Invalid file input `accept` value: {{reason}}",[ye]:"The file input `accept` value must be static.",[yt]:"Prefer `{{replacement}}` as the file input `accept` value."},languages:["js/js","html/html"]}},"unicorn/no-late-current-target-access":{create:e=>{let{sourceCode:t}=e,r=yE(e);e.on("MemberExpression",e=>{if("Identifier"!==e.object.type||!tF(e,{property:"currentTarget"})||!yh.test(e.object.name))return;let n=eS(t.getScope(e.object),e.object),o=n?.defs.find(({type:e})=>"Parameter"===e);if(!o)return;let a=o.node,i=yx(e)!==a;if(i||r.isFunctionSuspended(a)||r.isInsideSuspendingLoop(e,a))return{node:e,messageId:i?yS:yv,data:{name:e.object.name}}})},meta:{type:"problem",docs:{description:"Disallow accessing `event.currentTarget` after the synchronous event dispatch has finished.",recommended:!0},messages:{[yv]:"`{{name}}.currentTarget` is `null` after the handler suspends. It is only set during synchronous event dispatch; save it to a variable beforehand.",[yS]:"`{{name}}.currentTarget` is `null` inside this nested function. It is only set during synchronous event dispatch; save it to a variable in the outer function."},languages:["js/js"]}},"unicorn/no-unnecessary-nested-ternary":{create:e=>{let{sourceCode:t}=e;e.on("ConditionalExpression",r=>{let{test:n,consequent:o,alternate:a}=r;return"ConditionalExpression"===o.type&&yD(o.alternate,a,t)?yw(e,r,{left:n,operator:"&&",right:o.test,consequent:o.consequent,alternate:o.alternate}):"ConditionalExpression"===a.type&&yD(o,a.consequent,t)?yw(e,r,{left:n,operator:"||",right:a.test,consequent:o,alternate:a.alternate}):void 0})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary nested ternary expressions.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[yC]:"Do not use unnecessary nested ternary expressions."},languages:["js/js"]}},"unicorn/no-unused-array-method-return":{create:e=>{e.on("CallExpression",t=>{let r="MemberExpression"===t.callee.type?ez(t.callee,e.sourceCode.getScope(t.callee)):void 0;if(!(!yI.has(r)||!(e=>{for(;;){if(aB(e))return!0;let{parent:t}=e;if("ForStatement"===t.type&&(t.init===e||t.update===e))return!0;if("ChainExpression"!==t.type&&"AwaitExpression"!==t.type&&"TSAsExpression"!==t.type&&"TSTypeAssertion"!==t.type&&"TSNonNullExpression"!==t.type&&"TSSatisfiesExpression"!==t.type)return!1;e=t}})(t)||((e,t,r)=>{let n,o=function e(t,r,n=new i){if(!t||t===yF||n.has(t))return t;if(n.add(t),"Identifier"===t.type){let o=function(e,t){let r=eS(t.sourceCode.getScope(e),e);if(!r||0===r.defs.length)return;if(1!==r.defs.length||function(e,t,r){let[n]=r.sourceCode.getRange(t);return e.references.some(e=>!e.init&&e.isWrite()&&r.sourceCode.getRange(e.identifier)[0]<n)}(r,e,t))return yF;let[n]=r.defs;if("Parameter"===n.type&&n.node.params?.includes(n.name))return n.name.typeAnnotation&&!nj(n.name.typeAnnotation,t)?yF:void 0;if("Variable"===n.type&&"VariableDeclarator"===n.node.type&&"Identifier"===n.node.id.type&&n.node.id.name===e.name&&"VariableDeclaration"===n.parent.type){let{typeAnnotation:e}=n.node.id;return e?nj(e,t)?void 0:yF:n.node.init??yF}return yF}(t,r);return o===yF?o:void 0===o?t:e(o,r,n)}return["ChainExpression","TSNonNullExpression","TSSatisfiesExpression"].includes(t.type)?e(t.expression,r,n):"MemberExpression"===t.type?yF:"TSAsExpression"===t.type||"TSTypeAssertion"===t.type?nj(t,r)?t:yF:t}(e,r);return!!(tb(n=o,"expect",ty)||tR(n,{object:"expect",methods:["element","poll","soft"]}))||("values"===t?o===yF||!nj(o,r):o===yF||((e,t)=>{let r,n;return yR(e,"undefined",t)||"ObjectExpression"===e.type||"Literal"===e.type||"BinaryExpression"===e.type||"TemplateLiteral"===e.type||"ArrowFunctionExpression"===e.type||"FunctionExpression"===e.type||"ClassExpression"===e.type||"NewExpression"===e.type&&!yR(e.callee,"Array",t)||(r=e,n=t,tb(r,yB,ty)&&n.sourceCode.isGlobalReference(r.callee))})(o,r)||"Identifier"===o.type&&yj.test(o.name)&&!nj(o,r))})(t.callee.object,r,e)))return{node:t.callee.property,messageId:yk,data:{method:r}}})},meta:{type:"suggestion",docs:{description:"Disallow ignoring the return value of selected array methods.",recommended:"unopinionated"},messages:{[yk]:"Do not ignore the return value of `.{{method}}(…)`."},languages:["js/js"]}},"unicorn/prefer-array-last-methods":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",r=>{if(!tR(r,{methods:yN.keys().toArray(),optionalCall:!1,optionalMember:!1}))return;let n=r.callee.object;if(!tR(n,{methods:y$,argumentsLength:0,optionalCall:!1,optionalMember:!1}))return;let o=r.callee.property.name,a=yN.get(o),i={method:o,replacement:a,reversingMethod:n.callee.property.name},s={node:r.callee.property,messageId:yP,data:i};return 0===t.getCommentsInside(r).length&&(s.suggest=[{messageId:yL,data:i,*fix(t){yield t.replaceText(r.callee.property,a),yield iH(t,n,e)}}]),s})},meta:{type:"suggestion",docs:{description:"Prefer last-oriented array methods over `Array#reverse()` or `Array#toReversed()` followed by a method.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[yP]:"Prefer `Array#{{replacement}}()` over `Array#{{reversingMethod}}().{{method}}()`.",[yL]:"Replace `.{{reversingMethod}}().{{method}}()` with `.{{replacement}}()`."},languages:["js/js"]}},"unicorn/prefer-math-abs":{create:e=>{e.on("ConditionalExpression",t=>{let r=function(e,t){let r=function(e,t){if(!("BinaryExpression"!==e.type||!yO.has(e.operator)||yz(e.left,t)||yz(e.right,t))){if(ti(e.right,0))return{value:e.left,operator:e.operator};if(ti(e.left,0))return{value:e.right,operator:yq[e.operator]}}}(e.test,t);if(!r)return;let{value:n,operator:o}=r,{consequent:a,alternate:i}=e;if(("<"===o||"<="===o)&&yK(a,n)&&rk(i,n)||(">"===o||">="===o)&&rk(a,n)&&yK(i,n))return n}(t,e);if(!r)return;let n=yH(r)?function*(n){yield iG(n,t,e),yield n.replaceText(t,`Math.abs(${yX(r,e)})`)}:void 0;return yY(t,e,n)}),e.on("LogicalExpression",t=>{let r=function(e,t){if("||"!==e.operator)return;let r=yG(e.left,t),n=yJ(e.right,t);if(r&&n&&rk(r.value,n.value)&&yU[r.operator]===n.operator&&yK(n.negativeThreshold,r.threshold))return{value:r.value,threshold:r.threshold,operator:r.operator};let o=yG(e.right,t),a=yJ(e.left,t);if(o&&a&&rk(o.value,a.value)&&yU[o.operator]===a.operator&&yK(a.negativeThreshold,o.threshold))return{value:o.value,threshold:o.threshold,operator:o.operator}}(t,e);if(!r)return;let{value:n,threshold:o,operator:a}=r,i=yH(n)&&yH(o)?function*(r){yield iG(r,t,e),yield r.replaceText(t,`Math.abs(${yX(n,e)}) ${a} ${to(o,e)}`)}:void 0;return yY(t,e,i)})},meta:{type:"suggestion",docs:{description:"Prefer `Math.abs()` over manual absolute value expressions and symmetric range checks.",recommended:"unopinionated"},fixable:"code",messages:{[yM]:"Prefer `Math.abs()` to simplify this expression."},languages:["js/js"]}},"unicorn/prefer-split-limit":{create:e=>{let{sourceCode:t}=e;e.on("MemberExpression",r=>{if(!r.computed||nG(r))return;let n=y0(r.object);if(!n)return;let o=yZ(r.property,t);if(void 0!==o)return y1(r,n,o+1,e)}),e.on("CallExpression",r=>{if(!tR(r,{method:"at",argumentsLength:1}))return;let n=y0(r.callee.object);if(!n)return;let o=yZ(r.arguments[0],t);if(void 0!==o)return y1(r,n,o+1,e)}),e.on("VariableDeclarator",t=>{if("ArrayPattern"===t.id.type)return y2(t.id,t.init,e)}),e.on("AssignmentExpression",t=>{if("ArrayPattern"===t.left.type&&aB(t))return y2(t.left,t.right,e)})},meta:{type:"suggestion",docs:{description:"Prefer `String#split()` with a limit.",recommended:"unopinionated"},fixable:"code",messages:{[yQ]:"Prefer `String#split()` with a limit."},languages:["js/js"]}},"unicorn/prefer-queue-microtask":y8,"unicorn/prefer-string-pad-start-end":{create:e=>{e.on("BinaryExpression",t=>((e,t)=>{if("+"!==e.operator)return;let r=hn(e.left,t);if(r&&rk(e.right,r.targetNode)&&!y4(e.right,t)){let n=ht({targetNode:e.right,targetLengthNode:r.targetLengthNode,paddingNode:r.paddingNode});return ha({node:e,method:"padStart",replacement:n&&ho({method:"padStart",targetNode:e.right,...r},t),context:t,canFix:n})}let n=hn(e.right,t);if(n&&rk(e.left,n.targetNode)&&!y4(e.left,t)){let r=ht({targetNode:e.left,targetLengthNode:n.targetLengthNode,paddingNode:n.paddingNode});return ha({node:e,method:"padEnd",replacement:r&&ho({method:"padEnd",targetNode:e.left,...n},t),context:t,canFix:r})}})(t,e)),e.on("CallExpression",t=>((e,t)=>{if(!tR(e,{method:"slice",minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1})||"BinaryExpression"!==e.callee.object.type||"+"!==e.callee.object.operator)return;let{object:r}=e.callee,[n,o]=e.arguments,a=hr(r.left,t),i=(e=>{if(e?.type==="UnaryExpression"&&"-"===e.operator)return e.argument})(n);if(1===e.arguments.length&&a&&i&&tp(a.widthNode)&&rk(a.widthNode,i)&&"Identifier"===r.right.type&&!y4(r.right,t)){let n=he(a.paddingNode);return hi({node:e,method:"padStart",replacement:ho({method:"padStart",targetNode:r.right,targetLengthNode:a.widthNode,...a},t),context:t,canSuggest:n})}let s=hr(r.right,t);if(2===e.arguments.length&&s&&tp(n)&&0===n.value&&tp(s.widthNode)&&rk(s.widthNode,o)&&"Identifier"===r.left.type&&!y4(r.left,t)){let n=he(s.paddingNode);return hi({node:e,method:"padEnd",replacement:ho({method:"padEnd",targetNode:r.left,targetLengthNode:s.widthNode,...s},t),context:t,canSuggest:n})}})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer `String#padStart()` and `String#padEnd()` over manual string padding.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[y6]:"Prefer `String#{{method}}()` over manual string padding.",[y9]:"Replace with `String#{{method}}()`."},languages:["js/js"]}},"unicorn/require-css-escape":hm,"unicorn/require-passive-events":{create:e=>{e.on("CallExpression",t=>{if(!tR(t,{method:"addEventListener",minimumArguments:2,maximumArguments:3,optionalCall:!1,optionalMember:!1}))return;let[r,n,o]=t.arguments;if(!ts(r)||!hg.has(r.value)||"ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type||!((e,t)=>{let r;if(r=t.sourceCode,"FunctionExpression"===e.type&&ry(r.getScope(e)).some(t=>((e,t)=>{let r=e.block;for(;r&&r!==t;){if("FunctionDeclaration"===r.type||"FunctionExpression"===r.type)return!1;r=r.parent}return r===t})(t,e)&&t.references.some(({identifier:e})=>"arguments"===e.name)))return!1;let[n]=e.params;if(!n)return!0;if("Identifier"!==n.type)return!1;let o=t.sourceCode.getDeclaredVariables(e).find(e=>e.defs[0]?.name===n);if(!o)return!1;for(let{identifier:e}of o.references)if(hh(e)||!hx(e))return!1;return!0})(n,e))return;let a=((e,t,r)=>{if(!r){let r;return{fix:(r=t.arguments[1],t=>t.insertTextAfterRange(tn(r,e),", {passive: true}"))}}if(tl(r,!0)||tl(r,!1))return{fix:e=>e.replaceText(r,tl(r,!0)?"{capture: true, passive: true}":"{passive: true}")};if("ObjectExpression"!==r.type||r.properties.some(e=>"SpreadElement"===e.type||e.computed))return;let n=r.properties.findLast(e=>"Property"===e.type&&"passive"===(e=>{if(!e.computed){if("Identifier"===e.key.type)return e.key.name;if(ts(e.key))return e.key.value}})(e));if(!n)return{fix:((e,t)=>{let r=e.properties.at(-1);if(!r)return!1;let n=t.getLastToken(e);return t.getTokensBetween(r,n,{includeComments:!0}).some(e=>"Block"===e.type||"Line"===e.type)})(r,e.sourceCode)?void 0:t=>{let{sourceCode:n}=e;if(0===r.properties.length)return t.replaceText(r,"{passive: true}");let o=r.properties.at(-1);if(n.getLoc(r).start.line===n.getLoc(r).end.line)return t.insertTextAfter(o,", passive: true");let a=n.getTokenAfter(o),i=rR(o,e);return","===a.value?t.insertTextAfter(a,`
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ESLint, Linter } from 'eslint';
|
|
2
2
|
|
|
3
3
|
declare const plugin: ESLint.Plugin & {
|
|
4
|
-
configs: Record<"node" | "
|
|
4
|
+
configs: Record<"node" | "recommended" | "recommended_unicorn" | "stylistic_unicorn" | "recommended_extra_with_typed_lint" | "recommended_react", Linter.Config>;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
export { plugin as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-sukka/eslint-plugin-sukka-full",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"homepage": "https://github.com/SukkaW/eslint-config-sukka",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/SukkaW/eslint-config-sukka",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"eslint-plugin-sukka": "^
|
|
25
|
-
"@eslint-sukka/shared": "
|
|
24
|
+
"eslint-plugin-sukka": "^10.0.0",
|
|
25
|
+
"@eslint-sukka/shared": "9.0.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@masknet/eslint-plugin": "^0.5.4",
|
|
29
29
|
"eslint-plugin-unicorn": "^73.0.0",
|
|
30
|
-
"@eslint-sukka/rollup-config": "
|
|
30
|
+
"@eslint-sukka/rollup-config": "9.0.1"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"eslint": "*",
|