@eslint-sukka/eslint-plugin-sukka-full 8.13.1 → 8.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -78
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -19,7 +19,7 @@ ${r}}`))}(t,i,l))}}}({discriminant:n,ifStatements:s},e,t)),yield l}})},meta:{typ
|
|
|
19
19
|
export default ${n};`)}]},bU=({context:e,declaration:t,exportDeclaration:r,expectedStyle:n,kind:o,name:a,scope:i})=>{if(!(n===bv||((e,t,r)=>{let[,n]=e.sourceCode.getRange(t),[o]=e.sourceCode.getRange(r);return t9(e).some(t=>{let[r,a]=e.sourceCode.getRange(t);return r>=n&&a<=o})})(e,t,r)||bB(i,r.declaration))&&(o!==bA||"FunctionDeclaration"!==t.type||!t.generator)&&!(o===bA&&"FunctionDeclaration"===t.type&&bP(t,e.sourceCode.visitorKeys))){if(n===bS)return"VariableDeclaration"===t.type?{node:r,messageId:bh,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||bF(e,r)||e.sourceCode.getCommentsInside(t).length>e.sourceCode.getCommentsInside(i).length||b$(o,a,r.declaration))&&"ArrowFunctionExpression"===i.type&&!bP(i,e.sourceCode.visitorKeys)&&0===e.sourceCode.getCommentsInside(i).length&&bL(i,e)&&!rm(i.body,e.sourceCode.visitorKeys))return[{messageId:bb,data:{kind:bA},fix:o=>o.replaceTextRange([e.sourceCode.getRange(t)[0],e.sourceCode.getRange(r)[1]],`export default ${i.async?"async ":""}function ${n}(${bM(i,e.sourceCode)}) ${"BlockStatement"===i.body.type?e.sourceCode.getText(i.body):`{ return ${eQ(i.body,e)}; }`}`)}]})({context:e,declaration:t,exportDeclaration:r,name:a,scope:i})}:o===bC&&bP(t,e.sourceCode.visitorKeys)?void 0:e.sourceCode.getCommentsInside(r).length>0||bF(e,r)?{node:r,messageId:bh,data:{kind:o}}:{node:r,messageId:bh,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===bD&&o===bA&&"FunctionDeclaration"===t.type)return{node:r,messageId:bx,data:{kind:o,style:"const arrow function"},suggest:bO({context:e,declaration:t,exportDeclaration:r,name:a,scope:i})}}},bq=({context:e,exportDeclaration:t,expectedStyle:r,kind:n})=>{let{declaration:o}=t,a=bk(o),i=e.sourceCode.getScope(t);if(!(!a||r===bv||r===bS||bB(i,a)||n===bA&&(o.generator||bP(o,e.sourceCode.visitorKeys)))){if(n===bA)return{node:t,messageId:bx,data:{kind:n,style:"const arrow function"},suggest:bO({context:e,declaration:o,exportDeclaration:t,name:a,scope:i,rangeStartNode:t})};if(!(n===bC&&bP(o,e.sourceCode.visitorKeys)))return e.sourceCode.getCommentsInside(t).length>e.sourceCode.getCommentsInside(o).length?{node:t,messageId:bx,data:{kind:n,style:"class declaration"}}:{node:t,messageId:bx,data:{kind:n,style:"class declaration"},fix:r=>{let{declaration:n}=t;return r.replaceText(t,`${e.sourceCode.getText(n)}
|
|
20
20
|
export default ${n.id.name};`)}}}},bW={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=bI(r),a=bk(r);if(!n||!a)continue;let i=bq({context:e,exportDeclaration:o,expectedStyle:t[bj(n)],kind:n});if(i)return i;continue}let a=r.body[n+1],i=bN(o,e);if(!i||!bw(a,i.name))continue;let s=bU({context:e,exportDeclaration:a,expectedStyle:t[bj(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:bT(),classes:bT()},additionalProperties:!1}],defaultOptions:[{functions:bS,classes:bS}],messages:{[bh]:"Prefer declaring this default-exported {{kind}} inline.",[bx]:"Prefer declaring this default-exported {{kind}} as a separate {{style}}.",[bb]:"Use an inline default {{kind}} declaration.",[bE]:"Use a separate const arrow function default export."},languages:["js/js"]}};function b_(e){for(;;){let t=ry(e);if(t!==e){e=t;continue}if(e?.type!=="ParenthesizedExpression")return e;e=e.expression}}function bV(e,t){return ei(t.sourceCode.getScope(e),e)}let bz="no-array-concat-in-loop",bK="no-array-front-mutation",bG=["stream.unshift","this.unshift","this.stream.unshift","process.stdin.unshift","process.stdout.unshift","process.stderr.unshift"],bJ="no-array-sort-for-min-max/error",bX="no-array-sort-for-min-max/suggestion",bH=e=>e8(e)&&0===e.value,bY=(e,t)=>{if(!td(e,{methods:["sort","toSorted"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||rQ(e.callee.object,t)||rh(e.callee.object))return;let[r]=e.arguments,n=(e=>{if(!tl(e)||e.async||e.generator||2!==e.params.length||e.params.some(e=>"Identifier"!==e.type))return;let t=ry((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(t0(t.left,r)&&t0(t.right,n))return"ascending";if(t0(t.left,n)&&t0(t.right,r))return"descending"}})(r);if(n)return{direction:n,node:e.callee.object}},bQ=(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:bJ,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=nG(a)?i.getText(a):`(${i.getText(a)})`,`Math.${s}(...${r})`);l.suggest=[{messageId:bX,data:{replacement:o},fix:t=>t.replaceText(e,o)}]}return l},bZ="no-boolean-sort-comparator",b0="no-boolean-sort-comparator/suggestion",b1=new Set(["sort","toSorted"]),b2=new Set([">",">=","<","<="]),b3=(e,t,r,n)=>(e=ry(e),t=ry(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?!!t0(e.property,t.property):e.property.name===t.property.name)&&b3(e.object,t.object,r,n),b8=(e,t)=>{for(;rg(e);){if(e.typeAnnotation&&nS(e.typeAnnotation,t,t.sourceCode.getScope(e)))return!0;e=e.expression}return!1},b6="no-chained-comparison/error",b9="no-chained-comparison/suggestion",b5=new Set(["<",">","<=",">="]),b4=new Set(["===","!==","==","!="]),b7=b5.union(b4),Ee=e=>"BinaryExpression"===e.type&&b7.has(e.operator),Et="no-constant-zero-expression/error",Er="no-constant-zero-expression/suggestion",En="no-duplicate-logical-operands",Eo="no-duplicate-logical-operands/suggestion",Ea=new Set(["Identifier","ThisExpression","Literal"]),Ei=new Set(["Identifier","ThisExpression"]),Es=e=>{if(l_(e=ry(e)))return!1;switch(e.type){case"Identifier":case"Super":case"ThisExpression":return!0;case"MemberExpression":var t;return Es(e.object)&&(!e.computed||(t=ry(t=e.property),Ea.has(t.type)));default:return!1}},El="no-impossible-length-comparison",Eu={"<":">","<=":">=",">":"<",">=":"<=","===":"===","!==":"!==","==":"==","!=":"!="},Ep="no-invalid-character-comparison",Ec=new Set(["==","===","!=","!=="]),Ed=(e,t)=>!!(td(e,{method:"charAt",maximumArguments:1,optionalCall:!1,optionalMember:!1})&&nR(e.callee.object,t)||td(e,{method:"at",maximumArguments:1,optionalCall:!1,optionalMember:!1})&&nR(e.callee.object,t))||"MemberExpression"===e.type&&e.computed&&!e.optional&&(e=>{if(e8(e))return!0;if(!e1(e))return!1;let t=Number(e.value);return Number.isSafeInteger(t)&&t>=0&&String(t)===e.value})(e.property)&&nR(e.object,t),Em="no-loop-iterable-mutation",Ef=["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"],Eg=["add","clear","delete"],Ey=["clear","delete","set"],Eh={array:new Set(Ef),set:new Set(Eg),map:new Set(Ey),unknown:new Set([...Ef,...Eg,...Ey])},Ex=new Set(["entries","keys","values"]),Eb=new Set(["ArrowFunctionExpression","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression"]);function EE(e,t){return rY(e,t)?"array":r6(e,t)?"set":r9(e,t)?"map":void 0}function ES(e){return"VariableDeclaration"===e.left.type?e.left.declarations[0].id:e.left}function ED(e){return"Identifier"===(e=ry(e)).type?e:void 0}function Ev(e){if("ArrayPattern"!==(e=ry(e)).type)return;let[t]=e.elements;return t&&ED(t)}function EC(e,t){if(l_(e=ry(e)))return;if(lW(e))return{collectionKind:EE(e,t),reference:e,method:"direct"};if("CallExpression"!==e.type||"MemberExpression"!==e.callee.type||e.arguments.length>0)return;let r=eI(e.callee,t.sourceCode.getScope(e.callee));if(!(!Ex.has(r)||l_(e.callee.object))&&lW(e.callee.object))return{collectionKind:EE(e.callee.object,t),reference:e.callee.object,method:r}}function EA(e,t){let r=ES(e);return"keys"===t.method?ED(r):"entries"===t.method||"direct"===t.method&&"set"!==t.collectionKind?Ev(r):void 0}function ET(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=ES(e),"entries"===t.method?Ev(r):"direct"!==t.method||"map"!==t.collectionKind?ED(r):void 0),a=EA(e,t),i=(n=ES(e),"set"===t.collectionKind&&("direct"===t.method||"values"===t.method)?ED(n):"direct"===t.method&&"map"!==t.collectionKind?ED(n)??Ev(n):EA(e,t));return{addArgumentIdentifier:o,collectionKind:t.collectionKind,deleteArgumentIdentifier:i,iterable:t.reference,loopBody:e.body,setKeyIdentifier:a}}function*Ew(e){"Identifier"===(e=ry(e)).type?yield e:"MemberExpression"===e.type&&(yield*Ew(e.object),e.computed&&(yield*Ew(e.property)))}function Ek(e,t,r){if(!lq(e,t))return!1;let n=[...Ew(e)],o=[...Ew(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=ei(r.sourceCode.getScope(e),e),i=ei(r.sourceCode.getScope(n),n),a||i?a===i:e.name===n.name})}function EI(e,t,r){let[n]=e.arguments;return!!(t&&n&&Ek(n,t,r))}function Ej(e,t,r,n){return"add"===r&&EI(e,t.addArgumentIdentifier,n)||"set"===r&&EI(e,t.setKeyIdentifier,n)}let EF="no-selector-as-dom-name",EB=["add","remove","contains","toggle","replace"],ER=/^[#.]-?[A-Z_a-z][\w-]*$/u,EP=new Set([".","#"]),EL=e=>EP.has(e?.[0]),E$=e=>e3(e)??("TemplateLiteral"===e.type&&e.quasis[0].value.cooked),EN=(e,t,r,n)=>({node:e,messageId:EF,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(ER.test(t))return e=>e.removeRange(o)}})(e,t,r,n)}),EM=(e,t)=>e.map(e=>({node:e,expectedPrefix:t})),EO="no-useless-compound-assignment/error",EU="no-useless-compound-assignment/remove",Eq="no-useless-compound-assignment/replace",EW=new Map([["+=",0],["-=",0],["*=",1],["/=",1],["**=",1]]),E_="no-useless-delete-check",EV="removeCheck",Ez={considerGetters:!0},EK=new Set(["Map","Set","WeakMap","WeakSet"]),EG=new Set(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]),EJ=new Set(["ClassName","FunctionName"]),EX=new Set(["TSConstructorType","TSFunctionType","TSObjectKeyword"]),EH=e=>null!==e&&("object"==typeof e||"function"==typeof e),EY=e=>!!EX.has(e?.type)||e?.type==="TSUnionType"&&e.types.every(e=>EY(e)),EQ=(e,t)=>{if("Identifier"!==e.type)return!1;let r=ei(t.sourceCode.getScope(e),e);return r?.defs.some(e=>EJ.has(e.type))??!1},EZ=(e,t)=>{let r=ew(e,t.sourceCode.getScope(e));return r&&"symbol"!=typeof r.value&&!EH(r.value)?String(r.value):void 0},E0=(e,t)=>{let r=ew(e,t.sourceCode.getScope(e));if(r)return EH(r.value);let n=ra(ry(e),t);if(n){let e=ry(n),r=ew(e,t.sourceCode.getScope(e));if(r)return EH(r.value);if(EG.has(e.type))return!0}return!EQ(ry(e),t)&&EY(((e,t)=>{if("Identifier"!==(e=ry(e)).type)return;let r=ei(t.sourceCode.getScope(e),e);return r?.defs[0]?.name?.typeAnnotation?.typeAnnotation??e.typeAnnotation?.typeAnnotation})(e,t))},E1=(e,t)=>!eL(e,t.sourceCode,Ez),E2=(e,t)=>td(e,{method:t,argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1,allowSpreadElement:!1}),E3=(e,t,r)=>n=>{if(rt(r,r.sourceCode.getRange(e)))return;let o=r.sourceCode.getText(t.parent);return o.trimEnd().endsWith(";")||(o+=";"),nQ(r.sourceCode.getTokenBefore(e),r,o)&&(o=`;${o}`),n.replaceText(e,o)},E8="no-useless-logical-operand",E6=new Map([["&&",!0],["||",!1]]),E9=new Map([["&&",!1],["||",!0]]),E5=new Set(["FunctionExpression","ClassExpression","ObjectExpression"]),E4="prefer-boolean-return",E7=new Set(["==","!=","===","!==","<","<=",">",">=","in","instanceof"]);function Se(e){if(e){if("BlockStatement"===e.type){let t=e.body.filter(({type:e})=>"EmptyStatement"!==e);if(1===t.length)return Se(t[0])}return e}}let St=e=>{if(e?.type==="ReturnStatement"&&e.argument?.type==="Literal"&&"boolean"==typeof e.argument.value)return e.argument.value};function Sr(e,t){switch(e.type){case"Literal":return"boolean"==typeof e.value;case"UnaryExpression":return["!","delete"].includes(e.operator);case"BinaryExpression":return E7.has(e.operator);case"LogicalExpression":return Sr(e.left,t)&&Sr(e.right,t);case"CallExpression":return tA(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 Sn="prefer-flat-math-min-max",So=["min","max"],Sa=(e,t)=>td(e,{object:"Math",method:t,optionalCall:!1,optionalMember:!1}),Si=(e,t)=>{let r=[];for(let n of e.arguments){if(Sa(n,t)){r.push(...Si(n,t));continue}r.push(n)}return r},Ss="prefer-hoisting-branch-code/start",Sl="prefer-hoisting-branch-code/end",Su="prefer-hoisting-branch-code/suggestion",Sp=new Set(["await using","using"]),Sc=(e,t)=>eL(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),Sd=(e,t)=>{let r=t.getTokens(e),n=r.at(-1);return n?.type==="Punctuator"&&";"===n.value?r.slice(0,-1):r},Sm=(e,t,r)=>{let n=Sd(e,r),o=Sd(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 Sf(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 Sg({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=>!ro(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 rt(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&&rt(a,[r+1,n]))return!0;if(!i.isStart){let[,r]=t.getRange(e.body.at(-1)),[,n]=t.getRange(e);if(rt(a,[r,n-1]))return!0}return rt(a,Sf(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"&&Sp.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?Ss:Sl};if(p){let i=function({ifStatement:e,blocks:t,leading:r,trailing:n,isStart:o},a){let{sourceCode:i}=a,s=t6(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=t6(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&&nQ(t,a,c)?";":"";yield l.insertTextBefore(e,`${r}${c}
|
|
21
21
|
${s}`)}else{let t=i.getLastToken(p.at(-1)),r=i.getTokenAfter(e),n=r&&nQ(t,a,r.value)?";":"";yield l.insertTextAfter(e,`
|
|
22
|
-
${s}${c}${n}`)}for(let e of t)yield l.removeRange(Sf(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(Sc(r.test,t))return!1;return!0}(e,s)&&u.every(e=>"ExpressionStatement"===e.type&&!Sc(e,s))?c.fix=i:c.suggest=[{messageId:Su,fix:i}]}return c}let{parse:Sy}=iN,Sh="prefer-single-replace",Sx=new Set(["g","m","s"]),Sb=new Map([["\\",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 SE(e){if(!td(e,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1,optionalMember:!1,computed:!1}))return;let[t]=e.arguments;if(e1(t)){if("replaceAll"!==e.callee.property.name)return;return 1===t.value.length?t.value:void 0}if(e6(t))return function({pattern:e,flags:t}){let r;if(t.includes("g")){for(let e of t)if(!Sx.has(e))return;try{r=Sy(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 SS="consistent-tuple-labels",SD="no-invalid-well-known-symbol-methods/async-dispose",Sv="no-invalid-well-known-symbol-methods/dispose-generator",SC="no-invalid-well-known-symbol-methods/sync-iterator",SA="no-invalid-well-known-symbol-methods/async-iterator",ST="no-invalid-well-known-symbol-methods/suggestion",Sw=new Set(["Promise","PromiseLike"]),Sk=new Set(["dispose","iterator","asyncIterator"]);function SI(e){return"TSTypeReference"===e.type&&"Identifier"===e.typeName.type&&Sw.has(e.typeName.name)}function Sj(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(!Sk.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:Sv};let a=!o.async&&(!!(r=o.returnType?.typeAnnotation)&&("TSTypeReference"===r.type?SI(r):"TSUnionType"===r.type&&r.types.some(e=>SI(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===nq(t.getReturnTypeOfSignature(o),t);return r.getTypeAtLocation(e).getCallSignatures().some(e=>!0===nq(t.getReturnTypeOfSignature(e),t))}catch{return!1}}(o,t));if("dispose"===n&&(o.async||a))return{node:e.key,messageId:SD,fix:t=>t.replaceText(e.key.property,"asyncDispose")};if("iterator"===n&&(o.async||a)){let t={node:e.key,messageId:SC};return o.generator&&(t.suggest=[{messageId:ST,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:SA}}let SF="after-suspension",SB="in-generator",SR="in-nested-function",SP=["preventDefault","stopImmediatePropagation","stopPropagation"],SL="prefer-abort-signal-timeout",S$="prefer-abort-signal-timeout/suggestion",SN=0x80000000-1,SM=new Set(["reason","throwIfAborted"]),SO=(e,t)=>{let r,{parent:n}=e;if(!(!tc(n,{property:"signal",computed:!1,optional:!1})||n.object!==e||nr(n)||("ForInStatement"===n.parent.type||"ForOfStatement"===n.parent.type)&&n.parent.left===n||tc(n.parent)&&n.parent.object===n&&(r=n.parent,SM.has(eI(r,t.sourceCode.getScope(r))))||(e=>{let{expression:t,parent:r}=(e=>{let t=e,{parent:r}=e;for(;rg(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)||rt(t,t.sourceCode.getRange(n))))return n},SU=(e,t,r,n)=>{let o=ei(n.sourceCode.getScope(r),e);return o&&o!==t},Sq="prefer-aggregate-error",SW=/[Ee]rrors$|[Ee]rror(?:List|Array|Collection)$/u,S_=new Set(sS);function SV(e){for(;e?.type==="ParenthesizedExpression";)e=e.expression;return ry(e)}function Sz(e){if("Identifier"===e.type)return e.name;if("TSQualifiedName"===e.type){let t=Sz(e.left);return t?`${t}.${e.right.name}`:void 0}}function SK(e){return e=e?.type==="TSTypeAnnotation"?e.typeAnnotation:e,e?.type==="TSTypeOperator"&&"readonly"===e.operator&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType"?SK(e.typeAnnotation):e}function SG(e,t,r,n=new Set){switch(e=SK(e),e?.type){case"TSTypeReference":{let o=Sz(e.typeName);if(!o)return!1;let a=n1(o,t);if(S_.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&&SG(i.node.typeAnnotation,s,r,n);return n.delete(o),l}case"TSUnionType":return e.types.every(e=>SG(e,t,r,n));case"TSIntersectionType":return e.types.some(e=>SG(e,t,r,n));default:return!1}}function SJ(e,t){let r;if(tc(e=SV(e),{property:"length",optional:!1})&&"Identifier"===e.object.type&&(r=e.object.name,SW.test(r))&&rY(e.object,t)&&function(e,t){let r=n1(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 Set){switch(t=SK(t),t?.type){case"TSArrayType":return SG(t.elementType,r,n,o);case"TSTupleType":return t.elementTypes.length>0&&t.elementTypes.every(e=>SG("TSNamedTupleMember"===e.type?e.elementType:"TSRestType"===e.type?e.typeAnnotation:e,r,n,o));case"TSTypeReference":return function(t,r,n,o){let a=Sz(t.typeName),i=t.typeArguments?.params??t.typeParameters?.params;if(("Array"===a||"ReadonlyArray"===a)&&i?.length===1)return SG(i[0],r,n,o);if(!a||o.has(a))return!1;o.add(a);let s=n1(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 Set){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 i=r.getTypeArguments(t);return i.length>0&&i.every(e=>(function e(t,r,n,o=new Set){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 i=rv(t);return!!(S_.has(i?.getName())&&rC(i,n))||rA(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 SX=(e,t,r)=>{var n;if(("!=="===e||"!="===e)&&e0(SV(t),0))return!0;let o=(n=SV(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)},SH=e=>"LogicalExpression"!==(e=SV(e)).type||"&&"!==e.operator?[e]:[...SH(e.left),...SH(e.right)],SY={resize:"Prefer ResizeObserver over a resize listener with layout reads.",scroll:"Prefer IntersectionObserver over a scroll listener with layout reads."},SQ=new Set(Object.keys(SY)),SZ=new Set(["globalThis","self","window"]),S0=new Set(["getBoundingClientRect","getClientRects"]),S1=new Set(["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetParent","offsetTop","offsetWidth","scrollHeight","scrollWidth"]),S2=new Set(["innerHeight","innerWidth"]),S3=new Set(["height","width"]),S8=new Set(["Window"]),S6=new Set(["VisualViewport"]),S9=new Set(["Document","Element","HTMLElement","Node","SVGElement","VisualViewport","Window"]),S5=(e,t,r)=>{let n;if(rS.has(e.intrinsicName))return!1;if(rD.has(e.intrinsicName)||e.intrinsicName)return!0;if(e.isUnion()||e.isIntersection())return e.types.every(e=>S5(e,t,r));let o=t.getBaseConstraintOfType(e);if(o&&o!==e)return S5(o,t,r);let a=rv(e);return!(!a||rA(e,t).some(e=>!S5(e,t,r)))&&(!rC(a,r)||(n=a.getName(),!(S9.has(n)||/^HTML\w*Element$/.test(n)||/^SVG\w*Element$/.test(n))))},S4=(e,t,r,n)=>{if(rS.has(e.intrinsicName)||rD.has(e.intrinsicName))return!1;if(e.isUnion()){let o=e.types.filter(e=>!rD.has(e.intrinsicName));return o.length>0&&o.every(e=>S4(e,t,r,n))}if(e.isIntersection())return e.types.some(e=>S4(e,t,r,n));let o=t.getBaseConstraintOfType(e);if(o&&o!==e)return S4(o,t,r,n);let a=rv(e);return!!(a&&rC(a,r)&&n.has(a.getName()))||rA(e,t).some(e=>S4(e,t,r,n))},S7=(e,t,r)=>{let{parserServices:n}=t.sourceCode;if(!n?.program)return!1;try{let{program:t}=n,o=t.getTypeChecker();return S4(n.getTypeAtLocation(e),o,t,r)}catch{return!1}},De=(e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let{program:t}=r,n=t.getTypeChecker();return S5(r.getTypeAtLocation(e),n,t)}catch{return!1}},Dt=e=>e.computed||"Identifier"!==e.property.type?e3(ry(e.property)):e.property.name,Dr=(e,t)=>e.properties.some(e=>t.has((e=>{if("Property"===e.type)return e.computed||"Identifier"!==e.key.type?e3(ry(e.key)):e.key.name})(e))),Dn=(e,t)=>"Identifier"===e.type&&SZ.has(e.name)&&n_(e,t),Do=e=>nr(e)&&"UpdateExpression"!==e.parent.type&&("AssignmentExpression"!==e.parent.type||e.parent.left!==e||"="===e.parent.operator),Da=(e,t)=>"Identifier"===(e=ry(e)).type?"visualViewport"===e.name&&n_(e,t):"MemberExpression"===e.type&&"visualViewport"===Dt(e)&&Dn(ry(e.object),t),Di=(e,t)=>{var r;return Dn(e=ry(e),t)||("Identifier"===(r=ry(r=e)).type?"document"===r.name&&n_(r,t):"MemberExpression"===r.type&&"document"===Dt(r)&&Dn(ry(r.object),t))||Da(e,t)},Ds=(e,t,r)=>{let n=ry(t);return Dr(e,S2)&&(Dn(n,r)||S7(t,r,S8))||Dr(e,S3)&&(Da(n,r)||S7(t,r,S6))||Dr(e,S1)&&!Di(n,r)&&!De(t,r)},Dl=(e,t,r=e)=>{let n,o;if(!e||e!==r&&tl(e))return!1;if(e7(e)&&"MemberExpression"===e.callee.type&&S0.has(Dt(e.callee))&&!Di(e.callee.object,t)&&!De(e.callee.object,t)||tf(e)&&S2.has(e.name)&&!Do(e)&&n_(e,t)||"MemberExpression"===e.type&&!Do(e)&&(n=Dt(e),o=ry(e.object),S2.has(n)&&(Dn(o,t)||S7(e.object,t,S8))||S3.has(n)&&(Da(o,t)||S7(e.object,t,S6))||S1.has(Dt(e))&&!Di(e.object,t)&&!De(e.object,t))||("VariableDeclarator"===e.type&&"ObjectPattern"===e.id.type&&e.init?Ds(e.id,e.init,t):"AssignmentExpression"===e.type&&"ObjectPattern"===e.left.type&&Ds(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=>Dl(e,t,r)))return!0;continue}if(Dl(o,t,r))return!0}return!1},Du="prefer-set-methods/union",Dp="prefer-set-methods/intersection",Dc="prefer-set-methods/intersection-suggestion",Dd="prefer-set-methods/difference",Dm="prefer-set-methods/difference-suggestion",Df=(e,t)=>te(e,{name:"Set",argumentsLength:1})&&n_(e.callee,t),Dg=(e,t)=>{let r=eQ(e,t);return og(e,t)&&!eZ(e,t)?`(${r})`:r},Dy=(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)&&nQ(r.sourceCode.getTokenBefore(e),r,t)?`;${t}`:t,Dh=(e,t)=>("ParenthesizedExpression"===e.type||rg(e))&&e.expression===t,Dx=e=>{for(;e.parent;){let{parent:t}=e;if(Dh(t,e)){e=t;continue}break}return e},Db=(e,t)=>e?.type==="SpreadElement"&&"Set"===on(e.argument,t),DE=(e,t,r)=>{if(!(!td(e,{method:"has",argumentsLength:1,optionalCall:!1,optionalMember:!1})||!t0(e.arguments[0],t)||t0(e.callee.object,t))&&"Set"===on(e.callee.object,r))return e.callee.object},DS=(e,t,r)=>{var n;if(r.sourceCode.getCommentsInside(t).length>0||(n=Dx(n=e),n.parent?.type==="MemberExpression"&&n.parent.object===n)||e===t&&rg(e.parent))return;let o=((e,t)=>{if(!td(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&&Db(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=DE(e,t,r);if(n)return{method:"intersection",messageId:Dp,suggestionMessageId:Dc,otherSet:n};if("UnaryExpression"!==e.type||"!"!==e.operator||!e.prefix)return;let o=DE(e.argument,t,r);if(o)return{method:"difference",messageId:Dd,suggestionMessageId:Dm,otherSet:o}})(n.body,n.params[0],t);if(!(!o||eL(o.otherSet,t.sourceCode,{considerGetters:!0})))return{messageId:o.messageId,suggestionMessageId:o.suggestionMessageId,replacement:`${Dg(r,t)}.${o.method}(${eQ(o.otherSet,t)})`}})(e,r);if(o)return{node:t,messageId:o.messageId,suggest:[{messageId:o.suggestionMessageId,fix:e=>e.replaceText(t,Dy(t,o.replacement,r))}]}},DD="prefer-toggle-attribute/error",Dv="prefer-toggle-attribute/suggestion",DC=(e,t,r)=>{let n=eQ(e,t);return r?"UnaryExpression"===e.type&&"!"===e.operator&&e.prefix&&t.sourceCode.getCommentsInside(e).length===t.sourceCode.getCommentsInside(e.argument).length?DC(e.argument,t,!1):(!eZ(e,t.sourceCode)&&oh(e,"!")&&(n=`(${n})`),`!${n}`):eZ(e,t.sourceCode)||"SequenceExpression"!==e.type?n:`(${n})`},DA=(e,t,r)=>td(e,{methods:t,argumentsLength:r,optionalCall:!1,computed:!1});function DT(e){if(e?.type==="ChainExpression"&&(e=e.expression),DA(e,["removeAttribute","hasAttribute"],1)||DA(e,["setAttribute"],2)){let{callee:t}=e,[r,n]=e.arguments;if(e3(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||e0(n,"")}}}function Dw(e){if(e){if("BlockStatement"===e.type){if(1!==e.body.length)return;e=e.body[0]}return"ExpressionStatement"===e.type&&(e=e.expression),DT(e)}}let Dk=(e,t)=>e.isOptional===t.isOptional&&t0(e.receiver,t.receiver)&&t0(e.attributeName,t.attributeName),DI=(e,t)=>nL(e.receiver)||ne(e.receiver,t),Dj="prefer-url-search-parameters/error",DF="prefer-url-search-parameters/suggestion",DB=new Set(["node:url","url"]),DR=e=>"Type"===e.type||"ImportBinding"===e.type&&nZ(e.node),DP=(e,t,r)=>{let n=ei(r.sourceCode.getScope(t),e);return!n||n.defs.every(e=>DR(e))},DL=(e,t)=>e3(ry(e))===t,D$=(e,t)=>{let r=t.sourceCode.getText(e);return"SequenceExpression"===e.type?`(${r})`:r},DN=(e,t)=>{if(!td(e=ry(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(td(e=ry(e),{method:"split",argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1})&&!(!DL(e.arguments[0],"&")||nB(e.callee.object,t)||(n=ew(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!!td(e=ry(e),{method:"split",minimumArguments:1,maximumArguments:2,computed:!1,optionalCall:!1,optionalMember:!1})&&!!nW(ry(e.callee.object),t)&&!!DL(e.arguments[0],"=")&&(1===e.arguments.length||2===(n=e.arguments[1],ew(n,r.sourceCode.getScope(n))?.value))})(o.returnExpression,o.parameter,t))return{node:e,query:r.callee.object}},DM=(e,t)=>`new URLSearchParams(${D$(e,t)})`,DO=(e,t,r,n)=>{let{sourceCode:o}=n,[a,i]=o.getRange(e),[s,l]=eY(t,n);return o.text.slice(a,s)+r+o.text.slice(l,i)},DU=(e,t,r)=>{let[n,o]=r.sourceCode.getRange(e),[a,i]=eY(t,r);return[[n,a],[i,o]]},Dq=({node:e,query:t,replacement:r,preservedNodes:n=[t]},o)=>{let a=(({node:e,replacement:t,preservedNodes:r},n)=>{let o;if(!(!(!(o=ei(n.sourceCode.getScope(e),"URLSearchParams"))||o.defs.every(e=>DR(e))||o.defs.some(e=>(e=>{if("ImportBinding"!==e.type)return!1;let{node:t,parent:r}=e;return DB.has(r.source.value)&&"type"!==r.importKind&&"ImportSpecifier"===t.type&&"type"!==t.importKind&&"Identifier"===t.imported.type&&"URLSearchParams"===t.imported.name})(e)))||t7(n,e,r)))return[{messageId:DF,data:{replacement:t},fix:r=>r.replaceText(e,t)}]})({node:e,replacement:r,preservedNodes:n},o);if(a)return{node:e,messageId:Dj,suggest:a}},DW={configs:{node:{name:"@eslint-sukka/eslint-plugin-sukka-full node preset",plugins:{get sukka(){return DW}},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 DW}},rules:{"sukka/ban-eslint-disable":["error","allow-with-description"]}},recommended:{...u.eslint_plugin_sukka.configs.recommended,plugins:{get sukka(){return DW}},rules:{...u.eslint_plugin_sukka.configs.recommended.rules,"sukka/prefer-single-boolean-return":"off","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"}},recommended_unicorn:{name:"@eslint-sukka/eslint-plugin-sukka-full recommended unicorn preset",plugins:{get sukka(){return DW}},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-code-point":"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":"warn","sukka/unicorn/prefer-queue-microtask":"warn","sukka/unicorn/prefer-string-pad-start-end":"warn","sukka/unicorn/require-css-escape":"error","sukka/unicorn/require-passive-events":"warn","sukka/unicorn/class-reference-in-static-methods":"warn","sukka/unicorn/consistent-optional-chaining":"error","sukka/unicorn/explicit-timer-delay":"warn","sukka/unicorn/no-confusing-array-with":"error","sukka/unicorn/no-duplicate-loops":"warn","sukka/unicorn/no-declarations-before-early-exit":"warn","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":"warn","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":"warn","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":"warn","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"}},stylistic_unicorn:{name:"@eslint-sukka/eslint-plugin-sukka-full stylistic unicorn preset",plugins:{get sukka(){return DW}},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:{...u.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint,plugins:{get sukka(){return DW}},rules:{...u.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint.rules,"sukka/string/no-unneeded-to-string":"error","sukka/type/no-force-cast-via-top-type":"error","sukka/type/no-wrapper-type-reference":"error","sukka/no-default-error":"off","sukka/unicorn/consistent-tuple-labels":"warn"}},recommended_react:{...u.eslint_plugin_sukka.configs.recommended_react,plugins:{get sukka(){return DW}}}},rules:Object.assign(u.eslint_plugin_sukka.rules,{"array/no-unneeded-flat-map":A,"browser/prefer-location-assign":w,"jsx/no-template-literal":I,"jsx/no-unneeded-nested":j,"string/no-locale-case":B,"string/no-simple-template-literal":R,"unicode/no-bidi":U,"unicode/no-invisible":W,"no-redundant-variable":_,"no-single-return":z,"prefer-early-return":G,"prefer-fetch":J,"prefer-timer-id":Y,"string/no-unneeded-to-string":Q,"type/no-force-cast-via-top-type":Z,"type/no-wrapper-type-reference":et,"no-default-error":er},Object.fromEntries(Object.entries({"unicorn/catch-error-name":ca,"unicorn/custom-error-definition":{create:e=>{e.on("ClassDeclaration",t=>cw(e,t)),e.on("AssignmentExpression",t=>{if("ClassExpression"===t.right.type)return cw(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||!cg(t)||!t.id)return;let r=t.id.name;return e.left.property.name!==r?{node:e.left.property,messageId:ci,fix:t=>t.replaceText(e.left.property,r)}:void 0}})},meta:{type:"problem",docs:{description:"Enforce correct `Error` subclassing.",recommended:!1},fixable:"code",messages:{[ci]:"Exported error name should match error class",[cs]:"Do not pass the error message to `super()` when the class defines a `message` accessor.",[cl]:"Do not assign to `this.message` when the class defines a `message` getter without a setter.",[cu]:"Error constructors should accept `options` as the second parameter.",[cp]:"Error constructors should use `options` as the second parameter.",[cc]:"Pass the error message to `super()` as the first argument.",[cd]:"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||eZ(t,e)?o>1?{node:o>2?n[o-3]:t,messageId:oI}:void 0:{node:t,messageId:oj,fix:e=>[e.insertTextBefore(t,"("),e.insertTextAfter(t,")")]}})},meta:{type:"suggestion",docs:{description:"Disallow nested ternary expressions.",recommended:!0},fixable:"code",messages:{[oI]:"Do not nest ternary expressions.",[oj]:"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!!(oB.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)&&oR(e.parent.parent)&&oP(e.parent.parent.parent.init))||!!(oR(e)&&tc(e.parent.init,{property:"EventEmitter",optional:!1,computed:!1})&&oP(e.parent.init.object))}(ei(r,t)?.defs[0]?.name))return{node:t,messageId:oF}})},meta:{type:"suggestion",docs:{description:"Prefer `EventTarget` over `EventEmitter`.",recommended:"unopinionated"},messages:{[oF]:"Prefer `EventTarget` over `EventEmitter`."},languages:["js/js"]}},"unicorn/prefer-keyboard-event-key":{create:e=>{e.on("Identifier",t=>{if(oM.has(t.name)){for(let r of o_(e,t))if(r.references?.some(e=>oW(t,e.identifier)))return oV(t,r)}}),e.on("Property",t=>{let r;if("Identifier"===t.key.type&&oM.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 o_(e,t))if(oK(t.key,r))return oV(t.key,r);for(let r of o_(e,t))if(oz(t.key,r))return oV(t.key,r)}})},meta:{type:"suggestion",docs:{description:"Prefer `KeyboardEvent#key` over deprecated keyboard event properties.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[o$]:"Use `.key` instead of `.{{name}}`.",[oN]:"Use `.key` with `{{key}}`."},languages:["js/js"]}},"unicorn/prefer-text-content":{create:e=>{e.on("MemberExpression",t=>{if(!tc(t,{property:"innerText"})||ne(t.object,e))return;let r=t.property;return{node:r,messageId:oG,suggest:[{messageId:oJ,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(ne(e,t))return!0;let{parent:r}=e;return"VariableDeclarator"===r.type?r.id===e&&r.init&&ne(r.init,t):"AssignmentExpression"===r.type&&r.left===e&&ne(r.right,t)})(t.parent.parent,e))return{node:t,messageId:oG,suggest:[{messageId:oJ,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:{[oG]:"Prefer `.textContent` over `.innerText`.",[oJ]:"Switch to `.textContent`."},languages:["js/js"]}},"unicorn/require-array-join-separator":{create:e=>{e.on("CallExpression",t=>{if(!(td(t,{method:"join",argumentsLength:0,optionalCall:!1})||td(t,{method:"call",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&tE(t.callee.object,{property:"join"}))||0===t.arguments.length&&r0(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:ao,fix:r=>oH(r,t,"','",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the separator argument with `Array#join()`.",recommended:"unopinionated"},fixable:"code",messages:{[ao]:"Missing the separator argument."},languages:["js/js"]}},"unicorn/no-thenable":{create:e=>{for(let{selector:t,selectors:r,messageId:n,getNodes:o}of ap)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:{[aa]:"Do not add `then` to an object.",[ai]:"Do not export `then`.",[as]:"Do not add `then` to a class."},languages:["js/js"]}},"unicorn/no-invalid-remove-event-listener":{create:e=>{e.on("CallExpression",t=>{if(!(td(t,{method:"removeEventListener",minimumArguments:2,optionalCall:!1})&&"SpreadElement"!==t.arguments[0].type&&("FunctionExpression"===t.arguments[1].type||"ArrowFunctionExpression"===t.arguments[1].type||td(t.arguments[1],{method:"bind",optionalCall:!1,optionalMember:!1}))))return;let[,r]=t.arguments;return["ArrowFunctionExpression","FunctionExpression"].includes(r.type)?{node:r,loc:eh(r,e.sourceCode),messageId:ac}:{node:r.callee.property,messageId:ac}})},meta:{type:"problem",docs:{description:"Prevent calling `EventTarget#removeEventListener()` with the result of an expression.",recommended:"unopinionated"},messages:{[ac]:"The listener argument should be a function reference."},languages:["js/js"]}},"unicorn/consistent-function-scoping":ab,"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(nc(r,t))return"alloc";let n=ew(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:aE,data:{method:n},fix:av(r,e,n)}:{node:r,messageId:aS,suggest:["from","alloc"].map(t=>({messageId:aD,data:{replacement:t},fix:av(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:{[aE]:"`new Buffer()` is deprecated, use `Buffer.{{method}}()` instead.",[aS]:"`new Buffer()` is deprecated, use `Buffer.alloc()` or `Buffer.from()` instead.",[aD]:"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:oD(l,e),messageId:aC,data:{method:n,position:o},fix:e=>e.removeRange(l)}};e.on("CallExpression",function*(e){if(!td(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(!e1(i)&&"TemplateLiteral"!==i.type)continue;let o=t.getText(i).slice(1,-1);0!==e&&aA(o)&&(yield r(i,n,"leading")),e!==a-1&&aT(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:{[aC]:"Do not use {{position}} space between `console.{{method}}` parameters."},languages:["js/js"]}},"unicorn/no-empty-file":ak,"unicorn/no-useless-fallback-in-spread":{create:e=>{e.on("ObjectExpression",t=>{if(ta(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:aI,*fix(r,{abort:n}){let{sourceCode:o}=e,a=t.parent;if(o.getCommentsInside(a).length>0)return n();let{left:i}=a,s=eZ(i,e),[,l]=s?eY(i,e):o.getRange(i),[,u]=o.getRange(a);yield r.removeRange([l,u]),(s||"SequenceExpression"!==i.type)&&(yield oX(a,r,e))}}})},meta:{type:"suggestion",docs:{description:"Disallow useless fallback when spreading in object literals.",recommended:"unopinionated"},fixable:"code",messages:{[aI]:"The empty object is useless."},languages:["js/js"]}},"unicorn/no-useless-length-check":{create:e=>{let t=[],r=new Set,n=new Set,o=new Set,a=new Set;e.on("BinaryExpression",e=>{if(!("BinaryExpression"===e.type&&"Literal"===e.right.type&&"0"===e.right.raw&&tc(e.left,{property:"length",optional:!1})&&tS(e.parent)))return;let{operator:t}=e;"==="===t?r.add(e):(">"===t||"!=="===t)&&n.add(e)}),e.on("CallExpression",t=>{td(t,{optionalCall:!1,optionalMember:!1,computed:!1})&&"Identifier"===t.callee.property.type&&!rQ(t.callee.object,e)&&("some"===t.callee.property.name?o.add(t):"every"===t.callee.property.name&&a.add(t))}),e.on("LogicalExpression",e=>{tS(e)&&t.push(e)}),e.on("Program:exit",function*(){let i=new Set(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,i,s)=>(function({node:e,operator:t,siblings:i}){return"||"===t&&r.has(e)&&i.some(t=>a.has(t)&&t0(e.left.object,t.callee.object))||"&&"===t&&n.has(e)&&i.some(t=>o.has(t)&&t0(e.left.object,t.callee.object))})({node:e,operator:t,siblings:[s[i-1],s[i+1]].filter(Boolean)}))})(e))),{sourceCode:s}=e;for(let t of i)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=eY(n,e),i=eY(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=>{if(!(td(t,{object:"Promise",methods:["resolve","reject"],optionalCall:!1,optionalMember:!1})&&("ArrowFunctionExpression"===t.parent.type&&t.parent.body===t||"ReturnStatement"===t.parent.type&&t.parent.argument===t||"YieldExpression"===t.parent.type&&!t.parent.delegate&&t.parent.argument===t)))return;let{functionNode:r,isInTryStatement:n}=function(e){let t,r=!1;for(;e;e=e.parent){if(tl(e)){t=e;break}"TryStatement"===e.type&&(r=!0)}return{functionNode:t,isInTryStatement:r}}(t);if(r&&(r.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}(r)))return function(e,t){let{callee:r,parent:n}=e,o=r.property.name;return{node:r,messageId:o,data:{type:"YieldExpression"===n.type?"yield":"return"},fix:t}}(t,function(e,t,r){if(e.arguments.length>1)return;let{callee:n,parent:o,arguments:a}=e,[i]=a;if(i?.type==="SpreadElement")return;let s="reject"===n.property.name,l="YieldExpression"===o.type;if(!s||!t&&(!l||"ExpressionStatement"===o.parent.type))return function(t){let n="ArrowFunctionExpression"===o.type,a=i?r.sourceCode.getText(i):"";if(i?.type==="SequenceExpression"&&(a=`(${a})`),s){if(a||="undefined",a=`throw ${a}`,l)return t.replaceTextRange(eY(o,r),a);if(a+=";",n)return a=`{ ${a} }`,t.replaceTextRange(eY(e,r),a)}else l?a=`yield${a?" ":""}${a}`:"ReturnStatement"===o.type?a=`return${a?" ":""}${a};`:(i?.type==="ObjectExpression"&&(a=`(${a})`),a||="{}");return t.replaceText(n?e:o,a)}}(t,n,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(!e8(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:oD([p-(r.length-s.length),p],e),messageId:l?aF:aj,*fix(r){let n=s;"MemberExpression"===t.parent.type&&t.parent.object===t&&om.test(s)&&!eZ(t,e)&&(n=`(${n})`,nQ(u.getTokenBefore(t),e,n)&&(n=`;${n}`)),yield r.replaceText(t,n),yield o8(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow number literals with zero fractions or dangling dots.",recommended:"unopinionated"},fixable:"code",messages:{[aj]:"Don't use a zero fraction in the number.",[aF]:"Don't use a dangling dot in the number."},languages:["js/js"]}},"unicorn/prefer-export-from":aU,"unicorn/prefer-native-coercion-functions":{create:e=>{e.on(ts,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&&a_.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&&aV(e.body,t)?e.body:"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type&&aV(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:eh(t,n),messageId:aq,data:{functionNameWithKind:ej(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:{[aq]:"{{functionNameWithKind}} is equivalent to `{{replacementFunction}}`. Use `{{replacementFunction}}` directly."},languages:["js/js"]}},"unicorn/no-document-cookie":{create(e){aX.listen({context:e})},meta:{type:"problem",docs:{description:"Do not use `document.cookie` directly.",recommended:"unopinionated"},messages:{[aJ]:"Do not use `document.cookie` directly."},languages:["js/js"]}},"unicorn/prefer-add-event-listener":aZ,"unicorn/prefer-array-index-of":a9,"unicorn/prefer-blob-reading-methods":{create:e=>{e.on("CallExpression",e=>{if(!td(e,{methods:["readAsText","readAsArrayBuffer"],argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let t=e.callee.property,r=t.name;return{node:t,messageId:a5,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:{[a5]:"Prefer `Blob#{{replacement}}()` over `FileReader#{{method}}(blob)`."},languages:["js/js"]}},"unicorn/prefer-date-now":{create:e=>{e.on("CallExpression",e=>{if(td(e,{methods:["getTime","valueOf"],argumentsLength:0,optionalCall:!1,optionalMember:!1})&&it(e.callee.object)){let t=e.callee.property;return ir(e,{node:t,messageId:a7,data:{method:t.name}})}if(e7(e,{names:["Number","BigInt"],argumentsLength:1,optional:!1})&&it(e.arguments[0])){let{name:t}=e.callee;return"Number"===t?ir(e,{messageId:ie}):ir(e.arguments[0])}}),e.on("UnaryExpression",t=>{if(("+"===t.operator||"-"===t.operator)&&it(t.argument))return ir("-"===t.operator?t.argument:t,{},e)}),e.on("AssignmentExpression",e=>{if(("-="===e.operator||"*="===e.operator||"/="===e.operator||"%="===e.operator||"**="===e.operator)&&it(e.right))return ir(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])it(t)&&(yield ir(t))})},meta:{type:"suggestion",docs:{description:"Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.",recommended:"unopinionated"},fixable:"code",messages:{[a4]:"Prefer `Date.now()` over `new Date()`.",[a7]:"Prefer `Date.now()` over `Date#{{method}}()`.",[ie]:"Prefer `Date.now()` over `Number(new Date())`."},languages:["js/js"]}},"unicorn/dom-node-dataset":ig,"unicorn/prefer-modern-math-apis":{create:e=>{let t=[];e.on("CallExpression",t=>{if(!td(t,{object:"Math",method:"sqrt",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let r=iD(t.arguments[0]);if(r.some(e=>!("BinaryExpression"===e.type&&("*"===e.operator&&t0(e.left,e.right)||"**"===e.operator&&e0(e.right,2)))))return;let n=1===r.length?"abs":"hypot",o=new Set(1===r.length?[]:r.map(e=>e.parent));return{node:t.callee.property,messageId:iy,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 an(t,",",a,e),yield oX(r,a,e)}for(let t of r)yield a.removeRange([eY(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 iS){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:{[iy]:"Prefer `{{replacement}}` over `{{description}}`."},languages:["js/js"]}},"unicorn/number-literal-case":iA,"unicorn/prefer-number-properties":iF,"unicorn/prefer-reflect-apply":{create:e=>{e.on("CallExpression",t=>{if(!td(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"===eI(e.callee)&&2===e.arguments.length&&iR(e.arguments[0],e.arguments[1]))return r=>r.replaceText(e,iP(t,e.callee.object,e.arguments[0],e.arguments[1]))})(t,r)||((e,t)=>{if("call"===eI(e.callee)&&"apply"===eI(e.callee.object)&&"prototype"===eI(e.callee.object.object)&&e.callee.object.object.object?.type==="Identifier"&&"Function"===e.callee.object.object.object.name&&3===e.arguments.length&&iR(e.arguments[1],e.arguments[2]))return r=>r.replaceText(e,iP(t,e.arguments[0],e.arguments[1],e.arguments[2]))})(t,r);if(n)return{node:t,messageId:iB,fix:n}})},meta:{type:"suggestion",docs:{description:"Prefer `Reflect.apply()` over `Function#apply()`.",recommended:"unopinionated"},fixable:"code",messages:{[iB]:"Prefer `Reflect.apply()` over `Function#apply()`."},languages:["js/js"]}},"unicorn/prefer-set-size":{create:e=>{e.on("MemberExpression",t=>{var r;if(!tc(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:td(r,{object:"Array",method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})?r.arguments[0]:void 0;if(n&&r6(n,e))return{node:t.property,messageId:iL,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);og(r,e)&&(s=`(${s})`),yield i.replaceText(o,s),"ArrayExpression"===o.type&&(yield o8(i,t,e))}}(e,t,n)}})},meta:{type:"suggestion",docs:{description:"Prefer using `Set#size` instead of `Array#length`.",recommended:"unopinionated"},fixable:"code",messages:{[iL]:"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(!td(e,{method:"join",argumentsLength:1,optionalCall:!1,optionalMember:!1})||!td(e.callee.object,{method:"split",argumentsLength:1,optionalCall:!1,optionalMember:!1})||t.sourceCode.getCommentsInside(e).length>0)return;let n=e.callee.object;if(nB(n.callee.object,t))return;let[o]=n.arguments,[a]=e.arguments,i=e3(o);if("string"==typeof i){if(0===i.length)return;r=tB(i)}else if(!(r=(e=>{if(!e6(e)||e.regex.flags.includes("y"))return;let t=iH(e);if(!t||iZ(t)||0===iQ(t))return;let{pattern:r,flags:n}=e.regex;return`/${r}/${n.includes("g")?n:`g${n}`}`})(o)))return;let s=e3(a);if("string"==typeof s)return`${eQ(n.callee.object,t)}.replaceAll(${r}, ${tB(s.replaceAll("$","$$$$"))})`})(t,e);if(o)return{node:t.callee.property,messageId:i_,fix:e=>e.replaceText(t,o)};if(!td(t,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1})||td(t,{method:"replace",argumentsLength:2,optionalCall:!1,optionalMember:!1})&&e6(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 Set,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||!iO.has(n))return;t.add(n)}return t})(r.regex.pattern)?.size>=8&&e1(n=t.arguments[1])&&n.value===iM)return;let{arguments:a,callee:{property:i}}=t;if(nB(t.callee.object,e))return;let[s]=a;if(!((e,t)=>{if(e6(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=ew(e,t);if(!r)return!1;let{value:n}=r;return"[object RegExp]"===Object.prototype.toString.call(n)&&n.global})(s,e.sourceCode.getScope(s)))return;let l=i.name,u=function(e){if(!e6(e))return;let t=iH(e);if(!t)return;let{flags:r}=e.regex;if(!function(e){if(!e.includes("g"))return!1;for(let t of e)if(iV.has(t))return!1;return!0}(r))return;let n="alternative"===t.type?iX(t.body):iJ(t);if(n)return"'"+n+"'"}(s);if("replaceAll"===l){if(!u)return;return{node:s,messageId:iW,data:{replacement:u.length<20?u:"a string literal"},fix:e=>e.replaceText(s,u)}}return{node:i,messageId:iq,*fix(e){yield e.insertTextAfter(i,"All"),u&&(yield e.replaceText(s,u))}}})},meta:{type:"suggestion",docs:{description:"Prefer `String#replaceAll()` over regex searches with the global flag and `String#split().join()`.",recommended:"unopinionated"},fixable:"code",messages:{[iq]:"Prefer `String#replaceAll()` over `String#replace()`.",[iW]:"This pattern can be replaced with {{replacement}}.",[i_]:"Prefer `String#replaceAll()` over `String#split().join()`."},languages:["js/js"]}},"unicorn/prefer-string-slice":{create:e=>{e.on("CallExpression",t=>{if(!td(t,{methods:["substr","substring"]})||nB(t.callee.object,e))return;let r=t.callee.property.name;if(!("substring"===r&&(e=>{if(!td(e,{method:"substring",argumentsLength:2}))return;let[t,r]=e.arguments;if(i0(t)&&i0(r)&&1===Math.abs(t.value-r.value))return t.value<r.value?t:r;let n=(e=>{if("BinaryExpression"===e.type&&"-"===e.operator&&e0(e.right,1))return e.left})(t);return i1(r,t)??(i1(t,r)?r:void 0)??(n&&t0(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=ew(a,s.getScope(e)),u=eY(i,r);if(l?.value===0){let n=((e,t,r)=>{let n,o,{sourceCode:a}=r;if(!("BinaryExpression"!==e.type||"-"!==e.operator||!(e8(n=e.right)&&Number.isSafeInteger(n.value)&&n.value>0)||!i3(e.left)||!("Identifier"===t.type||e1(t))||!t0(e.left.object,t)||(o=((e,t)=>{let[r,n]=eY(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 oQ(t,i,n,r));if(e8(i)||i3(i))return;let o=i2(i);return"number"==typeof o?void(yield oQ(t,i,String(Math.max(0,o)),r)):(yield t.insertTextBeforeRange(u,"Math.max(0, "),void(yield t.insertTextAfterRange(u,")")))}if(o.every(e=>e8(e))){let e;return void(yield(e=String(a.value+i.value),oQ(t,i,e,r)))}return n()}:function*({node:e,fixer:t,context:r,abort:n}){let[o,a]=e.arguments,i=o?i2(o):void 0;if(!a){if(i3(o))return;if(void 0!==i)return void(yield oQ(t,o,String(Math.max(0,i)),r));let e=eY(o,r);return yield t.insertTextBeforeRange(e,"Math.max(0, "),void(yield t.insertTextAfterRange(e,")"))}let s=i2(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 oQ(t,o,String(e[0]),r)),e[1]!==s&&(yield oQ(t,a,String(e[1]),r));return}if(0===i||0===s){let e=eQ(o,r),n=eQ(a,r);yield oQ(t,o,"0",r),yield oQ(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(!td(t,{methods:["trimLeft","trimRight"],argumentsLength:0,optionalCall:!1})||nB(t.callee.object,e))return;let r=t.callee.property,n=r.name,o="trimLeft"===n?"trimStart":"trimEnd";return{node:r,messageId:i8,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:{[i8]:"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||!eZ(t.callee.body,e))return;let{body:r}=t.callee,n={node:t,loc:oD(eY(r,e),e),messageId:i6};return!function(e,t){let{sourceCode:r}=t,[n,o]=eY(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:i9,fix:t=>t.replaceTextRange(eY(r,e),`{ return ${e.sourceCode.getText(r)}; }`)}]),n})},meta:{type:"suggestion",docs:{description:"Disallow unreadable IIFEs.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[i6]:"IIFE with parenthesized arrow function body is considered unreadable.",[i9]:"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||rh(r))&&("Identifier"===r.type&&i4.test(r.name)||"MemberExpression"===r.type&&!r.computed&&"Identifier"===r.property.type&&i4.test(r.property.name))&&!tc(r,{object:"Data",property:"TaggedError",computed:!1}))return{node:t,messageId:i5,fix:r=>o6(t,e,r)}})},meta:{type:"suggestion",docs:{description:"Require `new` when creating an error.",recommended:"unopinionated"},fixable:"code",messages:{[i5]:"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(e1(e))return sn({node:e,original:e.raw,lowercase:t})}),e.on("Literal",e=>{if(e6(e))return sn({node:e,original:e.raw,regex:sr,lowercase:t})}),e.on("TemplateElement",r=>{if(!tx(r.parent))return sn({node:r,original:r.value.raw,lowercase:t,fix:(t,n)=>ar(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:{[i7]:"Use uppercase characters for the value of the escape sequence.",[se]:"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=>e1(e)?sx(e,e.raw):e6(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:a,hasReplacement:i}=sh(n,{isRegex:!0,supportsNestedCharacterClasses:o.includes("v")}),s=o.includes("u")||o.includes("v"),l=function(e){for(let t=0;t<e.length;t++)if(void 0!==function(e,t){var r;if(!e.startsWith(si,t))return;let n=t+si.length;for(;r=e[n],ss.test(r);)n++;if(n===t+si.length||"}"!==e[n])return;let o=Number.parseInt(e.slice(t+si.length,n),16);if(!(o>1114111))return o}(e,t)&&sc(e,t))return!0;return!1}(n);if(!i&&(s||!l))return;let u=`/${i?a:n}/${sb(o)}`;return s?{node:e,messageId:so,fix:t=>t.replaceText(e,u)}:!function(e,t){try{return new RegExp(e,t),!0}catch{return!1}}(i?a:n,sb(o))?{node:e,messageId:so}:{node:e,messageId:so,suggest:[{messageId:sa,fix:t=>t.replaceText(e,u)}]}}(e):void 0),e.on("TemplateElement",t=>{if(!tx(t.parent))return sx(t,t.value.raw,(r,n)=>ar(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:{[so]:"Prefer Unicode code point escapes.",[sa]:"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 WeakMap;for(let{node:e,path:r}of new ez(t.getScope(n)).iterateGlobalReferences(Object.fromEntries(sE.map(e=>[e,{[ez.READ]:!0}]))))o.set(e,r);for(let t of r)yield function(e,{context:t,globalReferences:r}){let n;td(e,{object:"Reflect",method:"apply",minimumArguments:1,optionalCall:!1,optionalMember:!1})?n=e.arguments[0]:td(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(!tc(e,{optional:!1}))return;let n=e.object;if(to(n)||ta(n))return{constructorName:"ArrayExpression"===n.type?"Array":"Object",methodName:eI(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(tc(n)){let o=n.object;yield r.replaceText(o,`${a}.prototype`),("ArrayExpression"===o.type||"ObjectExpression"===o.type)&&(yield o8(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(!(tt(t,{names:sS,optional:!1})&&e.sourceCode.isGlobalReference(t.callee)))return;let r=t.callee.name,n=sA.has(r)?sA.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:sD,data:{constructorName:r}};if("ArrayExpression"===a.type||"ObjectExpression"===a.type)return{node:a,messageId:sC};let i=ew(a,e.sourceCode.getScope(a));if(!i)return;let{value:s}=i;return"string"!=typeof s?{node:a,messageId:sC}:""===s?{node:a,messageId:sv}:void 0})},meta:{type:"problem",docs:{description:"Enforce passing a `message` value when creating a built-in error.",recommended:"unopinionated"},messages:{[sD]:"Pass a message to the `{{constructorName}}` constructor.",[sv]:"Error message should not be an empty string.",[sC]:"Error message should be a string."},languages:["js/js"]}},"unicorn/no-instanceof-builtins":sP,"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&&sW(t.test)))return;let r=e.argument.callee;return{node:r,messageId:sL,fix:e=>e.insertTextBefore(r,"Type")}})},meta:{type:"suggestion",docs:{description:"Enforce throwing `TypeError` in type checking conditions.",recommended:"unopinionated"},fixable:"code",messages:{[sL]:"`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 Map,n=[],o=[],a=e=>{let r=ry(e.object);if(e.computed||"Identifier"!==e.property.type||!["Identifier","ThisExpression"].includes(r.type))return;let n=t.getScope(e);o.push({propertyName:e.property.name,rootIdentifierName:"Identifier"===r.type?r.name:void 0,rootVariable:"Identifier"===r.type?ei(n,r):void 0,thisScopeBoundary:"ThisExpression"===r.type?sK(r):void 0,start:t.getRange(e)[0],scope:n})},i=e=>{switch(e.type){case"MemberExpression":a(e);break;case"AssignmentPattern":i(e.left);break;case"RestElement":i(e.argument);break;case"ObjectPattern":for(let t of e.properties)i("Property"===t.type?t.value:t.argument);break;case"ArrayPattern":for(let t of e.elements)t&&i(t)}};e.on("AssignmentExpression",e=>{i(e.left)}),e.on(["ForInStatement","ForOfStatement"],e=>{"VariableDeclaration"!==e.left.type&&i(e.left)}),e.on("UpdateExpression",e=>{"MemberExpression"===e.argument.type&&a(e.argument)}),e.on("UnaryExpression",e=>{"delete"===e.operator&&"MemberExpression"===e.argument.type&&a(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&&ei(t.getScope(e),o),thisScopeBoundary:"ThisExpression"===e.init.type?sK(e.init):void 0,objectPattern:e.id},i=t.getText(e.init);r.set(i,[...r.get(i)??[],a])});let s=e=>{let n;if(e.computed||tt(e.parent)&&e.parent.callee===e||"TaggedTemplateExpression"===e.parent.type&&e.parent.tag===e||nr(e))return;let a=ry(e.object),i=r.get(t.getText(a));if(!i)return;let s=t.getScope(e),l="Identifier"===a.type?a:void 0,u=l&&ei(s,l),p="ThisExpression"===a.type?sK(a):void 0,c=t.getText(e.property);for(let r of i.toReversed())if(sX({declaration:r,memberExpressionNode:e,memberScope:s,memberRootIdentifier:l,memberRootVariable:u,memberThisScopeBoundary:p,memberExpressionWrites:o,sourceCode:t})&&(n=sJ(r.objectPattern.properties.filter(e=>sG(e)&&"Identifier"===e.value.type),c,s,t)))break;if(!n||((e,t)=>{let r=e,{parent:n}=e;for(;n&&!sQ(n);){if(sY(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:s_};let d=t.getText(e),m=n.value.name;return{node:e,messageId:s_,suggest:[{messageId:sV,data:{expression:d,property:m},fix:t=>t.replaceText(e,m)}]}};e.on("MemberExpression",e=>{n.push(e)}),e.onExit("Program",function*(){for(let e of n){let t=s(e);t&&(yield t)}})},meta:{type:"suggestion",docs:{description:"Use destructured variables over properties.",recommended:!1},hasSuggestions:!0,messages:{[s_]:"Use destructured variables over properties.",[sV]:"Replace `{{expression}}` with destructured property `{{property}}`."},languages:["js/js"]}},"unicorn/new-for-builtins":{create:e=>{s8.listen({context:e}),s6.listen({context:e}),s9.listen({context:e}),s5.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.",[s1]:"Use `String(new Date())` instead of `Date()`.",[s2]:"Switch to `String(new Date())`."},languages:["js/js"]}},"unicorn/prefer-single-call":ln,"unicorn/no-process-exit":{create:e=>{if(0===e.sourceCode.lines[0].indexOf("#!"))return;let t=0,r=!1,n=[],o=e=>td(e,{object:"process",methods:["on","once"],minimumArguments:1,optionalCall:!1,optionalMember:!1});e.on("CallExpression",e=>{tg(e)&&la(e.arguments[0])&&(r=!0)}),e.on("ImportDeclaration",e=>{"Literal"===e.source.type&&la(e.source)&&(r=!0)}),e.on("CallExpression",e=>{o(e)&&t++}),e.onExit("CallExpression",e=>{o(e)&&t--}),e.on("CallExpression",e=>{0===t&&td(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:lo}})},meta:{type:"suggestion",docs:{description:"Disallow `process.exit()`.",recommended:"unopinionated"},messages:{[lo]:"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!(!lg(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:lm,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(lg(e)&&(e.typeAnnotation||e.value&&p.getText(e.value).includes("this")))return;return function*(n){let a=p.getFirstToken(e);if(tk(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 o1(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);tk(o,{expected:{type:"Keyword",value:"static"},ruleId:"no-static-only-class"}),yield r.remove(o),yield o1(o,t,r);let a=lg(e)?n.getLastToken(e):n.getTokenAfter(e),i=ep(a);if(lg(e)){let{key:t,value:o}=e;if(o){let e=n.getTokenAfter(t,lf);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:{[lm]:"Use an object instead of a class with only static members."},languages:["js/js"]}},"unicorn/no-unreadable-array-destructuring":lx,"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)||tt(r.parent.parent)&&r.parent.parent.arguments.includes(r.parent)))))return;let n=r.parent,o=t.getFirstToken(n),a=n.parent.type,i={node:o,messageId:lb,data:{argumentType:"ArrayExpression"===r.type?"array":"object",parentDescription:lF[a]}};return"NewExpression"===a&&lj(r)&&te(n.parent,{names:lw,argumentsLength:1,allowSpreadElement:!0})?i:{...i,*fix(i){let s;yield i.remove(o),yield oX(r,i,e);let l=t.getFirstToken(r);yield i.remove(l);let[u,p]=t.getLastTokens(r,2);if(yield i.remove(p),eu(u)&&(yield i.remove(u)),to(r)||ta(r)){let e=t.getTokenAfter(n);eu(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 eu(e)?e:void 0}let a=t.getTokenAfter(e||s,eu);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(!td(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:lC};return t.getCommentsInside(r).length>0?i:{...i,suggest:[{messageId:lT,fix:t=>t.replaceText(r,r.properties.map(t=>eQ(t.argument,e)).join(", "))}]}}),e.on("NewExpression",e=>{if(te(e,{names:lw,argumentsLength:1,allowSpreadElement:!0})&&"SpreadElement"===e.arguments[0].type&&"ArrayExpression"!==e.arguments[0].argument.type)return{node:e.arguments[0],messageId:lv,data:{constructorName:`new ${e.callee.name}(…)`}}}),e.on("ArrayExpression",t=>{if(!lj(t))return;let{parent:r}=t;if(!("ForOfStatement"===r.type&&r.right===t||"YieldExpression"===r.type&&r.delegate&&r.argument===t||(te(r,{names:lw,argumentsLength:1})||te(r,{names:rE,minimumArguments:1})||td(r,{object:"Promise",methods:["all","allSettled","any","race"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||td(r,{objects:["Array",...rE],method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})||td(r,{object:"Object",method:"fromEntries",argumentsLength:1,optionalCall:!1,optionalMember:!1}))&&r.arguments[0]===t))return;let n="",o=lE;switch(r.type){case"ForOfStatement":o=lS;break;case"YieldExpression":o=lD;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=>lB(r,t,e)}}),e.on("ArrayExpression",t=>{if(!lj(t))return;let r=t.elements[0].argument,n=!!td(r,{methods:lI,optionalCall:!1,optionalMember:!1})&&rY(r.callee.object,e)&&rY(r,e);if(!n&&!(!rQ(r,e)&&(td(r,{methods:lk,optionalCall:!1,optionalMember:!1})?!lR(r,e):td(r,{method:"concat",optionalCall:!1,optionalMember:!1})?!("Identifier"===r.callee.object.type&&"Iterator"===r.callee.object.name||lR(r,e)):td(r,{method:"split",optionalCall:!1,optionalMember:!1})||td(r,{object:"Object",methods:["keys","values"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||"AwaitExpression"===r.type&&td(r.argument,{object:"Promise",methods:["all","allSettled"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||td(r,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1})||te(r,{name:"Array"}))))return;let o={node:t,messageId:lA};return te(r,{name:"Array"})||td(r,{method:"slice",optionalCall:!1,optionalMember:!1})&&!n?o:Object.assign(o,{fix:r=>lB(r,t,e)})})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary spread.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[lb]:"Spread an {{argumentType}} literal in {{parentDescription}} is unnecessary.",[lE]:"`{{parentDescription}}` accepts an iterable as an argument, it's unnecessary to convert to an array.",[lS]:"`for…of` can iterate over an iterable, it's unnecessary to convert to an array.",[lD]:"`yield*` can delegate to an iterable, it's unnecessary to convert to an array.",[lv]:"`{{constructorName}}` accepts a single iterable argument, spreading is misleading.",[lC]:"`Object.assign(…)` source object with only spread properties is unnecessary.",[lA]:"Unnecessarily cloning an array.",[lT]:"Remove the object literal wrapper."},languages:["js/js"]}},"unicorn/no-useless-switch-case":{create:e=>{let t=ru(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(!l$(o))break;t&&lN(o)||(yield{node:o,loc:function(e,t){let{sourceCode:r}=t,n=e.test||r.getFirstToken(e),o=r.getTokenAfter(n,ec);return{start:r.getLoc(e).start,end:r.getLoc(o).end}}(o,e),messageId:lP,suggest:[{messageId:lL,fix:e=>e.remove(o)}]})}})},meta:{type:"suggestion",docs:{description:"Disallow useless case in switch statements.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[lP]:"Useless case in switch statement.",[lL]:"Remove this case."},languages:["js/js"]}},"unicorn/no-useless-undefined":l3,"unicorn/numeric-separators-style":l5,"unicorn/prefer-array-find":ux,"unicorn/prefer-array-flat-map":{create:e=>{e.on("CallExpression",t=>{if(!(td(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)&&td(t.callee.object,{method:"map",optionalCall:!1})))return;let r=t.callee.object;if(th(r.callee.object,uD)||r0(r.callee.object,e))return;let{sourceCode:n}=e,o=r.callee.property,a=t7(e,t,[r])||t.typeArguments||t.typeParameters||r.typeArguments||r.typeParameters?void 0:function*(r){yield o4(r,t,e),yield r.replaceText(o,"flatMap")};return{node:t,loc:{start:n.getLoc(o).start,end:n.getLoc(t).end},messageId:ub,fix:a}}),e.on("CallExpression",t=>{if(!td(t,{method:"flatMap",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||t.typeArguments||t.typeParameters)return;let r=t.callee.object;if(!td(r,{method:"filter",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||r.typeArguments||r.typeParameters||rh(r.callee.object)||rQ(r.callee.object,e))return;let{sourceCode:n}=e;if(n.getCommentsInside(t).length>0)return;let[o]=r.arguments,[a]=t.arguments;if(!uC(o)||!uC(a))return;let[i]=o.params,[s]=a.params;if(!nW(i,s))return;let l=function(e,t){if(eZ(e,t))return eQ(e,t);let r=t.sourceCode.getText(e);return og(e,t)?`(${r})`:r}(r.callee.object,e),u=n.getText(i),p=function(e,t){if(eZ(e,t))return eQ(e,t);let r=t.sourceCode.getText(e);return uv.has(e.type)?`(${r})`:r}(o.body,e),c=function(e,t){if(eZ(e,t))return eQ(e,t);let r=t.sourceCode.getText(e);return od(e)?`(${r})`:r}(a.body,e);return{node:t.callee.property,messageId:uE,suggest:[{messageId:uS,fix:e=>e.replaceText(t,`${l}.flatMap(${u} => ${p} ? ${c} : [])`)}]}})},meta:{type:"suggestion",docs:{description:"Prefer `.flatMap(…)` over `.map(…).flat()` and `.filter(…).flatMap(…)`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[ub]:"Prefer `.flatMap(…)` over `.map(…).flat()`.",[uE]:"Prefer a single `.flatMap(…)` over `.filter(…).flatMap(…)`.",[uS]:"Replace `.filter(…).flatMap(…)` with a single `.flatMap(…)`."},languages:["js/js"]}},"unicorn/prefer-array-flat":uR,"unicorn/prefer-array-some":uN,"unicorn/prefer-code-point":{create:e=>{e.on("CallExpression",e=>{if(td(e,{method:"charCodeAt",optionalCall:!1}))return uM(e.callee.property,"codePointAt",!(e=>{let t=(e=>{let t=e;for(;;){let{parent:e}=t;if("ChainExpression"===e.type||"LogicalExpression"===e.type||"ConditionalExpression"===e.type&&(e.consequent===t||e.alternate===t)){t=e;continue}return t}})(e),{parent:r}=t;switch(r.type){case"BinaryExpression":return uO.has(r.operator);case"UnaryExpression":return uU.has(r.operator);case"AssignmentExpression":return r.right===t&&uO.has(r.operator.slice(0,-1));default:return!1}})(e))}),e.on("MemberExpression",e=>{if(tc(e,{object:"String",property:"fromCharCode",optional:!1}))return uM(e.property,"fromCodePoint")})},meta:{type:"suggestion",docs:{description:"Prefer `String#codePointAt(…)` over `String#charCodeAt(…)` and `String.fromCodePoint(…)` over `String.fromCharCode(…)`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{"error/charCodeAt":"Prefer `String#codePointAt()` over `String#charCodeAt()`.","error/fromCharCode":"Prefer `String.fromCodePoint()` over `String.fromCharCode()`.","suggestion/codePointAt":"Use `String#codePointAt()`.","suggestion/fromCodePoint":"Use `String.fromCodePoint()`."},languages:["js/js"]}},"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=ei(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(uV(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:uq,suggest:[{messageId:uW,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(ts,e=>{r.push(e)}),e.onExit(ts,()=>{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:{[uq]:"Prefer default parameters over reassignment.",[uW]:"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=u0(e);if(r?.kind==="nullish")return r;if("LogicalExpression"!==e.type)return;let n=u0(e.left),o=u0(e.right);if(n&&o&&uY(n.reference,o.reference,t)){if("||"===e.operator&&n.isTrueWhenNullish&&o.isTrueWhenNullish&&u1(n,o))return{reference:n.reference,isTrueWhenNullish:!0};if("&&"===e.operator&&!n.isTrueWhenNullish&&!o.isTrueWhenNullish&&u1(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&&uY(i,o,t.sourceCode))return uQ({context:t,conditionalExpression:e,left:o,right:n,operators:["??"]});if(!a.isTrueWhenNullish&&uY(i,n,t.sourceCode))return uQ({context:t,conditionalExpression:e,left:n,right:o,operators:["??"]});let s=a.isTrueWhenNullish?n:o,l=a.isTrueWhenNullish?o:n;if(!tb(s)||!tc(l)||l.optional||!t0(ry(i),ry(l.object))||function(e){let t=e,{parent:r}=t;for(;rg(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=ri(e,t);if(rt(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:uK,suggest:[{messageId:uJ,fix(r){let n=u;return nQ(t.sourceCode.getTokenBefore(e),t,n)&&(n=`;${n}`),r.replaceText(e,n)}}]}}(r,e);return i||(uY(n,o,t)?uQ({context:e,conditionalExpression:r,left:n,right:a}):"UnaryExpression"===n.type&&"!"===n.operator&&n.prefix&&uY(n.argument,a,t)?uQ({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:{[uz]:"Prefer using a logical operator over a ternary.",[uK]:"Prefer using optional chaining over a ternary.",[uG]:"Switch to `{{operator}}` operator.",[uJ]:"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?u2:u3,data:{name:a},fix:s?void 0:function*(e){let t=n.getTokenBefore(r);tk(t,{test:ed,expected:"(",ruleId:"prefer-optional-catch-binding"});let o=n.getTokenAfter(r);tk(o,{test:em,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:{[u2]:"Remove unused catch binding `{{name}}`.",[u3]:"Remove unused catch binding."},languages:["js/js"]}},"unicorn/prefer-regexp-test":pv,"unicorn/prefer-set-has":pM,"unicorn/prefer-string-raw":{create:e=>{e.on("Literal",t=>{if(!e1(t)||function(e){let{parent:t}=e,{type:r}=t;return tr(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)||pO(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=pW(n.slice(1,-1),n.charAt(0));if(o===t.value)return{node:t,messageId:pU,*fix(r){yield o8(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)||pW(t)!==e)||pO(t)))return{node:t,messageId:pU,*fix(r){for(let n of(yield o8(r,t,e),yield r.insertTextBefore(t,"String.raw"),t.quasis)){let{cooked:t,raw:o}=n.value;t!==o&&(yield ar(n,t,e,r))}}}}),e.on("TaggedTemplateExpression",t=>{let{quasi:r,tag:n,parent:o}=t,{sourceCode:a}=e;if(!tc(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:pq,*fix(r){let n=a.getTokenBefore(t);nQ(n,e,s)&&(yield r.insertTextBefore(t,";")),"ReturnStatement"!==o.type&&"ThrowStatement"!==o.type||nU(n,t.quasi,e)||eZ(t,e)||(yield o0(r,o,e)),"YieldExpression"!==o.type||o.delegate||o.argument!==t||nU(n,t.quasi,e)||eZ(t,e)||(yield r.insertTextBefore(t,"("),yield r.insertTextAfter(t,")")),yield r.replaceText(t.quasi,s),yield oX(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:{[pU]:"`String.raw` should be used to avoid escaping `\\`.",[pq]:"Using `String.raw` is unnecessary as the string does not contain any `\\`."},languages:["js/js"]}},"unicorn/prefer-switch":pX,"unicorn/require-number-to-fixed-digits-argument":{create:e=>{e.on("CallExpression",t=>{if(!td(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:pH,fix:r=>oH(r,t,"0",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the digits argument with `Number#toFixed()`.",recommended:"unopinionated"},fixable:"code",messages:{[pH]:"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 Set,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 WeakSet,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 p1(p3(e.lines,t)).indent||p1(pY(r=p3(n.split(/\r?\n/)))).indent||p1(r).indent||" "}return r.startsWith(" ")?" ":" "})(t,n,m,l);let f=pY(l).replaceAll(RegExp(`^${p}|${p}[ ]*$`,"g"),""),g=p+function(e,t=1,r={}){let{indent:n=" ",includeEmptyLines:o=!1}=r;if("string"!=typeof e)throw TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if("number"!=typeof t)throw TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(t<0)throw RangeError(`Expected \`count\` to be at least 0, got \`${t}\``);if("string"!=typeof n)throw TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof n}\``);return 0===t?e:e.replace(o?/^/gm:/^(?!\s*$)/gm,n.repeat(t))}(f,1,{indent:m+i})+p+m;if(g!==l)return{node:a,messageId:p2,fix:t=>g.split(s).map((r,n)=>ar(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!!(pO(e)||r.tags.length>0&&tx(e,r.tags))||!!(r.functions.length>0&&"CallExpression"===e.parent.type&&e.parent.arguments.includes(e)&&th(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:p8,defaultOptions:[{tags:["outdent","dedent","gql","sql","html","styled"],functions:["dedent","stripIndent"],selectors:[],comments:["HTML","indent"]}],messages:{[p2]:"Templates should be properly indented."},languages:["js/js"]}},"unicorn/no-single-promise-in-promise-methods":{create:e=>{e.on("CallExpression",t=>{if(!(td(t,{object:"Promise",methods:lu,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:li,data:{method:r}},{sourceCode:o}=e;if("AwaitExpression"===t.parent.type&&t.parent.argument===t&&("all"!==r||ti(t.parent.parent)))return n.fix=r=>r.replaceText(t,lp(t,e)),n;return"all"===r?(n.fix=((e,t)=>{let{sourceCode:r}=t;if(lc(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&&ld(t.id)?t.id:"AssignmentExpression"===t.type&&t.right===e&&ld(t.left)&&ti(t.parent)?t.left:void 0})(n);if(o){if(lc(r,o))return;return function*(n){yield n.replaceText(o,r.getText(o.elements[0])),yield n.replaceText(e,lp(e,t))}}let a=n.parent;if("MemberExpression"===a.type&&a.computed&&e0(a.property,0)&&a.object===n&&("VariableDeclarator"===a.parent.type&&a.parent.init===a||"AssignmentExpression"===a.parent.type&&a.parent.right===a)&&!lc(r,a))return r=>r.replaceText(a,`await ${lp(e,t)}`)})(t,e),n):(n.suggest=[{messageId:ls,fix:r=>{let[n]=t.arguments[0].elements,o=eQ(n,e);return eZ(n,e)||"Identifier"===n.type||"MemberExpression"===n.type||(o=`(${o})`),nQ(e.sourceCode.getTokenBefore(t),e,o)&&(o=`;${o}`),r.replaceText(t,o)}},{messageId:ll,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),eu(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:{[li]:"Wrapping single-element array with `Promise.{{method}}()` is unnecessary.",[ls]:"Use the value directly.",[ll]:"Switch to `Promise.resolve(…)`."},languages:["js/js"]}},"unicorn/no-await-in-promise-methods":{create:e=>{e.on("CallExpression",function*(t){if(td(t,{object:"Promise",methods:p5,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:p6,data:{method:t.callee.property.name},suggest:[{messageId:p9,*fix(t){let n=e.sourceCode.getFirstToken(r);yield t.remove(n),yield o1(n,e,t)}}]})})},meta:{type:"suggestion",docs:{description:"Disallow using `await` in `Promise` method parameters.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[p6]:"Promise in `Promise.{{method}}()` should not be awaited.",[p9]:"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&&ce.has(t.operator)&&ct(n)&&!ct(n.argument)))return;let{sourceCode:o}=e,a=o.getFirstToken(n),i=`${r.startsWith("!")?"=":"!"}${r.slice(1)}`;return{node:a,messageId:p4,suggest:[{messageId:p7,data:{operator:i},*fix(s){yield o8(s,t,e);let l=o.getTokenAfter(a),{parent:u}=t;("ReturnStatement"===u.type||"ThrowStatement"===u.type)&&!eZ(t,e)&&(nU(o.getFirstToken(u),l,e)||(yield o0(s,u,e))),yield s.remove(a),nQ(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:{[p4]:"Negated expression is not allowed in equality check.",[p7]:"Switch to '{{operator}}' check."},languages:["js/js"]}},"unicorn/no-unnecessary-slice-end":{create(e){cr(e,{methods:["slice"],messageId:cn})},meta:{type:"suggestion",docs:{description:"Disallow using `.length` or `Infinity` as the `end` argument of `{Array,String,TypedArray}#slice()`.",recommended:"unopinionated"},fixable:"code",messages:{[cn]:"Passing `{{description}}` as the `end` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-lonely-if":{create:e=>{e.on("IfStatement",t=>{if(cI(t)&&("BlockStatement"===t.parent.type&&1===t.parent.body.length&&t.parent.body[0]===t&&cI(t.parent.parent)&&t.parent.parent.consequent===t.parent||cI(t.parent)&&t.parent.consequent===t))return{node:t,messageId:ck,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,...cj(i,r)},l={...e,...cj(e,r)},u=cP(s,r),p=cL(s,t,r),c=cR(cB(cP(l,r)),cL(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(ey(a)){let t=n.getTokenAfter(e);t&&nQ(a,r,t.value)&&(o[1]=n.getRange(t)[0])}return o}(i,l.consequent,t,r),m={outerConditionGap:s.openingBraceToken?cB(cF(s.closingParenthesisToken,s.openingBraceToken,r)):"",outerLeadingContent:s.openingBraceToken?cB(cF(s.openingBraceToken,l.ifToken,r)):cB(cF(s.closingParenthesisToken,l.ifToken,r)),outerTrailingContent:s.openingBraceToken?cB(cF(l,s.closingBraceToken,r)):""},f=(o=m.outerConditionGap,a=m.outerLeadingContent,o.trimStart().startsWith("//")?{leadingStatementText:cB(a).trimStart(),conditionSuffixText:o}:{leadingStatementText:cB(cR(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=cF(t.closingParenthesisToken,t.openingBraceToken,n),r=cF(t.openingBraceToken,t.closingBraceToken,n);return`${s}${e}{${r}${i}}`}let l=cF(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:{[ck]:"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(!td(t,{method:"flat",argumentsLength:1,optionalCall:!1}))return;let[r]=t.arguments;if(!e8(r)||1===r.value)return;let{sourceCode:n}=e,{openingParenthesisToken:o,closingParenthesisToken:a}=tH(t,e);if(!n.commentsExistBetween(o,a))return{node:r,messageId:c$}})},meta:{type:"suggestion",docs:{description:"Disallow a magic number as the `depth` argument in `Array#flat(…).`",recommended:"unopinionated"},messages:{[c$]:"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:cN,*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 oX(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=eY(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 o8(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||nU(i,s,e)||eZ(t,e)||eZ(r,e)?nQ(o.getTokenBefore(t),e,s.value)&&(yield n.insertTextBefore(t,";")):yield o0(n,a,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow negated conditions.",recommended:"unopinionated"},fixable:"code",messages:{[cN]:"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&&tl(e.parent)&&e.parent.params.includes(e)))return;let{left:t,right:r}=e;return"Identifier"===t.type?{node:t,messageId:cM,data:{parameter:t.name}}:{node:r,messageId:cO}})},meta:{type:"problem",docs:{description:"Disallow the use of objects as default parameters.",recommended:"unopinionated"},messages:{[cM]:"Do not use an object literal as default for parameter `{{parameter}}`.",[cO]:"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(cq.has(n))return{method:n,target:o,argumentsNodes:a};if("call"!==n&&"apply"!==n||(n=cW(t.object),!cq.has(n)))return;let i="apply"===t.property.name,{supportObjects:s}=cq.get(n),l=t.object.object;if(to(l)||"slice"===n&&e0(l,"")||"prototype"===cW(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}=cq.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=ry(t);if("BinaryExpression"!==o||"-"!==a||!(e8(n=ry(s))&&n.value>0))return;let l=ry(i);return"MemberExpression"===l.type&&!l.computed&&!l.optional&&"Identifier"===l.property.type&&"length"===l.property.name&&lq(l.object,r)?i:e(i,r)})(a[e],o)).filter(Boolean);if(0!==s.length)return{node:t,messageId:cU,data:{method:n},*fix(t){for(let r of s)yield function(e,t,r){let[n,o]=eY(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:{[cU]:"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||(td(t.parent,{object:"process",method:"getBuiltinModule",argumentsLength:1,optionalCall:!1,optionalMember:!1})||tg(t.parent))&&t.parent.arguments[0]===t))return;let{value:r}=t;if(!("string"==typeof r&&!r.startsWith(cK)&&cV(r)&&cV(`${cK}${r}`)))return;let n=e.sourceCode.getRange(t)[0]+1;return{node:t,messageId:cz,data:{moduleName:r},fix:e=>e.insertTextAfterRange([n,n],cK)}})},meta:{type:"suggestion",docs:{description:"Prefer using the `node:` protocol when importing Node.js builtin modules.",recommended:"unopinionated"},fixable:"code",messages:{[cz]:"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(!td(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:cG,fix:t=>o4(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Prefer passing `Date` directly to the constructor when cloning.",recommended:"unopinionated"},fixable:"code",messages:{[cG]:"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)&&cX(n.key)&&("get"===n.kind&&(cY(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&&cH(e.key,n.key)))||"set"===n.kind&&((e,t)=>{if(!cY(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:cJ,data:{kind:n.kind}}})},meta:{type:"problem",docs:{description:"Disallow recursive access to `this` within getters and setters.",recommended:"unopinionated"},defaultOptions:[],messages:{[cJ]:"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(!tc(r,{properties:["url","filename"],computed:!1,optional:!1}))return;let n=r.property.name;if("url"===n){if(c1(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&&c1(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&&c1(n,t)&&n.arguments[0]===e&&(yield i(n,"dirname"))}return}function*a(e,{reportFilenameNode:r=!1}={}){let{parent:n}=e;if(c2(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=ei(t.getScope(n.id),n.id);if(o)for(let e of o.references){if(!e.isReadOnly())continue;let{parent:r}=e.identifier;c2(r,t)&&r.arguments[0]===e.identifier&&(yield i(r,"dirname"))}}function i(e,t){return{node:e,messageId:"dirname"===t?cQ:cZ,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:{[cQ]:"Do not construct dirname.",[cZ]:"Do not construct filename using `fileURLToPath()`."},languages:["js/js"]}},"unicorn/no-unnecessary-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!(td(t,{method:"flat",argumentsLength:1,optionalCall:!1})&&e0(t.arguments[0],1)))return;let[r]=t.arguments;return{node:r,messageId:c3,fix:t=>oY(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Disallow using `1` as the `depth` argument of `Array#flat()`.",recommended:"unopinionated"},fixable:"code",messages:{[c3]:"Passing `1` as the `depth` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-unnecessary-array-splice-count":{create(e){cr(e,{methods:["splice","toSpliced"],messageId:c8})},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:{[c8]:"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&&sS.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))&&td(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||tc(e,{property:"constructor",computed:!1,optional:!1})&&"ThisExpression"===e.object.type)return!0;if("Identifier"!==e.type||!t.id)return!1;let n=ei(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:c6},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:{[c6]:"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:c9};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 ep(r)?void(yield s.insertTextBefore(r,e)):void(yield s.insertTextAfter(l,`${e};`))}let u=t.getLastToken(r),p=t6(n,e),c=`${p}${a} = ${i};
|
|
22
|
+
${s}${c}${n}`)}for(let e of t)yield l.removeRange(Sf(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(Sc(r.test,t))return!1;return!0}(e,s)&&u.every(e=>"ExpressionStatement"===e.type&&!Sc(e,s))?c.fix=i:c.suggest=[{messageId:Su,fix:i}]}return c}let{parse:Sy}=iN,Sh="prefer-single-replace",Sx=new Set(["g","m","s"]),Sb=new Map([["\\",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 SE(e){if(!td(e,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1,optionalMember:!1,computed:!1}))return;let[t]=e.arguments;if(e1(t)){if("replaceAll"!==e.callee.property.name)return;return 1===t.value.length?t.value:void 0}if(e6(t))return function({pattern:e,flags:t}){let r;if(t.includes("g")){for(let e of t)if(!Sx.has(e))return;try{r=Sy(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 SS="consistent-tuple-labels",SD="no-invalid-well-known-symbol-methods/async-dispose",Sv="no-invalid-well-known-symbol-methods/dispose-generator",SC="no-invalid-well-known-symbol-methods/sync-iterator",SA="no-invalid-well-known-symbol-methods/async-iterator",ST="no-invalid-well-known-symbol-methods/suggestion",Sw=new Set(["Promise","PromiseLike"]),Sk=new Set(["dispose","iterator","asyncIterator"]);function SI(e){return"TSTypeReference"===e.type&&"Identifier"===e.typeName.type&&Sw.has(e.typeName.name)}function Sj(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(!Sk.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:Sv};let a=!o.async&&(!!(r=o.returnType?.typeAnnotation)&&("TSTypeReference"===r.type?SI(r):"TSUnionType"===r.type&&r.types.some(e=>SI(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===nq(t.getReturnTypeOfSignature(o),t);return r.getTypeAtLocation(e).getCallSignatures().some(e=>!0===nq(t.getReturnTypeOfSignature(e),t))}catch{return!1}}(o,t));if("dispose"===n&&(o.async||a))return{node:e.key,messageId:SD,fix:t=>t.replaceText(e.key.property,"asyncDispose")};if("iterator"===n&&(o.async||a)){let t={node:e.key,messageId:SC};return o.generator&&(t.suggest=[{messageId:ST,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:SA}}let SF="after-suspension",SB="in-generator",SR="in-nested-function",SP=["preventDefault","stopImmediatePropagation","stopPropagation"],SL="prefer-abort-signal-timeout",S$="prefer-abort-signal-timeout/suggestion",SN=0x80000000-1,SM=new Set(["reason","throwIfAborted"]),SO=(e,t)=>{let r,{parent:n}=e;if(!(!tc(n,{property:"signal",computed:!1,optional:!1})||n.object!==e||nr(n)||("ForInStatement"===n.parent.type||"ForOfStatement"===n.parent.type)&&n.parent.left===n||tc(n.parent)&&n.parent.object===n&&(r=n.parent,SM.has(eI(r,t.sourceCode.getScope(r))))||(e=>{let{expression:t,parent:r}=(e=>{let t=e,{parent:r}=e;for(;rg(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)||rt(t,t.sourceCode.getRange(n))))return n},SU=(e,t,r,n)=>{let o=ei(n.sourceCode.getScope(r),e);return o&&o!==t},Sq="prefer-aggregate-error",SW=/[Ee]rrors$|[Ee]rror(?:List|Array|Collection)$/u,S_=new Set(sS);function SV(e){for(;e?.type==="ParenthesizedExpression";)e=e.expression;return ry(e)}function Sz(e){if("Identifier"===e.type)return e.name;if("TSQualifiedName"===e.type){let t=Sz(e.left);return t?`${t}.${e.right.name}`:void 0}}function SK(e){return e=e?.type==="TSTypeAnnotation"?e.typeAnnotation:e,e?.type==="TSTypeOperator"&&"readonly"===e.operator&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType"?SK(e.typeAnnotation):e}function SG(e,t,r,n=new Set){switch(e=SK(e),e?.type){case"TSTypeReference":{let o=Sz(e.typeName);if(!o)return!1;let a=n1(o,t);if(S_.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&&SG(i.node.typeAnnotation,s,r,n);return n.delete(o),l}case"TSUnionType":return e.types.every(e=>SG(e,t,r,n));case"TSIntersectionType":return e.types.some(e=>SG(e,t,r,n));default:return!1}}function SJ(e,t){let r;if(tc(e=SV(e),{property:"length",optional:!1})&&"Identifier"===e.object.type&&(r=e.object.name,SW.test(r))&&rY(e.object,t)&&function(e,t){let r=n1(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 Set){switch(t=SK(t),t?.type){case"TSArrayType":return SG(t.elementType,r,n,o);case"TSTupleType":return t.elementTypes.length>0&&t.elementTypes.every(e=>SG("TSNamedTupleMember"===e.type?e.elementType:"TSRestType"===e.type?e.typeAnnotation:e,r,n,o));case"TSTypeReference":return function(t,r,n,o){let a=Sz(t.typeName),i=t.typeArguments?.params??t.typeParameters?.params;if(("Array"===a||"ReadonlyArray"===a)&&i?.length===1)return SG(i[0],r,n,o);if(!a||o.has(a))return!1;o.add(a);let s=n1(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 Set){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 i=r.getTypeArguments(t);return i.length>0&&i.every(e=>(function e(t,r,n,o=new Set){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 i=rv(t);return!!(S_.has(i?.getName())&&rC(i,n))||rA(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 SX=(e,t,r)=>{var n;if(("!=="===e||"!="===e)&&e0(SV(t),0))return!0;let o=(n=SV(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)},SH=e=>"LogicalExpression"!==(e=SV(e)).type||"&&"!==e.operator?[e]:[...SH(e.left),...SH(e.right)],SY={resize:"Prefer ResizeObserver over a resize listener with layout reads.",scroll:"Prefer IntersectionObserver over a scroll listener with layout reads."},SQ=new Set(Object.keys(SY)),SZ=new Set(["globalThis","self","window"]),S0=new Set(["getBoundingClientRect","getClientRects"]),S1=new Set(["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetParent","offsetTop","offsetWidth","scrollHeight","scrollWidth"]),S2=new Set(["innerHeight","innerWidth"]),S3=new Set(["height","width"]),S8=new Set(["Window"]),S6=new Set(["VisualViewport"]),S9=new Set(["Document","Element","HTMLElement","Node","SVGElement","VisualViewport","Window"]),S5=(e,t,r)=>{let n;if(rS.has(e.intrinsicName))return!1;if(rD.has(e.intrinsicName)||e.intrinsicName)return!0;if(e.isUnion()||e.isIntersection())return e.types.every(e=>S5(e,t,r));let o=t.getBaseConstraintOfType(e);if(o&&o!==e)return S5(o,t,r);let a=rv(e);return!(!a||rA(e,t).some(e=>!S5(e,t,r)))&&(!rC(a,r)||(n=a.getName(),!(S9.has(n)||/^HTML\w*Element$/.test(n)||/^SVG\w*Element$/.test(n))))},S4=(e,t,r,n)=>{if(rS.has(e.intrinsicName)||rD.has(e.intrinsicName))return!1;if(e.isUnion()){let o=e.types.filter(e=>!rD.has(e.intrinsicName));return o.length>0&&o.every(e=>S4(e,t,r,n))}if(e.isIntersection())return e.types.some(e=>S4(e,t,r,n));let o=t.getBaseConstraintOfType(e);if(o&&o!==e)return S4(o,t,r,n);let a=rv(e);return!!(a&&rC(a,r)&&n.has(a.getName()))||rA(e,t).some(e=>S4(e,t,r,n))},S7=(e,t,r)=>{let{parserServices:n}=t.sourceCode;if(!n?.program)return!1;try{let{program:t}=n,o=t.getTypeChecker();return S4(n.getTypeAtLocation(e),o,t,r)}catch{return!1}},De=(e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let{program:t}=r,n=t.getTypeChecker();return S5(r.getTypeAtLocation(e),n,t)}catch{return!1}},Dt=e=>e.computed||"Identifier"!==e.property.type?e3(ry(e.property)):e.property.name,Dr=(e,t)=>e.properties.some(e=>t.has((e=>{if("Property"===e.type)return e.computed||"Identifier"!==e.key.type?e3(ry(e.key)):e.key.name})(e))),Dn=(e,t)=>"Identifier"===e.type&&SZ.has(e.name)&&n_(e,t),Do=e=>nr(e)&&"UpdateExpression"!==e.parent.type&&("AssignmentExpression"!==e.parent.type||e.parent.left!==e||"="===e.parent.operator),Da=(e,t)=>"Identifier"===(e=ry(e)).type?"visualViewport"===e.name&&n_(e,t):"MemberExpression"===e.type&&"visualViewport"===Dt(e)&&Dn(ry(e.object),t),Di=(e,t)=>{var r;return Dn(e=ry(e),t)||("Identifier"===(r=ry(r=e)).type?"document"===r.name&&n_(r,t):"MemberExpression"===r.type&&"document"===Dt(r)&&Dn(ry(r.object),t))||Da(e,t)},Ds=(e,t,r)=>{let n=ry(t);return Dr(e,S2)&&(Dn(n,r)||S7(t,r,S8))||Dr(e,S3)&&(Da(n,r)||S7(t,r,S6))||Dr(e,S1)&&!Di(n,r)&&!De(t,r)},Dl=(e,t,r=e)=>{let n,o;if(!e||e!==r&&tl(e))return!1;if(e7(e)&&"MemberExpression"===e.callee.type&&S0.has(Dt(e.callee))&&!Di(e.callee.object,t)&&!De(e.callee.object,t)||tf(e)&&S2.has(e.name)&&!Do(e)&&n_(e,t)||"MemberExpression"===e.type&&!Do(e)&&(n=Dt(e),o=ry(e.object),S2.has(n)&&(Dn(o,t)||S7(e.object,t,S8))||S3.has(n)&&(Da(o,t)||S7(e.object,t,S6))||S1.has(Dt(e))&&!Di(e.object,t)&&!De(e.object,t))||("VariableDeclarator"===e.type&&"ObjectPattern"===e.id.type&&e.init?Ds(e.id,e.init,t):"AssignmentExpression"===e.type&&"ObjectPattern"===e.left.type&&Ds(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=>Dl(e,t,r)))return!0;continue}if(Dl(o,t,r))return!0}return!1},Du="prefer-set-methods/union",Dp="prefer-set-methods/intersection",Dc="prefer-set-methods/intersection-suggestion",Dd="prefer-set-methods/difference",Dm="prefer-set-methods/difference-suggestion",Df=(e,t)=>te(e,{name:"Set",argumentsLength:1})&&n_(e.callee,t),Dg=(e,t)=>{let r=eQ(e,t);return og(e,t)&&!eZ(e,t)?`(${r})`:r},Dy=(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)&&nQ(r.sourceCode.getTokenBefore(e),r,t)?`;${t}`:t,Dh=(e,t)=>("ParenthesizedExpression"===e.type||rg(e))&&e.expression===t,Dx=e=>{for(;e.parent;){let{parent:t}=e;if(Dh(t,e)){e=t;continue}break}return e},Db=(e,t)=>e?.type==="SpreadElement"&&"Set"===on(e.argument,t),DE=(e,t,r)=>{if(!(!td(e,{method:"has",argumentsLength:1,optionalCall:!1,optionalMember:!1})||!t0(e.arguments[0],t)||t0(e.callee.object,t))&&"Set"===on(e.callee.object,r))return e.callee.object},DS=(e,t,r)=>{var n;if(r.sourceCode.getCommentsInside(t).length>0||(n=Dx(n=e),n.parent?.type==="MemberExpression"&&n.parent.object===n)||e===t&&rg(e.parent))return;let o=((e,t)=>{if(!td(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&&Db(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=DE(e,t,r);if(n)return{method:"intersection",messageId:Dp,suggestionMessageId:Dc,otherSet:n};if("UnaryExpression"!==e.type||"!"!==e.operator||!e.prefix)return;let o=DE(e.argument,t,r);if(o)return{method:"difference",messageId:Dd,suggestionMessageId:Dm,otherSet:o}})(n.body,n.params[0],t);if(!(!o||eL(o.otherSet,t.sourceCode,{considerGetters:!0})))return{messageId:o.messageId,suggestionMessageId:o.suggestionMessageId,replacement:`${Dg(r,t)}.${o.method}(${eQ(o.otherSet,t)})`}})(e,r);if(o)return{node:t,messageId:o.messageId,suggest:[{messageId:o.suggestionMessageId,fix:e=>e.replaceText(t,Dy(t,o.replacement,r))}]}},DD="prefer-toggle-attribute/error",Dv="prefer-toggle-attribute/suggestion",DC=(e,t,r)=>{let n=eQ(e,t);return r?"UnaryExpression"===e.type&&"!"===e.operator&&e.prefix&&t.sourceCode.getCommentsInside(e).length===t.sourceCode.getCommentsInside(e.argument).length?DC(e.argument,t,!1):(!eZ(e,t.sourceCode)&&oh(e,"!")&&(n=`(${n})`),`!${n}`):eZ(e,t.sourceCode)||"SequenceExpression"!==e.type?n:`(${n})`},DA=(e,t,r)=>td(e,{methods:t,argumentsLength:r,optionalCall:!1,computed:!1});function DT(e){if(e?.type==="ChainExpression"&&(e=e.expression),DA(e,["removeAttribute","hasAttribute"],1)||DA(e,["setAttribute"],2)){let{callee:t}=e,[r,n]=e.arguments;if(e3(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||e0(n,"")}}}function Dw(e){if(e){if("BlockStatement"===e.type){if(1!==e.body.length)return;e=e.body[0]}return"ExpressionStatement"===e.type&&(e=e.expression),DT(e)}}let Dk=(e,t)=>e.isOptional===t.isOptional&&t0(e.receiver,t.receiver)&&t0(e.attributeName,t.attributeName),DI=(e,t)=>nL(e.receiver)||ne(e.receiver,t),Dj="prefer-url-search-parameters/error",DF="prefer-url-search-parameters/suggestion",DB=new Set(["node:url","url"]),DR=e=>"Type"===e.type||"ImportBinding"===e.type&&nZ(e.node),DP=(e,t,r)=>{let n=ei(r.sourceCode.getScope(t),e);return!n||n.defs.every(e=>DR(e))},DL=(e,t)=>e3(ry(e))===t,D$=(e,t)=>{let r=t.sourceCode.getText(e);return"SequenceExpression"===e.type?`(${r})`:r},DN=(e,t)=>{if(!td(e=ry(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(td(e=ry(e),{method:"split",argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1})&&!(!DL(e.arguments[0],"&")||nB(e.callee.object,t)||(n=ew(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!!td(e=ry(e),{method:"split",minimumArguments:1,maximumArguments:2,computed:!1,optionalCall:!1,optionalMember:!1})&&!!nW(ry(e.callee.object),t)&&!!DL(e.arguments[0],"=")&&(1===e.arguments.length||2===(n=e.arguments[1],ew(n,r.sourceCode.getScope(n))?.value))})(o.returnExpression,o.parameter,t))return{node:e,query:r.callee.object}},DM=(e,t)=>`new URLSearchParams(${D$(e,t)})`,DO=(e,t,r,n)=>{let{sourceCode:o}=n,[a,i]=o.getRange(e),[s,l]=eY(t,n);return o.text.slice(a,s)+r+o.text.slice(l,i)},DU=(e,t,r)=>{let[n,o]=r.sourceCode.getRange(e),[a,i]=eY(t,r);return[[n,a],[i,o]]},Dq=({node:e,query:t,replacement:r,preservedNodes:n=[t]},o)=>{let a=(({node:e,replacement:t,preservedNodes:r},n)=>{let o;if(!(!(!(o=ei(n.sourceCode.getScope(e),"URLSearchParams"))||o.defs.every(e=>DR(e))||o.defs.some(e=>(e=>{if("ImportBinding"!==e.type)return!1;let{node:t,parent:r}=e;return DB.has(r.source.value)&&"type"!==r.importKind&&"ImportSpecifier"===t.type&&"type"!==t.importKind&&"Identifier"===t.imported.type&&"URLSearchParams"===t.imported.name})(e)))||t7(n,e,r)))return[{messageId:DF,data:{replacement:t},fix:r=>r.replaceText(e,t)}]})({node:e,replacement:r,preservedNodes:n},o);if(a)return{node:e,messageId:Dj,suggest:a}},DW={configs:{node:{name:"@eslint-sukka/eslint-plugin-sukka-full node preset",plugins:{get sukka(){return DW}},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 DW}},rules:{"sukka/ban-eslint-disable":["error","allow-with-description"]}},recommended:{...u.eslint_plugin_sukka.configs.recommended,plugins:{get sukka(){return DW}},rules:{...u.eslint_plugin_sukka.configs.recommended.rules,"sukka/prefer-single-boolean-return":"off","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"}},recommended_unicorn:{name:"@eslint-sukka/eslint-plugin-sukka-full recommended unicorn preset",plugins:{get sukka(){return DW}},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-code-point":"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":"warn","sukka/unicorn/prefer-queue-microtask":"warn","sukka/unicorn/prefer-string-pad-start-end":"warn","sukka/unicorn/require-css-escape":"error","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":"warn","sukka/unicorn/no-confusing-array-with":"error","sukka/unicorn/no-duplicate-loops":"warn","sukka/unicorn/no-declarations-before-early-exit":"warn","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":"warn","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":"warn","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":"warn","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"}},stylistic_unicorn:{name:"@eslint-sukka/eslint-plugin-sukka-full stylistic unicorn preset",plugins:{get sukka(){return DW}},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:{...u.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint,plugins:{get sukka(){return DW}},rules:{...u.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint.rules,"sukka/string/no-unneeded-to-string":"error","sukka/type/no-force-cast-via-top-type":"error","sukka/type/no-wrapper-type-reference":"error","sukka/no-default-error":"off","sukka/unicorn/consistent-tuple-labels":"warn"}},recommended_react:{...u.eslint_plugin_sukka.configs.recommended_react,plugins:{get sukka(){return DW}}}},rules:Object.assign(u.eslint_plugin_sukka.rules,{"array/no-unneeded-flat-map":A,"browser/prefer-location-assign":w,"jsx/no-template-literal":I,"jsx/no-unneeded-nested":j,"string/no-locale-case":B,"string/no-simple-template-literal":R,"unicode/no-bidi":U,"unicode/no-invisible":W,"no-redundant-variable":_,"no-single-return":z,"prefer-early-return":G,"prefer-fetch":J,"prefer-timer-id":Y,"string/no-unneeded-to-string":Q,"type/no-force-cast-via-top-type":Z,"type/no-wrapper-type-reference":et,"no-default-error":er},Object.fromEntries(Object.entries({"unicorn/catch-error-name":ca,"unicorn/custom-error-definition":{create:e=>{e.on("ClassDeclaration",t=>cw(e,t)),e.on("AssignmentExpression",t=>{if("ClassExpression"===t.right.type)return cw(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||!cg(t)||!t.id)return;let r=t.id.name;return e.left.property.name!==r?{node:e.left.property,messageId:ci,fix:t=>t.replaceText(e.left.property,r)}:void 0}})},meta:{type:"problem",docs:{description:"Enforce correct `Error` subclassing.",recommended:!1},fixable:"code",messages:{[ci]:"Exported error name should match error class",[cs]:"Do not pass the error message to `super()` when the class defines a `message` accessor.",[cl]:"Do not assign to `this.message` when the class defines a `message` getter without a setter.",[cu]:"Error constructors should accept `options` as the second parameter.",[cp]:"Error constructors should use `options` as the second parameter.",[cc]:"Pass the error message to `super()` as the first argument.",[cd]:"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||eZ(t,e)?o>1?{node:o>2?n[o-3]:t,messageId:oI}:void 0:{node:t,messageId:oj,fix:e=>[e.insertTextBefore(t,"("),e.insertTextAfter(t,")")]}})},meta:{type:"suggestion",docs:{description:"Disallow nested ternary expressions.",recommended:!0},fixable:"code",messages:{[oI]:"Do not nest ternary expressions.",[oj]:"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!!(oB.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)&&oR(e.parent.parent)&&oP(e.parent.parent.parent.init))||!!(oR(e)&&tc(e.parent.init,{property:"EventEmitter",optional:!1,computed:!1})&&oP(e.parent.init.object))}(ei(r,t)?.defs[0]?.name))return{node:t,messageId:oF}})},meta:{type:"suggestion",docs:{description:"Prefer `EventTarget` over `EventEmitter`.",recommended:"unopinionated"},messages:{[oF]:"Prefer `EventTarget` over `EventEmitter`."},languages:["js/js"]}},"unicorn/prefer-keyboard-event-key":{create:e=>{e.on("Identifier",t=>{if(oM.has(t.name)){for(let r of o_(e,t))if(r.references?.some(e=>oW(t,e.identifier)))return oV(t,r)}}),e.on("Property",t=>{let r;if("Identifier"===t.key.type&&oM.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 o_(e,t))if(oK(t.key,r))return oV(t.key,r);for(let r of o_(e,t))if(oz(t.key,r))return oV(t.key,r)}})},meta:{type:"suggestion",docs:{description:"Prefer `KeyboardEvent#key` over deprecated keyboard event properties.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[o$]:"Use `.key` instead of `.{{name}}`.",[oN]:"Use `.key` with `{{key}}`."},languages:["js/js"]}},"unicorn/prefer-text-content":{create:e=>{e.on("MemberExpression",t=>{if(!tc(t,{property:"innerText"})||ne(t.object,e))return;let r=t.property;return{node:r,messageId:oG,suggest:[{messageId:oJ,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(ne(e,t))return!0;let{parent:r}=e;return"VariableDeclarator"===r.type?r.id===e&&r.init&&ne(r.init,t):"AssignmentExpression"===r.type&&r.left===e&&ne(r.right,t)})(t.parent.parent,e))return{node:t,messageId:oG,suggest:[{messageId:oJ,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:{[oG]:"Prefer `.textContent` over `.innerText`.",[oJ]:"Switch to `.textContent`."},languages:["js/js"]}},"unicorn/require-array-join-separator":{create:e=>{e.on("CallExpression",t=>{if(!(td(t,{method:"join",argumentsLength:0,optionalCall:!1})||td(t,{method:"call",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&tE(t.callee.object,{property:"join"}))||0===t.arguments.length&&r0(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:ao,fix:r=>oH(r,t,"','",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the separator argument with `Array#join()`.",recommended:"unopinionated"},fixable:"code",messages:{[ao]:"Missing the separator argument."},languages:["js/js"]}},"unicorn/no-thenable":{create:e=>{for(let{selector:t,selectors:r,messageId:n,getNodes:o}of ap)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:{[aa]:"Do not add `then` to an object.",[ai]:"Do not export `then`.",[as]:"Do not add `then` to a class."},languages:["js/js"]}},"unicorn/no-invalid-remove-event-listener":{create:e=>{e.on("CallExpression",t=>{if(!(td(t,{method:"removeEventListener",minimumArguments:2,optionalCall:!1})&&"SpreadElement"!==t.arguments[0].type&&("FunctionExpression"===t.arguments[1].type||"ArrowFunctionExpression"===t.arguments[1].type||td(t.arguments[1],{method:"bind",optionalCall:!1,optionalMember:!1}))))return;let[,r]=t.arguments;return["ArrowFunctionExpression","FunctionExpression"].includes(r.type)?{node:r,loc:eh(r,e.sourceCode),messageId:ac}:{node:r.callee.property,messageId:ac}})},meta:{type:"problem",docs:{description:"Prevent calling `EventTarget#removeEventListener()` with the result of an expression.",recommended:"unopinionated"},messages:{[ac]:"The listener argument should be a function reference."},languages:["js/js"]}},"unicorn/consistent-function-scoping":ab,"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(nc(r,t))return"alloc";let n=ew(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:aE,data:{method:n},fix:av(r,e,n)}:{node:r,messageId:aS,suggest:["from","alloc"].map(t=>({messageId:aD,data:{replacement:t},fix:av(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:{[aE]:"`new Buffer()` is deprecated, use `Buffer.{{method}}()` instead.",[aS]:"`new Buffer()` is deprecated, use `Buffer.alloc()` or `Buffer.from()` instead.",[aD]:"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:oD(l,e),messageId:aC,data:{method:n,position:o},fix:e=>e.removeRange(l)}};e.on("CallExpression",function*(e){if(!td(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(!e1(i)&&"TemplateLiteral"!==i.type)continue;let o=t.getText(i).slice(1,-1);0!==e&&aA(o)&&(yield r(i,n,"leading")),e!==a-1&&aT(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:{[aC]:"Do not use {{position}} space between `console.{{method}}` parameters."},languages:["js/js"]}},"unicorn/no-empty-file":ak,"unicorn/no-useless-fallback-in-spread":{create:e=>{e.on("ObjectExpression",t=>{if(ta(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:aI,*fix(r,{abort:n}){let{sourceCode:o}=e,a=t.parent;if(o.getCommentsInside(a).length>0)return n();let{left:i}=a,s=eZ(i,e),[,l]=s?eY(i,e):o.getRange(i),[,u]=o.getRange(a);yield r.removeRange([l,u]),(s||"SequenceExpression"!==i.type)&&(yield oX(a,r,e))}}})},meta:{type:"suggestion",docs:{description:"Disallow useless fallback when spreading in object literals.",recommended:"unopinionated"},fixable:"code",messages:{[aI]:"The empty object is useless."},languages:["js/js"]}},"unicorn/no-useless-length-check":{create:e=>{let t=[],r=new Set,n=new Set,o=new Set,a=new Set;e.on("BinaryExpression",e=>{if(!("BinaryExpression"===e.type&&"Literal"===e.right.type&&"0"===e.right.raw&&tc(e.left,{property:"length",optional:!1})&&tS(e.parent)))return;let{operator:t}=e;"==="===t?r.add(e):(">"===t||"!=="===t)&&n.add(e)}),e.on("CallExpression",t=>{td(t,{optionalCall:!1,optionalMember:!1,computed:!1})&&"Identifier"===t.callee.property.type&&!rQ(t.callee.object,e)&&("some"===t.callee.property.name?o.add(t):"every"===t.callee.property.name&&a.add(t))}),e.on("LogicalExpression",e=>{tS(e)&&t.push(e)}),e.on("Program:exit",function*(){let i=new Set(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,i,s)=>(function({node:e,operator:t,siblings:i}){return"||"===t&&r.has(e)&&i.some(t=>a.has(t)&&t0(e.left.object,t.callee.object))||"&&"===t&&n.has(e)&&i.some(t=>o.has(t)&&t0(e.left.object,t.callee.object))})({node:e,operator:t,siblings:[s[i-1],s[i+1]].filter(Boolean)}))})(e))),{sourceCode:s}=e;for(let t of i)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=eY(n,e),i=eY(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=>{if(!(td(t,{object:"Promise",methods:["resolve","reject"],optionalCall:!1,optionalMember:!1})&&("ArrowFunctionExpression"===t.parent.type&&t.parent.body===t||"ReturnStatement"===t.parent.type&&t.parent.argument===t||"YieldExpression"===t.parent.type&&!t.parent.delegate&&t.parent.argument===t)))return;let{functionNode:r,isInTryStatement:n}=function(e){let t,r=!1;for(;e;e=e.parent){if(tl(e)){t=e;break}"TryStatement"===e.type&&(r=!0)}return{functionNode:t,isInTryStatement:r}}(t);if(r&&(r.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}(r)))return function(e,t){let{callee:r,parent:n}=e,o=r.property.name;return{node:r,messageId:o,data:{type:"YieldExpression"===n.type?"yield":"return"},fix:t}}(t,function(e,t,r){if(e.arguments.length>1)return;let{callee:n,parent:o,arguments:a}=e,[i]=a;if(i?.type==="SpreadElement")return;let s="reject"===n.property.name,l="YieldExpression"===o.type;if(!s||!t&&(!l||"ExpressionStatement"===o.parent.type))return function(t){let n="ArrowFunctionExpression"===o.type,a=i?r.sourceCode.getText(i):"";if(i?.type==="SequenceExpression"&&(a=`(${a})`),s){if(a||="undefined",a=`throw ${a}`,l)return t.replaceTextRange(eY(o,r),a);if(a+=";",n)return a=`{ ${a} }`,t.replaceTextRange(eY(e,r),a)}else l?a=`yield${a?" ":""}${a}`:"ReturnStatement"===o.type?a=`return${a?" ":""}${a};`:(i?.type==="ObjectExpression"&&(a=`(${a})`),a||="{}");return t.replaceText(n?e:o,a)}}(t,n,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(!e8(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:oD([p-(r.length-s.length),p],e),messageId:l?aF:aj,*fix(r){let n=s;"MemberExpression"===t.parent.type&&t.parent.object===t&&om.test(s)&&!eZ(t,e)&&(n=`(${n})`,nQ(u.getTokenBefore(t),e,n)&&(n=`;${n}`)),yield r.replaceText(t,n),yield o8(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow number literals with zero fractions or dangling dots.",recommended:"unopinionated"},fixable:"code",messages:{[aj]:"Don't use a zero fraction in the number.",[aF]:"Don't use a dangling dot in the number."},languages:["js/js"]}},"unicorn/prefer-export-from":aU,"unicorn/prefer-native-coercion-functions":{create:e=>{e.on(ts,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&&a_.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&&aV(e.body,t)?e.body:"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type&&aV(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:eh(t,n),messageId:aq,data:{functionNameWithKind:ej(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:{[aq]:"{{functionNameWithKind}} is equivalent to `{{replacementFunction}}`. Use `{{replacementFunction}}` directly."},languages:["js/js"]}},"unicorn/no-document-cookie":{create(e){aX.listen({context:e})},meta:{type:"problem",docs:{description:"Do not use `document.cookie` directly.",recommended:"unopinionated"},messages:{[aJ]:"Do not use `document.cookie` directly."},languages:["js/js"]}},"unicorn/prefer-add-event-listener":aZ,"unicorn/prefer-array-index-of":a9,"unicorn/prefer-blob-reading-methods":{create:e=>{e.on("CallExpression",e=>{if(!td(e,{methods:["readAsText","readAsArrayBuffer"],argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let t=e.callee.property,r=t.name;return{node:t,messageId:a5,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:{[a5]:"Prefer `Blob#{{replacement}}()` over `FileReader#{{method}}(blob)`."},languages:["js/js"]}},"unicorn/prefer-date-now":{create:e=>{e.on("CallExpression",e=>{if(td(e,{methods:["getTime","valueOf"],argumentsLength:0,optionalCall:!1,optionalMember:!1})&&it(e.callee.object)){let t=e.callee.property;return ir(e,{node:t,messageId:a7,data:{method:t.name}})}if(e7(e,{names:["Number","BigInt"],argumentsLength:1,optional:!1})&&it(e.arguments[0])){let{name:t}=e.callee;return"Number"===t?ir(e,{messageId:ie}):ir(e.arguments[0])}}),e.on("UnaryExpression",t=>{if(("+"===t.operator||"-"===t.operator)&&it(t.argument))return ir("-"===t.operator?t.argument:t,{},e)}),e.on("AssignmentExpression",e=>{if(("-="===e.operator||"*="===e.operator||"/="===e.operator||"%="===e.operator||"**="===e.operator)&&it(e.right))return ir(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])it(t)&&(yield ir(t))})},meta:{type:"suggestion",docs:{description:"Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.",recommended:"unopinionated"},fixable:"code",messages:{[a4]:"Prefer `Date.now()` over `new Date()`.",[a7]:"Prefer `Date.now()` over `Date#{{method}}()`.",[ie]:"Prefer `Date.now()` over `Number(new Date())`."},languages:["js/js"]}},"unicorn/dom-node-dataset":ig,"unicorn/prefer-modern-math-apis":{create:e=>{let t=[];e.on("CallExpression",t=>{if(!td(t,{object:"Math",method:"sqrt",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let r=iD(t.arguments[0]);if(r.some(e=>!("BinaryExpression"===e.type&&("*"===e.operator&&t0(e.left,e.right)||"**"===e.operator&&e0(e.right,2)))))return;let n=1===r.length?"abs":"hypot",o=new Set(1===r.length?[]:r.map(e=>e.parent));return{node:t.callee.property,messageId:iy,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 an(t,",",a,e),yield oX(r,a,e)}for(let t of r)yield a.removeRange([eY(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 iS){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:{[iy]:"Prefer `{{replacement}}` over `{{description}}`."},languages:["js/js"]}},"unicorn/number-literal-case":iA,"unicorn/prefer-number-properties":iF,"unicorn/prefer-reflect-apply":{create:e=>{e.on("CallExpression",t=>{if(!td(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"===eI(e.callee)&&2===e.arguments.length&&iR(e.arguments[0],e.arguments[1]))return r=>r.replaceText(e,iP(t,e.callee.object,e.arguments[0],e.arguments[1]))})(t,r)||((e,t)=>{if("call"===eI(e.callee)&&"apply"===eI(e.callee.object)&&"prototype"===eI(e.callee.object.object)&&e.callee.object.object.object?.type==="Identifier"&&"Function"===e.callee.object.object.object.name&&3===e.arguments.length&&iR(e.arguments[1],e.arguments[2]))return r=>r.replaceText(e,iP(t,e.arguments[0],e.arguments[1],e.arguments[2]))})(t,r);if(n)return{node:t,messageId:iB,fix:n}})},meta:{type:"suggestion",docs:{description:"Prefer `Reflect.apply()` over `Function#apply()`.",recommended:"unopinionated"},fixable:"code",messages:{[iB]:"Prefer `Reflect.apply()` over `Function#apply()`."},languages:["js/js"]}},"unicorn/prefer-set-size":{create:e=>{e.on("MemberExpression",t=>{var r;if(!tc(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:td(r,{object:"Array",method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})?r.arguments[0]:void 0;if(n&&r6(n,e))return{node:t.property,messageId:iL,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);og(r,e)&&(s=`(${s})`),yield i.replaceText(o,s),"ArrayExpression"===o.type&&(yield o8(i,t,e))}}(e,t,n)}})},meta:{type:"suggestion",docs:{description:"Prefer using `Set#size` instead of `Array#length`.",recommended:"unopinionated"},fixable:"code",messages:{[iL]:"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(!td(e,{method:"join",argumentsLength:1,optionalCall:!1,optionalMember:!1})||!td(e.callee.object,{method:"split",argumentsLength:1,optionalCall:!1,optionalMember:!1})||t.sourceCode.getCommentsInside(e).length>0)return;let n=e.callee.object;if(nB(n.callee.object,t))return;let[o]=n.arguments,[a]=e.arguments,i=e3(o);if("string"==typeof i){if(0===i.length)return;r=tB(i)}else if(!(r=(e=>{if(!e6(e)||e.regex.flags.includes("y"))return;let t=iH(e);if(!t||iZ(t)||0===iQ(t))return;let{pattern:r,flags:n}=e.regex;return`/${r}/${n.includes("g")?n:`g${n}`}`})(o)))return;let s=e3(a);if("string"==typeof s)return`${eQ(n.callee.object,t)}.replaceAll(${r}, ${tB(s.replaceAll("$","$$$$"))})`})(t,e);if(o)return{node:t.callee.property,messageId:i_,fix:e=>e.replaceText(t,o)};if(!td(t,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1})||td(t,{method:"replace",argumentsLength:2,optionalCall:!1,optionalMember:!1})&&e6(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 Set,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||!iO.has(n))return;t.add(n)}return t})(r.regex.pattern)?.size>=8&&e1(n=t.arguments[1])&&n.value===iM)return;let{arguments:a,callee:{property:i}}=t;if(nB(t.callee.object,e))return;let[s]=a;if(!((e,t)=>{if(e6(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=ew(e,t);if(!r)return!1;let{value:n}=r;return"[object RegExp]"===Object.prototype.toString.call(n)&&n.global})(s,e.sourceCode.getScope(s)))return;let l=i.name,u=function(e){if(!e6(e))return;let t=iH(e);if(!t)return;let{flags:r}=e.regex;if(!function(e){if(!e.includes("g"))return!1;for(let t of e)if(iV.has(t))return!1;return!0}(r))return;let n="alternative"===t.type?iX(t.body):iJ(t);if(n)return"'"+n+"'"}(s);if("replaceAll"===l){if(!u)return;return{node:s,messageId:iW,data:{replacement:u.length<20?u:"a string literal"},fix:e=>e.replaceText(s,u)}}return{node:i,messageId:iq,*fix(e){yield e.insertTextAfter(i,"All"),u&&(yield e.replaceText(s,u))}}})},meta:{type:"suggestion",docs:{description:"Prefer `String#replaceAll()` over regex searches with the global flag and `String#split().join()`.",recommended:"unopinionated"},fixable:"code",messages:{[iq]:"Prefer `String#replaceAll()` over `String#replace()`.",[iW]:"This pattern can be replaced with {{replacement}}.",[i_]:"Prefer `String#replaceAll()` over `String#split().join()`."},languages:["js/js"]}},"unicorn/prefer-string-slice":{create:e=>{e.on("CallExpression",t=>{if(!td(t,{methods:["substr","substring"]})||nB(t.callee.object,e))return;let r=t.callee.property.name;if(!("substring"===r&&(e=>{if(!td(e,{method:"substring",argumentsLength:2}))return;let[t,r]=e.arguments;if(i0(t)&&i0(r)&&1===Math.abs(t.value-r.value))return t.value<r.value?t:r;let n=(e=>{if("BinaryExpression"===e.type&&"-"===e.operator&&e0(e.right,1))return e.left})(t);return i1(r,t)??(i1(t,r)?r:void 0)??(n&&t0(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=ew(a,s.getScope(e)),u=eY(i,r);if(l?.value===0){let n=((e,t,r)=>{let n,o,{sourceCode:a}=r;if(!("BinaryExpression"!==e.type||"-"!==e.operator||!(e8(n=e.right)&&Number.isSafeInteger(n.value)&&n.value>0)||!i3(e.left)||!("Identifier"===t.type||e1(t))||!t0(e.left.object,t)||(o=((e,t)=>{let[r,n]=eY(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 oQ(t,i,n,r));if(e8(i)||i3(i))return;let o=i2(i);return"number"==typeof o?void(yield oQ(t,i,String(Math.max(0,o)),r)):(yield t.insertTextBeforeRange(u,"Math.max(0, "),void(yield t.insertTextAfterRange(u,")")))}if(o.every(e=>e8(e))){let e;return void(yield(e=String(a.value+i.value),oQ(t,i,e,r)))}return n()}:function*({node:e,fixer:t,context:r,abort:n}){let[o,a]=e.arguments,i=o?i2(o):void 0;if(!a){if(i3(o))return;if(void 0!==i)return void(yield oQ(t,o,String(Math.max(0,i)),r));let e=eY(o,r);return yield t.insertTextBeforeRange(e,"Math.max(0, "),void(yield t.insertTextAfterRange(e,")"))}let s=i2(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 oQ(t,o,String(e[0]),r)),e[1]!==s&&(yield oQ(t,a,String(e[1]),r));return}if(0===i||0===s){let e=eQ(o,r),n=eQ(a,r);yield oQ(t,o,"0",r),yield oQ(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(!td(t,{methods:["trimLeft","trimRight"],argumentsLength:0,optionalCall:!1})||nB(t.callee.object,e))return;let r=t.callee.property,n=r.name,o="trimLeft"===n?"trimStart":"trimEnd";return{node:r,messageId:i8,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:{[i8]:"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||!eZ(t.callee.body,e))return;let{body:r}=t.callee,n={node:t,loc:oD(eY(r,e),e),messageId:i6};return!function(e,t){let{sourceCode:r}=t,[n,o]=eY(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:i9,fix:t=>t.replaceTextRange(eY(r,e),`{ return ${e.sourceCode.getText(r)}; }`)}]),n})},meta:{type:"suggestion",docs:{description:"Disallow unreadable IIFEs.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[i6]:"IIFE with parenthesized arrow function body is considered unreadable.",[i9]:"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||rh(r))&&("Identifier"===r.type&&i4.test(r.name)||"MemberExpression"===r.type&&!r.computed&&"Identifier"===r.property.type&&i4.test(r.property.name))&&!tc(r,{object:"Data",property:"TaggedError",computed:!1}))return{node:t,messageId:i5,fix:r=>o6(t,e,r)}})},meta:{type:"suggestion",docs:{description:"Require `new` when creating an error.",recommended:"unopinionated"},fixable:"code",messages:{[i5]:"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(e1(e))return sn({node:e,original:e.raw,lowercase:t})}),e.on("Literal",e=>{if(e6(e))return sn({node:e,original:e.raw,regex:sr,lowercase:t})}),e.on("TemplateElement",r=>{if(!tx(r.parent))return sn({node:r,original:r.value.raw,lowercase:t,fix:(t,n)=>ar(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:{[i7]:"Use uppercase characters for the value of the escape sequence.",[se]:"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=>e1(e)?sx(e,e.raw):e6(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:a,hasReplacement:i}=sh(n,{isRegex:!0,supportsNestedCharacterClasses:o.includes("v")}),s=o.includes("u")||o.includes("v"),l=function(e){for(let t=0;t<e.length;t++)if(void 0!==function(e,t){var r;if(!e.startsWith(si,t))return;let n=t+si.length;for(;r=e[n],ss.test(r);)n++;if(n===t+si.length||"}"!==e[n])return;let o=Number.parseInt(e.slice(t+si.length,n),16);if(!(o>1114111))return o}(e,t)&&sc(e,t))return!0;return!1}(n);if(!i&&(s||!l))return;let u=`/${i?a:n}/${sb(o)}`;return s?{node:e,messageId:so,fix:t=>t.replaceText(e,u)}:!function(e,t){try{return new RegExp(e,t),!0}catch{return!1}}(i?a:n,sb(o))?{node:e,messageId:so}:{node:e,messageId:so,suggest:[{messageId:sa,fix:t=>t.replaceText(e,u)}]}}(e):void 0),e.on("TemplateElement",t=>{if(!tx(t.parent))return sx(t,t.value.raw,(r,n)=>ar(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:{[so]:"Prefer Unicode code point escapes.",[sa]:"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 WeakMap;for(let{node:e,path:r}of new ez(t.getScope(n)).iterateGlobalReferences(Object.fromEntries(sE.map(e=>[e,{[ez.READ]:!0}]))))o.set(e,r);for(let t of r)yield function(e,{context:t,globalReferences:r}){let n;td(e,{object:"Reflect",method:"apply",minimumArguments:1,optionalCall:!1,optionalMember:!1})?n=e.arguments[0]:td(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(!tc(e,{optional:!1}))return;let n=e.object;if(to(n)||ta(n))return{constructorName:"ArrayExpression"===n.type?"Array":"Object",methodName:eI(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(tc(n)){let o=n.object;yield r.replaceText(o,`${a}.prototype`),("ArrayExpression"===o.type||"ObjectExpression"===o.type)&&(yield o8(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(!(tt(t,{names:sS,optional:!1})&&e.sourceCode.isGlobalReference(t.callee)))return;let r=t.callee.name,n=sA.has(r)?sA.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:sD,data:{constructorName:r}};if("ArrayExpression"===a.type||"ObjectExpression"===a.type)return{node:a,messageId:sC};let i=ew(a,e.sourceCode.getScope(a));if(!i)return;let{value:s}=i;return"string"!=typeof s?{node:a,messageId:sC}:""===s?{node:a,messageId:sv}:void 0})},meta:{type:"problem",docs:{description:"Enforce passing a `message` value when creating a built-in error.",recommended:"unopinionated"},messages:{[sD]:"Pass a message to the `{{constructorName}}` constructor.",[sv]:"Error message should not be an empty string.",[sC]:"Error message should be a string."},languages:["js/js"]}},"unicorn/no-instanceof-builtins":sP,"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&&sW(t.test)))return;let r=e.argument.callee;return{node:r,messageId:sL,fix:e=>e.insertTextBefore(r,"Type")}})},meta:{type:"suggestion",docs:{description:"Enforce throwing `TypeError` in type checking conditions.",recommended:"unopinionated"},fixable:"code",messages:{[sL]:"`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 Map,n=[],o=[],a=e=>{let r=ry(e.object);if(e.computed||"Identifier"!==e.property.type||!["Identifier","ThisExpression"].includes(r.type))return;let n=t.getScope(e);o.push({propertyName:e.property.name,rootIdentifierName:"Identifier"===r.type?r.name:void 0,rootVariable:"Identifier"===r.type?ei(n,r):void 0,thisScopeBoundary:"ThisExpression"===r.type?sK(r):void 0,start:t.getRange(e)[0],scope:n})},i=e=>{switch(e.type){case"MemberExpression":a(e);break;case"AssignmentPattern":i(e.left);break;case"RestElement":i(e.argument);break;case"ObjectPattern":for(let t of e.properties)i("Property"===t.type?t.value:t.argument);break;case"ArrayPattern":for(let t of e.elements)t&&i(t)}};e.on("AssignmentExpression",e=>{i(e.left)}),e.on(["ForInStatement","ForOfStatement"],e=>{"VariableDeclaration"!==e.left.type&&i(e.left)}),e.on("UpdateExpression",e=>{"MemberExpression"===e.argument.type&&a(e.argument)}),e.on("UnaryExpression",e=>{"delete"===e.operator&&"MemberExpression"===e.argument.type&&a(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&&ei(t.getScope(e),o),thisScopeBoundary:"ThisExpression"===e.init.type?sK(e.init):void 0,objectPattern:e.id},i=t.getText(e.init);r.set(i,[...r.get(i)??[],a])});let s=e=>{let n;if(e.computed||tt(e.parent)&&e.parent.callee===e||"TaggedTemplateExpression"===e.parent.type&&e.parent.tag===e||nr(e))return;let a=ry(e.object),i=r.get(t.getText(a));if(!i)return;let s=t.getScope(e),l="Identifier"===a.type?a:void 0,u=l&&ei(s,l),p="ThisExpression"===a.type?sK(a):void 0,c=t.getText(e.property);for(let r of i.toReversed())if(sX({declaration:r,memberExpressionNode:e,memberScope:s,memberRootIdentifier:l,memberRootVariable:u,memberThisScopeBoundary:p,memberExpressionWrites:o,sourceCode:t})&&(n=sJ(r.objectPattern.properties.filter(e=>sG(e)&&"Identifier"===e.value.type),c,s,t)))break;if(!n||((e,t)=>{let r=e,{parent:n}=e;for(;n&&!sQ(n);){if(sY(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:s_};let d=t.getText(e),m=n.value.name;return{node:e,messageId:s_,suggest:[{messageId:sV,data:{expression:d,property:m},fix:t=>t.replaceText(e,m)}]}};e.on("MemberExpression",e=>{n.push(e)}),e.onExit("Program",function*(){for(let e of n){let t=s(e);t&&(yield t)}})},meta:{type:"suggestion",docs:{description:"Use destructured variables over properties.",recommended:!1},hasSuggestions:!0,messages:{[s_]:"Use destructured variables over properties.",[sV]:"Replace `{{expression}}` with destructured property `{{property}}`."},languages:["js/js"]}},"unicorn/new-for-builtins":{create:e=>{s8.listen({context:e}),s6.listen({context:e}),s9.listen({context:e}),s5.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.",[s1]:"Use `String(new Date())` instead of `Date()`.",[s2]:"Switch to `String(new Date())`."},languages:["js/js"]}},"unicorn/prefer-single-call":ln,"unicorn/no-process-exit":{create:e=>{if(0===e.sourceCode.lines[0].indexOf("#!"))return;let t=0,r=!1,n=[],o=e=>td(e,{object:"process",methods:["on","once"],minimumArguments:1,optionalCall:!1,optionalMember:!1});e.on("CallExpression",e=>{tg(e)&&la(e.arguments[0])&&(r=!0)}),e.on("ImportDeclaration",e=>{"Literal"===e.source.type&&la(e.source)&&(r=!0)}),e.on("CallExpression",e=>{o(e)&&t++}),e.onExit("CallExpression",e=>{o(e)&&t--}),e.on("CallExpression",e=>{0===t&&td(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:lo}})},meta:{type:"suggestion",docs:{description:"Disallow `process.exit()`.",recommended:"unopinionated"},messages:{[lo]:"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!(!lg(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:lm,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(lg(e)&&(e.typeAnnotation||e.value&&p.getText(e.value).includes("this")))return;return function*(n){let a=p.getFirstToken(e);if(tk(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 o1(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);tk(o,{expected:{type:"Keyword",value:"static"},ruleId:"no-static-only-class"}),yield r.remove(o),yield o1(o,t,r);let a=lg(e)?n.getLastToken(e):n.getTokenAfter(e),i=ep(a);if(lg(e)){let{key:t,value:o}=e;if(o){let e=n.getTokenAfter(t,lf);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:{[lm]:"Use an object instead of a class with only static members."},languages:["js/js"]}},"unicorn/no-unreadable-array-destructuring":lx,"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)||tt(r.parent.parent)&&r.parent.parent.arguments.includes(r.parent)))))return;let n=r.parent,o=t.getFirstToken(n),a=n.parent.type,i={node:o,messageId:lb,data:{argumentType:"ArrayExpression"===r.type?"array":"object",parentDescription:lF[a]}};return"NewExpression"===a&&lj(r)&&te(n.parent,{names:lw,argumentsLength:1,allowSpreadElement:!0})?i:{...i,*fix(i){let s;yield i.remove(o),yield oX(r,i,e);let l=t.getFirstToken(r);yield i.remove(l);let[u,p]=t.getLastTokens(r,2);if(yield i.remove(p),eu(u)&&(yield i.remove(u)),to(r)||ta(r)){let e=t.getTokenAfter(n);eu(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 eu(e)?e:void 0}let a=t.getTokenAfter(e||s,eu);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(!td(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:lC};return t.getCommentsInside(r).length>0?i:{...i,suggest:[{messageId:lT,fix:t=>t.replaceText(r,r.properties.map(t=>eQ(t.argument,e)).join(", "))}]}}),e.on("NewExpression",e=>{if(te(e,{names:lw,argumentsLength:1,allowSpreadElement:!0})&&"SpreadElement"===e.arguments[0].type&&"ArrayExpression"!==e.arguments[0].argument.type)return{node:e.arguments[0],messageId:lv,data:{constructorName:`new ${e.callee.name}(…)`}}}),e.on("ArrayExpression",t=>{if(!lj(t))return;let{parent:r}=t;if(!("ForOfStatement"===r.type&&r.right===t||"YieldExpression"===r.type&&r.delegate&&r.argument===t||(te(r,{names:lw,argumentsLength:1})||te(r,{names:rE,minimumArguments:1})||td(r,{object:"Promise",methods:["all","allSettled","any","race"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||td(r,{objects:["Array",...rE],method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})||td(r,{object:"Object",method:"fromEntries",argumentsLength:1,optionalCall:!1,optionalMember:!1}))&&r.arguments[0]===t))return;let n="",o=lE;switch(r.type){case"ForOfStatement":o=lS;break;case"YieldExpression":o=lD;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=>lB(r,t,e)}}),e.on("ArrayExpression",t=>{if(!lj(t))return;let r=t.elements[0].argument,n=!!td(r,{methods:lI,optionalCall:!1,optionalMember:!1})&&rY(r.callee.object,e)&&rY(r,e);if(!n&&!(!rQ(r,e)&&(td(r,{methods:lk,optionalCall:!1,optionalMember:!1})?!lR(r,e):td(r,{method:"concat",optionalCall:!1,optionalMember:!1})?!("Identifier"===r.callee.object.type&&"Iterator"===r.callee.object.name||lR(r,e)):td(r,{method:"split",optionalCall:!1,optionalMember:!1})||td(r,{object:"Object",methods:["keys","values"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||"AwaitExpression"===r.type&&td(r.argument,{object:"Promise",methods:["all","allSettled"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||td(r,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1})||te(r,{name:"Array"}))))return;let o={node:t,messageId:lA};return te(r,{name:"Array"})||td(r,{method:"slice",optionalCall:!1,optionalMember:!1})&&!n?o:Object.assign(o,{fix:r=>lB(r,t,e)})})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary spread.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[lb]:"Spread an {{argumentType}} literal in {{parentDescription}} is unnecessary.",[lE]:"`{{parentDescription}}` accepts an iterable as an argument, it's unnecessary to convert to an array.",[lS]:"`for…of` can iterate over an iterable, it's unnecessary to convert to an array.",[lD]:"`yield*` can delegate to an iterable, it's unnecessary to convert to an array.",[lv]:"`{{constructorName}}` accepts a single iterable argument, spreading is misleading.",[lC]:"`Object.assign(…)` source object with only spread properties is unnecessary.",[lA]:"Unnecessarily cloning an array.",[lT]:"Remove the object literal wrapper."},languages:["js/js"]}},"unicorn/no-useless-switch-case":{create:e=>{let t=ru(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(!l$(o))break;t&&lN(o)||(yield{node:o,loc:function(e,t){let{sourceCode:r}=t,n=e.test||r.getFirstToken(e),o=r.getTokenAfter(n,ec);return{start:r.getLoc(e).start,end:r.getLoc(o).end}}(o,e),messageId:lP,suggest:[{messageId:lL,fix:e=>e.remove(o)}]})}})},meta:{type:"suggestion",docs:{description:"Disallow useless case in switch statements.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[lP]:"Useless case in switch statement.",[lL]:"Remove this case."},languages:["js/js"]}},"unicorn/no-useless-undefined":l3,"unicorn/numeric-separators-style":l5,"unicorn/prefer-array-find":ux,"unicorn/prefer-array-flat-map":{create:e=>{e.on("CallExpression",t=>{if(!(td(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)&&td(t.callee.object,{method:"map",optionalCall:!1})))return;let r=t.callee.object;if(th(r.callee.object,uD)||r0(r.callee.object,e))return;let{sourceCode:n}=e,o=r.callee.property,a=t7(e,t,[r])||t.typeArguments||t.typeParameters||r.typeArguments||r.typeParameters?void 0:function*(r){yield o4(r,t,e),yield r.replaceText(o,"flatMap")};return{node:t,loc:{start:n.getLoc(o).start,end:n.getLoc(t).end},messageId:ub,fix:a}}),e.on("CallExpression",t=>{if(!td(t,{method:"flatMap",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||t.typeArguments||t.typeParameters)return;let r=t.callee.object;if(!td(r,{method:"filter",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||r.typeArguments||r.typeParameters||rh(r.callee.object)||rQ(r.callee.object,e))return;let{sourceCode:n}=e;if(n.getCommentsInside(t).length>0)return;let[o]=r.arguments,[a]=t.arguments;if(!uC(o)||!uC(a))return;let[i]=o.params,[s]=a.params;if(!nW(i,s))return;let l=function(e,t){if(eZ(e,t))return eQ(e,t);let r=t.sourceCode.getText(e);return og(e,t)?`(${r})`:r}(r.callee.object,e),u=n.getText(i),p=function(e,t){if(eZ(e,t))return eQ(e,t);let r=t.sourceCode.getText(e);return uv.has(e.type)?`(${r})`:r}(o.body,e),c=function(e,t){if(eZ(e,t))return eQ(e,t);let r=t.sourceCode.getText(e);return od(e)?`(${r})`:r}(a.body,e);return{node:t.callee.property,messageId:uE,suggest:[{messageId:uS,fix:e=>e.replaceText(t,`${l}.flatMap(${u} => ${p} ? ${c} : [])`)}]}})},meta:{type:"suggestion",docs:{description:"Prefer `.flatMap(…)` over `.map(…).flat()` and `.filter(…).flatMap(…)`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[ub]:"Prefer `.flatMap(…)` over `.map(…).flat()`.",[uE]:"Prefer a single `.flatMap(…)` over `.filter(…).flatMap(…)`.",[uS]:"Replace `.filter(…).flatMap(…)` with a single `.flatMap(…)`."},languages:["js/js"]}},"unicorn/prefer-array-flat":uR,"unicorn/prefer-array-some":uN,"unicorn/prefer-code-point":{create:e=>{e.on("CallExpression",e=>{if(td(e,{method:"charCodeAt",optionalCall:!1}))return uM(e.callee.property,"codePointAt",!(e=>{let t=(e=>{let t=e;for(;;){let{parent:e}=t;if("ChainExpression"===e.type||"LogicalExpression"===e.type||"ConditionalExpression"===e.type&&(e.consequent===t||e.alternate===t)){t=e;continue}return t}})(e),{parent:r}=t;switch(r.type){case"BinaryExpression":return uO.has(r.operator);case"UnaryExpression":return uU.has(r.operator);case"AssignmentExpression":return r.right===t&&uO.has(r.operator.slice(0,-1));default:return!1}})(e))}),e.on("MemberExpression",e=>{if(tc(e,{object:"String",property:"fromCharCode",optional:!1}))return uM(e.property,"fromCodePoint")})},meta:{type:"suggestion",docs:{description:"Prefer `String#codePointAt(…)` over `String#charCodeAt(…)` and `String.fromCodePoint(…)` over `String.fromCharCode(…)`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{"error/charCodeAt":"Prefer `String#codePointAt()` over `String#charCodeAt()`.","error/fromCharCode":"Prefer `String.fromCodePoint()` over `String.fromCharCode()`.","suggestion/codePointAt":"Use `String#codePointAt()`.","suggestion/fromCodePoint":"Use `String.fromCodePoint()`."},languages:["js/js"]}},"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=ei(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(uV(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:uq,suggest:[{messageId:uW,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(ts,e=>{r.push(e)}),e.onExit(ts,()=>{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:{[uq]:"Prefer default parameters over reassignment.",[uW]:"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=u0(e);if(r?.kind==="nullish")return r;if("LogicalExpression"!==e.type)return;let n=u0(e.left),o=u0(e.right);if(n&&o&&uY(n.reference,o.reference,t)){if("||"===e.operator&&n.isTrueWhenNullish&&o.isTrueWhenNullish&&u1(n,o))return{reference:n.reference,isTrueWhenNullish:!0};if("&&"===e.operator&&!n.isTrueWhenNullish&&!o.isTrueWhenNullish&&u1(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&&uY(i,o,t.sourceCode))return uQ({context:t,conditionalExpression:e,left:o,right:n,operators:["??"]});if(!a.isTrueWhenNullish&&uY(i,n,t.sourceCode))return uQ({context:t,conditionalExpression:e,left:n,right:o,operators:["??"]});let s=a.isTrueWhenNullish?n:o,l=a.isTrueWhenNullish?o:n;if(!tb(s)||!tc(l)||l.optional||!t0(ry(i),ry(l.object))||function(e){let t=e,{parent:r}=t;for(;rg(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=ri(e,t);if(rt(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:uK,suggest:[{messageId:uJ,fix(r){let n=u;return nQ(t.sourceCode.getTokenBefore(e),t,n)&&(n=`;${n}`),r.replaceText(e,n)}}]}}(r,e);return i||(uY(n,o,t)?uQ({context:e,conditionalExpression:r,left:n,right:a}):"UnaryExpression"===n.type&&"!"===n.operator&&n.prefix&&uY(n.argument,a,t)?uQ({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:{[uz]:"Prefer using a logical operator over a ternary.",[uK]:"Prefer using optional chaining over a ternary.",[uG]:"Switch to `{{operator}}` operator.",[uJ]:"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?u2:u3,data:{name:a},fix:s?void 0:function*(e){let t=n.getTokenBefore(r);tk(t,{test:ed,expected:"(",ruleId:"prefer-optional-catch-binding"});let o=n.getTokenAfter(r);tk(o,{test:em,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:{[u2]:"Remove unused catch binding `{{name}}`.",[u3]:"Remove unused catch binding."},languages:["js/js"]}},"unicorn/prefer-regexp-test":pv,"unicorn/prefer-set-has":pM,"unicorn/prefer-string-raw":{create:e=>{e.on("Literal",t=>{if(!e1(t)||function(e){let{parent:t}=e,{type:r}=t;return tr(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)||pO(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=pW(n.slice(1,-1),n.charAt(0));if(o===t.value)return{node:t,messageId:pU,*fix(r){yield o8(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)||pW(t)!==e)||pO(t)))return{node:t,messageId:pU,*fix(r){for(let n of(yield o8(r,t,e),yield r.insertTextBefore(t,"String.raw"),t.quasis)){let{cooked:t,raw:o}=n.value;t!==o&&(yield ar(n,t,e,r))}}}}),e.on("TaggedTemplateExpression",t=>{let{quasi:r,tag:n,parent:o}=t,{sourceCode:a}=e;if(!tc(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:pq,*fix(r){let n=a.getTokenBefore(t);nQ(n,e,s)&&(yield r.insertTextBefore(t,";")),"ReturnStatement"!==o.type&&"ThrowStatement"!==o.type||nU(n,t.quasi,e)||eZ(t,e)||(yield o0(r,o,e)),"YieldExpression"!==o.type||o.delegate||o.argument!==t||nU(n,t.quasi,e)||eZ(t,e)||(yield r.insertTextBefore(t,"("),yield r.insertTextAfter(t,")")),yield r.replaceText(t.quasi,s),yield oX(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:{[pU]:"`String.raw` should be used to avoid escaping `\\`.",[pq]:"Using `String.raw` is unnecessary as the string does not contain any `\\`."},languages:["js/js"]}},"unicorn/prefer-switch":pX,"unicorn/require-number-to-fixed-digits-argument":{create:e=>{e.on("CallExpression",t=>{if(!td(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:pH,fix:r=>oH(r,t,"0",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the digits argument with `Number#toFixed()`.",recommended:"unopinionated"},fixable:"code",messages:{[pH]:"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 Set,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 WeakSet,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 p1(p3(e.lines,t)).indent||p1(pY(r=p3(n.split(/\r?\n/)))).indent||p1(r).indent||" "}return r.startsWith(" ")?" ":" "})(t,n,m,l);let f=pY(l).replaceAll(RegExp(`^${p}|${p}[ ]*$`,"g"),""),g=p+function(e,t=1,r={}){let{indent:n=" ",includeEmptyLines:o=!1}=r;if("string"!=typeof e)throw TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if("number"!=typeof t)throw TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(t<0)throw RangeError(`Expected \`count\` to be at least 0, got \`${t}\``);if("string"!=typeof n)throw TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof n}\``);return 0===t?e:e.replace(o?/^/gm:/^(?!\s*$)/gm,n.repeat(t))}(f,1,{indent:m+i})+p+m;if(g!==l)return{node:a,messageId:p2,fix:t=>g.split(s).map((r,n)=>ar(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!!(pO(e)||r.tags.length>0&&tx(e,r.tags))||!!(r.functions.length>0&&"CallExpression"===e.parent.type&&e.parent.arguments.includes(e)&&th(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:p8,defaultOptions:[{tags:["outdent","dedent","gql","sql","html","styled"],functions:["dedent","stripIndent"],selectors:[],comments:["HTML","indent"]}],messages:{[p2]:"Templates should be properly indented."},languages:["js/js"]}},"unicorn/no-single-promise-in-promise-methods":{create:e=>{e.on("CallExpression",t=>{if(!(td(t,{object:"Promise",methods:lu,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:li,data:{method:r}},{sourceCode:o}=e;if("AwaitExpression"===t.parent.type&&t.parent.argument===t&&("all"!==r||ti(t.parent.parent)))return n.fix=r=>r.replaceText(t,lp(t,e)),n;return"all"===r?(n.fix=((e,t)=>{let{sourceCode:r}=t;if(lc(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&&ld(t.id)?t.id:"AssignmentExpression"===t.type&&t.right===e&&ld(t.left)&&ti(t.parent)?t.left:void 0})(n);if(o){if(lc(r,o))return;return function*(n){yield n.replaceText(o,r.getText(o.elements[0])),yield n.replaceText(e,lp(e,t))}}let a=n.parent;if("MemberExpression"===a.type&&a.computed&&e0(a.property,0)&&a.object===n&&("VariableDeclarator"===a.parent.type&&a.parent.init===a||"AssignmentExpression"===a.parent.type&&a.parent.right===a)&&!lc(r,a))return r=>r.replaceText(a,`await ${lp(e,t)}`)})(t,e),n):(n.suggest=[{messageId:ls,fix:r=>{let[n]=t.arguments[0].elements,o=eQ(n,e);return eZ(n,e)||"Identifier"===n.type||"MemberExpression"===n.type||(o=`(${o})`),nQ(e.sourceCode.getTokenBefore(t),e,o)&&(o=`;${o}`),r.replaceText(t,o)}},{messageId:ll,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),eu(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:{[li]:"Wrapping single-element array with `Promise.{{method}}()` is unnecessary.",[ls]:"Use the value directly.",[ll]:"Switch to `Promise.resolve(…)`."},languages:["js/js"]}},"unicorn/no-await-in-promise-methods":{create:e=>{e.on("CallExpression",function*(t){if(td(t,{object:"Promise",methods:p5,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:p6,data:{method:t.callee.property.name},suggest:[{messageId:p9,*fix(t){let n=e.sourceCode.getFirstToken(r);yield t.remove(n),yield o1(n,e,t)}}]})})},meta:{type:"suggestion",docs:{description:"Disallow using `await` in `Promise` method parameters.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[p6]:"Promise in `Promise.{{method}}()` should not be awaited.",[p9]:"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&&ce.has(t.operator)&&ct(n)&&!ct(n.argument)))return;let{sourceCode:o}=e,a=o.getFirstToken(n),i=`${r.startsWith("!")?"=":"!"}${r.slice(1)}`;return{node:a,messageId:p4,suggest:[{messageId:p7,data:{operator:i},*fix(s){yield o8(s,t,e);let l=o.getTokenAfter(a),{parent:u}=t;("ReturnStatement"===u.type||"ThrowStatement"===u.type)&&!eZ(t,e)&&(nU(o.getFirstToken(u),l,e)||(yield o0(s,u,e))),yield s.remove(a),nQ(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:{[p4]:"Negated expression is not allowed in equality check.",[p7]:"Switch to '{{operator}}' check."},languages:["js/js"]}},"unicorn/no-unnecessary-slice-end":{create(e){cr(e,{methods:["slice"],messageId:cn})},meta:{type:"suggestion",docs:{description:"Disallow using `.length` or `Infinity` as the `end` argument of `{Array,String,TypedArray}#slice()`.",recommended:"unopinionated"},fixable:"code",messages:{[cn]:"Passing `{{description}}` as the `end` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-lonely-if":{create:e=>{e.on("IfStatement",t=>{if(cI(t)&&("BlockStatement"===t.parent.type&&1===t.parent.body.length&&t.parent.body[0]===t&&cI(t.parent.parent)&&t.parent.parent.consequent===t.parent||cI(t.parent)&&t.parent.consequent===t))return{node:t,messageId:ck,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,...cj(i,r)},l={...e,...cj(e,r)},u=cP(s,r),p=cL(s,t,r),c=cR(cB(cP(l,r)),cL(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(ey(a)){let t=n.getTokenAfter(e);t&&nQ(a,r,t.value)&&(o[1]=n.getRange(t)[0])}return o}(i,l.consequent,t,r),m={outerConditionGap:s.openingBraceToken?cB(cF(s.closingParenthesisToken,s.openingBraceToken,r)):"",outerLeadingContent:s.openingBraceToken?cB(cF(s.openingBraceToken,l.ifToken,r)):cB(cF(s.closingParenthesisToken,l.ifToken,r)),outerTrailingContent:s.openingBraceToken?cB(cF(l,s.closingBraceToken,r)):""},f=(o=m.outerConditionGap,a=m.outerLeadingContent,o.trimStart().startsWith("//")?{leadingStatementText:cB(a).trimStart(),conditionSuffixText:o}:{leadingStatementText:cB(cR(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=cF(t.closingParenthesisToken,t.openingBraceToken,n),r=cF(t.openingBraceToken,t.closingBraceToken,n);return`${s}${e}{${r}${i}}`}let l=cF(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:{[ck]:"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(!td(t,{method:"flat",argumentsLength:1,optionalCall:!1}))return;let[r]=t.arguments;if(!e8(r)||1===r.value)return;let{sourceCode:n}=e,{openingParenthesisToken:o,closingParenthesisToken:a}=tH(t,e);if(!n.commentsExistBetween(o,a))return{node:r,messageId:c$}})},meta:{type:"suggestion",docs:{description:"Disallow a magic number as the `depth` argument in `Array#flat(…).`",recommended:"unopinionated"},messages:{[c$]:"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:cN,*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 oX(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=eY(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 o8(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||nU(i,s,e)||eZ(t,e)||eZ(r,e)?nQ(o.getTokenBefore(t),e,s.value)&&(yield n.insertTextBefore(t,";")):yield o0(n,a,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow negated conditions.",recommended:"unopinionated"},fixable:"code",messages:{[cN]:"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&&tl(e.parent)&&e.parent.params.includes(e)))return;let{left:t,right:r}=e;return"Identifier"===t.type?{node:t,messageId:cM,data:{parameter:t.name}}:{node:r,messageId:cO}})},meta:{type:"problem",docs:{description:"Disallow the use of objects as default parameters.",recommended:"unopinionated"},messages:{[cM]:"Do not use an object literal as default for parameter `{{parameter}}`.",[cO]:"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(cq.has(n))return{method:n,target:o,argumentsNodes:a};if("call"!==n&&"apply"!==n||(n=cW(t.object),!cq.has(n)))return;let i="apply"===t.property.name,{supportObjects:s}=cq.get(n),l=t.object.object;if(to(l)||"slice"===n&&e0(l,"")||"prototype"===cW(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}=cq.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=ry(t);if("BinaryExpression"!==o||"-"!==a||!(e8(n=ry(s))&&n.value>0))return;let l=ry(i);return"MemberExpression"===l.type&&!l.computed&&!l.optional&&"Identifier"===l.property.type&&"length"===l.property.name&&lq(l.object,r)?i:e(i,r)})(a[e],o)).filter(Boolean);if(0!==s.length)return{node:t,messageId:cU,data:{method:n},*fix(t){for(let r of s)yield function(e,t,r){let[n,o]=eY(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:{[cU]:"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||(td(t.parent,{object:"process",method:"getBuiltinModule",argumentsLength:1,optionalCall:!1,optionalMember:!1})||tg(t.parent))&&t.parent.arguments[0]===t))return;let{value:r}=t;if(!("string"==typeof r&&!r.startsWith(cK)&&cV(r)&&cV(`${cK}${r}`)))return;let n=e.sourceCode.getRange(t)[0]+1;return{node:t,messageId:cz,data:{moduleName:r},fix:e=>e.insertTextAfterRange([n,n],cK)}})},meta:{type:"suggestion",docs:{description:"Prefer using the `node:` protocol when importing Node.js builtin modules.",recommended:"unopinionated"},fixable:"code",messages:{[cz]:"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(!td(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:cG,fix:t=>o4(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Prefer passing `Date` directly to the constructor when cloning.",recommended:"unopinionated"},fixable:"code",messages:{[cG]:"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)&&cX(n.key)&&("get"===n.kind&&(cY(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&&cH(e.key,n.key)))||"set"===n.kind&&((e,t)=>{if(!cY(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:cJ,data:{kind:n.kind}}})},meta:{type:"problem",docs:{description:"Disallow recursive access to `this` within getters and setters.",recommended:"unopinionated"},defaultOptions:[],messages:{[cJ]:"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(!tc(r,{properties:["url","filename"],computed:!1,optional:!1}))return;let n=r.property.name;if("url"===n){if(c1(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&&c1(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&&c1(n,t)&&n.arguments[0]===e&&(yield i(n,"dirname"))}return}function*a(e,{reportFilenameNode:r=!1}={}){let{parent:n}=e;if(c2(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=ei(t.getScope(n.id),n.id);if(o)for(let e of o.references){if(!e.isReadOnly())continue;let{parent:r}=e.identifier;c2(r,t)&&r.arguments[0]===e.identifier&&(yield i(r,"dirname"))}}function i(e,t){return{node:e,messageId:"dirname"===t?cQ:cZ,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:{[cQ]:"Do not construct dirname.",[cZ]:"Do not construct filename using `fileURLToPath()`."},languages:["js/js"]}},"unicorn/no-unnecessary-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!(td(t,{method:"flat",argumentsLength:1,optionalCall:!1})&&e0(t.arguments[0],1)))return;let[r]=t.arguments;return{node:r,messageId:c3,fix:t=>oY(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Disallow using `1` as the `depth` argument of `Array#flat()`.",recommended:"unopinionated"},fixable:"code",messages:{[c3]:"Passing `1` as the `depth` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-unnecessary-array-splice-count":{create(e){cr(e,{methods:["splice","toSpliced"],messageId:c8})},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:{[c8]:"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&&sS.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))&&td(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||tc(e,{property:"constructor",computed:!1,optional:!1})&&"ThisExpression"===e.object.type)return!0;if("Identifier"!==e.type||!t.id)return!1;let n=ei(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:c6},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:{[c6]:"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:c9};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 ep(r)?void(yield s.insertTextBefore(r,e)):void(yield s.insertTextAfter(l,`${e};`))}let u=t.getLastToken(r),p=t6(n,e),c=`${p}${a} = ${i};
|
|
23
23
|
`;"\n"!==t.getText()[t.getRange(u)[0]-1]&&(c=`
|
|
24
24
|
${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:c5,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:{[c9]:"Prefer class field declaration over `this` assignment in constructor for static values.",[c5]:"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(!e7(t,{name:"BigInt",argumentsLength:1,optional:!1}))return;let[r]=t.arguments,n=function(e){let t,r;if(e1(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:c4},{shouldUseSuggestion:a,text:i,bigint:s}=n,l=r=>{let n=i;return!eZ(t,e)&&s<0n&&(n=`(${n})`,nQ(e.sourceCode.getTokenBefore(t),e,n)&&(n=`;${n}`)),r.replaceText(t,n)};return a||e.sourceCode.getCommentsInside(t).length>0?o.suggest=[{messageId:c7,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:{[c4]:"Prefer using bigint literal over `BigInt(…)`.",[c7]:"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=>!di(e,["add","remove"])))return;let[o,a]=n;if(o.callee.property.name!==a.callee.property.name&&ds(o,a))return dn(r,function*(n){let i=eQ(o.callee.object.object,e),s=eQ(o.arguments[0],e),l="ConditionalExpression"===r.type,u="remove"===o.callee.property.name,p=r.test,c=dl(p,u,o),d=c?"":da(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+=";"),nQ(t.getTokenBefore(r),e,f)&&(f=`;${f}`),yield n.replaceText(r,f),l&&(yield o8(n,r,e))})}),e.on("ConditionalExpression",t=>{let r=[t.consequent,t.alternate];if(!(r.every(e=>e1(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&&dr(t.parent.object)&&e7(t.parent.parent,{optional:!1,argumentsLength:1})&&t.parent.parent.callee===t.parent))return;let n=t.parent,o=n.parent;return dn(o,function*(r){let a="remove"===t.consequent.value,i=t.test,s=dl(i,a,o)?"":da(i,e,a);s&&(yield r.insertTextAfter(o.arguments[0],`, ${s}`)),yield o9(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:{[de]:"Prefer using `Element#classList.toggle()` to toggle class names.",[dt]:"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:du,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)&&ta(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:du,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(eu(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,eu),...t.getTokens(a),...eH(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:{[du]:"{{type}} with empty attribute list is not allowed."},languages:["js/js"]}},"unicorn/no-immediate-mutation":{create:e=>{for(let t of dS)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=oT(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):ei(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:{[dp]:"Immediate mutation on {{objectType}} is not allowed.",[dc]:"{{operation}} the elements to the {{assignType}}.",[dd]:"Move this property to the {{assignType}}.",[dm]:"{{description}} the {{assignType}}.",[df]:"Move the element to the {{assignType}}.",[dg]:"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=to(r=i)?"empty array":e0(r,"")?"empty string":e9(r)?"`null`":tb(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=eZ(o,e),[,s]=a?eY(o,e):r.getRange(o),[,l]=r.getRange(n);yield t.removeRange([s,l]),(a||"SequenceExpression"!==o.type)&&(yield oX(n,t,e))};else e.sourceCode.getCommentsInside(i).length>0&&(l=!0),n=t=>oY(t,i,e);let u={node:i,messageId:dD,data:{description:s}};return l?u.suggest=[{messageId:dv,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:{[dD]:"The {{description}} is useless.",[dv]:"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(td(r,{object:"JSON",method:"stringify",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return{node:r.callee,messageId:dC,*fix(n){yield n.insertTextAfter(t.callee,".json"),yield o2(t,e,n);let[o]=r.arguments,a=eY(r,e),i=eY(o,e);yield n.removeRange([a[0],i[0]]),yield n.removeRange([i[1],a[1]]),!eZ(t,e)&&eZ(t.callee,e)&&nQ(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:{[dC]:"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=>c.isRegExp(e)?e:RegExp(e,"u")),a=!1!==r.multipleFileExtensions,i=!1!==r.checkDirectories,s=n.map(e=>dH[e].fn);e.on(rp,r=>{if("Document"!==r.type||r.parent?.type!=="Program")return(()=>{var r;let l,u,p=(r=e.cwd,""===(l=d.relative(r,d.resolve(r,t)))||".."===l||l.startsWith(`..${d.sep}`)||d.isAbsolute(l)?[d.basename(t)]:l.split(d.sep).filter(e=>"."!==e)),{basename:c,filename:m,middle:f,extension:g}=function(e,{multipleFileExtensions:t}){let r=d.extname(e),n=d.basename(e,r),o={basename:n+r,filename:n,middle:"",extension:r};if(t){let[e]=n.split(".");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}=d0(e);if(e.startsWith("$")||dY(a,r))return;let i=dQ(a,r,{leading:o,trailing:""});return{loc:{column:0,line:1},messageId:dU,data:{directory:e,chosenCases:d1(t),renamedDirectories:(n=i.map(e=>`\`${e}\``),dV.format(n))}}}(e,n,s);if(t)return t}if(d_.has(c))return;let{leading:y,words:h}=d0(m);if(m.startsWith("$")||dY(h,s))return g!==g.toLowerCase()?{loc:{column:0,line:1},messageId:dq,data:{filename:m+f+g.toLowerCase(),extension:g}}:void 0;let x=dQ(h,s,{leading:y,trailing:f+g.toLowerCase()});return{loc:{column:0,line:1},messageId:dO,data:{chosenCases:d1(n),renamedFilenames:(u=x.map(e=>`\`${e}\``),dV.format(u))}}})()})},meta:{type:"suggestion",docs:{description:"Enforce a case style for filenames and directory names.",recommended:!0},schema:d2,defaultOptions:[],messages:{[dO]:"Filename is not in {{chosenCases}}. Rename it to {{renamedFilenames}}.",[dU]:"Directory name `{{directory}}` is not in {{chosenCases}}. Rename it to {{renamedDirectories}}.",[dq]:"File extension `{{extension}}` is not in lowercase. Rename it to `{{filename}}`."},languages:["*"]}},"unicorn/consistent-template-literal-escape":{create:e=>{e.on("TemplateElement",t=>{if(tx(t.parent))return;let{raw:r}=t.value,n=r.replaceAll(/(?<=(?:^|[^\\])(?:\\\\)*)\\?\$\\{/g,"\\${");if(r!==n)return{node:t,messageId:d3,fix:r=>ar(t,n,e,r)}})},meta:{type:"suggestion",docs:{description:"Enforce consistent style for escaping `${` in template literals.",recommended:!0},fixable:"code",messages:{[d3]:"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:rE,minimumArguments:1}))||!mn(t.arguments[0]))return;let r=t.arguments[0],n=mo(r,e);return{node:r.callee.property,messageId:d8,data:{description:`new ${t.callee.name}(…)`},...n&&{fix:n}}}),e.on("CallExpression",t=>((e,t)=>{if(!td(e,{objects:["Array",...rE],method:"from",minimumArguments:1,optionalCall:!1,optionalMember:!1})||!mn(e.arguments[0]))return;let r=e.arguments[0],n=mo(r,t);return{node:r.callee.property,messageId:d8,data:{description:`${e.callee.object.name}.${e.callee.property.name}(…)`},...n&&{fix:n}}})(t,e)??((e,t)=>{if(!td(e,{object:"Object",method:"fromEntries",minimumArguments:1,optionalCall:!1,optionalMember:!1})||!mn(e.arguments[0]))return;let r=e.arguments[0],n=mo(r,t);return{node:r.callee.property,messageId:d8,data:{description:`${e.callee.object.name}.${e.callee.property.name}(…)`},...n&&{fix:n}}})(t,e)??((e,t)=>{if(!td(e,{object:"Promise",methods:["all","allSettled","any","race"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||!mn(e.arguments[0]))return;let r=e.arguments[0],n=ma(r,t,d7);return{node:r.callee.property,messageId:d8,data:{description:`${e.callee.object.name}.${e.callee.property.name}(…)`},...n&&{suggest:[n]}}})(t,e)??((e,t)=>{if(!(td(e,{methods:mt,maximumArguments:1,optionalCall:!1,optionalMember:!1})||td(e,{method:mr,argumentsLength:2,optionalCall:!1,optionalMember:!1}))||!mn(e.callee.object))return;let r=e.arguments[0],n=e.callee.property.name,o=n===mr;if(r&&("ArrowFunctionExpression"===r.type||"FunctionExpression"===r.type)&&(r.params.length>(o?3:2)||r.params.at(-1)?.type==="RestElement"))return;let a=e.callee.object,i=ma(a,t,me,{method:n});return{node:a.callee.property,messageId:d4,data:{method:n},...i&&{suggest:[i]}}})(t,e)),e.on("ForOfStatement",t=>{if(!mn(t.right))return;let r=mo(t.right,e);return{node:t.right.callee.property,messageId:d6,...r&&{fix:r}}}),e.on("YieldExpression",t=>{if(!t.delegate||!mn(t.argument))return;let r=mo(t.argument,e);return{node:t.argument.callee.property,messageId:d9,...r&&{fix:r}}}),e.on("SpreadElement",t=>{if(!mn(t.argument))return;let{parent:r}=t;if("ArrayExpression"!==r.type&&"CallExpression"!==r.type&&"NewExpression"!==r.type)return;let n=mo(t.argument,e);return{node:t.argument.callee.property,messageId:d5,...n&&{fix:n}}})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `.toArray()` on iterators.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[d8]:"`{{description}}` accepts an iterable, `.toArray()` is unnecessary.",[d6]:"`for…of`/`for await…of` can iterate over an iterable, `.toArray()` is unnecessary.",[d9]:"`yield*` can delegate to an iterable, `.toArray()` is unnecessary.",[d5]:"Spread works on iterables, `.toArray()` is unnecessary.",[d4]:"`Iterator` has a `.{{method}}()` method, `.toArray()` is unnecessary.",[d7]:"Remove `.toArray()`.",[me]:"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||!mu(r.right)||mu(r.left)||"ConditionalExpression"!==r.left.type||!function e(t){let{parent:r}=t;return!!r&&("IfStatement"===r.type&&r.test===t||"WhileStatement"===r.type&&r.test===t||"DoWhileStatement"===r.type&&r.test===t||"ForStatement"===r.type&&r.test===t||"ConditionalExpression"===r.type&&r.test===t||"UnaryExpression"===r.type&&"!"===r.operator||"LogicalExpression"===r.type&&e(r))}(r)||function e(t){if(!t||"object"!=typeof t)return!1;if(mp.has(t.type)||"MemberExpression"===t.type||"BinaryExpression"===t.type&&("in"===t.operator||"instanceof"===t.operator))return!0;for(let[r,n]of Object.entries(t))if("parent"!==r){if(Array.isArray(n)){if(n.some(t=>e(t)))return!0}else if(n&&"string"==typeof n.type&&e(n))return!0}return!1}(r.left)||function e(t){if(!t||"object"!=typeof t)return!1;if("CallExpression"===t.type||"NewExpression"===t.type)return!0;for(let[r,n]of Object.entries(t))if("parent"!==r){if(Array.isArray(n)){if(n.some(t=>e(t)))return!0}else if(n&&"string"==typeof n.type&&e(n))return!0}return!1}(r.left))return;let n=mc(r.right,e,{operator:r.operator,property:"left"}),o=mc(r.left,e,{operator:r.operator,property:"right"}),a=t.getTokensBetween(r.left,r.right,{includeComments:!0}).some(e=>eg(e))?void 0:t=>t.replaceTextRange([eY(r.left,e)[0],eY(r.right,e)[1]],`${n} ${r.operator} ${o}`);return"LogicalExpression"===r.left.type&&r.left.operator===r.operator?{node:r,loc:t.getLoc(r.right),messageId:mi,data:{operator:r.operator},...a&&{suggest:[{messageId:ms,fix:a}]}}:{node:r,loc:t.getLoc(r.right),messageId:mi,data:{operator:r.operator},...a&&{fix:a}}})},meta:{type:"suggestion",docs:{description:"Prefer simple conditions first in logical expressions.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[mi]:"Prefer simple condition first in `{{operator}}` expression.",[ms]:"Swap conditions."},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(!mm.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:md,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=>eg(e)))return;let a=t.getLoc(i);if(a.start.line===a.end.line||re(e,o))return;let s=i.body.at(-1),l=t.getText(o),u=t6(s,e),p=t.getTokenBefore(n,{includeComments:!0});yield r.insertTextAfter(p,`
|
|
25
25
|
${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:{[md]:"Move `{{keyword}}` inside the block statement."},languages:["js/js"]}},"unicorn/better-dom-traversing":{create:e=>{e.on("MemberExpression",t=>{let r,n=(e=>{if(mC(e)){if(mv(e.object,"childNodes"))return"childNodes";if(mv(e.object,"children"))return"children"}})(t);if(!n||nL(t.object.object)||"children"===n&&mv(r=t.object,"children")&&("Identifier"===r.object.type&&"props"===r.object.name||tc(r.object,{property:"props",optional:!1,computed:!1}))||t.parent?.type==="MemberExpression"&&t.parent.object===t&&mv(t.parent,"children")&&mC(t.parent.parent))return;let o=t.property.value;return"childNodes"===n&&0===o?{node:t,messageId:mf,suggest:mT(t,"firstChild",mb,e)}:"children"===n&&0===o?{node:t,messageId:mg,suggest:mT(t,"firstElementChild",mE,e)}:"children"===n?{node:t,messageId:my}:void 0}),e.on("MemberExpression",e=>{if(!(!mw(e)||!mw(e.object)||!(!mw(e.parent)||e.parent.object!==e)||nL((e=>{for(;mw(e);)e=e.object;return e})(e))))return{node:e,messageId:mh}}),e.on("CallExpression",t=>{if(!mI(t)||t.parent?.type==="MemberExpression"&&t.parent.object===t&&t.parent.parent?.callee===t.parent&&mI(t.parent.parent)&&mk(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(;mI(e);){let[r]=e.arguments;if(!mk(r))break;t.push(e),e=e.callee.object}if(t.length<2||"ChainExpression"===e.type||nL(e))return;let r=[];for(let e of t)r.unshift(e3(e.arguments[0]));return{root:e,selectors:r,quoteNode:t.at(-1).arguments[0]}})(t);if(r)return{node:t,messageId:mx,suggest:((e,t,r)=>{let n,o,{sourceCode:a}=r;if(mA(e,a)||!t.selectors.every(e=>!e.includes(",")&&!e.includes(":scope")))return;let i=eQ(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(${tB(s,"Literal"===(o=t.quoteNode).type&&o.raw.startsWith('"')?'"':"'")})`;return[{messageId:mS,fix:t=>t.replaceText(e,l)}]})(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Prefer better DOM traversal APIs.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[mf]:"Prefer `.firstChild` over `.childNodes[0]`.",[mg]:"Prefer `.firstElementChild` over `.children[0]`.",[my]:"Consider `.querySelector()` over positional child traversal.",[mh]:"Consider `.closest()` over chaining `.parentElement`.",[mx]:"Consider merging chained `.querySelector()` calls.",[mb]:"Switch to `.firstChild`.",[mE]:"Switch to `.firstElementChild`.",[mS]:"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:o=!1,extendDefaultReplacements:a=!0,replacements:i={},allowList:s={}}={})=>{let l=new Map(Object.entries(a?{...m$,...i}:i).filter(([,e])=>!1!==e));return{checkProperties:e,checkVariables:t,checkDefaultAndNamespaceImports:r,checkShorthandImports:n,checkShorthandProperties:o,replacements:l,replacementRegExp:l.size>0?(e=>{let t=[],r=[];for(let n of e.keys())t.push(mM(n)),r.push(mM(ow(n)));return RegExp(`(?:^(?:${t.join("|")})|(?:${r.join("|")}))${mO}`,"gv")})(l):void 0,allowList:new Set(Object.keys(s))}})(e.options[0]),r=new WeakMap,n=new WeakMap,o=(e,t)=>t.every(t=>{let r=n.get(t);return!r||!r.has(e)}),a=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?i({name:e.name,scope:e.scope,defs:e.defs,identifiers:e.identifiers,references:[...e.references,...n.references]}):i(e)}let[t]=e.defs;return void r.set(t.name,e)}return i(e)},i=r=>{var a;if(0===r.defs.length)return;let i=mU(r.name,t);if(!i)return;let[s]=r.defs;if(!(!("ImportDefaultSpecifier"===(a=s.name).parent.type&&a.parent.local===a||"ImportNamespaceSpecifier"===a.parent.type&&a.parent.local===a||"ImportSpecifier"===a.parent.type&&a.parent.local===a&&"Identifier"===a.parent.imported.type&&"default"===a.parent.imported.name||"VariableDeclarator"===a.parent.type&&a.parent.id===a&&tg(a.parent.init))||t.checkDefaultAndNamespaceImports&&("internal"!==t.checkDefaultAndNamespaceImports||mB(s)))||!(!nz(s.name,e)||t.checkShorthandImports&&("internal"!==t.checkShorthandImports||mB(s)))||!t.checkShorthandProperties&&nJ(s.name))return;let l=[...r.references.map(e=>e.from),r.scope],u=mL(i)?tJ(i,l,o):void 0,p=mq(s.name,u??i);if(u&&rd(r).every(e=>!("VariableDeclarator"===e.parent.type&&e.parent.id===e?"VariableDeclaration"===e.parent.parent.type&&"ExportNamedDeclaration"===e.parent.parent.parent.type:!!mj.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 l)n.has(e)||n.set(e,new Set),n.get(e).add(u);p.suggest=[{messageId:mP,data:{replacement:u},fix:t=>at(r,u,e,t)}]}e.report(p)},s=e=>{for(let t of e.variables)a(t)},l=r=>{if(!t.checkProperties||"__proto__"===r.name)return;let n=mU(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||mF.has(r.parent.type)&&r.parent.key===r&&!r.parent.computed))return;let o=mq(r,n);e.report(o)};e.on("Identifier",l),e.on("PrivateIdentifier",l),e.on("Program:exit",r=>{if(t.checkVariables)for(let t of tO(e.sourceCode.getScope(r)))s(t)})},meta:{type:"suggestion",docs:{description:"Enforce consistent spelling of compound words in identifiers.",recommended:"unopinionated"},hasSuggestions:!0,schema:mW,defaultOptions:[{}],messages:{[mR]:"Prefer `{{replacement}}` over `{{name}}`.",[mP]:"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})||!mz(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===e3(n))return;let[o]=r.elements;if(function(e,t,r){let n=mK(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}))&&mz(o.callee,r)}(o,e,t))return o}(o,t);if(!a)return;let i=ei(r.getScope(n),n);if(!i)return;let s=rd(i).filter(e=>e!==n);if(1!==s.length)return;let[l]=s,u=function(e,t){let r,{parent:n}=e;return td(n,{object:"URL",method:"createObjectURL",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&n.arguments[0]===e&&mz(n.callee.object,t)?{call:n,kind:"blobArgument"}:td(n,{methods:["append","set"],minimumArguments:2,maximumArguments:3,optionalCall:!1,optionalMember:!1})&&n.arguments[1]===e&&(r=mK(n.callee.object,t)?.init,te(r,{name:"FormData",argumentsLength:0})&&mz(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 ei(n.getScope(e),e)===ei(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)||re(t,e)}(e.parent,t))&&("formData"!==u.kind||2!==u.call.arguments.length||p))return{node:o,messageId:m_,suggest:[{messageId:mV,*fix(n){yield o7(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:{[m_]:"Use the original `Blob` instead of converting it to a `File`.",[mV]:"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(!td(e,{method:"drawImage",minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let[a]=e.arguments;if("SpreadElement"!==a.type&&(r=mX(a,t),r?.type==="CallExpression"&&!r.optional&&"Identifier"===r.callee.type&&"loadImage"===r.callee.name&&r.arguments.length>0&&"SpreadElement"!==r.arguments[0].type&&td(n=r.arguments[0],{method:"toDataURL",optionalCall:!1,optionalMember:!1})&&("Identifier"===(o=n.callee.object).type?mH(o.name):"MemberExpression"===o.type&&!o.computed&&"Identifier"===o.property.type&&mH(o.property.name))))return{node:a,messageId:mG}}),e.on("CallExpression",e=>{if(!td(e,{method:"putImageData",minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let[r]=e.arguments;if("SpreadElement"!==r.type&&td(mX(r,t),{method:"getImageData",optionalCall:!1,optionalMember:!1}))return{node:r,messageId:mG}})},meta:{type:"suggestion",docs:{description:"Prefer drawing canvases directly instead of converting them to images.",recommended:"unopinionated"},messages:{[mG]:"Prefer drawing the canvas directly with `drawImage()`."},languages:["js/js"]}},"unicorn/no-confusing-array-splice":{create:e=>{e.on("CallExpression",t=>{if(!td(t,{methods:["splice","toSpliced"],argumentsLength:3,optionalCall:!1,optionalMember:!1}))return;let r=function([e,t]){let r=function(e){let t=of(e);if("number"==typeof t)return Math.max(Math.trunc(t),0)}(t);return 1===r?mY:-1===Math.trunc(of(e))&&0===r?mQ:void 0}(t.arguments);if(!r)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=eQ(o,r),p=n.getText(i),c=n.getText(s);if(t===mY){if(m2(e,n))return;if("toSpliced"===l){var d,m;if(0>Math.trunc(of(i))||(d=i,m=o,d=ry(d),m=ry(m),"MemberExpression"===d.type&&!d.optional&&!d.computed&&"Identifier"===d.property.type&&"length"===d.property.name&&lq(d.object,m)))return;return{messageId:mZ,fix:t=>t.replaceText(e,`${u}.with(${p}, ${c})`)}}return"ExpressionStatement"===e.parent.type&&m1(o)&&(of(i)??0)>=0?{messageId:mZ,fix:t=>t.replaceText(e,`${u}[${p}] = ${c}`)}:void 0}if(t===mQ&&m1(o)&&!m2(i,n))return{messageId:m0,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:{[mY]:"Prefer a direct element replacement instead of `{{method}}()`.",[mQ]:"Avoid using `{{method}}()` to insert at `-1`.",[mZ]:"Use direct element replacement.",[m0]:"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 t8(n.elements,e).map(e=>({node:e??n,messageId:m3,data:{value:e?t.getText(e):"undefined"}}))})},meta:{type:"suggestion",docs:{description:"Disallow duplicate values in `Set` constructor array literals.",recommended:!0},messages:{[m3]:"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(!ft(r)||fn(r))return;let n=r.object;if(!fo(r,n,t,e))return fs(r,n,e)}),e.on("CallExpression",r=>{let n;if(fr(r)){if(fn(r))return;let n=r.callee.object;if(fo(r,n,t,e))return;return fs(r,n,e)}let o=fi(r,e);if(o)return o;if(fe(r)&&!(ft(n=r.parent)||fr(n)||"MemberExpression"===r.parent.type&&r.parent.object===r&&fr(r.parent.parent))){let e;if(e=e3(r.arguments[0]),/^#[\-A-Z_a-z][\w\-]*$/v.test(e))return{node:r.callee.property,messageId:m6}}}),e.on("BinaryExpression",r=>((e,t)=>{let{sourceCode:r}=t;if(fu(e,fe,r))return{node:e,messageId:m5}})(r,e)??((e,t)=>{let r=fu(e,m7,t);if(r&&("==="===e.operator||"!=="===e.operator)&&tb(r.value))return{node:e,messageId:m4}})(r,t)),e.on("Identifier",t=>fi(t,e))},meta:{type:"suggestion",docs:{description:"Disallow incorrect `querySelector()` and `querySelectorAll()` usage.",recommended:!0},fixable:"code",schema:[],messages:{[m8]:"Prefer `.querySelector()` when only the first match is used.",[m6]:"Prefer `.querySelector()` for a simple ID selector.",[m9]:"Check `.length` instead of the `NodeList` object itself.",[m5]:"Check `.length` instead of comparing the `NodeList` object with `null` or `undefined`.",[m4]:"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"!==fx(t.name))return;let r=((e,t)=>{if(t?.value){if(e1(t.value))return t.value.value;if("JSXExpressionContainer"===t.value.type)return fE(e,t.value.expression)}})(e,fb(t,"type"));if(r?.toLowerCase()!=="file")return;let n=fb(t,"accept");if(!n)return;let o=((e,t)=>{if(!t.value)return{node:t,missing:!0};if(e1(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=fE(e,t.value.expression);return void 0===r?{node:t.value,dynamic:!0}:{node:t.value,value:r,fixable:!1}})(e,n);return fw({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=fT(e,t,"type")?.value;if(r?.toLowerCase()!=="file")return;let n=((e,t,r)=>{let n=fT(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}:fg.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 fw({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:{[fp]:"Invalid file input `accept` value: {{reason}}",[fc]:"The file input `accept` value must be static.",[fd]:"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=fF(e);e.on("MemberExpression",e=>{if("Identifier"!==e.object.type||!tc(e,{property:"currentTarget"})||!fk.test(e.object.name))return;let n=ei(t.getScope(e.object),e.object),o=n?.defs.find(({type:e})=>"Parameter"===e);if(!o)return;let a=o.node,i=fI(e)!==a;if(i||r.isFunctionSuspended(a)||r.isInsideSuspendingLoop(e,a))return{node:e,messageId:i?fR:fB,data:{name:e.object.name}}})},meta:{type:"problem",docs:{description:"Disallow accessing `event.currentTarget` after the synchronous event dispatch has finished.",recommended:!0},messages:{[fB]:"`{{name}}.currentTarget` is `null` after the handler suspends. It is only set during synchronous event dispatch; save it to a variable beforehand.",[fR]:"`{{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&&fL(o.alternate,a,t)?fM(e,r,{left:n,operator:"&&",right:o.test,consequent:o.consequent,alternate:o.alternate}):"ConditionalExpression"===a.type&&fL(o,a.consequent,t)?fM(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:{[fP]:"Do not use unnecessary nested ternary expressions."},languages:["js/js"]}},"unicorn/no-unused-array-method-return":{create:e=>{e.on("CallExpression",t=>{var r,n,o;let a,i,s="MemberExpression"===t.callee.type?eI(r=t.callee,e.sourceCode.getScope(r)):void 0;if(!(!fU.has(s)||!(e=>{for(;;){if(nX(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)||(n=t.callee.object,fq.has(s)?!rY(n,e):(o=function e(t,r,n=new Set){if(!t||t===f_||n.has(t))return t;if(n.add(t),"Identifier"===t.type){let o=function(e,t){let r=function(e,t){if("Identifier"===e.type)return ei(t.sourceCode.getScope(e),e)}(e,t);if(!r)return;if(1!==r.defs.length||function(e,t,r){if(!e)return!1;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 f_;let[n]=r.defs;return"Variable"===n.type&&"VariableDeclarator"===n.node.type&&"Identifier"===n.node.id.type&&n.node.id.name===e.name&&n.node.init&&"VariableDeclaration"===n.parent.type?n.node.init:f_}(t,r);return o===f_?o:void 0===o?t:e(o,r,n)}if(["ChainExpression","TSNonNullExpression","TSSatisfiesExpression"].includes(t.type))return e(t.expression,r,n);if("MemberExpression"===t.type)return f_;if("TSAsExpression"===t.type||"TSTypeAssertion"===t.type){let{typeAnnotation:e}=t;return"TSTypeOperator"===e.type&&"readonly"===e.operator&&(e=e.typeAnnotation),"TSArrayType"===e.type||"TSTypeReference"===e.type&&"Identifier"===e.typeName.type&&("Array"===e.typeName.name||"ReadonlyArray"===e.typeName.name)?t:f_}return t}(o=n,e))===f_||((e,t)=>fz(e,"undefined",t)||"ObjectExpression"===e.type||"Literal"===e.type||"TemplateLiteral"===e.type||"ArrowFunctionExpression"===e.type||"FunctionExpression"===e.type||"ClassExpression"===e.type||"NewExpression"===e.type&&"Identifier"===e.callee.type&&!fz(e.callee,"Array",t)||"CallExpression"===e.type&&"Identifier"===e.callee.type&&fV.has(e.callee.name)&&t.sourceCode.isGlobalReference(e.callee))(o,e)||"Identifier"===(a=o).type&&fW.test(a.name)&&!("ArrayExpression"===(i=o).type||("CallExpression"===i.type||"NewExpression"===i.type)&&fz(i.callee,"Array",e)))))return{node:t.callee.property,messageId:fO,data:{method:s}}})},meta:{type:"suggestion",docs:{description:"Disallow ignoring the return value of selected array methods.",recommended:"unopinionated"},messages:{[fO]:"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(!td(r,{methods:fJ.keys().toArray(),optionalCall:!1,optionalMember:!1}))return;let n=r.callee.object;if(!td(n,{methods:fX,argumentsLength:0,optionalCall:!1,optionalMember:!1}))return;let o=r.callee.property.name,a=fJ.get(o),i={method:o,replacement:a,reversingMethod:n.callee.property.name},s={node:r.callee.property,messageId:fK,data:i};return 0===t.getCommentsInside(r).length&&(s.suggest=[{messageId:fG,data:i,*fix(t){yield t.replaceText(r.callee.property,a),yield o4(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:{[fK]:"Prefer `Array#{{replacement}}()` over `Array#{{reversingMethod}}().{{method}}()`.",[fG]:"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||!fY.has(e.operator)||f3(e.left,t)||f3(e.right,t))){if(e0(e.right,0))return{value:e.left,operator:e.operator};if(e0(e.left,0))return{value:e.right,operator:fQ[e.operator]}}}(e.test,t);if(!r)return;let{value:n,operator:o}=r,{consequent:a,alternate:i}=e;if(("<"===o||"<="===o)&&f8(a,n)&&t0(i,n)||(">"===o||">="===o)&&t0(a,n)&&f8(i,n))return n}(t,e);if(!r)return;let n=f7(r)?function*(n){yield o8(n,t,e),yield n.replaceText(t,`Math.abs(${f5(r,e)})`)}:void 0;return f4(t,e,n)}),e.on("LogicalExpression",t=>{let r=function(e,t){if("||"!==e.operator)return;let r=f6(e.left,t),n=f9(e.right,t);if(r&&n&&t0(r.value,n.value)&&fZ[r.operator]===n.operator&&f8(n.negativeThreshold,r.threshold))return{value:r.value,threshold:r.threshold,operator:r.operator};let o=f6(e.right,t),a=f9(e.left,t);if(o&&a&&t0(o.value,a.value)&&fZ[o.operator]===a.operator&&f8(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=f7(n)&&f7(o)?function*(r){yield o8(r,t,e),yield r.replaceText(t,`Math.abs(${f5(n,e)}) ${a} ${eQ(o,e)}`)}:void 0;return f4(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:{[fH]:"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||!gr(r.object)||nr(r))return;let n=gt(r.property,t);if(void 0!==n)return gn(r,r.object,n,e)}),e.on("CallExpression",r=>{if(!td(r,{method:"at",argumentsLength:1}))return;let{object:n}=r.callee;if(!tc(r.callee)||!gr(n))return;let o=gt(r.arguments[0],t);if(void 0!==o)return gn(r,n,o,e)})},meta:{type:"suggestion",docs:{description:"Prefer `String#split()` with a limit.",recommended:"unopinionated"},fixable:"code",messages:{[ge]:"Prefer `String#split()` with a limit."},languages:["js/js"]}},"unicorn/prefer-queue-microtask":ga,"unicorn/prefer-string-pad-start-end":{create:e=>{e.on("BinaryExpression",t=>((e,t)=>{if("+"!==e.operator)return;let r=gg(e.left,t);if(r&&t0(e.right,r.targetNode)&&!gu(e.right,t)){let n=gm({targetNode:e.right,targetLengthNode:r.targetLengthNode,paddingNode:r.paddingNode});return gh({node:e,method:"padStart",replacement:n&&gy({method:"padStart",targetNode:e.right,...r},t),context:t,canFix:n})}let n=gg(e.right,t);if(n&&t0(e.left,n.targetNode)&&!gu(e.left,t)){let r=gm({targetNode:e.left,targetLengthNode:n.targetLengthNode,paddingNode:n.paddingNode});return gh({node:e,method:"padEnd",replacement:r&&gy({method:"padEnd",targetNode:e.left,...n},t),context:t,canFix:r})}})(t,e)),e.on("CallExpression",t=>((e,t)=>{if(!td(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=gf(r.left,t),i=(e=>{if(e?.type==="UnaryExpression"&&"-"===e.operator)return e.argument})(n);if(1===e.arguments.length&&a&&i&&gc(a.widthNode)&&t0(a.widthNode,i)&&"Identifier"===r.right.type&&!gu(r.right,t)){let n=gd(a.paddingNode);return gx({node:e,method:"padStart",replacement:gy({method:"padStart",targetNode:r.right,targetLengthNode:a.widthNode,...a},t),context:t,canSuggest:n})}let s=gf(r.right,t);if(2===e.arguments.length&&s&&gc(n)&&0===n.value&&gc(s.widthNode)&&t0(s.widthNode,o)&&"Identifier"===r.left.type&&!gu(r.left,t)){let n=gd(s.paddingNode);return gx({node:e,method:"padEnd",replacement:gy({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:{[gi]:"Prefer `String#{{method}}()` over manual string padding.",[gs]:"Replace with `String#{{method}}()`."},languages:["js/js"]}},"unicorn/require-css-escape":gA,"unicorn/require-passive-events":{create:e=>{e.on("CallExpression",t=>{if(!td(t,{method:"addEventListener",minimumArguments:2,maximumArguments:3,optionalCall:!1,optionalMember:!1}))return;let[r,n,o]=t.arguments;if(!e1(r)||!gw.has(r.value)||"ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type||!((e,t)=>{let r;if(r=t.sourceCode,"FunctionExpression"===e.type&&tO(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(gI(e)||!gj(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(eY(r,e),", {passive: true}"))}}if(e2(r,!0)||e2(r,!1))return{fix:e=>e.replaceText(r,e2(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(e1(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=t6(o,e);return","===a.value?t.insertTextAfter(a,`
|
package/dist/index.d.ts
CHANGED
|
@@ -1,81 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ESLint } from 'eslint';
|
|
2
2
|
|
|
3
|
-
declare const plugin:
|
|
4
|
-
readonly configs: {
|
|
5
|
-
readonly node: {
|
|
6
|
-
readonly name: "@eslint-sukka/eslint-plugin-sukka-full node preset";
|
|
7
|
-
readonly plugins: {
|
|
8
|
-
readonly sukka: /*elided*/ any;
|
|
9
|
-
};
|
|
10
|
-
readonly rules: Linter.RulesRecord;
|
|
11
|
-
};
|
|
12
|
-
readonly comment: {
|
|
13
|
-
readonly name: "@eslint-sukka/eslint-plugin-sukka-full comments preset";
|
|
14
|
-
readonly plugins: {
|
|
15
|
-
readonly sukka: /*elided*/ any;
|
|
16
|
-
};
|
|
17
|
-
readonly rules: Linter.RulesRecord;
|
|
18
|
-
};
|
|
19
|
-
readonly recommended: {
|
|
20
|
-
readonly plugins: {
|
|
21
|
-
readonly sukka: /*elided*/ any;
|
|
22
|
-
};
|
|
23
|
-
readonly rules: {
|
|
24
|
-
readonly 'sukka/prefer-single-boolean-return': "off";
|
|
25
|
-
readonly 'sukka/array/no-unneeded-flat-map': "error";
|
|
26
|
-
readonly 'sukka/browser/prefer-location-assign': "warn";
|
|
27
|
-
readonly 'sukka/jsx/no-template-literal': "error";
|
|
28
|
-
readonly 'sukka/jsx/no-unneeded-nested': "error";
|
|
29
|
-
readonly 'sukka/string/no-locale-case': "warn";
|
|
30
|
-
readonly 'sukka/string/no-simple-template-literal': "error";
|
|
31
|
-
readonly 'sukka/unicode/no-bidi': "warn";
|
|
32
|
-
readonly 'sukka/unicode/no-invisible': "warn";
|
|
33
|
-
readonly 'sukka/no-redundant-variable': "error";
|
|
34
|
-
readonly 'sukka/no-single-return': "warn";
|
|
35
|
-
readonly 'sukka/prefer-early-return': readonly ["error", {
|
|
36
|
-
readonly maximumStatements: 16;
|
|
37
|
-
}];
|
|
38
|
-
readonly 'sukka/prefer-fetch': "error";
|
|
39
|
-
readonly 'sukka/prefer-timer-id': "warn";
|
|
40
|
-
};
|
|
41
|
-
readonly name: "eslint-plugin-sukka/recommended";
|
|
42
|
-
};
|
|
43
|
-
readonly recommended_unicorn: {
|
|
44
|
-
readonly name: "@eslint-sukka/eslint-plugin-sukka-full recommended unicorn preset";
|
|
45
|
-
readonly plugins: {
|
|
46
|
-
readonly sukka: /*elided*/ any;
|
|
47
|
-
};
|
|
48
|
-
readonly rules: Linter.RulesRecord;
|
|
49
|
-
};
|
|
50
|
-
readonly stylistic_unicorn: {
|
|
51
|
-
readonly name: "@eslint-sukka/eslint-plugin-sukka-full stylistic unicorn preset";
|
|
52
|
-
readonly plugins: {
|
|
53
|
-
readonly sukka: /*elided*/ any;
|
|
54
|
-
};
|
|
55
|
-
readonly rules: Linter.RulesRecord;
|
|
56
|
-
};
|
|
57
|
-
readonly recommended_extra_with_typed_lint: {
|
|
58
|
-
readonly plugins: {
|
|
59
|
-
readonly sukka: /*elided*/ any;
|
|
60
|
-
};
|
|
61
|
-
readonly rules: {
|
|
62
|
-
readonly 'sukka/string/no-unneeded-to-string': "error";
|
|
63
|
-
readonly 'sukka/type/no-force-cast-via-top-type': "error";
|
|
64
|
-
readonly 'sukka/type/no-wrapper-type-reference': "error";
|
|
65
|
-
readonly 'sukka/no-default-error': "off";
|
|
66
|
-
readonly 'sukka/unicorn/consistent-tuple-labels': "warn";
|
|
67
|
-
};
|
|
68
|
-
readonly name: "eslint-plugin-sukka/recommended_extra_with_typed_lint";
|
|
69
|
-
};
|
|
70
|
-
readonly recommended_react: {
|
|
71
|
-
readonly plugins: {
|
|
72
|
-
readonly sukka: /*elided*/ any;
|
|
73
|
-
};
|
|
74
|
-
readonly name: "eslint-plugin-sukka/recommended_react";
|
|
75
|
-
readonly rules: Linter.RulesRecord;
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
readonly rules: any;
|
|
79
|
-
};
|
|
3
|
+
declare const plugin: ESLint.Plugin;
|
|
80
4
|
|
|
81
5
|
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": "8.13.
|
|
3
|
+
"version": "8.13.3",
|
|
4
4
|
"homepage": "https://github.com/SukkaW/eslint-config-sukka",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/SukkaW/eslint-config-sukka",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"eslint-plugin-sukka": "^9.
|
|
24
|
+
"eslint-plugin-sukka": "^9.11.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@masknet/eslint-plugin": "^0.4.1",
|
|
28
28
|
"eslint-plugin-unicorn": "^69.0.0",
|
|
29
|
-
"@eslint-sukka/rollup-config": "8.13.
|
|
29
|
+
"@eslint-sukka/rollup-config": "8.13.3"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"eslint": "*",
|