@eslint-sukka/eslint-plugin-sukka-full 8.8.0 → 8.9.0

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 CHANGED
@@ -12,11 +12,11 @@ ${u}break;
12
12
  ${u}`)}else yield t.insertTextAfter(e,`
13
13
  ${u}break;`)}(t,i,n,s),yield function*(e,t,r){e&&"BlockStatement"!==e.type&&(yield t.insertTextBefore(e,`{
14
14
  ${r}`),yield t.insertTextAfter(e,`
15
- ${r}}`))}(t,i,s))}}}({discriminant:u,ifStatements:o},e,t)),yield s}})},meta:{type:"suggestion",docs:{description:"Prefer `switch` over multiple `else-if`.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{minimumCases:{type:"integer",minimum:2},emptyDefaultCase:{enum:["no-default-comment","do-nothing-comment","no-default-case"]}}}],defaultOptions:[{minimumCases:3,emptyDefaultCase:"no-default-comment"}],messages:{[oH]:"Use `switch` instead of multiple `else-if`."}}},o0="require-number-to-fixed-digits-argument",o1="template-indent",o3=[{type:"object",additionalProperties:!1,properties:{indent:{oneOf:[{type:"string",pattern:/^\s+$/.source},{type:"integer",minimum:1}]},tags:{type:"array",uniqueItems:!0,items:{type:"string"}},functions:{type:"array",uniqueItems:!0,items:{type:"string"}},selectors:{type:"array",uniqueItems:!0,items:{type:"string"}},comments:{type:"array",uniqueItems:!0,items:{type:"string"}}}}],o2="no-await-in-promise-methods/error",o4="no-await-in-promise-methods/suggestion",o5=["all","allSettled","any","race"],o8="no-negation-in-equality-check/error",o6="no-negation-in-equality-check/suggestion",o9=new Set(["===","!==","==","!="]),o7=e=>"UnaryExpression"===e.type&&e.prefix&&"!"===e.operator;function se(e,{methods:t,messageId:r}){e.on("CallExpression",u=>{if(!rR(u,{methods:t,argumentsLength:2,optionalCall:!1}))return;let n=u.arguments[1],a=function(e,t){if("Identifier"===e.type&&"Infinity"===e.name)return"Infinity";if(rP(e,{object:"Number",property:"POSITIVE_INFINITY",computed:!1,optional:!1}))return"Number.POSITIVE_INFINITY";let r="ChainExpression"===e.type;if(r&&(e=e.expression),rP(e,{property:"length",computed:!1})&&ux(t,e.object))return`${"Identifier"===t.type?t.name:"…"}${r?"?.":"."}length`}(n,u.callee.object);if(!a)return;let i=u.callee.property.name,o={description:a};return"splice"===i?o.argumentName="deleteCount":"toSpliced"===i&&(o.argumentName="skipCount"),{node:n,messageId:r,data:o,fix:t=>u8(t,n,e)}})}let st="no-unnecessary-slice-end",sr="catch-error-name",su="invalidExport",sn=/^(?:[A-Z][\da-z]*)*Error$/,sa=e=>{if(!e.superClass)return!1;let{name:t,type:r,property:u}=e.superClass;return"MemberExpression"===r&&({name:t}=u),sn.test(t)},si=(e,t)=>{if("ExpressionStatement"!==e.type||"AssignmentExpression"!==e.expression.type)return!1;let r=e.expression.left;return!!r.object&&"ThisExpression"===r.object.type&&r.property.name===t};function*so(e,t){if(!sa(t)||null===t.id)return;let{name:r}=t.id,u=uU(r).replace(/(?:error|)$/i,"Error");r!==u&&(yield{node:t.id,message:`Invalid class name, use \`${u}\`.`});let{sourceCode:n}=e,{body:a}=t.body,i=n.getRange(t.body),o=a.find(e=>"constructor"===e.kind);if(!o)return void(yield{node:t,message:"Add a constructor to your error.",fix:e=>e.insertTextAfterRange([i[0],i[0]+1],`
15
+ ${r}}`))}(t,i,s))}}}({discriminant:u,ifStatements:o},e,t)),yield s}})},meta:{type:"suggestion",docs:{description:"Prefer `switch` over multiple `else-if`.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{minimumCases:{type:"integer",minimum:2},emptyDefaultCase:{enum:["no-default-comment","do-nothing-comment","no-default-case"]}}}],defaultOptions:[{minimumCases:3,emptyDefaultCase:"no-default-comment"}],messages:{[oH]:"Use `switch` instead of multiple `else-if`."}}},o0="require-number-to-fixed-digits-argument",o1="template-indent",o3=[{type:"object",additionalProperties:!1,properties:{indent:{oneOf:[{type:"string",pattern:/^\s+$/.source},{type:"integer",minimum:1}]},tags:{type:"array",uniqueItems:!0,items:{type:"string"}},functions:{type:"array",uniqueItems:!0,items:{type:"string"}},selectors:{type:"array",uniqueItems:!0,items:{type:"string"}},comments:{type:"array",uniqueItems:!0,items:{type:"string"}}}}],o2="no-await-in-promise-methods/error",o4="no-await-in-promise-methods/suggestion",o5=["all","allSettled","any","race"],o8="no-negation-in-equality-check/error",o6="no-negation-in-equality-check/suggestion",o9=new Set(["===","!==","==","!="]),o7=e=>"UnaryExpression"===e.type&&e.prefix&&"!"===e.operator;function se(e,{methods:t,messageId:r}){e.on("CallExpression",u=>{if(!rR(u,{methods:t,argumentsLength:2,optionalCall:!1}))return;let n=u.arguments[1],a=function(e,t){if("Identifier"===e.type&&"Infinity"===e.name)return"Infinity";if(rP(e,{object:"Number",property:"POSITIVE_INFINITY",computed:!1,optional:!1}))return"Number.POSITIVE_INFINITY";let r="ChainExpression"===e.type;if(r&&(e=e.expression),rP(e,{property:"length",computed:!1})&&ux(t,e.object))return`${"Identifier"===t.type?t.name:"…"}${r?"?.":"."}length`}(n,u.callee.object);if(!a)return;let i=u.callee.property.name,o={description:a};return"splice"===i?o.argumentName="deleteCount":"toSpliced"===i&&(o.argumentName="skipCount"),{node:n,messageId:r,data:o,fix:t=>u8(t,n,e)}})}let st="no-unnecessary-slice-end",sr="catch-error-name",su={create:e=>{let t=e.options[0],{name:r}=t,u=t.ignore.map(e=>eX.isRegExp(e)?e:RegExp(e,"u")),n=e=>e===r||u.some(t=>t.test(e))||e.endsWith(r)||e.endsWith(uU(r));e.on("Identifier",t=>{if(("CatchClause"!==t.parent.type||t.parent.param!==t)&&!(("FunctionExpression"===t.parent.type||"ArrowFunctionExpression"===t.parent.type)&&t.parent.params[0]===t&&(rR(t.parent.parent,{method:"then",argumentsLength:2,optionalCall:!1})||rR(t.parent.parent,{method:"catch",argumentsLength:1,optionalCall:!1}))&&t.parent.parent.arguments.at(-1)===t.parent))return;let u=t.name;if(n(u)||n(u.replaceAll(/_+$/g,"")))return;let a=tR(e.sourceCode.getScope(t),t);if(!a||"_"===u&&0===a.references.length)return;let i=r9(r,[a.scope,...a.references.map(({from:e})=>e)]),o={node:t,messageId:sr,data:{originalName:u,fixedName:i||r}};return i&&(o.fix=t=>ns(a,i,e,t)),o})},meta:{type:"suggestion",docs:{description:"Enforce a specific parameter name in catch clauses.",recommended:!0},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{name:{type:"string"},ignore:{type:"array",uniqueItems:!0}}}],defaultOptions:[{name:"error",ignore:[]}],messages:{[sr]:"The catch parameter `{{originalName}}` should be named `{{fixedName}}`."}}},sn="invalidExport",sa=/^(?:[A-Z][\da-z]*)*Error$/,si=e=>{if(!e.superClass)return!1;let{name:t,type:r,property:u}=e.superClass;return"MemberExpression"===r&&({name:t}=u),sa.test(t)},so=(e,t)=>{if("ExpressionStatement"!==e.type||"AssignmentExpression"!==e.expression.type)return!1;let r=e.expression.left;return!!r.object&&"ThisExpression"===r.object.type&&r.property.name===t};function*ss(e,t){if(!si(t)||null===t.id)return;let{name:r}=t.id,u=uU(r).replace(/(?:error|)$/i,"Error");r!==u&&(yield{node:t.id,message:`Invalid class name, use \`${u}\`.`});let{sourceCode:n}=e,{body:a}=t.body,i=n.getRange(t.body),o=a.find(e=>"constructor"===e.kind);if(!o)return void(yield{node:t,message:"Add a constructor to your error.",fix:e=>e.insertTextAfterRange([i[0],i[0]+1],`
16
16
  constructor() {
17
17
  super();
18
18
  this.name = '${r}';
19
19
  }
20
- `)});let s=o.value.body;if(!s)return;let d=s.body,l=d.find(e=>"ExpressionStatement"===e.type&&"CallExpression"===e.expression.type&&"Super"===e.expression.callee.type),c=d.findIndex(e=>si(e,"message"));if(l){if(-1!==c){let t=d[c];yield{node:l,message:"Pass the error message to `super()` instead of setting `this.message`.",*fix(r){if(0===l.expression.arguments.length){let u=t.expression.right,[a]=n.getRange(l);yield r.insertTextAfterRange([a,a+6],rg(u,e))}let u=0===c?n.getRange(s)[0]:n.getRange(d[c-1])[1],[,a]=n.getRange(t);yield r.removeRange([u,a])}}}}else yield{node:s,message:"Missing call to `super()` in constructor."};let f=d.find(e=>si(e,"name"));if(f)f.expression.right.value!==r&&(yield{node:f?.expression.right??s,message:`The \`name\` property should be set to \`${r}\`.`});else{let e=a.find(e=>"PropertyDefinition"===e.type&&!e.computed&&"Identifier"===e.key.type&&"name"===e.key.name);e?.value&&e.value.value===r||(yield{node:e?.value??s,message:`The \`name\` property should be set to \`${r}\`.`})}}let ss="no-lonely-if",sd=e=>"IfStatement"===e.type&&!e.alternate,sl=e=>"LogicalExpression"===e.type&&("||"===e.operator||"??"===e.operator)||"ConditionalExpression"===e.type||"AssignmentExpression"===e.type||"YieldExpression"===e.type||"SequenceExpression"===e.type;function sc(e,t){let r={ifToken:t.getFirstToken(e),openingParenthesisToken:t.getFirstToken(e,1)},{consequent:u}=e;return r.closingParenthesisToken=t.getTokenBefore(u),"BlockStatement"===u.type&&(r.openingBraceToken=t.getFirstToken(u),r.closingBraceToken=t.getLastToken(u)),r}let sf="no-magic-array-flat-depth",sp="no-negated-condition",sm="identifier",sg="non-identifier",sy="prefer-negative-index",sh=new Map([["slice",{argumentsIndexes:[0,1],supportObjects:new Set(["Array","String","ArrayBuffer",...ie])}],["subarray",{argumentsIndexes:[0,1],supportObjects:new Set(ie)}],["splice",{argumentsIndexes:[0],supportObjects:new Set(["Array"])}],["toSpliced",{argumentsIndexes:[0],supportObjects:new Set(["Array"])}],["at",{argumentsIndexes:[0],supportObjects:new Set(["Array","String",...ie])}],["with",{argumentsIndexes:[0],supportObjects:new Set(["Array",...ie])}]]),sb=e=>{let{type:t,property:r}=e;if("MemberExpression"===t&&"Identifier"===r.type)return r.name};var sD=["node:assert","assert","node:assert/strict","assert/strict","node:async_hooks","async_hooks","node:buffer","buffer","node:child_process","child_process","node:cluster","cluster","node:console","console","node:constants","constants","node:crypto","crypto","node:dgram","dgram","node:diagnostics_channel","diagnostics_channel","node:dns","dns","node:dns/promises","dns/promises","node:domain","domain","node:events","events","node:fs","fs","node:fs/promises","fs/promises","node:http","http","node:http2","http2","node:https","https","node:inspector","inspector","node:inspector/promises","inspector/promises","node:module","module","node:net","net","node:os","os","node:path","path","node:path/posix","path/posix","node:path/win32","path/win32","node:perf_hooks","perf_hooks","node:process","process","node:querystring","querystring","node:quic","node:readline","readline","node:readline/promises","readline/promises","node:repl","repl","node:sea","node:sqlite","node:stream","stream","node:stream/consumers","stream/consumers","node:stream/promises","stream/promises","node:stream/web","stream/web","node:string_decoder","string_decoder","node:test","node:test/reporters","node:timers","timers","node:timers/promises","timers/promises","node:tls","tls","node:trace_events","trace_events","node:tty","tty","node:url","url","node:util","util","node:util/types","util/types","node:v8","v8","node:vm","vm","node:wasi","wasi","node:worker_threads","worker_threads","node:zlib","zlib"];function sx(t){if("string"!=typeof t)throw TypeError("Expected a string");return(e??=new Set(sD)).has(t)}let sv="prefer-node-protocol",sE="node:",sA="consistent-date-clone/error",sC="no-accessor-recursion/error",sS=e=>"Identifier"===e.type||"PrivateIdentifier"===e.type,sF=(e,t)=>["type","name"].every(r=>e[r]===t[r]),sw=(e,t)=>"MemberExpression"===e.parent.type&&e.parent.object===e&&!e.parent.computed&&sS(e.parent.property)&&sF(e.parent.property,t.key),sk="error/calculate-dirname",sT="error/calculate-filename";function s_(e,{modules:t,functionName:r,sourceCode:u}){if(!rA(e,{optional:!1,argumentsLength:1}))return!1;let n=new Set;return function e(t,i){if("MemberExpression"===t.type)return!!("property"===i&&rP(t,{property:r,computed:!1,optional:!1}))&&e(t.object,"module");if("CallExpression"===t.type)return"module"===i&&rR(t,{object:"process",method:"getBuiltinModule",argumentsLength:1,optionalMember:!1,optionalCall:!1})&&a(t.arguments[0]);if("Identifier"!==t.type||n.has(t))return!1;n.add(t);let o=tR(u.getScope(t),t);if(o&&1===o.defs.length){var s=o.defs[0],d=i;if("ImportBinding"===s.type){if(!a(s.parent.source))return!1;let e=s.node;return"module"===d?e?.type==="ImportDefaultSpecifier"||e?.type==="ImportNamespaceSpecifier":e?.type==="ImportSpecifier"&&e.imported.name===r}return"Variable"===s.type&&function t(u,n){let{parent:a}=u;return"VariableDeclarator"===a.type?!!a.init&&a.id===u&&"VariableDeclaration"===a.parent.type&&"const"===a.parent.kind&&e(a.init,n):"Property"===a.type&&!!("property"===n&&a.value===u&&!a.computed&&"Identifier"===a.key.type&&a.key.name===r)&&t(a.parent,"module")}(s.name,d)}}(e.callee,"property");function a(e){return e?.type==="Literal"&&t.has(e.value)}}function sI(e,t){return s_(e,{modules:new Set(["url","node:url"]),functionName:"fileURLToPath",sourceCode:t})}function sB(e,t){return s_(e,{modules:new Set(["path","node:path"]),functionName:"dirname",sourceCode:t})}let sP="no-unnecessary-array-flat-depth",sR="no-unnecessary-array-splice-count",sL="no-useless-error-capture-stack-trace/error",sj="prefer-class-fields/error",sO="prefer-class-fields/suggestion",sN="prefer-bigint-literals/error",s$="prefer-bigint-literals/suggestion",sM="prefer-classlist-toggle/error",sz="prefer-classlist-toggle/suggestion",sU=e=>rP(e,{property:"classList",computed:!1}),sq=(e,t,r)=>{let u={node:r??e,messageId:sM};return"IfStatement"===e.type||r_(e)||r_(e.parent)?u.fix=t:u.suggest=[{messageId:sz,fix:t}],u},sW=(e,t,r)=>{let{sourceCode:u}=t,n=rg(e,t);if(r)return ry(e,u)||"UpdateExpression"!==e.type&&"BinaryExpression"!==e.type&&"LogicalExpression"!==e.type&&"ConditionalExpression"!==e.type&&"AssignmentExpression"!==e.type&&"ArrowFunctionExpression"!==e.type&&"YieldExpression"!==e.type&&"SequenceExpression"!==e.type||(n=`(${n})`),n=`!${n}`;return ry(e,u)||"SequenceExpression"!==e.type||(n=`(${n})`),n},sV=(e,t)=>rR(e,{methods:t,argumentsLength:1,optionalCall:!1,optionalMember:!1})&&sU(e.callee.object),sZ=(e,t)=>ux(e.callee.object,t.callee.object)&&ux(e.arguments[0],t.arguments[0]),sG=(e,t,r)=>t?("ChainExpression"===e.type&&(e=e.expression),sV(e,["contains"])&&sZ(e,r))?e:void 0:"UnaryExpression"===e.type&&"!"===e.operator&&e.prefix?sG(e.argument,!t,r):void 0,sH="require-module-attributes",sJ="error",sK="suggestion/array",sX="suggestion/object",sY="suggestion/object-assign",sQ="suggestion/set",s0="suggestion/map",s1=(e,t,r)=>{let{sourceCode:u}=r,n=un(e);return t.some(e=>{let t=u.getRange(e);return n.some(e=>{let[r,n]=u.getRange(e);return r>=t[0]&&n<=t[1]})})};function s3(e,t){if(!rC(e,{names:t,maximumArguments:1}))return!1;let[r]=e.arguments;return!r||"ArrayExpression"===r.type}function*s2(e,t,r){let u=!tN(t.sourceCode.getTokenBefore(e));yield function(e,t,r,u=!1){let{sourceCode:n}=t,{lines:a}=n,i=e;if(u){let[t,r]=n.getLastTokens(e,2);tN(r)&&(i=t)}let o=n.getLoc(e).start,s=n.getLoc(i).end,d=a[o.line-1].slice(0,o.column),l=a[s.line-1].slice(s.column),[c]=n.getRange(e),[,f]=n.getRange(i);return/^\s*$/.test(d)&&/^\s*$/.test(l)&&(c=Math.max(0,c-d.length-1),f+=l.length),r.removeRange([c,f])}(e,t,r,u)}function s4(e,t,r,u){let{sourceCode:n}=e,[a,i]=n.getLastTokens(r,2),o=("ArrayExpression"===r.type?r.elements:r.properties).length>0&&!tO(a);return t.insertTextBefore(i,`${o?",":""} ${u}`)}function*s5({context:e,fixer:t,newExpression:r,elementsText:u,nextExpressionStatement:n}){if(r7(r,e)){let[n]=r.arguments;if(n)yield s4(e,t,n,u);else{let{openingParenthesisToken:n}=r7(r,e)?ue(r,e):{};yield t.insertTextAfter(n,`[${u}]`)}}else yield t.insertTextAfter(r,`([${u}])`);yield*s2(n,e,t)}let s8=[{testValue:e=>e?.type==="ArrayExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let u=r.expression;if(rR(u,{object:t.name,methods:["push","unshift"],optionalMember:!1,optionalCall:!1})&&u.arguments.length>0&&!s1(t,u.arguments,e))return u},getProblem(e,t){let{context:r,assignType:u,getFix:n}=t,{sourceCode:a}=r,i=e.callee,o=i.property,s={node:i,messageId:sJ,data:{objectType:"array"}},d="unshift"===o.name,l=n(t,{callExpression:e,isPrepend:d});return e.arguments.some(e=>t9(e,a))?s.suggest=[{messageId:sK,fix:l,data:{operation:d?"Prepend":"Append",assignType:u}}]:s.fix=l,s},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{callExpression:u,isPrepend:n})=>function*(a){let i=ut(e,u,!1);yield n?a.insertTextAfter(e.sourceCode.getFirstToken(t),`${i}, `):s4(e,a,t,i),yield s2(r,e,a)}},{testValue:e=>e?.type==="ObjectExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let u=r.expression;if(!("AssignmentExpression"===u.type&&"="===u.operator&&rP(u.left,{object:t.name,optional:!1})))return;let n=u.right,a=u.left,{property:i}=a;if(!s1(t,a.computed?[i,n]:[n],e))return u},getProblem(e,t){let{context:r,assignType:u,getFix:n}=t,{sourceCode:a}=r,{left:i,right:o}=e,{property:s}=i,d=a.getTokenAfter(i,t=>"Punctuator"===t.type&&t.value===e.operator),l={node:e,loc:{start:a.getLoc(e).start,end:a.getLoc(d).end},messageId:sJ,data:{objectType:"object"}},c=n(t,{assignmentExpression:e,memberExpression:i,property:s,value:o});return i.computed&&t9(s,a)||t9(o,a)?l.suggest=[{messageId:sX,data:{assignType:u},fix:c}]:l.fix=c,l},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{memberExpression:u,property:n,value:a})=>function*(i){let o=rg(n,e);u.computed&&(o=`[${o}]`);let s=rg(a,e),d=`${o}: ${s},`,[l,c]=e.sourceCode.getLastTokens(t,2),f=t.properties.length>0&&!tO(l);yield i.insertTextBefore(c,`${f?",":""} ${d}`),yield s2(r,e,i)}},{testValue:e=>e?.type==="ObjectExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let u=r.expression;if(!rR(u,{object:"Object",method:"assign",minimumArguments:2,optionalMember:!1,optionalCall:!1}))return;let[n,a]=u.arguments;if(!("Identifier"!==n.type||n.name!==t.name||"SpreadElement"===a.type||s1(t,[a],e)))return u},getProblem(e,t){let{context:r,assignType:u,getFix:n}=t,{sourceCode:a}=r,[,i]=e.arguments,o={node:e.callee,messageId:sJ,data:{objectType:"object"}},s=n(t,{callExpression:e,firstValue:i});return t9(i,a)?o.suggest=[{messageId:sY,data:{description:"ObjectExpression"===i.type?"Move properties to":"Spread properties in",assignType:u},fix:s}]:o.fix=s,o},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{callExpression:u,firstValue:n})=>function*(a){let i;("ObjectExpression"===n.type?n.properties.length>0&&(i=function(e,t){let{sourceCode:r}=t,u=r.getFirstToken(e),[n,a]=r.getLastTokens(e,2),[,i]=r.getRange(u),[o]=r.getRange(tO(n)?n:a);return r.text.slice(i,o)}(n,e)):i=`...${rg(n,e)}`,i&&(yield s4(e,a,t,i)),2!==u.arguments.length)?yield u8(a,n,e):yield s2(r,e,a)}},{testValue:e=>s3(e,["Set","WeakSet"]),getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let u=r.expression;if(("ChainExpression"===u.type&&(u=u.expression),rR(u,{object:t.name,method:"add",argumentsLength:1,optionalMember:!1,optionalCall:!1}))&&!s1(t,u.arguments,e))return u},getProblem(e,t){let{context:r,assignType:u,valueNode:n,getFix:a}=t,{sourceCode:i}=r,o={node:e.callee,messageId:sJ,data:{objectType:`\`${n.callee.name}\``}},s=a(t,{callExpression:e,newExpression:n});return e.arguments.some(e=>t9(e,i))?o.suggest=[{messageId:sQ,data:{assignType:u},fix:s}]:o.fix=s,o},getFix:({context:e,nextExpressionStatement:t},{callExpression:r,newExpression:u})=>n=>{let a=ut(e,r,!1);return s5({context:e,fixer:n,newExpression:u,elementsText:a,nextExpressionStatement:t})}},{testValue:e=>s3(e,["Map","WeakMap"]),getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let u=r.expression;if(rR(u,{object:t.name,method:"set",argumentsLength:2,optionalCall:!1})&&!s1(t,u.arguments,e))return u},getProblem(e,t){let{context:r,assignType:u,valueNode:n,getFix:a}=t,{sourceCode:i}=r,o={node:e.callee,messageId:sJ,data:{objectType:`\`${n.callee.name}\``}},s=a(t,{callExpression:e,newExpression:n});return e.arguments.some(e=>t9(e,i))?o.suggest=[{messageId:s0,data:{assignType:u},fix:s}]:o.fix=s,o},getFix:({context:e,nextExpressionStatement:t},{callExpression:r,newExpression:u})=>n=>{let a=ut(e,r,!1);return s5({context:e,fixer:n,newExpression:u,elementsText:`[${a}]`,nextExpressionStatement:t})}}],s6="no-useless-collection-argument/error",s9="no-useless-collection-argument/suggestion",s7="prefer-response-static-json",de={configs:{node:{name:"@eslint-sukka/eslint-plugin-sukka-full node preset",plugins:{get sukka(){return de}},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 de}},rules:{"sukka/ban-eslint-disable":["error","allow-with-description"]}},regexp:{name:"@eslint-sukka/eslint-plugin-sukka-full regexp preset",plugins:{get sukka(){return de}},rules:{"sukka/unicorn/better-regex":"warn"}},recommended:{...eJ.eslint_plugin_sukka.configs.recommended,plugins:{get sukka(){return de}}},recommended_extra_with_typed_lint:{...eJ.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint,plugins:{get sukka(){return de}}}},rules:Object.assign(eJ.eslint_plugin_sukka.rules,{"array/no-unneeded-flat-map":e7,"browser/prefer-location-assign":tt,"jsx/no-template-literal":tu,"jsx/no-unneeded-nested":tn,"string/no-locale-case":ti,"string/no-simple-template-literal":to,"unicode/no-bidi":tm,"unicode/no-invisible":ty,"no-redundant-variable":th,"no-single-return":tD,"prefer-early-return":tv,"prefer-fetch":tE,"prefer-timer-id":tS,"string/no-unneeded-to-string":tF,"type/no-force-cast-via-top-type":tw,"type/no-wrapper-type-reference":tT,"no-default-error":t_},Object.fromEntries(Object.entries({"unicorn/better-regex":aK,"unicorn/catch-error-name":{create:e=>{let t=e.options[0],{name:r}=t,u=t.ignore.map(e=>eX.isRegExp(e)?e:RegExp(e,"u")),n=e=>e===r||u.some(t=>t.test(e))||e.endsWith(r)||e.endsWith(uU(r));e.on("Identifier",t=>{if(("CatchClause"!==t.parent.type||t.parent.param!==t)&&!(("FunctionExpression"===t.parent.type||"ArrowFunctionExpression"===t.parent.type)&&t.parent.params[0]===t&&(rR(t.parent.parent,{method:"then",argumentsLength:2,optionalCall:!1})||rR(t.parent.parent,{method:"catch",argumentsLength:1,optionalCall:!1}))&&t.parent.parent.arguments.at(-1)===t.parent))return;let u=t.name;if(n(u)||n(u.replaceAll(/_+$/g,"")))return;let a=tR(e.sourceCode.getScope(t),t);if(!a||"_"===u&&0===a.references.length)return;let i=r9(r,[a.scope,...a.references.map(({from:e})=>e)]),o={node:t,messageId:sr,data:{originalName:u,fixedName:i||r}};return i&&(o.fix=t=>ns(a,i,e,t)),o})},meta:{type:"suggestion",docs:{description:"Enforce a specific parameter name in catch clauses.",recommended:!0},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{name:{type:"string"},ignore:{type:"array",uniqueItems:!0}}}],defaultOptions:[{name:"error",ignore:[]}],messages:{[sr]:"The catch parameter `{{originalName}}` should be named `{{fixedName}}`."}}},"unicorn/custom-error-definition":{create:e=>{e.on("ClassDeclaration",t=>so(e,t)),e.on("AssignmentExpression",t=>{if("ClassExpression"===t.right.type)return so(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.left.property.name,r=e.right;if("ClassExpression"!==r.type||!sa(r)||!r.id)return;let u=r.id.name;return t!==u?{node:e.left.property,messageId:su,fix:t=>t.replaceText(e.left.property,u)}:void 0}})},meta:{type:"problem",docs:{description:"Enforce correct `Error` subclassing.",recommended:!1},fixable:"code",messages:{[su]:"Exported error name should match error class"}}},"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,u=r.getAncestors(t).toReversed(),n=u.findIndex(e=>"ConditionalExpression"!==e.type);return 1!==n||ry(t,e)?n>1?{node:n>2?u[n-3]:t,messageId:uq}:void 0:{node:t,messageId:uW,fix:e=>[e.insertTextBefore(t,"("),e.insertTextAfter(t,")")]}})},meta:{type:"suggestion",docs:{description:"Disallow nested ternary expressions.",recommended:!0},fixable:"code",messages:{[uq]:"Do not nest ternary expressions.",[uW]:"Nested ternary expression should be parenthesized."}}},"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!!(uZ.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)&&uG(e.parent.parent)&&uH(e.parent.parent.parent.init)||uG(e)&&rP(e.parent.init,{property:"EventEmitter",optional:!1,computed:!1})&&uH(e.parent.init.object))}(tR(r,t)?.defs[0]?.name))return{node:t,messageId:uV}})},meta:{type:"suggestion",docs:{description:"Prefer `EventTarget` over `EventEmitter`.",recommended:"unopinionated"},messages:{[uV]:"Prefer `EventTarget` over `EventEmitter`."}}},"unicorn/prefer-keyboard-event-key":{create:e=>{e.on("Identifier",t=>{if("keyCode"!==t.name&&"charCode"!==t.name&&"which"!==t.name)return;let{event:r,references:u}=uQ(e,t);if(r&&u&&u.some(e=>{let r;return r=e.identifier,t?.parent?.type==="MemberExpression"&&t.parent.object===r}))return u1(t)}),e.on("Property",t=>{let r=t.value.name;if(!uX.has(r))return;let{event:u,references:n}=uQ(e,t);if(!u)return;let a=u0(t,"VariableDeclarator"),i=a?.init;if(n&&n.some(e=>e.identifier===i))return u1(t.value);if("ObjectPattern"===u.type){for(let e of u.properties)if(e===t)return u1(t.value)}})},meta:{type:"suggestion",docs:{description:"Prefer `KeyboardEvent#key` over `KeyboardEvent#keyCode`.",recommended:"unopinionated"},fixable:"code",messages:{[uK]:"Use `.key` instead of `.{{name}}`."}}},"unicorn/prefer-text-content":{create:e=>{e.on("MemberExpression",e=>{if(!rP(e,{property:"innerText"}))return;let t=e.property;return{node:t,messageId:u3,suggest:[{messageId:u2,fix:e=>e.replaceText(t,"textContent")}]}}),e.on("Identifier",e=>{if("innerText"===e.name&&"Property"===e.parent.type&&e.parent.key===e&&!e.parent.computed&&"init"===e.parent.kind&&"ObjectPattern"===e.parent.parent.type&&e.parent.parent.properties.includes(e.parent))return{node:e,messageId:u3,suggest:[{messageId:u2,fix:t=>t.replaceText(e,e.parent.shorthand?"textContent: innerText":"textContent")}]}})},meta:{type:"suggestion",docs:{description:"Prefer `.textContent` over `.innerText`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[u3]:"Prefer `.textContent` over `.innerText`.",[u2]:"Switch to `.textContent`."}}},"unicorn/require-array-join-separator":{create:e=>{e.on("CallExpression",t=>{if(!(rR(t,{method:"join",argumentsLength:0,optionalCall:!1})||rR(t,{method:"call",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&rM(t.callee.object,{property:"join"})))return;let{sourceCode:r}=e,[u,n]=r.getLastTokens(t,2),a=1===t.arguments.length;return{loc:{start:r.getLoc(u)[a?"end":"start"],end:r.getLoc(n).end},messageId:nc,fix:r=>u5(r,t,"','",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the separator argument with `Array#join()`.",recommended:"unopinionated"},fixable:"code",messages:{[nc]:"Missing the separator argument."}}},"unicorn/no-thenable":{create:e=>{for(let{selector:t,selectors:r,messageId:u,getNodes:n}of nh)e.on(t??r,function*(t){for(let r of n(t,e))yield{node:r,messageId:u}})},meta:{type:"problem",docs:{description:"Disallow `then` property.",recommended:"unopinionated"},messages:{[nf]:"Do not add `then` to an object.",[np]:"Do not export `then`.",[nm]:"Do not add `then` to a class."}}},"unicorn/no-invalid-remove-event-listener":{create:e=>{e.on("CallExpression",t=>{if(!(rR(t,{method:"removeEventListener",minimumArguments:2,optionalCall:!1})&&"SpreadElement"!==t.arguments[0].type&&("FunctionExpression"===t.arguments[1].type||"ArrowFunctionExpression"===t.arguments[1].type||rR(t.arguments[1],{method:"bind",optionalCall:!1,optionalMember:!1}))))return;let[,r]=t.arguments;return["ArrowFunctionExpression","FunctionExpression"].includes(r.type)?{node:r,loc:tW(r,e.sourceCode),messageId:nb}:{node:r.callee.property,messageId:nb}})},meta:{type:"problem",docs:{description:"Prevent calling `EventTarget#removeEventListener()` with the result of an expression.",recommended:"unopinionated"},messages:{[nb]:"The listener argument should be a function reference."}}},"unicorn/consistent-function-scoping":nC,"unicorn/no-new-buffer":{create:e=>{let{sourceCode:t}=e;e.on("NewExpression",r=>{if(!rC(r,{name:"Buffer"}))return;let u=((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(function e(t,r){if(rD(t)||uo(t,"Math",ud)||"CallExpression"===t.type&&!t.optional&&uo(t.callee,"Math",ul)||us(t,"Number")||uo(t,"Number",uc)||"CallExpression"===t.type&&!t.optional&&uo(t.callee,"Number",uf)||us(t,"parseInt")||us(t,"parseFloat")||"MemberExpression"===t.type&&!t.computed&&!t.optional&&"Identifier"===t.property.type&&"length"===t.property.name)return!0;switch(t.type){case"AssignmentExpression":{let{operator:u}=t;if("="===u&&e(t.right,r))return!0}case"BinaryExpression":{let{operator:u}=t;if("AssignmentExpression"===t.type&&(u=u.slice(0,-1)),"+"===u&&e(t.left,r)&&e(t.right,r)||">>>"===u||up.has(u)&&(e(t.left,r)||e(t.right,r)))return!0;break}case"UnaryExpression":{let{operator:u}=t;if("+"===u||("-"===u||"~"===u)&&e(t.argument,r))return!0;break}case"UpdateExpression":if(e(t.argument,r))return!0;break;case"ConditionalExpression":{let u=e(t.consequent,r),n=e(t.alternate,r);if(u&&n)return!0;let a=t0(t.test,r);if(null!==a&&(a.value&&u||!a.value&&n))return!0;break}case"SequenceExpression":if(e(t.expressions.at(-1),r))return!0}return"number"==typeof t0(t,r)?.value}(r,t))return"alloc";let u=t0(r,t);if(u){let{value:e}=u;if("string"==typeof e||Array.isArray(e))return"from"}})(r.arguments,t.getScope(r));return u?{node:r,messageId:nS,data:{method:u},fix:nk(r,e,u)}:{node:r,messageId:nF,suggest:["from","alloc"].map(t=>({messageId:nw,data:{replacement:t},fix:nk(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:{[nS]:"`new Buffer()` is deprecated, use `Buffer.{{method}}()` instead.",[nF]:"`new Buffer()` is deprecated, use `Buffer.alloc()` or `Buffer.from()` instead.",[nw]:"Switch to `Buffer.{{replacement}}()`."}}},"unicorn/no-console-spaces":{create:e=>{let{sourceCode:t}=e,r=(r,u,n)=>{let[a,i]=t.getRange(r),o="leading"===n?a+1:i-2,s=[o,o+1];return{loc:u$(s,e),messageId:nT,data:{method:u,position:n},fix:e=>e.removeRange(s)}};e.on("CallExpression",function*(e){if(!rR(e,{object:"console",methods:["log","debug","info","warn","error"],minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let u=e.callee.property.name,{arguments:n}=e,{length:a}=n;for(let[e,i]of n.entries()){if(!rb(i)&&"TemplateLiteral"!==i.type)continue;let n=t.getText(i).slice(1,-1);0!==e&&n_(n)&&(yield r(i,u,"leading")),e!==a-1&&nI(n)&&(yield r(i,u,"trailing"))}})},meta:{type:"suggestion",docs:{description:"Do not use leading/trailing space between `console.log` parameters.",recommended:"unopinionated"},fixable:"code",messages:{[nT]:"Do not use {{position}} space between `console.{{method}}` parameters."}}},"unicorn/no-empty-file":{create:e=>{let t=e.physicalFilename;/\.(?:js|mjs|cjs|jsx|ts|mts|cts|tsx)$/i.test(t)&&e.on("Program",t=>{if(t.body.some(e=>!rw(e,rF)))return;let{sourceCode:r}=e;if(!r.getAllComments().some(e=>"Line"===e.type&&e.value.startsWith("/")))return{node:t,messageId:nB}})},meta:{type:"suggestion",docs:{description:"Disallow empty files.",recommended:"unopinionated"},messages:{[nB]:"Empty files are not allowed."}}},"unicorn/no-useless-fallback-in-spread":{create:e=>{e.on("ObjectExpression",t=>{if(rT(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:nP,*fix(r){let{sourceCode:u}=e,n=t.parent,{left:a}=n,i=ry(a,e),[,o]=i?rm(a,e):u.getRange(a),[,s]=u.getRange(n);yield r.removeRange([o,s]),(i||"SequenceExpression"!==a.type)&&(yield u4(n,r,e))}}})},meta:{type:"suggestion",docs:{description:"Disallow useless fallback when spreading in object literals.",recommended:"unopinionated"},fixable:"code",messages:{[nP]:"The empty object is useless."}}},"unicorn/no-useless-length-check":{create:e=>{let t=[],r=new Set,u=new Set,n=new Set,a=new Set;e.on("BinaryExpression",e=>{if("BinaryExpression"===e.type&&"Literal"===e.right.type&&"0"===e.right.raw&&rP(e.left,{property:"length",optional:!1})&&rz(e.parent)){let{operator:t}=e;"==="===t?r.add(e):(">"===t||"!=="===t)&&u.add(e)}}),e.on("CallExpression",e=>{rR(e,{optionalCall:!1,optionalMember:!1,computed:!1})&&"Identifier"===e.callee.property.type&&("some"===e.callee.property.name?n.add(e):"every"===e.callee.property.name&&a.add(e))}),e.on("LogicalExpression",e=>{rz(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,o)=>(function({node:e,operator:t,siblings:i}){return"||"===t&&r.has(e)&&i.some(t=>a.has(t)&&ux(e.left.object,t.callee.object))||"&&"===t&&u.has(e)&&i.some(t=>n.has(t)&&ux(e.left.object,t.callee.object))})({node:e,operator:t,siblings:[o[i-1],o[i+1]].filter(Boolean)}))})(e))),{sourceCode:o}=e;for(let t of i)yield{loc:{start:o.getLoc(t.left.property).start,end:o.getLoc(t).end},messageId:r.has(t)?"zero":"non-zero",fix(r){let{left:u,right:n}=t.parent,a=rm(u,e),i=rm(n,e),o=[];return u===t?(o[0]=a[0],o[1]=i[0]):(o[0]=a[1],o[1]=i[1]),r.removeRange(o)}}})},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."}}},"unicorn/no-useless-promise-resolve-reject":{create:e=>{e.on("CallExpression",t=>{if(!(rR(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:u}=function(e){let t,r=!1;for(;e;e=e.parent){if(rB(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"===t.name||"catch"===t.name||"finally"===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:u}=e,n=r.property.name;return{node:r,messageId:n,data:{type:"YieldExpression"===u.type?"yield":"return"},fix:t}}(t,function(e,t,r){if(e.arguments.length>1)return;let{callee:u,parent:n,arguments:[a]}=e;if(a?.type==="SpreadElement")return;let i="reject"===u.property.name,o="YieldExpression"===n.type;if(!i||!t&&(!o||"ExpressionStatement"===n.parent.type))return function(t){let u="ArrowFunctionExpression"===n.type,s=a?r.sourceCode.getText(a):"";if(a?.type==="SequenceExpression"&&(s=`(${s})`),i){if(s||="undefined",s=`throw ${s}`,o)return t.replaceTextRange(rm(n,r),s);if(s+=";",u)return s=`{ ${s} }`,t.replaceTextRange(rm(e,r),s)}else o?s=`yield${s?" ":""}${s}`:"ReturnStatement"===n.type?s=`return${s?" ":""}${s};`:(a?.type==="ObjectExpression"&&(s=`(${s})`),s||="{}");return t.replaceText(u?e:n,s)}}(t,u,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)`."}}},"unicorn/no-zero-fractions":{create:e=>{e.on("Literal",t=>{if(!rD(t))return;let{raw:r}=t,u=r.match(/^(?<before>[\d_]*)(?<dotAndFractions>\.[\d_]*)(?<after>.*)$/);if(!u)return;let{before:n,dotAndFractions:a,after:i}=u.groups,o=(n+a.replaceAll(/[.0_]+$/g,"")||"0")+i;if(o===r)return;let s="."===a,{sourceCode:d}=e,l=d.getRange(t)[0]+n.length+a.length;return{loc:u$([l-(r.length-o.length),l],e),messageId:s?nL:nR,*fix(r){let u=o;"MemberExpression"===t.parent.type&&t.parent.object===t&&uR.test(o)&&!ry(t,e)&&(u=`(${u})`,uS(d.getTokenBefore(t),e,u)&&(u=`;${u}`)),yield r.replaceText(t,u),yield nr(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow number literals with zero fractions or dangling dots.",recommended:"unopinionated"},fixable:"code",messages:{[nR]:"Don't use a zero fraction in the number.",[nL]:"Don't use a dangling dot in the number."}}},"unicorn/prefer-export-from":nW,"unicorn/prefer-native-coercion-functions":{create:e=>{e.on(rI,t=>{if(t.async||t.generator||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&&nG.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&&nH(e.body,t)?e.body:"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type&&nH(e.body.body[0].argument,t)?e.body.body[0].argument:void 0);if(!r)return;let{name:u}=r.callee,n={replacementFunction:u};return"FunctionDeclaration"===e.type||1!==r.arguments.length||(n.fix=t=>{let r=u;return"Property"===e.parent.type&&e.parent.method&&e.parent.value===e?r=`: ${r}`:"MethodDefinition"===e.parent.type&&(r=` = ${r};`),t.replaceText(e,r)}),n}(t);if(!r)return;let{sourceCode:u}=e,{replacementFunction:n,fix:a}=r;return r={node:t,loc:tW(t,u),messageId:nV,data:{functionNameWithKind:t2(t,u),replacementFunction:n}},!a||1!==t.params.length||u.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:{[nV]:"{{functionNameWithKind}} is equivalent to `{{replacementFunction}}`. Use `{{replacementFunction}}` directly."}}},"unicorn/no-document-cookie":{create(e){nY.listen({context:e})},meta:{type:"problem",docs:{description:"Do not use `document.cookie` directly.",recommended:"unopinionated"},messages:{[nX]:"Do not use `document.cookie` directly."}}},"unicorn/prefer-add-event-listener":n3,"unicorn/prefer-array-index-of":n9,"unicorn/prefer-blob-reading-methods":{create:e=>{e.on("CallExpression",e=>{if(!rR(e,{methods:["readAsText","readAsArrayBuffer"],argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let t=e.callee.property,r=t.name;return{node:t,messageId:n7,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:{[n7]:"Prefer `Blob#{{replacement}}()` over `FileReader#{{method}}(blob)`."}}},"unicorn/prefer-date-now":{create:e=>{e.on("CallExpression",e=>{if(rR(e,{methods:["getTime","valueOf"],argumentsLength:0,optionalCall:!1,optionalMember:!1})&&au(e.callee.object)){let t=e.callee.property;return an(e,{node:t,messageId:at,data:{method:t.name}})}if(rA(e,{names:["Number","BigInt"],argumentsLength:1,optional:!1})&&au(e.arguments[0])){let{name:t}=e.callee;return"Number"===t?an(e,{messageId:ar}):an(e.arguments[0])}}),e.on("UnaryExpression",t=>{if(("+"===t.operator||"-"===t.operator)&&au(t.argument))return an("-"===t.operator?t.argument:t,{},e)}),e.on("AssignmentExpression",e=>{if(("-="===e.operator||"*="===e.operator||"/="===e.operator||"%="===e.operator||"**="===e.operator)&&au(e.right))return an(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])au(t)&&(yield an(t))})},meta:{type:"suggestion",docs:{description:"Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.",recommended:"unopinionated"},fixable:"code",messages:{[ae]:"Prefer `Date.now()` over `new Date()`.",[at]:"Prefer `Date.now()` over `Date#{{method}}()`.",[ar]:"Prefer `Date.now()` over `Number(new Date())`."}}},"unicorn/prefer-dom-node-dataset":{create:e=>{e.on("CallExpression",t=>{if(!((rR(t,{method:"setAttribute",argumentsLength:2,optionalCall:!1,optionalMember:!1})||rR(t,{methods:["removeAttribute","hasAttribute"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||rR(t,{method:"getAttribute",argumentsLength:1,optionalCall:!1}))&&rb(t.arguments[0])))return;let r=t.callee.property.name;if(("AwaitExpression"!==t.parent.type||t.parent.argument!==t||"getAttribute"!==r)&&t.arguments[0].value.toLowerCase().startsWith("data-"))return{node:t,messageId:ai,data:{method:t.callee.property.name},fix:function(e,t){let r=e.callee.property.name;if(!("setAttribute"===r&&function e(t){return("MemberExpression"===t.type||"CallExpression"===t.type)&&(!!t.optional||"MemberExpression"===t.type&&e(t.object))}(e.callee))){if(("setAttribute"!==r||r_(e.parent))&&("removeAttribute"!==r||r_(e.parent)))return u=>{let[n]=e.arguments,a=n.value.toLowerCase().slice(5).replaceAll(/-[a-z]/g,e=>e[1].toUpperCase()),{sourceCode:i}=t,o="",s=`${i.getText(e.callee.object)}${e.callee.optional?"?":""}.dataset`;switch(r){case"setAttribute":case"getAttribute":case"removeAttribute":o=aa(a)?`.${a}`:`[${rH(a,n.raw.charAt(0))}]`,o=`${s}${o}`,"setAttribute"===r?o+=` = ${i.getText(e.arguments[1])}`:"removeAttribute"===r&&(o=`delete ${o}`);break;case"hasAttribute":o=`Object.hasOwn(${s}, ${rH(a,n.raw.charAt(0))})`}return u.replaceText(e,o)}}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Prefer using `.dataset` on DOM elements over calling attribute methods.",recommended:"unopinionated"},fixable:"code",messages:{[ai]:"Prefer `.dataset` over `{{method}}(…)`."}}},"unicorn/prefer-modern-math-apis":{create:e=>{let t=[];e.on("CallExpression",t=>{if(!rR(t,{object:"Math",method:"sqrt",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let r=ap(t.arguments[0]);if(r.some(e=>!("BinaryExpression"===e.type&&("*"===e.operator&&ux(e.left,e.right)||"**"===e.operator&&rh(e.right,2)))))return;let u=1===r.length?"abs":"hypot",n=new Set(1===r.length?[]:r.map(e=>e.parent));return{node:t.callee.property,messageId:ao,data:{replacement:`Math.${u}(…)`,description:"Math.sqrt(…)"},*fix(a){let{sourceCode:i}=e;for(let r of(yield a.replaceText(t.callee.property,u),n)){let t=i.getTokenAfter(r.left,e=>"Punctuator"===e.type&&"+"===e.value);yield nl(t,",",a,e),yield u4(r,a,e)}for(let t of r)yield a.removeRange([rm(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 af){let u=t(r,e);u&&(yield u)}})},meta:{type:"suggestion",docs:{description:"Prefer modern `Math` APIs over legacy patterns.",recommended:"unopinionated"},fixable:"code",messages:{[ao]:"Prefer `{{replacement}}` over `{{description}}`."}}},"unicorn/number-literal-case":ay,"unicorn/prefer-number-properties":av,"unicorn/prefer-reflect-apply":{create:e=>{e.on("CallExpression",t=>{if(!rR(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,u=((e,t)=>{if("apply"===t3(e.callee)&&2===e.arguments.length&&aA(e.arguments[0],e.arguments[1]))return r=>r.replaceText(e,aC(t,e.callee.object,e.arguments[0],e.arguments[1]))})(t,r)||((e,t)=>{if("call"===t3(e.callee)&&"apply"===t3(e.callee.object)&&"prototype"===t3(e.callee.object.object)&&e.callee.object.object.object?.type==="Identifier"&&"Function"===e.callee.object.object.object.name&&3===e.arguments.length&&aA(e.arguments[1],e.arguments[2]))return r=>r.replaceText(e,aC(t,e.arguments[0],e.arguments[1],e.arguments[2]))})(t,r);if(u)return{node:t,messageId:aE,fix:u}})},meta:{type:"suggestion",docs:{description:"Prefer `Reflect.apply()` over `Function#apply()`.",recommended:"unopinionated"},fixable:"code",messages:{[aE]:"Prefer `Reflect.apply()` over `Function#apply()`."}}},"unicorn/prefer-set-size":{create:e=>{let{sourceCode:t}=e;e.on("MemberExpression",r=>{var u;if(!rP(r,{property:"length",optional:!1}))return;let n="ArrayExpression"===(u=r.object).type&&1===u.elements.length&&u.elements[0]?.type==="SpreadElement"?u.elements[0].argument:rR(u,{object:"Array",method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})?u.arguments[0]:void 0;if(n&&function(e,t){if(aF(e))return!0;if("Identifier"!==e.type)return!1;let r=tR(t,e);if(!r||1!==r.defs.length)return!1;let[u]=r.defs;if("Variable"!==u.type||"const"!==u.kind)return!1;let n=u.node;return"VariableDeclarator"===n.type&&"Identifier"===n.id.type&&aF(u.node.init)}(n,t.getScope(n)))return{node:r.property,messageId:aS,fix:function(e,t,r){let{sourceCode:u}=e,{object:n,property:a}=t;if(!(u.getCommentsInside(n).length>u.getCommentsInside(r).length))return function*(i){yield i.replaceText(a,"size"),yield i.replaceText(n,u.getText(r)),"ArrayExpression"===n.type&&(yield nr(i,t,e))}}(e,r,n)}})},meta:{type:"suggestion",docs:{description:"Prefer using `Set#size` instead of `Array#length`.",recommended:"unopinionated"},fixable:"code",messages:{[aS]:"Prefer using `Set#size` instead of `Array#length`."}}},"unicorn/prefer-string-replace-all":{create:e=>{e.on("CallExpression",t=>{if(!rR(t,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1}))return;let{arguments:[r],callee:{property:u}}=t;if(!((e,t)=>{if(rx(e))return e.regex.flags.includes("g");if(rC(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=t0(e,t);if(!r)return!1;let{value:u}=r;return"[object RegExp]"===Object.prototype.toString.call(u)&&u.global})(r,e.sourceCode.getScope(r)))return;let n=u.name,a=function(e){let t;if(!rx(e))return;let{pattern:r,flags:u}=e.regex;if("g"!==u.replace("u","").replace("v",""))return;try{t=ak(r,u,{unicodePropertyEscape:u.includes("u"),unicodeSet:u.includes("v"),namedGroups:!0,lookbehind:!0})}catch{return}let n="alternative"===t.type?t.body:[t];if(!n.some(e=>"value"!==e.type))return"'"+n.map(e=>{let{kind:t,codePoint:r,raw:u}=e;if("controlLetter"===t)return 13===r?String.raw`\r`:10===r?String.raw`\n`:9===r?String.raw`\t`:String.raw`\u{${r.toString(16)}}`;if("octal"===t)return String.raw`\u{${r.toString(16)}}`;let n=u;return("identifier"===t&&(n=n.slice(1)),"'"===n||"\\"===n)?`\\${n}`:n}).join("")+"'"}(r);if("replaceAll"===n){if(!a)return;return{node:r,messageId:a_,data:{replacement:a.length<20?a:"a string literal"},fix:e=>e.replaceText(r,a)}}return{node:u,messageId:aT,*fix(e){yield e.insertTextAfter(u,"All"),a&&(yield e.replaceText(r,a))}}})},meta:{type:"suggestion",docs:{description:"Prefer `String#replaceAll()` over regex searches with the global flag.",recommended:"unopinionated"},fixable:"code",messages:{[aT]:"Prefer `String#replaceAll()` over `String#replace()`.",[a_]:"This pattern can be replaced with {{replacement}}."}}},"unicorn/prefer-string-slice":{create:e=>{e.on("CallExpression",t=>{if(!rR(t,{methods:["substr","substring"]}))return;let r=t.callee.property.name;return{node:t,messageId:r,*fix(u,{abort:n}){if(yield u.replaceText(t.callee.property,"slice"),0!==t.arguments.length){if(t.arguments.length>2||t.arguments.some(e=>"SpreadElement"===e.type))return n();yield("substr"===r?function*({node:e,fixer:t,context:r,abort:u}){let n=e.arguments,[a,i]=n;if(!i)return;let{sourceCode:o}=r,s=t0(a,o.getScope(e)),d=rm(i,r);if(s?.value===0){if(rD(i)||aB(i))return;if("number"==typeof aI(i)){let e;return void(yield(e=String(Math.max(0,aI(i))),u6(t,i,e,r)))}return yield t.insertTextBeforeRange(d,"Math.max(0, "),void(yield t.insertTextAfterRange(d,")"))}if(n.every(e=>rD(e))){let e;return void(yield(e=String(a.value+i.value),u6(t,i,e,r)))}return u()}:function*({node:e,fixer:t,context:r,abort:u}){let[n,a]=e.arguments,i=n?aI(n):void 0,o=rg(n,r);if(!a){if(aB(n))return;if(void 0!==i)return void(yield u6(t,n,String(Math.max(0,i)),r));let e=rm(n,r);return yield t.insertTextBeforeRange(e,"Math.max(0, "),void(yield t.insertTextAfterRange(e,")"))}let s=aI(a),d=rg(a,r);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 u6(t,n,String(e[0]),r)),e[1]!==s&&(yield u6(t,a,String(e[1]),r));return}if(0===i||0===s){yield u6(t,n,"0",r),yield u6(t,a,`Math.max(0, ${0===i?d:o})`,r);return}return u()})({node:t,fixer:u,context:e,abort:n})}}}})},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()`."}}},"unicorn/prefer-string-trim-start-end":{create:e=>{e.on("CallExpression",e=>{if(!rR(e,{methods:["trimLeft","trimRight"],argumentsLength:0,optionalCall:!1}))return;let t=e.callee.property,r=t.name,u="trimLeft"===r?"trimStart":"trimEnd";return{node:t,messageId:aP,data:{method:r,replacement:u},fix:e=>e.replaceText(t,u)}})},meta:{type:"suggestion",docs:{description:"Prefer `String#trimStart()` / `String#trimEnd()` over `String#trimLeft()` / `String#trimRight()`.",recommended:"unopinionated"},fixable:"code",messages:{[aP]:"Prefer `String#{{replacement}}()` over `String#{{method}}()`."}}},"unicorn/no-unreadable-iife":{create:e=>{e.on("CallExpression",t=>{if("ArrowFunctionExpression"===t.callee.type&&"BlockStatement"!==t.callee.body.type&&ry(t.callee.body,e))return{node:t,loc:u$(rm(t.callee.body,e),e),messageId:aR}})},meta:{type:"suggestion",docs:{description:"Disallow unreadable IIFEs.",recommended:"unopinionated"},hasSuggestions:!1,messages:{[aR]:"IIFE with parenthesized arrow function body is considered unreadable."}}},"unicorn/throw-new-error":{create:e=>{e.on("CallExpression",t=>{let{callee:r}=t;if(("Identifier"===r.type&&aj.test(r.name)||"MemberExpression"===r.type&&!r.computed&&"Identifier"===r.property.type&&aj.test(r.property.name))&&!rP(r,{object:"Data",property:"TaggedError",computed:!1}))return{node:t,messageId:aL,fix:r=>nu(t,e,r)}})},meta:{type:"suggestion",docs:{description:"Require `new` when creating an error.",recommended:"unopinionated"},fixable:"code",messages:{[aL]:"Use `new` when creating an error."}}},"unicorn/escape-case":{create:e=>{let t="lowercase"===e.options[0];e.on("Literal",e=>{if(rb(e))return a1({node:e,original:e.raw,lowercase:t})}),e.on("Literal",e=>{if(rx(e))return a1({node:e,original:e.raw,regex:a0,lowercase:t})}),e.on("TemplateElement",r=>{if(!rN(r.parent,["String.raw"]))return a1({node:r,original:r.value.raw,lowercase:t,fix:(t,u)=>nd(r,u,e,t)})})},meta:{type:"suggestion",docs:{description:"Require escape sequences to use uppercase or lowercase values.",recommended:"unopinionated"},fixable:"code",schema:[{enum:["uppercase","lowercase"]}],defaultOptions:["uppercase"],messages:{[aX]:"Use uppercase characters for the value of the escape sequence.",[aY]:"Use lowercase characters for the value of the escape sequence."}}},"unicorn/no-hex-escape":{create:e=>{e.on("Literal",t=>{if(rb(t)||rx(t))return a2(e,t,t.raw)}),e.on("TemplateElement",t=>{if(!rN(t.parent,["String.raw"]))return a2(e,t,t.value.raw)})},meta:{type:"suggestion",docs:{description:"Enforce the use of Unicode escapes instead of hexadecimal escapes.",recommended:"unopinionated"},fixable:"code",messages:{[a3]:"Use Unicode escapes instead of hexadecimal escapes."}}},"unicorn/prefer-prototype-methods":{create:function(e){let{sourceCode:t}=e,r=[];e.on("CallExpression",e=>{r.push(e)}),e.onExit("Program",function*(u){let n=new WeakMap;for(let{node:e,path:r}of new rs(t.getScope(u)).iterateGlobalReferences(Object.fromEntries(a4.map(e=>[e,{[rs.READ]:!0}]))))n.set(e,r);for(let t of r)yield function(e,{context:t,globalReferences:r}){let u;rR(e,{object:"Reflect",method:"apply",minimumArguments:1,optionalCall:!1,optionalMember:!1})?u=e.arguments[0]:rR(e,{methods:["apply","bind","call"],optionalCall:!1,optionalMember:!1})&&(u=e.callee.object);let{isGlobalReference:n,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(!rP(e,{optional:!1}))return;let u=e.object;if(rk(u)||rT(u))return{constructorName:"ArrayExpression"===u.type?"Array":"Object",methodName:t3(e,t.sourceCode.getScope(e))}}(u,{context:t,globalReferences:r})??{};if(a)return{node:u,messageId:i?"known-method":"unknown-method",data:{constructorName:a,methodName:i},*fix(r){if(n)return void(yield r.replaceText(u,`${a}.prototype.${i}`));if(rP(u)){let n=u.object;yield r.replaceText(n,`${a}.prototype`),("ArrayExpression"===n.type||"ObjectExpression"===n.type)&&(yield nr(r,e,t))}}}}(t,{context:e,globalReferences:n})})},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`."}}},"unicorn/error-message":{create:e=>{e.on(["CallExpression","NewExpression"],t=>{if(!(rS(t,{names:a5,optional:!1})&&e.sourceCode.isGlobalReference(t.callee)))return;let r=t.callee.name,u=a7.has(r)?a7.get(r):0,n=t.arguments;if(n.some((e,t)=>t<=u&&"SpreadElement"===e.type))return;let a=n[u];if(!a)return{node:t,messageId:a8,data:{constructorName:r}};if("ArrayExpression"===a.type||"ObjectExpression"===a.type)return{node:a,messageId:a9};let i=t0(a,e.sourceCode.getScope(a));if(!i)return;let{value:o}=i;return"string"!=typeof o?{node:a,messageId:a9}:""===o?{node:a,messageId:a6}:void 0})},meta:{type:"problem",docs:{description:"Enforce passing a `message` value when creating a built-in error.",recommended:"unopinionated"},messages:{[a8]:"Pass a message to the `{{constructorName}}` constructor.",[a6]:"Error message should not be an empty string.",[a9]:"Error message should be a string."}}},"unicorn/no-instanceof-builtins":is,"unicorn/prefer-type-error":{create:e=>{e.on("ThrowStatement",e=>{let t;if(rC(e.argument,{name:"Error"})&&e.parent&&e.parent.body&&1===e.parent.body.length&&e.parent.parent&&"IfStatement"===(t=e.parent.parent).type&&iy(t.test)){let t=e.argument.callee;return{node:t,messageId:id,fix:e=>e.insertTextBefore(t,"Type")}}})},meta:{type:"suggestion",docs:{description:"Enforce throwing `TypeError` in type checking conditions.",recommended:"unopinionated"},fixable:"code",messages:{[id]:"`new Error()` is too unspecific for a type check. Use `new TypeError()` instead."}}},"unicorn/consistent-destructuring":{create:e=>{let{sourceCode:t}=e,r=new Map;e.on("VariableDeclarator",e=>{"ObjectPattern"===e.id.type&&e.init&&"Literal"!==e.init.type&&(e=>{for(;e;){if(e.computed)return!1;if("MemberExpression"!==e.type)break;e=e.object}return"Identifier"===e.type||"ThisExpression"===e.type})(e.init)&&r.set(t.getText(e.init),{scope:t.getScope(e),variables:t.getDeclaredVariables(e),objectPattern:e.id})}),e.on("MemberExpression",e=>{if(e.computed||rS(e.parent)&&e.parent.callee===e||ui(e))return;let u=r.get(t.getText(e.object));if(!u)return;let{scope:n,objectPattern:a}=u,i=t.getScope(e);if(!((e,t)=>{for(;e;){if(e===t)return!0;e=e.upper}return!1})(i,n))return;let o=a.properties.filter(e=>"Property"===e.type&&"Identifier"===e.key.type&&"Identifier"===e.value.type),s=a.properties.at(-1),d=s&&"RestElement"===s.type,l=t.getText(e),c=t.getText(e.property),f=o.find(e=>e.key.name===c);if(!f&&(d||r9(c,[i])!==c))return;if("MemberExpression"===e.parent.type)return{node:e,messageId:ih};let p=f?f.value.name:c;return{node:e,messageId:ih,suggest:[{messageId:ib,data:{expression:l,property:p},*fix(t){let{properties:r}=a,u=r.at(-1);yield t.replaceText(e,p),f||(yield u?t.insertTextAfter(u,`, ${p}`):t.replaceText(a,`{${p}}`))}}]}})},meta:{type:"suggestion",docs:{description:"Use destructured variables over properties.",recommended:!1},hasSuggestions:!0,messages:{[ih]:"Use destructured variables over properties.",[ib]:"Replace `{{expression}}` with destructured property `{{property}}`."}}},"unicorn/new-for-builtins":{create:e=>{iE.listen({context:e}),iA.listen({context:e})},meta:{type:"suggestion",docs:{description:"Enforce the use of `new` for all builtins, except `String`, `Number`, `Boolean`, `Symbol` and `BigInt`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{enforce:"Use `new {{name}}()` instead of `{{name}}()`.",disallow:"Use `{{name}}()` instead of `new {{name}}()`.",[ix]:"Use `String(new Date())` instead of `Date()`.",[iv]:"Switch to `String(new Date())`."}}},"unicorn/prefer-single-call":ik,"unicorn/no-process-exit":{create:e=>{let t;if(0===e.sourceCode.lines[0].indexOf("#!"))return;let r=!1,u=[];e.on("CallExpression",e=>{rL(e)&&i_(e.arguments[0])&&(r=!0)}),e.on("ImportDeclaration",e=>{"Literal"===e.source.type&&i_(e.source)&&(r=!0)}),e.on("CallExpression",e=>{rR(e,{object:"process",methods:["on","once"],minimumArguments:1,optionalCall:!1,optionalMember:!1})&&(t=e)}),e.onExit("CallExpression",e=>{e===t&&(t=void 0)}),e.on("CallExpression",e=>{!t&&rR(e,{object:"process",method:"exit",optionalCall:!1,optionalMember:!1})&&u.push(e)}),e.onExit("Program",function*(){if(!r)for(let e of u)yield{node:e,messageId:iT}})},meta:{type:"suggestion",docs:{description:"Disallow `process.exit()`.",recommended:"unopinionated"},messages:{[iT]:"Only use `process.exit()` in CLI apps. Throw an error instead."}}},"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:u,readonly:n,accessibility:a,decorators:i,key:o}=e;return!(!iO(e)&&"MethodDefinition"!==e.type||!r||t||"PrivateIdentifier"===o.type||u||n||void 0!==a||Array.isArray(i)&&i.length>0)}(e))))return{node:t,loc:function(e,t){let{sourceCode:r}=t,{body:u}=e,n=r.getTokenBefore(u),{start:a}=r.getLoc(e),{end:i}=r.getLoc(n);return{start:a,end:i}}(t,e),messageId:iL,fix:function(e,t){let{type:r,id:u,body:n,declare:a,abstract:i,implements:o,parent:s}=e;if(a||i||Array.isArray(o)&&o.length>0||"ClassExpression"===r&&u)return;let d="ClassDeclaration"===e.type&&"ExportDefaultDeclaration"===e.parent.type&&e.parent.declaration===e;if(d&&u)return;let{sourceCode:l}=t;for(let e of n.body)if(iO(e)&&(e.typeAnnotation||e.value&&l.getText(e.value).includes("this")))return;return function*(u){let a=l.getFirstToken(e);if(rV(a,{expected:{type:"Keyword",value:"class"},ruleId:"no-static-only-class"}),d||"ClassExpression"===r)if("ClassExpression"===r&&"ReturnStatement"===s.type&&l.getLoc(n).start.line!==l.getLoc(s).start.line&&l.text.slice(l.getRange(a)[1],l.getRange(n)[0]).trim()){yield u.replaceText(a,"{");let e=l.getFirstToken(n);yield u.remove(e)}else yield u.replaceText(a,""),yield u7(a,t,u);else yield u.replaceText(a,"const"),yield u.insertTextBefore(n,"= "),yield u.insertTextAfter(n,";");for(let e of n.body)yield function*(e,t,r){let{sourceCode:u}=t,n=u.getFirstToken(e);rV(n,{expected:{type:"Keyword",value:"static"},ruleId:"no-static-only-class"}),yield r.remove(n),yield u7(n,t,r);let a=iO(e)?u.getLastToken(e):u.getTokenAfter(e),i=tN(a);if(iO(e)){let{key:t,value:n}=e;if(n){let e=u.getTokenAfter(t,ij);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,u)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Disallow classes that only have static members.",recommended:"unopinionated"},fixable:"code",messages:{[iL]:"Use an object instead of a class with only static members."}}},"unicorn/no-unreadable-array-destructuring":{create:e=>{let{sourceCode:t}=e;e.on("ArrayPattern",r=>{let{elements:u,parent:n}=r;if(u.length<3||!u.some((e,t,r)=>null===e&&null===r[t+1]))return;let a={node:r,messageId:iN},i=u.filter(e=>null!==e);if("VariableDeclarator"===n.type&&n.id===r&&null!==n.init&&1===i.length){let[o]=i;"AssignmentPattern"!==o.type&&(a.fix=function*(a){let i=u.indexOf(o),s="RestElement"===o.type,d=s?o.argument:o;yield a.replaceText(r,t.getText(d));let l=s?`.slice(${i})`:`[${i}]`,c=n.init;!ry(c,e)&&uL(c,e)?(yield a.insertTextBefore(c,"("),yield a.insertTextAfter(n,`)${l}`)):yield a.insertTextAfter(n,l),yield nr(a,r,e)})}return a})},meta:{type:"suggestion",docs:{description:"Disallow unreadable array destructuring.",recommended:"unopinionated"},fixable:"code",messages:{[iN]:"Array destructuring may not contain consecutive ignored values."}}},"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)||rS(r.parent.parent)&&r.parent.parent.arguments.includes(r.parent)))))return;let u=r.parent,n=t.getFirstToken(u),a=u.parent.type;return{node:n,messageId:i$,data:{argumentType:"ArrayExpression"===r.type?"array":"object",parentDescription:iV[a]},*fix(i){let o;yield i.remove(n),yield u4(r,i,e);let s=t.getFirstToken(r);yield i.remove(s);let[d,l]=t.getLastTokens(r,2);if(yield i.remove(l),tO(d)&&(yield i.remove(d)),rk(r)||rT(r)){let e=t.getTokenAfter(u);tO(e)&&(yield i.remove(e))}if("CallExpression"===a||"NewExpression"===a)for(let[e,u]of(o=t.getFirstToken(r),r.elements.map((e,u,n)=>{if(u===n.length-1){let e=t.getLastToken(r,{skip:1});return tO(e)?e:void 0}let a=t.getTokenAfter(e||o,tO);return o=a,a})).entries())r.elements[e]||(yield i.insertTextBefore(u,"undefined"))}}}),e.on("ArrayExpression",t=>{if(!iW(t))return;let{parent:r}=t;if(!("ForOfStatement"===r.type&&r.right===t||"YieldExpression"===r.type&&r.delegate&&r.argument===t||(rC(r,{names:["Map","WeakMap","Set","WeakSet"],argumentsLength:1})||rC(r,{names:ie,minimumArguments:1})||rR(r,{object:"Promise",methods:["all","allSettled","any","race"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||rR(r,{objects:["Array",...ie],method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})||rR(r,{object:"Object",method:"fromEntries",argumentsLength:1,optionalCall:!1,optionalMember:!1}))&&r.arguments[0]===t))return;let u="",n=iM;switch(r.type){case"ForOfStatement":n=iz;break;case"YieldExpression":n=iU;break;case"NewExpression":u=`new ${r.callee.name}(…)`;break;case"CallExpression":u=`${r.callee.object.name}.${r.callee.property.name}(…)`}return{node:t,messageId:n,data:{parentDescription:u},fix:r=>iZ(r,t,e)}}),e.on("ArrayExpression",t=>{if(!iW(t))return;let r=t.elements[0].argument;if(!(rR(r,{methods:["concat","copyWithin","flat","slice","splice","toReversed","toSorted","toSpliced","with"],optionalCall:!1,optionalMember:!1})||rR(r,{method:"split",optionalCall:!1,optionalMember:!1})||rR(r,{object:"Object",methods:["keys","values"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||"AwaitExpression"===r.type&&rR(r.argument,{object:"Promise",methods:["all","allSettled"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||rR(r,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1})||rC(r,{name:"Array"})))return;let u={node:t,messageId:iq};return rC(r,{name:"Array"})||"CallExpression"===r.type&&"MemberExpression"===r.callee.type&&"Identifier"===r.callee.property.type&&"slice"===r.callee.property.name?u:Object.assign(u,{fix:r=>iZ(r,t,e)})})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary spread.",recommended:"unopinionated"},fixable:"code",messages:{[i$]:"Spread an {{argumentType}} literal in {{parentDescription}} is unnecessary.",[iM]:"`{{parentDescription}}` accepts iterable as argument, it's unnecessary to convert to an array.",[iz]:"`for…of` can iterate over iterable, it's unnecessary to convert to an array.",[iU]:"`yield*` can delegate iterable, it's unnecessary to convert to an array.",[iq]:"Unnecessarily cloning an array."}}},"unicorn/no-useless-switch-case":{create:e=>{e.on("SwitchStatement",function*(t){let{cases:r}=t;if(!(r.length<2)&&null===r.at(-1).test)for(let t=r.length-2;t>=0;t--){let u=r[t];if(!iJ(u))break;yield{node:u,loc:function(e,t){let{sourceCode:r}=t,u=e.test||r.getFirstToken(e),n=r.getTokenAfter(u,t$);return{start:r.getLoc(e).start,end:r.getLoc(n).end}}(u,e),messageId:iG,suggest:[{messageId:iH,fix:e=>e.remove(u)}]}}})},meta:{type:"suggestion",docs:{description:"Disallow useless case in switch statements.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[iG]:"Useless case in switch statement.",[iH]:"Remove this case."}}},"unicorn/no-useless-undefined":iY,"unicorn/numeric-separators-style":i3,"unicorn/prefer-array-find":ol,"unicorn/prefer-array-flat-map":{create:e=>{e.on("CallExpression",t=>{if(!(rR(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)&&rR(t.callee.object,{method:"map",optionalCall:!1})))return;let r=t.callee.object;if(rO(r.callee.object,of))return;let{sourceCode:u}=e,n=r.callee.property;return{node:t,loc:{start:u.getLoc(n).start,end:u.getLoc(t).end},messageId:oc,*fix(r){yield ni(r,t,e),yield r.replaceText(n,"flatMap")}}})},meta:{type:"suggestion",docs:{description:"Prefer `.flatMap(…)` over `.map(…).flat()`.",recommended:"unopinionated"},fixable:"code",messages:{[oc]:"Prefer `.flatMap(…)` over `.map(…).flat()`."}}},"unicorn/prefer-array-flat":oD,"unicorn/prefer-array-some":oA,"unicorn/prefer-code-point":{create:e=>{e.on("CallExpression",e=>{if(rR(e,{method:"charCodeAt",optionalCall:!1}))return oC(e.callee.property,"codePointAt")}),e.on("MemberExpression",e=>{if(rP(e,{object:"String",property:"fromCharCode",optional:!1}))return oC(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()`."}}},"unicorn/prefer-default-parameters":{create:e=>{let{sourceCode:t}=e,r=[],u=(e,u,n,a)=>{let i,o=r.at(-1);if(!o||!u||!n||"Identifier"!==u.type||"LogicalExpression"!==n.type||"||"!==n.operator&&"??"!==n.operator||"Identifier"!==n.left.type||"Literal"!==n.right.type)return;let{name:s}=u,{left:{name:d},right:{raw:l}}=n;if(a&&s!==d)return;let c=tR(t.getScope(e),d);if(!c)return;let{references:f}=c,{params:p}=o,m=p.find(e=>"Identifier"===e.type&&e.name===d);if(((e,t,r)=>{for(let u of t.body.body){if(u===r)break;if(ow(e,u))return!0}return!1})(t,o,e)||a&&f[0].identifier!==u||!a&&f.length>1||(i=p.at(-1),!m||m!==i))return;let g=((e,t)=>{if("ArrowFunctionExpression"!==t.type||t.params.length>1)return!1;let[r]=t.params,u=e.getTokenBefore(r),n=e.getTokenAfter(r);return!n||!u||"("!==u.value||")"!==n.value})(t,o)?`(${s} = ${l})`:`${s} = ${l}`;return{node:e,messageId:oS,suggest:[{messageId:oF,fix:r=>[r.replaceText(m,g),((e,t,r)=>{let{line:u}=t.getLoc(r).start,{column:n}=t.getLoc(r).end,a=t.getText(r),i=t.lines[u-1],o=i.trim()===a,s=" "===i[n];if(o)return e.removeRange([t.getIndexFromLoc({line:u,column:0}),t.getIndexFromLoc({line:u+1,column:0})]);if(s){let[u,n]=t.getRange(r);return e.removeRange([u,n+1])}return e.remove(r)})(r,t,e)]}]}};e.on(rI,e=>{r.push(e)}),e.onExit(rI,()=>{r.pop()}),e.on("AssignmentExpression",e=>{if("ExpressionStatement"===e.parent.type&&e.parent.expression===e)return u(e.parent,e.left,e.right,!0)}),e.on("VariableDeclarator",e=>{if("VariableDeclaration"===e.parent.type&&e.parent.declarations[0]===e)return u(e.parent,e.id,e.init,!1)})},meta:{type:"suggestion",docs:{description:"Prefer default parameters over reassignment.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[oS]:"Prefer default parameters over reassignment.",[oF]:"Replace reassignment with default parameter."}}},"unicorn/prefer-logical-operator-over-ternary":{create:e=>{let{sourceCode:t}=e;e.on("ConditionalExpression",r=>{let{test:u,consequent:n,alternate:a}=r;return o_(u,n,t)?oI({context:e,conditionalExpression:r,left:u,right:a}):"UnaryExpression"===u.type&&"!"===u.operator&&u.prefix&&o_(u.argument,a,t)?oI({context:e,conditionalExpression:r,left:u.argument,right:n}):void 0})},meta:{type:"suggestion",docs:{description:"Prefer using a logical operator over a ternary.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[ok]:"Prefer using a logical operator over a ternary.",[oT]:"Switch to `{{operator}}` operator."}}},"unicorn/prefer-optional-catch-binding":{create:e=>{e.on("CatchClause",t=>{let r=t.param;if(!r)return;let{sourceCode:u}=e;if(u.getDeclaredVariables(r.parent).some(e=>e.references.length>0))return;let{type:n,name:a,parent:i}=r;return{node:r,messageId:"Identifier"===n?oB:oP,data:{name:a},*fix(e){let t=u.getTokenBefore(r);rV(t,{test:tM,expected:"(",ruleId:"prefer-optional-catch-binding"});let n=u.getTokenAfter(r);rV(n,{test:tz,expected:")",ruleId:"prefer-optional-catch-binding"}),yield e.remove(t),yield e.remove(r),yield e.remove(n);let[,a]=u.getRange(n),[o]=u.getRange(i.body),s=u.text.slice(a,o),d=s.length-s.trimStart().length;0!==d&&(yield e.removeRange([a,a+d]))}}})},meta:{type:"suggestion",docs:{description:"Prefer omitting the `catch` binding parameter.",recommended:"unopinionated"},fixable:"code",messages:{[oB]:"Remove unused catch binding `{{name}}`.",[oP]:"Remove unused catch binding."}}},"unicorn/prefer-regexp-test":oM,"unicorn/prefer-set-has":{create:e=>{e.on("Identifier",t=>{let{parent:r}=t;if(!("VariableDeclarator"===r.type&&r.id===t&&r.init&&"VariableDeclaration"===r.parent.type&&r.parent.declarations.includes(r)&&("ExportNamedDeclaration"!==r.parent.parent.type||r.parent.parent.declaration!==r.parent)&&("ArrayExpression"===r.init.type||rS(r.init,{name:"Array",optional:!1})||rR(r.init,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1})||rR(r.init,{methods:oq,optionalCall:!1,optionalMember:!1}))))return;let u=tR(e.sourceCode.getScope(t),t);if(!u)return;let n=un(u).filter(e=>e!==t);if(0===n.length||n.some(e=>!(rR(e.parent.parent,{method:"includes",optionalCall:!1,optionalMember:!1,argumentsLength:1})&&e.parent.object===e))||1===n.length&&n.every(e=>!((e,t)=>{let r=t.parent.parent.parent,{parent:u}=e.parent;for(;u&&u!==r;){if(oW.has(u.type))return!0;u=u.parent}return!1})(e,t)))return;let a={node:t,messageId:oz,data:{name:t.name}},i=function*(e){for(let r of(yield e.insertTextBefore(t.parent.init,"new Set("),yield e.insertTextAfter(t.parent.init,")"),n))yield e.replaceText(r.parent.property,"has")};return t.typeAnnotation?a.suggest=[{messageId:oU,fix:i}]:a.fix=i,a})},meta:{type:"suggestion",docs:{description:"Prefer `Set#has()` over `Array#includes()` when checking for existence or non-existence.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[oz]:"`{{name}}` should be a `Set`, and use `{{name}}.has()` to check existence or non-existence.",[oU]:"Switch `{{name}}` to `Set`."}}},"unicorn/prefer-string-raw":{create:e=>{e.on("Literal",t=>{if(!rb(t)||function(e){let{parent:t}=e,{type:r}=t;return rF(t)||("Property"===r||"PropertyDefinition"===r||"MethodDefinition"===r||"AccessorProperty"===r)&&!t.computed&&t.key===e||("TSAbstractPropertyDefinition"===r||"TSAbstractMethodDefinition"===r||"TSAbstractAccessorProperty"===r||"TSPropertySignature"===r)&&t.key===e||("ImportDeclaration"===r||"ExportNamedDeclaration"===r||"ExportAllDeclaration"===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)||oV(t))return;let{sourceCode:r}=e,{raw:u}=t;if("\\"===u.at(-2)||!u.includes("\\\\")||u.includes("`")||u.includes("${")||r.getLoc(t).start.line!==r.getLoc(t).end.line)return;let n=oG(u.slice(1,-1),u.charAt(0));if(n===t.value)return{node:t,messageId:oZ,*fix(r){yield nr(r,t,e),yield r.replaceText(t,`String.raw\`${n}\``)}}}),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)||oG(t)!==e)||oV(t)))return{node:t,messageId:oZ,*fix(r){for(let u of(yield nr(r,t,e),yield r.insertTextBefore(t,"String.raw"),t.quasis)){let{cooked:t,raw:n}=u.value;t!==n&&(yield nd(u,t,e,r))}}}})},meta:{type:"suggestion",docs:{description:"Prefer using the `String.raw` tag to avoid escaping `\\`.",recommended:"unopinionated"},fixable:"code",messages:{[oZ]:"`String.raw` should be used to avoid escaping `\\`."}}},"unicorn/prefer-switch":oQ,"unicorn/require-number-to-fixed-digits-argument":{create:e=>{e.on("CallExpression",t=>{if(!rR(t,{method:"toFixed",argumentsLength:0,optionalCall:!1})||"NewExpression"===t.callee.object.type)return;let{sourceCode:r}=e,[u,n]=r.getLastTokens(t,2);return{loc:{start:r.getLoc(u).start,end:r.getLoc(n).end},messageId:o0,fix:r=>u5(r,t,"0",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the digits argument with `Number#toFixed()`.",recommended:"unopinionated"},fixable:"code",messages:{[o0]:"Missing the digits argument."}}},"unicorn/template-indent":{create:e=>{let{sourceCode:t}=e,r={...e.options[0]};r.comments=r.comments.map(e=>e.toLowerCase());let u=new WeakSet,n=n=>{let a;if("TemplateLiteral"!==n.type||u.has(n))return;u.add(n);let i="__PLACEHOLDER__"+Math.random(),o=n.quasis.map(e=>t.getText(e).slice(1,e.tail?-1:-2)).join(i),s=o.match(/\r?\n/);if(!s)return;let d=s[0],l=t.lines[t.getLoc(n).start.line-1].match(/^(\s*)\S/),c=l?l[1]:"";a="string"==typeof r.indent?r.indent:"number"==typeof r.indent?" ".repeat(r.indent):c.startsWith(" ")?" ":" ";let f=(function(e){let t=e.match(/^[ \t]*(?=\S)/gm);if(!t)return e;let r=1/0;for(let e of t)r=Math.min(r,e.length);return 0===r||r===1/0?e:e.replace(RegExp(`^[ \\t]{${r}}`,"gm"),"")})(o).replaceAll(RegExp(`^${d}|${d}[ ]*$`,"g"),""),p=d+function(e,t=1,r={}){let{indent:u=" ",includeEmptyLines:n=!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 u)throw TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof u}\``);return 0===t?e:e.replace(n?/^/gm:/^(?!\s*$)/gm,u.repeat(t))}(f,1,{indent:c+a})+d+c;if(p!==o)return{node:n,messageId:o1,fix:t=>p.split(i).map((r,u)=>nd(n.quasis[u],r,e,t))}};e.on("TemplateLiteral",e=>{if((e=>{if(r.comments.length>0){let u=t.getTokenBefore(e,{includeComments:!0});if(u?.type==="Block"&&r.comments.includes(u.value.trim().toLowerCase()))return!0}return!!(oV(e)||r.tags.length>0&&rN(e,r.tags)||r.functions.length>0&&"CallExpression"===e.parent.type&&e.parent.arguments.includes(e)&&rO(e.parent.callee,r.functions))})(e))return n(e)}),e.on(r.selectors,e=>n(e))},meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation.",recommended:!0},fixable:"code",schema:o3,defaultOptions:[{tags:["outdent","dedent","gql","sql","html","styled"],functions:["dedent","stripIndent"],selectors:[],comments:["HTML","indent"]}],messages:{[o1]:"Templates should be properly indented."}}},"unicorn/no-single-promise-in-promise-methods":{create:e=>{e.on("CallExpression",t=>{if(!(rR(t,{object:"Promise",methods:iR,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,u={node:t.arguments[0],messageId:iI,data:{method:r}},{sourceCode:n}=e;if("AwaitExpression"===t.parent.type&&t.parent.argument===t&&("all"!==r||r_(t.parent.parent)))return u.fix=r=>{let[u]=t.arguments[0].elements,n=rg(u,e);return ry(u,e)||"SequenceExpression"!==u.type&&"YieldExpression"!==u.type&&"ArrowFunctionExpression"!==u.type&&"ConditionalExpression"!==u.type&&"AssignmentExpression"!==u.type&&"LogicalExpression"!==u.type&&"BinaryExpression"!==u.type||(n=`(${n})`),r.replaceText(t,n)},u;return"all"===r?u:(u.suggest=[{messageId:iB,fix:r=>{let[u]=t.arguments[0].elements,n=rg(u,e);return ry(u,e)||"Identifier"===u.type||"MemberExpression"===u.type||(n=`(${n})`),uS(e.sourceCode.getTokenBefore(t),e,n)&&(n=`;${n}`),r.replaceText(t,n)}},{messageId:iP,fix:function*(e){let r=t.callee.property;yield e.replaceText(r,"resolve");let[u]=t.arguments,a=n.getFirstToken(u),[i,o]=n.getLastTokens(u,2);yield e.remove(a),yield e.remove(o),tO(i)&&(yield e.remove(i))}}],u)})},meta:{type:"suggestion",docs:{description:"Disallow passing single-element arrays to `Promise` methods.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[iI]:"Wrapping single-element array with `Promise.{{method}}()` is unnecessary.",[iB]:"Use the value directly.",[iP]:"Switch to `Promise.resolve(…)`."}}},"unicorn/no-await-in-promise-methods":{create:e=>{e.on("CallExpression",function*(t){if(rR(t,{object:"Promise",methods:o5,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:o2,data:{method:t.callee.property.name},suggest:[{messageId:o4,*fix(t){let u=e.sourceCode.getFirstToken(r);yield t.remove(u),yield u7(u,e,t)}}]})})},meta:{type:"suggestion",docs:{description:"Disallow using `await` in `Promise` method parameters.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[o2]:"Promise in `Promise.{{method}}()` should not be awaited.",[o4]:"Remove `await`."}}},"unicorn/no-negation-in-equality-check":{create:e=>{e.on("BinaryExpression",t=>{let{operator:r,left:u}=t;if(!("BinaryExpression"===t.type&&o9.has(t.operator)&&o7(u)&&!o7(u.argument)))return;let{sourceCode:n}=e,a=n.getFirstToken(u),i=`${r.startsWith("!")?"=":"!"}${r.slice(1)}`;return{node:a,messageId:o8,suggest:[{messageId:o6,data:{operator:i},*fix(o){yield nr(o,t,e);let s=n.getTokenAfter(a),{parent:d}=t;("ReturnStatement"===d.type||"ThrowStatement"===d.type)&&!ry(t,e)&&(uh(n.getFirstToken(d),s,e)||(yield u9(o,d,e))),yield o.remove(a),uS(n.getTokenBefore(a),e,s.value)&&(yield o.insertTextAfter(a,";"));let l=n.getTokenAfter(u,e=>"Punctuator"===e.type&&e.value===r);yield o.replaceText(l,i)}}]}})},meta:{type:"problem",docs:{description:"Disallow negated expression in equality check.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[o8]:"Negated expression is not allowed in equality check.",[o6]:"Switch to '{{operator}}' check."}}},"unicorn/no-unnecessary-slice-end":{create(e){se(e,{methods:["slice"],messageId:st})},meta:{type:"suggestion",docs:{description:"Disallow using `.length` or `Infinity` as the `end` argument of `{Array,String,TypedArray}#slice()`.",recommended:"unopinionated"},fixable:"code",messages:{[st]:"Passing `{{description}}` as the `end` argument is unnecessary."}}},"unicorn/no-lonely-if":{create:e=>{e.on("IfStatement",t=>{if(sd(t)&&("BlockStatement"===t.parent.type&&1===t.parent.body.length&&t.parent.body[0]===t&&sd(t.parent.parent)&&t.parent.parent.consequent===t.parent||sd(t.parent)&&t.parent.consequent===t))return{node:t,messageId:ss,fix:function(e,t){let{sourceCode:r}=t;return function*(u){let n=("BlockStatement"===e.parent.type?e.parent:e).parent,a={...n,...sc(n,r)},i={...e,...sc(e,r)};if(yield u.remove(i.ifToken),yield u7(i.ifToken,t,u),a.openingBraceToken){yield u.remove(a.openingBraceToken),yield u7(a.openingBraceToken,t,u),yield u.remove(a.closingBraceToken);let e=r.getTokenBefore(a.closingBraceToken,{includeComments:!0});yield u7(e,t,u)}for(let{test:e,openingParenthesisToken:r,closingParenthesisToken:n}of(yield u.insertTextBefore(a.openingParenthesisToken,"("),yield u.insertTextAfter(i.closingParenthesisToken,`)${"EmptyStatement"===i.consequent.type?"":" "}`),yield u.insertTextAfter(a.closingParenthesisToken," && "),[a,i]))(ry(e,t)||!sl(e))&&(yield u.remove(r),yield u.remove(n)),yield u7(n,t,u);if("BlockStatement"!==i.consequent.type){let e=r.getLastToken(i.consequent);if(tq(e)){let n=r.getTokenAfter(a);n&&uS(e,t,n.value)&&(yield u.insertTextBefore(n,";"))}}}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Disallow `if` statements as the only statement in `if` blocks without `else`.",recommended:"unopinionated"},fixable:"code",messages:{[ss]:"Unexpected `if` as the only statement in a `if` block without `else`."}}},"unicorn/no-magic-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!rR(t,{method:"flat",argumentsLength:1,optionalCall:!1}))return;let[r]=t.arguments;if(!rD(r)||1===r.value)return;let{sourceCode:u}=e,{openingParenthesisToken:n,closingParenthesisToken:a}=ue(t,e);if(!u.commentsExistBetween(n,a))return{node:r,messageId:sf}})},meta:{type:"suggestion",docs:{description:"Disallow a magic number as the `depth` argument in `Array#flat(…).`",recommended:"unopinionated"},messages:{[sf]:"Magic number as depth is not allowed."}}},"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:sp,*fix(u){if(yield function*(e,t,r){let{sourceCode:u}=r,{test:n}=t;if("UnaryExpression"===n.type){let a=u.getFirstToken(n);"IfStatement"===t.type&&(yield u4(n.argument,e,r)),yield e.remove(a);return}let a=u.getTokenAfter(n.left,e=>"Punctuator"===e.type&&e.value===n.operator);yield e.replaceText(a,"="+a.value.slice(1))}(u,t,e),yield function*(e,t,r){let u="IfStatement"===t.type,[n,a]=[t.consequent,t.alternate].map(e=>{let t=rm(e,r),n=r.sourceCode.text.slice(...t);return u&&"BlockStatement"!==e.type&&(n=`{${n}}`),{range:t,text:n}});if(n.text===a.text)return;let{sourceCode:i}=r;yield e.replaceTextRange(i.getRange(n),a.text),yield e.replaceTextRange(i.getRange(a),n.text)}(u,t,e),"ConditionalExpression"!==t.type||"UnaryExpression"!==r.type)return;yield nr(u,t,e);let{sourceCode:n}=e,{parent:a}=t,[i,o]=n.getFirstTokens(r,2);"ReturnStatement"!==a.type&&"ThrowStatement"!==a.type||a.argument!==t||uh(i,o,e)||ry(t,e)||ry(r,e)?uS(n.getTokenBefore(t),e,o.value)&&(yield u.insertTextBefore(t,";")):yield u9(u,a,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow negated conditions.",recommended:"unopinionated"},fixable:"code",messages:{[sp]:"Unexpected negated condition."}}},"unicorn/no-object-as-default-parameter":{create:e=>{e.on("AssignmentPattern",e=>{if(!("ObjectExpression"===e.right.type&&e.right.properties.length>0&&rB(e.parent)&&e.parent.params.includes(e)))return;let{left:t,right:r}=e;return"Identifier"===t.type?{node:t,messageId:sm,data:{parameter:t.name}}:{node:r,messageId:sg}})},meta:{type:"problem",docs:{description:"Disallow the use of objects as default parameters.",recommended:"unopinionated"},messages:{[sm]:"Do not use an object literal as default for parameter `{{parameter}}`.",[sg]:"Do not use an object literal as default."}}},"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,u=t.property.name,n=t.object,a=r;if(sh.has(u))return{method:u,target:n,argumentsNodes:a};if("call"!==u&&"apply"!==u)return;let i="apply"===u;if(u=sb(t.object),!sh.has(u))return;let{supportObjects:o}=sh.get(u),s=t.object.object;if(rk(s)||"slice"===u&&rh(s,"")||"prototype"===sb(s)&&"Identifier"===s.object.type&&o.has(s.object.name)){if([n]=r,i){let[,e]=r;if(!e||"ArrayExpression"!==e.type)return;a=e.elements}else a=r.slice(1);return{method:u,target:n,argumentsNodes:a}}}(t);if(!r)return;let{method:u,target:n,argumentsNodes:a}=r,{argumentsIndexes:i}=sh.get(u),o=i.map(e=>(function e(t,r){if(!t)return;let{type:u,operator:n,left:a,right:i}=t;if("BinaryExpression"===u&&"-"===n&&rD(i)&&i.value>0)return"MemberExpression"===a.type&&!a.computed&&!a.optional&&"Identifier"===a.property.type&&"length"===a.property.name&&ux(a.object,r)?a:e(a,r)})(a[e],n)).filter(Boolean);if(0!==o.length)return{node:t,messageId:sy,data:{method:u},*fix(t){for(let r of o)yield function(e,t,r){let[u,n]=rm(e,r);return t.removeRange([u,n+r.sourceCode.text.slice(n).match(/\S|$/).index])}(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Prefer negative index over `.length - index` when possible.",recommended:"unopinionated"},fixable:"code",messages:{[sy]:"Prefer negative index over length minus index for `{{method}}`."}}},"unicorn/prefer-node-protocol":{create:e=>{e.on("Literal",t=>{if(!(("ImportDeclaration"===t.parent.type||"ExportNamedDeclaration"===t.parent.type||"ImportExpression"===t.parent.type||"TSImportType"===t.parent.type)&&t.parent.source===t||(rR(t.parent,{object:"process",method:"getBuiltinModule",argumentsLength:1,optionalCall:!1,optionalMember:!1})||rL(t.parent))&&t.parent.arguments[0]===t))return;let{value:r}=t;if(!("string"==typeof r&&!r.startsWith(sE)&&sx(r)&&sx(`${sE}${r}`)))return;let u=e.sourceCode.getRange(t)[0]+1;return{node:t,messageId:sv,data:{moduleName:r},fix:e=>e.insertTextAfterRange([u,u],sE)}})},meta:{type:"suggestion",docs:{description:"Prefer using the `node:` protocol when importing Node.js builtin modules.",recommended:"unopinionated"},fixable:"code",messages:{[sv]:"Prefer `node:{{moduleName}}` over `{{moduleName}}`."}}},"unicorn/consistent-date-clone":{create:e=>{e.on("NewExpression",t=>{if(!rC(t,{name:"Date",argumentsLength:1}))return;let[r]=t.arguments;if(!rR(r,{method:"getTime",argumentsLength:0,optionalCall:!1,optionalMember:!1}))return;let{sourceCode:u}=e;return{node:r,loc:{start:u.getLoc(r.callee.property).start,end:u.getLoc(r).end},messageId:sA,fix:t=>ni(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Prefer passing `Date` directly to the constructor when cloning.",recommended:"unopinionated"},fixable:"code",messages:{[sA]:"Unnecessary `.getTime()` call."}}},"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 u=r.block.parent;if(["Property","MethodDefinition"].includes(u?.type)&&!u.computed&&["set","get"].includes(u.kind)&&sS(u.key)&&("get"===u.kind&&(sw(e,u)||"VariableDeclarator"===e.parent.type&&e.parent.init===e&&"ObjectPattern"===e.parent.id.type&&e.parent.id.properties.some(e=>"Property"===e.type&&!e.computed&&sF(e.key,u.key)))||"set"===u.kind&&((e,t)=>{if(!sw(e,t))return!1;let r=e.parent,{parent:u}=r;return("AssignmentExpression"===u.type||"AssignmentPattern"===u.type)&&u.left===r||"UpdateExpression"===u.type&&u.argument===r||"ArrayPattern"===u.type&&u.elements.includes(r)||"Property"===u.type&&u.value===r&&"ObjectPattern"===u.parent.type&&u.parent.properties.includes(r.parent)})(e,u)))return{node:e.parent,messageId:sC,data:{kind:u.kind}}})},meta:{type:"problem",docs:{description:"Disallow recursive access to `this` within getters and setters.",recommended:"unopinionated"},defaultOptions:[],messages:{[sC]:"Disallow recursive access to `this` within {{kind}}ters."}}},"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(!rP(r,{properties:["url","filename"],computed:!1,optional:!1}))return;let u=r.property.name;if("url"===u){if(sI(r.parent,t)&&r.parent.arguments[0]===r)return void(yield a(r.parent,{reportFilenameNode:!0}));if(rC(r.parent,{name:"URL",minimumArguments:1,maximumArguments:2})){var n;let e=r.parent,u=e.parent;if(1===e.arguments.length&&e.arguments[0]===r&&sI(u,t)&&u.arguments[0]===e)return void(yield a(u,{reportFilenameNode:!0}));2===e.arguments.length&&(n=e.arguments[0],n?.type==="Literal"&&("."===n.value||"./"===n.value))&&e.arguments[1]===r&&sI(u,t)&&u.arguments[0]===e&&(yield i(u,"dirname"))}return}function*a(e,{reportFilenameNode:r=!1}={}){let{parent:u}=e;if(sB(u,t)&&u.arguments[0]===e)return void(yield i(u,"dirname"));if(r&&(yield i(e,"filename")),"VariableDeclarator"!==u.type||u.init!==e||"Identifier"!==u.id.type||"VariableDeclaration"!==u.parent.type||"const"!==u.parent.kind)return;let n=tR(t.getScope(u.id),u.id);if(n)for(let e of n.references){if(!e.isReadOnly())continue;let{parent:r}=e.identifier;sB(r,t)&&r.arguments[0]===e.identifier&&(yield i(r,"dirname"))}}function i(e,t){return{node:e,messageId:"dirname"===t?sk:sT,fix:r=>r.replaceText(e,`import.meta.${t}`)}}"filename"===u&&(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:{[sk]:"Do not construct dirname.",[sT]:"Do not construct filename using `fileURLToPath()`."}}},"unicorn/no-unnecessary-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!(rR(t,{method:"flat",argumentsLength:1,optionalCall:!1})&&rh(t.arguments[0],1)))return;let[r]=t.arguments;return{node:r,messageId:sP,fix:t=>u8(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Disallow using `1` as the `depth` argument of `Array#flat()`.",recommended:"unopinionated"},fixable:"code",messages:{[sP]:"Passing `1` as the `depth` argument is unnecessary."}}},"unicorn/no-unnecessary-array-splice-count":{create(e){se(e,{methods:["splice","toSpliced"],messageId:sR})},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:{[sR]:"Passing `{{description}}` as the `{{argumentName}}` argument is unnecessary."}}},"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",u=>{let n,a=t.at(-1);if(!(a?.superClass&&"Identifier"===a.superClass.type&&a5.includes(a.superClass.name)&&e.sourceCode.isGlobalReference(a.superClass)&&(n=r.at(-1),n&&"MethodDefinition"===n.parent.type&&"constructor"===n.parent.kind&&n.parent.value===n&&a.body.body.includes(n.parent))&&rR(u,{object:"Error",method:"captureStackTrace",argumentsLength:2,optionalMember:!1})&&e.sourceCode.isGlobalReference(u.callee.object)))return;let[i,o]=u.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||rP(e,{property:"constructor",computed:!1,optional:!1})&&"ThisExpression"===e.object.type)return!0;if("Identifier"!==e.type||!t.id)return!1;let u=tR(r.sourceCode.getScope(e),e);return u&&1===u.defs.length&&"ClassName"===u.defs[0].type&&u.defs[0].node===t})(o,a,e))return;let s={node:u,messageId:sL},d="ChainExpression"===u.parent?u.parent.parent:u.parent;return"ExpressionStatement"===d.type&&"BlockStatement"===d.parent.type&&(s.fix=e=>e.remove(d)),s})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Error.captureStackTrace(…)`.",recommended:"unopinionated"},fixable:"code",messages:{[sL]:"Unnecessary `Error.captureStackTrace(…)` call."}}},"unicorn/prefer-class-fields":{create:e=>{let{sourceCode:t}=e;e.on("ClassBody",r=>{let u=r.body.find(e=>"constructor"===e.kind&&!e.computed&&!e.static&&"MethodDefinition"===e.type&&"FunctionExpression"===e.value.type);if(!u)return;let n=u.value.body.body.find(e=>"EmptyStatement"!==e.type);if(!(n?.type==="ExpressionStatement"&&"AssignmentExpression"===n.expression.type&&"="===n.expression.operator&&"MemberExpression"===n.expression.left.type&&"ThisExpression"===n.expression.left.object.type&&!n.expression.left.computed&&["Identifier","PrivateIdentifier"].includes(n.expression.left.property.type)&&"Literal"===n.expression.right.type))return;let a=n.expression.left.property.name,i=n.expression.right.raw,o=n.expression.left.property.type,s=r.body.find(e=>"PropertyDefinition"===e.type&&!e.computed&&!e.static&&e.key.type===o&&e.key.name===a),d={node:n,messageId:sj};function*l(o){if(yield((e,t,r)=>{let{line:u}=t.getLoc(e).start,n=t.getText(e);return t.lines[u-1].trim()===n?r.removeRange([t.getIndexFromLoc({line:u,column:0}),t.getIndexFromLoc({line:u+1,column:0})]):r.remove(e)})(n,t,o),s){if(s.value)return void(yield o.replaceText(s.value,i));let e=` = ${i}`,r=t.getLastToken(s);return tN(r)?void(yield o.insertTextBefore(r,e)):void(yield o.insertTextAfter(s,`${e};`))}let d=t.getLastToken(r),l=ur(u,e),c=`${l}${a} = ${i};
20
+ `)});let s=o.value.body;if(!s)return;let d=s.body,l=d.find(e=>"ExpressionStatement"===e.type&&"CallExpression"===e.expression.type&&"Super"===e.expression.callee.type),c=d.findIndex(e=>so(e,"message"));if(l){if(-1!==c){let t=d[c];yield{node:l,message:"Pass the error message to `super()` instead of setting `this.message`.",*fix(r){if(0===l.expression.arguments.length){let u=t.expression.right,[a]=n.getRange(l);yield r.insertTextAfterRange([a,a+6],rg(u,e))}let u=0===c?n.getRange(s)[0]:n.getRange(d[c-1])[1],[,a]=n.getRange(t);yield r.removeRange([u,a])}}}}else yield{node:s,message:"Missing call to `super()` in constructor."};let f=d.find(e=>so(e,"name"));if(f)f.expression.right.value!==r&&(yield{node:f?.expression.right??s,message:`The \`name\` property should be set to \`${r}\`.`});else{let e=a.find(e=>"PropertyDefinition"===e.type&&!e.computed&&"Identifier"===e.key.type&&"name"===e.key.name);e?.value&&e.value.value===r||(yield{node:e?.value??s,message:`The \`name\` property should be set to \`${r}\`.`})}}let sd="no-lonely-if",sl=e=>"IfStatement"===e.type&&!e.alternate,sc=e=>"LogicalExpression"===e.type&&("||"===e.operator||"??"===e.operator)||"ConditionalExpression"===e.type||"AssignmentExpression"===e.type||"YieldExpression"===e.type||"SequenceExpression"===e.type;function sf(e,t){let r={ifToken:t.getFirstToken(e),openingParenthesisToken:t.getFirstToken(e,1)},{consequent:u}=e;return r.closingParenthesisToken=t.getTokenBefore(u),"BlockStatement"===u.type&&(r.openingBraceToken=t.getFirstToken(u),r.closingBraceToken=t.getLastToken(u)),r}let sp="no-magic-array-flat-depth",sm="no-negated-condition",sg="identifier",sy="non-identifier",sh="prefer-negative-index",sb=new Map([["slice",{argumentsIndexes:[0,1],supportObjects:new Set(["Array","String","ArrayBuffer",...ie])}],["subarray",{argumentsIndexes:[0,1],supportObjects:new Set(ie)}],["splice",{argumentsIndexes:[0],supportObjects:new Set(["Array"])}],["toSpliced",{argumentsIndexes:[0],supportObjects:new Set(["Array"])}],["at",{argumentsIndexes:[0],supportObjects:new Set(["Array","String",...ie])}],["with",{argumentsIndexes:[0],supportObjects:new Set(["Array",...ie])}]]),sD=e=>{let{type:t,property:r}=e;if("MemberExpression"===t&&"Identifier"===r.type)return r.name};var sx=["node:assert","assert","node:assert/strict","assert/strict","node:async_hooks","async_hooks","node:buffer","buffer","node:child_process","child_process","node:cluster","cluster","node:console","console","node:constants","constants","node:crypto","crypto","node:dgram","dgram","node:diagnostics_channel","diagnostics_channel","node:dns","dns","node:dns/promises","dns/promises","node:domain","domain","node:events","events","node:fs","fs","node:fs/promises","fs/promises","node:http","http","node:http2","http2","node:https","https","node:inspector","inspector","node:inspector/promises","inspector/promises","node:module","module","node:net","net","node:os","os","node:path","path","node:path/posix","path/posix","node:path/win32","path/win32","node:perf_hooks","perf_hooks","node:process","process","node:querystring","querystring","node:quic","node:readline","readline","node:readline/promises","readline/promises","node:repl","repl","node:sea","node:sqlite","node:stream","stream","node:stream/consumers","stream/consumers","node:stream/promises","stream/promises","node:stream/web","stream/web","node:string_decoder","string_decoder","node:test","node:test/reporters","node:timers","timers","node:timers/promises","timers/promises","node:tls","tls","node:trace_events","trace_events","node:tty","tty","node:url","url","node:util","util","node:util/types","util/types","node:v8","v8","node:vm","vm","node:wasi","wasi","node:worker_threads","worker_threads","node:zlib","zlib"];function sv(t){if("string"!=typeof t)throw TypeError("Expected a string");return(e??=new Set(sx)).has(t)}let sE="prefer-node-protocol",sA="node:",sC="consistent-date-clone/error",sS="no-accessor-recursion/error",sF=e=>"Identifier"===e.type||"PrivateIdentifier"===e.type,sw=(e,t)=>["type","name"].every(r=>e[r]===t[r]),sk=(e,t)=>"MemberExpression"===e.parent.type&&e.parent.object===e&&!e.parent.computed&&sF(e.parent.property)&&sw(e.parent.property,t.key),sT="error/calculate-dirname",s_="error/calculate-filename";function sI(e,{modules:t,functionName:r,sourceCode:u}){if(!rA(e,{optional:!1,argumentsLength:1}))return!1;let n=new Set;return function e(t,i){if("MemberExpression"===t.type)return!!("property"===i&&rP(t,{property:r,computed:!1,optional:!1}))&&e(t.object,"module");if("CallExpression"===t.type)return"module"===i&&rR(t,{object:"process",method:"getBuiltinModule",argumentsLength:1,optionalMember:!1,optionalCall:!1})&&a(t.arguments[0]);if("Identifier"!==t.type||n.has(t))return!1;n.add(t);let o=tR(u.getScope(t),t);if(o&&1===o.defs.length){var s=o.defs[0],d=i;if("ImportBinding"===s.type){if(!a(s.parent.source))return!1;let e=s.node;return"module"===d?e?.type==="ImportDefaultSpecifier"||e?.type==="ImportNamespaceSpecifier":e?.type==="ImportSpecifier"&&e.imported.name===r}return"Variable"===s.type&&function t(u,n){let{parent:a}=u;return"VariableDeclarator"===a.type?!!a.init&&a.id===u&&"VariableDeclaration"===a.parent.type&&"const"===a.parent.kind&&e(a.init,n):"Property"===a.type&&!!("property"===n&&a.value===u&&!a.computed&&"Identifier"===a.key.type&&a.key.name===r)&&t(a.parent,"module")}(s.name,d)}}(e.callee,"property");function a(e){return e?.type==="Literal"&&t.has(e.value)}}function sB(e,t){return sI(e,{modules:new Set(["url","node:url"]),functionName:"fileURLToPath",sourceCode:t})}function sP(e,t){return sI(e,{modules:new Set(["path","node:path"]),functionName:"dirname",sourceCode:t})}let sR="no-unnecessary-array-flat-depth",sL="no-unnecessary-array-splice-count",sj="no-useless-error-capture-stack-trace/error",sO="prefer-class-fields/error",sN="prefer-class-fields/suggestion",s$="prefer-bigint-literals/error",sM="prefer-bigint-literals/suggestion",sz="prefer-classlist-toggle/error",sU="prefer-classlist-toggle/suggestion",sq=e=>rP(e,{property:"classList",computed:!1}),sW=(e,t,r)=>{let u={node:r??e,messageId:sz};return"IfStatement"===e.type||r_(e)||r_(e.parent)?u.fix=t:u.suggest=[{messageId:sU,fix:t}],u},sV=(e,t,r)=>{let{sourceCode:u}=t,n=rg(e,t);if(r)return ry(e,u)||"UpdateExpression"!==e.type&&"BinaryExpression"!==e.type&&"LogicalExpression"!==e.type&&"ConditionalExpression"!==e.type&&"AssignmentExpression"!==e.type&&"ArrowFunctionExpression"!==e.type&&"YieldExpression"!==e.type&&"SequenceExpression"!==e.type||(n=`(${n})`),n=`!${n}`;return ry(e,u)||"SequenceExpression"!==e.type||(n=`(${n})`),n},sZ=(e,t)=>rR(e,{methods:t,argumentsLength:1,optionalCall:!1,optionalMember:!1})&&sq(e.callee.object),sG=(e,t)=>ux(e.callee.object,t.callee.object)&&ux(e.arguments[0],t.arguments[0]),sH=(e,t,r)=>t?("ChainExpression"===e.type&&(e=e.expression),sZ(e,["contains"])&&sG(e,r))?e:void 0:"UnaryExpression"===e.type&&"!"===e.operator&&e.prefix?sH(e.argument,!t,r):void 0,sJ="require-module-attributes",sK="error",sX="suggestion/array",sY="suggestion/object",sQ="suggestion/object-assign",s0="suggestion/set",s1="suggestion/map",s3=(e,t,r)=>{let{sourceCode:u}=r,n=un(e);return t.some(e=>{let t=u.getRange(e);return n.some(e=>{let[r,n]=u.getRange(e);return r>=t[0]&&n<=t[1]})})};function s2(e,t){if(!rC(e,{names:t,maximumArguments:1}))return!1;let[r]=e.arguments;return!r||"ArrayExpression"===r.type}function*s4(e,t,r){let u=!tN(t.sourceCode.getTokenBefore(e));yield function(e,t,r,u=!1){let{sourceCode:n}=t,{lines:a}=n,i=e;if(u){let[t,r]=n.getLastTokens(e,2);tN(r)&&(i=t)}let o=n.getLoc(e).start,s=n.getLoc(i).end,d=a[o.line-1].slice(0,o.column),l=a[s.line-1].slice(s.column),[c]=n.getRange(e),[,f]=n.getRange(i);return/^\s*$/.test(d)&&/^\s*$/.test(l)&&(c=Math.max(0,c-d.length-1),f+=l.length),r.removeRange([c,f])}(e,t,r,u)}function s5(e,t,r,u){let{sourceCode:n}=e,[a,i]=n.getLastTokens(r,2),o=("ArrayExpression"===r.type?r.elements:r.properties).length>0&&!tO(a);return t.insertTextBefore(i,`${o?",":""} ${u}`)}function*s8({context:e,fixer:t,newExpression:r,elementsText:u,nextExpressionStatement:n}){if(r7(r,e)){let[n]=r.arguments;if(n)yield s5(e,t,n,u);else{let{openingParenthesisToken:n}=r7(r,e)?ue(r,e):{};yield t.insertTextAfter(n,`[${u}]`)}}else yield t.insertTextAfter(r,`([${u}])`);yield*s4(n,e,t)}let s6=[{testValue:e=>e?.type==="ArrayExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let u=r.expression;if(rR(u,{object:t.name,methods:["push","unshift"],optionalMember:!1,optionalCall:!1})&&u.arguments.length>0&&!s3(t,u.arguments,e))return u},getProblem(e,t){let{context:r,assignType:u,getFix:n}=t,{sourceCode:a}=r,i=e.callee,o=i.property,s={node:i,messageId:sK,data:{objectType:"array"}},d="unshift"===o.name,l=n(t,{callExpression:e,isPrepend:d});return e.arguments.some(e=>t9(e,a))?s.suggest=[{messageId:sX,fix:l,data:{operation:d?"Prepend":"Append",assignType:u}}]:s.fix=l,s},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{callExpression:u,isPrepend:n})=>function*(a){let i=ut(e,u,!1);yield n?a.insertTextAfter(e.sourceCode.getFirstToken(t),`${i}, `):s5(e,a,t,i),yield s4(r,e,a)}},{testValue:e=>e?.type==="ObjectExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let u=r.expression;if(!("AssignmentExpression"===u.type&&"="===u.operator&&rP(u.left,{object:t.name,optional:!1})))return;let n=u.right,a=u.left,{property:i}=a;if(!s3(t,a.computed?[i,n]:[n],e))return u},getProblem(e,t){let{context:r,assignType:u,getFix:n}=t,{sourceCode:a}=r,{left:i,right:o}=e,{property:s}=i,d=a.getTokenAfter(i,t=>"Punctuator"===t.type&&t.value===e.operator),l={node:e,loc:{start:a.getLoc(e).start,end:a.getLoc(d).end},messageId:sK,data:{objectType:"object"}},c=n(t,{assignmentExpression:e,memberExpression:i,property:s,value:o});return i.computed&&t9(s,a)||t9(o,a)?l.suggest=[{messageId:sY,data:{assignType:u},fix:c}]:l.fix=c,l},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{memberExpression:u,property:n,value:a})=>function*(i){let o=rg(n,e);u.computed&&(o=`[${o}]`);let s=rg(a,e),d=`${o}: ${s},`,[l,c]=e.sourceCode.getLastTokens(t,2),f=t.properties.length>0&&!tO(l);yield i.insertTextBefore(c,`${f?",":""} ${d}`),yield s4(r,e,i)}},{testValue:e=>e?.type==="ObjectExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let u=r.expression;if(!rR(u,{object:"Object",method:"assign",minimumArguments:2,optionalMember:!1,optionalCall:!1}))return;let[n,a]=u.arguments;if(!("Identifier"!==n.type||n.name!==t.name||"SpreadElement"===a.type||s3(t,[a],e)))return u},getProblem(e,t){let{context:r,assignType:u,getFix:n}=t,{sourceCode:a}=r,[,i]=e.arguments,o={node:e.callee,messageId:sK,data:{objectType:"object"}},s=n(t,{callExpression:e,firstValue:i});return t9(i,a)?o.suggest=[{messageId:sQ,data:{description:"ObjectExpression"===i.type?"Move properties to":"Spread properties in",assignType:u},fix:s}]:o.fix=s,o},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{callExpression:u,firstValue:n})=>function*(a){let i;("ObjectExpression"===n.type?n.properties.length>0&&(i=function(e,t){let{sourceCode:r}=t,u=r.getFirstToken(e),[n,a]=r.getLastTokens(e,2),[,i]=r.getRange(u),[o]=r.getRange(tO(n)?n:a);return r.text.slice(i,o)}(n,e)):i=`...${rg(n,e)}`,i&&(yield s5(e,a,t,i)),2!==u.arguments.length)?yield u8(a,n,e):yield s4(r,e,a)}},{testValue:e=>s2(e,["Set","WeakSet"]),getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let u=r.expression;if(("ChainExpression"===u.type&&(u=u.expression),rR(u,{object:t.name,method:"add",argumentsLength:1,optionalMember:!1,optionalCall:!1}))&&!s3(t,u.arguments,e))return u},getProblem(e,t){let{context:r,assignType:u,valueNode:n,getFix:a}=t,{sourceCode:i}=r,o={node:e.callee,messageId:sK,data:{objectType:`\`${n.callee.name}\``}},s=a(t,{callExpression:e,newExpression:n});return e.arguments.some(e=>t9(e,i))?o.suggest=[{messageId:s0,data:{assignType:u},fix:s}]:o.fix=s,o},getFix:({context:e,nextExpressionStatement:t},{callExpression:r,newExpression:u})=>n=>{let a=ut(e,r,!1);return s8({context:e,fixer:n,newExpression:u,elementsText:a,nextExpressionStatement:t})}},{testValue:e=>s2(e,["Map","WeakMap"]),getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let u=r.expression;if(rR(u,{object:t.name,method:"set",argumentsLength:2,optionalCall:!1})&&!s3(t,u.arguments,e))return u},getProblem(e,t){let{context:r,assignType:u,valueNode:n,getFix:a}=t,{sourceCode:i}=r,o={node:e.callee,messageId:sK,data:{objectType:`\`${n.callee.name}\``}},s=a(t,{callExpression:e,newExpression:n});return e.arguments.some(e=>t9(e,i))?o.suggest=[{messageId:s1,data:{assignType:u},fix:s}]:o.fix=s,o},getFix:({context:e,nextExpressionStatement:t},{callExpression:r,newExpression:u})=>n=>{let a=ut(e,r,!1);return s8({context:e,fixer:n,newExpression:u,elementsText:`[${a}]`,nextExpressionStatement:t})}}],s9="no-useless-collection-argument/error",s7="no-useless-collection-argument/suggestion",de="prefer-response-static-json",dt=/([\p{Ll}\d])(\p{Lu})/gu,dr=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,du=/(\d)\p{Ll}|(\p{L})\d/u,dn=/[^\p{L}\d]+/giu,da="$1\0$2";function di(e){let t=e.trim();t=(t=t.replace(dt,da).replace(dr,da)).replace(dn,"\0");let r=0,u=t.length;for(;"\0"===t.charAt(r);)r++;if(r===u)return[];for(;"\0"===t.charAt(u-1);)u--;return t.slice(r,u).split(/\0/g)}function ds(e){let t=di(e);for(let e=0;e<t.length;e++){let r=t[e],u=du.exec(r);if(u){let n=u.index+(u[1]??u[2]).length;t.splice(e,1,r.slice(0,n),r.slice(n))}}return t}function dd(e,t){let[r,u,n]=dm(e,t);return r+u.map(dl(t?.locale)).join(t?.delimiter??" ")+n}function dl(e){return!1===e?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function dc(e){return!1===e?e=>e.toUpperCase():t=>t.toLocaleUpperCase(e)}function df(e,t){return r=>`${t(r[0])}${e(r.slice(1))}`}function dp(e,t){return(r,u)=>{let n=r[0];return(u>0&&n>="0"&&n<="9"?"_"+n:t(n))+e(r.slice(1))}}function dm(e,t={}){let r=t.split??(t.separateNumbers?ds:di),u=t.prefixCharacters??"",n=t.suffixCharacters??"",a=0,i=e.length;for(;a<e.length;){let t=e.charAt(a);if(!u.includes(t))break;a++}for(;i>a;){let t=i-1,r=e.charAt(t);if(!n.includes(r))break;i=t}return[e.slice(0,a),r(e.slice(a,i)),e.slice(i)]}let dg="filename-case",dy="filename-extension",dh=e=>!/^[a-z\d-_]$/i.test(e),db=new Set(["index.js","index.mjs","index.cjs","index.ts","index.tsx","index.vue"]),dD={camelCase:{fn:function(e,t){let[r,u,n]=dm(e,t),a=dl(t?.locale),i=dc(t?.locale),o=t?.mergeAmbiguousCharacters?df(a,i):dp(a,i);return r+u.map((e,t)=>0===t?a(e):o(e,t)).join(t?.delimiter??"")+n},name:"camel case"},kebabCase:{fn:function(e,t){return dd(e,{delimiter:"-",...t})},name:"kebab case"},snakeCase:{fn:function(e,t){return dd(e,{delimiter:"_",...t})},name:"snake case"},pascalCase:{fn:function(e,t){let[r,u,n]=dm(e,t),a=dl(t?.locale),i=dc(t?.locale),o=t?.mergeAmbiguousCharacters?df(a,i):dp(a,i);return r+u.map(o).join(t?.delimiter??"")+n},name:"pascal case"}},dx=/^(?<leading>_+)(?<tailing>.*)$/,dv=e=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(e),dE=[{oneOf:[{properties:{case:{enum:["camelCase","snakeCase","kebabCase","pascalCase"]},ignore:{type:"array",uniqueItems:!0},multipleFileExtensions:{type:"boolean"}},additionalProperties:!1},{properties:{cases:{properties:{camelCase:{type:"boolean"},snakeCase:{type:"boolean"},kebabCase:{type:"boolean"},pascalCase:{type:"boolean"}},additionalProperties:!1},ignore:{type:"array",uniqueItems:!0},multipleFileExtensions:{type:"boolean"}},additionalProperties:!1}]}],dA={configs:{node:{name:"@eslint-sukka/eslint-plugin-sukka-full node preset",plugins:{get sukka(){return dA}},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 dA}},rules:{"sukka/ban-eslint-disable":["error","allow-with-description"]}},regexp:{name:"@eslint-sukka/eslint-plugin-sukka-full regexp preset",plugins:{get sukka(){return dA}},rules:{"sukka/unicorn/better-regex":"warn"}},recommended:{...eJ.eslint_plugin_sukka.configs.recommended,plugins:{get sukka(){return dA}}},recommended_extra_with_typed_lint:{...eJ.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint,plugins:{get sukka(){return dA}}},recommended_react:{...eJ.eslint_plugin_sukka.configs.recommended_react,plugins:{get sukka(){return dA}}}},rules:Object.assign(eJ.eslint_plugin_sukka.rules,{"array/no-unneeded-flat-map":e7,"browser/prefer-location-assign":tt,"jsx/no-template-literal":tu,"jsx/no-unneeded-nested":tn,"string/no-locale-case":ti,"string/no-simple-template-literal":to,"unicode/no-bidi":tm,"unicode/no-invisible":ty,"no-redundant-variable":th,"no-single-return":tD,"prefer-early-return":tv,"prefer-fetch":tE,"prefer-timer-id":tS,"string/no-unneeded-to-string":tF,"type/no-force-cast-via-top-type":tw,"type/no-wrapper-type-reference":tT,"no-default-error":t_},Object.fromEntries(Object.entries({"unicorn/better-regex":aK,"unicorn/catch-error-name":su,"unicorn/custom-error-definition":{create:e=>{e.on("ClassDeclaration",t=>ss(e,t)),e.on("AssignmentExpression",t=>{if("ClassExpression"===t.right.type)return ss(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.left.property.name,r=e.right;if("ClassExpression"!==r.type||!si(r)||!r.id)return;let u=r.id.name;return t!==u?{node:e.left.property,messageId:sn,fix:t=>t.replaceText(e.left.property,u)}:void 0}})},meta:{type:"problem",docs:{description:"Enforce correct `Error` subclassing.",recommended:!1},fixable:"code",messages:{[sn]:"Exported error name should match error class"}}},"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,u=r.getAncestors(t).toReversed(),n=u.findIndex(e=>"ConditionalExpression"!==e.type);return 1!==n||ry(t,e)?n>1?{node:n>2?u[n-3]:t,messageId:uq}:void 0:{node:t,messageId:uW,fix:e=>[e.insertTextBefore(t,"("),e.insertTextAfter(t,")")]}})},meta:{type:"suggestion",docs:{description:"Disallow nested ternary expressions.",recommended:!0},fixable:"code",messages:{[uq]:"Do not nest ternary expressions.",[uW]:"Nested ternary expression should be parenthesized."}}},"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!!(uZ.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)&&uG(e.parent.parent)&&uH(e.parent.parent.parent.init)||uG(e)&&rP(e.parent.init,{property:"EventEmitter",optional:!1,computed:!1})&&uH(e.parent.init.object))}(tR(r,t)?.defs[0]?.name))return{node:t,messageId:uV}})},meta:{type:"suggestion",docs:{description:"Prefer `EventTarget` over `EventEmitter`.",recommended:"unopinionated"},messages:{[uV]:"Prefer `EventTarget` over `EventEmitter`."}}},"unicorn/prefer-keyboard-event-key":{create:e=>{e.on("Identifier",t=>{if("keyCode"!==t.name&&"charCode"!==t.name&&"which"!==t.name)return;let{event:r,references:u}=uQ(e,t);if(r&&u&&u.some(e=>{let r;return r=e.identifier,t?.parent?.type==="MemberExpression"&&t.parent.object===r}))return u1(t)}),e.on("Property",t=>{let r=t.value.name;if(!uX.has(r))return;let{event:u,references:n}=uQ(e,t);if(!u)return;let a=u0(t,"VariableDeclarator"),i=a?.init;if(n&&n.some(e=>e.identifier===i))return u1(t.value);if("ObjectPattern"===u.type){for(let e of u.properties)if(e===t)return u1(t.value)}})},meta:{type:"suggestion",docs:{description:"Prefer `KeyboardEvent#key` over `KeyboardEvent#keyCode`.",recommended:"unopinionated"},fixable:"code",messages:{[uK]:"Use `.key` instead of `.{{name}}`."}}},"unicorn/prefer-text-content":{create:e=>{e.on("MemberExpression",e=>{if(!rP(e,{property:"innerText"}))return;let t=e.property;return{node:t,messageId:u3,suggest:[{messageId:u2,fix:e=>e.replaceText(t,"textContent")}]}}),e.on("Identifier",e=>{if("innerText"===e.name&&"Property"===e.parent.type&&e.parent.key===e&&!e.parent.computed&&"init"===e.parent.kind&&"ObjectPattern"===e.parent.parent.type&&e.parent.parent.properties.includes(e.parent))return{node:e,messageId:u3,suggest:[{messageId:u2,fix:t=>t.replaceText(e,e.parent.shorthand?"textContent: innerText":"textContent")}]}})},meta:{type:"suggestion",docs:{description:"Prefer `.textContent` over `.innerText`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[u3]:"Prefer `.textContent` over `.innerText`.",[u2]:"Switch to `.textContent`."}}},"unicorn/require-array-join-separator":{create:e=>{e.on("CallExpression",t=>{if(!(rR(t,{method:"join",argumentsLength:0,optionalCall:!1})||rR(t,{method:"call",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&rM(t.callee.object,{property:"join"})))return;let{sourceCode:r}=e,[u,n]=r.getLastTokens(t,2),a=1===t.arguments.length;return{loc:{start:r.getLoc(u)[a?"end":"start"],end:r.getLoc(n).end},messageId:nc,fix:r=>u5(r,t,"','",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the separator argument with `Array#join()`.",recommended:"unopinionated"},fixable:"code",messages:{[nc]:"Missing the separator argument."}}},"unicorn/no-thenable":{create:e=>{for(let{selector:t,selectors:r,messageId:u,getNodes:n}of nh)e.on(t??r,function*(t){for(let r of n(t,e))yield{node:r,messageId:u}})},meta:{type:"problem",docs:{description:"Disallow `then` property.",recommended:"unopinionated"},messages:{[nf]:"Do not add `then` to an object.",[np]:"Do not export `then`.",[nm]:"Do not add `then` to a class."}}},"unicorn/no-invalid-remove-event-listener":{create:e=>{e.on("CallExpression",t=>{if(!(rR(t,{method:"removeEventListener",minimumArguments:2,optionalCall:!1})&&"SpreadElement"!==t.arguments[0].type&&("FunctionExpression"===t.arguments[1].type||"ArrowFunctionExpression"===t.arguments[1].type||rR(t.arguments[1],{method:"bind",optionalCall:!1,optionalMember:!1}))))return;let[,r]=t.arguments;return["ArrowFunctionExpression","FunctionExpression"].includes(r.type)?{node:r,loc:tW(r,e.sourceCode),messageId:nb}:{node:r.callee.property,messageId:nb}})},meta:{type:"problem",docs:{description:"Prevent calling `EventTarget#removeEventListener()` with the result of an expression.",recommended:"unopinionated"},messages:{[nb]:"The listener argument should be a function reference."}}},"unicorn/consistent-function-scoping":nC,"unicorn/no-new-buffer":{create:e=>{let{sourceCode:t}=e;e.on("NewExpression",r=>{if(!rC(r,{name:"Buffer"}))return;let u=((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(function e(t,r){if(rD(t)||uo(t,"Math",ud)||"CallExpression"===t.type&&!t.optional&&uo(t.callee,"Math",ul)||us(t,"Number")||uo(t,"Number",uc)||"CallExpression"===t.type&&!t.optional&&uo(t.callee,"Number",uf)||us(t,"parseInt")||us(t,"parseFloat")||"MemberExpression"===t.type&&!t.computed&&!t.optional&&"Identifier"===t.property.type&&"length"===t.property.name)return!0;switch(t.type){case"AssignmentExpression":{let{operator:u}=t;if("="===u&&e(t.right,r))return!0}case"BinaryExpression":{let{operator:u}=t;if("AssignmentExpression"===t.type&&(u=u.slice(0,-1)),"+"===u&&e(t.left,r)&&e(t.right,r)||">>>"===u||up.has(u)&&(e(t.left,r)||e(t.right,r)))return!0;break}case"UnaryExpression":{let{operator:u}=t;if("+"===u||("-"===u||"~"===u)&&e(t.argument,r))return!0;break}case"UpdateExpression":if(e(t.argument,r))return!0;break;case"ConditionalExpression":{let u=e(t.consequent,r),n=e(t.alternate,r);if(u&&n)return!0;let a=t0(t.test,r);if(null!==a&&(a.value&&u||!a.value&&n))return!0;break}case"SequenceExpression":if(e(t.expressions.at(-1),r))return!0}return"number"==typeof t0(t,r)?.value}(r,t))return"alloc";let u=t0(r,t);if(u){let{value:e}=u;if("string"==typeof e||Array.isArray(e))return"from"}})(r.arguments,t.getScope(r));return u?{node:r,messageId:nS,data:{method:u},fix:nk(r,e,u)}:{node:r,messageId:nF,suggest:["from","alloc"].map(t=>({messageId:nw,data:{replacement:t},fix:nk(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:{[nS]:"`new Buffer()` is deprecated, use `Buffer.{{method}}()` instead.",[nF]:"`new Buffer()` is deprecated, use `Buffer.alloc()` or `Buffer.from()` instead.",[nw]:"Switch to `Buffer.{{replacement}}()`."}}},"unicorn/no-console-spaces":{create:e=>{let{sourceCode:t}=e,r=(r,u,n)=>{let[a,i]=t.getRange(r),o="leading"===n?a+1:i-2,s=[o,o+1];return{loc:u$(s,e),messageId:nT,data:{method:u,position:n},fix:e=>e.removeRange(s)}};e.on("CallExpression",function*(e){if(!rR(e,{object:"console",methods:["log","debug","info","warn","error"],minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let u=e.callee.property.name,{arguments:n}=e,{length:a}=n;for(let[e,i]of n.entries()){if(!rb(i)&&"TemplateLiteral"!==i.type)continue;let n=t.getText(i).slice(1,-1);0!==e&&n_(n)&&(yield r(i,u,"leading")),e!==a-1&&nI(n)&&(yield r(i,u,"trailing"))}})},meta:{type:"suggestion",docs:{description:"Do not use leading/trailing space between `console.log` parameters.",recommended:"unopinionated"},fixable:"code",messages:{[nT]:"Do not use {{position}} space between `console.{{method}}` parameters."}}},"unicorn/no-empty-file":{create:e=>{let t=e.physicalFilename;/\.(?:js|mjs|cjs|jsx|ts|mts|cts|tsx)$/i.test(t)&&e.on("Program",t=>{if(t.body.some(e=>!rw(e,rF)))return;let{sourceCode:r}=e;if(!r.getAllComments().some(e=>"Line"===e.type&&e.value.startsWith("/")))return{node:t,messageId:nB}})},meta:{type:"suggestion",docs:{description:"Disallow empty files.",recommended:"unopinionated"},messages:{[nB]:"Empty files are not allowed."}}},"unicorn/no-useless-fallback-in-spread":{create:e=>{e.on("ObjectExpression",t=>{if(rT(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:nP,*fix(r){let{sourceCode:u}=e,n=t.parent,{left:a}=n,i=ry(a,e),[,o]=i?rm(a,e):u.getRange(a),[,s]=u.getRange(n);yield r.removeRange([o,s]),(i||"SequenceExpression"!==a.type)&&(yield u4(n,r,e))}}})},meta:{type:"suggestion",docs:{description:"Disallow useless fallback when spreading in object literals.",recommended:"unopinionated"},fixable:"code",messages:{[nP]:"The empty object is useless."}}},"unicorn/no-useless-length-check":{create:e=>{let t=[],r=new Set,u=new Set,n=new Set,a=new Set;e.on("BinaryExpression",e=>{if("BinaryExpression"===e.type&&"Literal"===e.right.type&&"0"===e.right.raw&&rP(e.left,{property:"length",optional:!1})&&rz(e.parent)){let{operator:t}=e;"==="===t?r.add(e):(">"===t||"!=="===t)&&u.add(e)}}),e.on("CallExpression",e=>{rR(e,{optionalCall:!1,optionalMember:!1,computed:!1})&&"Identifier"===e.callee.property.type&&("some"===e.callee.property.name?n.add(e):"every"===e.callee.property.name&&a.add(e))}),e.on("LogicalExpression",e=>{rz(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,o)=>(function({node:e,operator:t,siblings:i}){return"||"===t&&r.has(e)&&i.some(t=>a.has(t)&&ux(e.left.object,t.callee.object))||"&&"===t&&u.has(e)&&i.some(t=>n.has(t)&&ux(e.left.object,t.callee.object))})({node:e,operator:t,siblings:[o[i-1],o[i+1]].filter(Boolean)}))})(e))),{sourceCode:o}=e;for(let t of i)yield{loc:{start:o.getLoc(t.left.property).start,end:o.getLoc(t).end},messageId:r.has(t)?"zero":"non-zero",fix(r){let{left:u,right:n}=t.parent,a=rm(u,e),i=rm(n,e),o=[];return u===t?(o[0]=a[0],o[1]=i[0]):(o[0]=a[1],o[1]=i[1]),r.removeRange(o)}}})},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."}}},"unicorn/no-useless-promise-resolve-reject":{create:e=>{e.on("CallExpression",t=>{if(!(rR(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:u}=function(e){let t,r=!1;for(;e;e=e.parent){if(rB(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"===t.name||"catch"===t.name||"finally"===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:u}=e,n=r.property.name;return{node:r,messageId:n,data:{type:"YieldExpression"===u.type?"yield":"return"},fix:t}}(t,function(e,t,r){if(e.arguments.length>1)return;let{callee:u,parent:n,arguments:[a]}=e;if(a?.type==="SpreadElement")return;let i="reject"===u.property.name,o="YieldExpression"===n.type;if(!i||!t&&(!o||"ExpressionStatement"===n.parent.type))return function(t){let u="ArrowFunctionExpression"===n.type,s=a?r.sourceCode.getText(a):"";if(a?.type==="SequenceExpression"&&(s=`(${s})`),i){if(s||="undefined",s=`throw ${s}`,o)return t.replaceTextRange(rm(n,r),s);if(s+=";",u)return s=`{ ${s} }`,t.replaceTextRange(rm(e,r),s)}else o?s=`yield${s?" ":""}${s}`:"ReturnStatement"===n.type?s=`return${s?" ":""}${s};`:(a?.type==="ObjectExpression"&&(s=`(${s})`),s||="{}");return t.replaceText(u?e:n,s)}}(t,u,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)`."}}},"unicorn/no-zero-fractions":{create:e=>{e.on("Literal",t=>{if(!rD(t))return;let{raw:r}=t,u=r.match(/^(?<before>[\d_]*)(?<dotAndFractions>\.[\d_]*)(?<after>.*)$/);if(!u)return;let{before:n,dotAndFractions:a,after:i}=u.groups,o=(n+a.replaceAll(/[.0_]+$/g,"")||"0")+i;if(o===r)return;let s="."===a,{sourceCode:d}=e,l=d.getRange(t)[0]+n.length+a.length;return{loc:u$([l-(r.length-o.length),l],e),messageId:s?nL:nR,*fix(r){let u=o;"MemberExpression"===t.parent.type&&t.parent.object===t&&uR.test(o)&&!ry(t,e)&&(u=`(${u})`,uS(d.getTokenBefore(t),e,u)&&(u=`;${u}`)),yield r.replaceText(t,u),yield nr(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow number literals with zero fractions or dangling dots.",recommended:"unopinionated"},fixable:"code",messages:{[nR]:"Don't use a zero fraction in the number.",[nL]:"Don't use a dangling dot in the number."}}},"unicorn/prefer-export-from":nW,"unicorn/prefer-native-coercion-functions":{create:e=>{e.on(rI,t=>{if(t.async||t.generator||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&&nG.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&&nH(e.body,t)?e.body:"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type&&nH(e.body.body[0].argument,t)?e.body.body[0].argument:void 0);if(!r)return;let{name:u}=r.callee,n={replacementFunction:u};return"FunctionDeclaration"===e.type||1!==r.arguments.length||(n.fix=t=>{let r=u;return"Property"===e.parent.type&&e.parent.method&&e.parent.value===e?r=`: ${r}`:"MethodDefinition"===e.parent.type&&(r=` = ${r};`),t.replaceText(e,r)}),n}(t);if(!r)return;let{sourceCode:u}=e,{replacementFunction:n,fix:a}=r;return r={node:t,loc:tW(t,u),messageId:nV,data:{functionNameWithKind:t2(t,u),replacementFunction:n}},!a||1!==t.params.length||u.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:{[nV]:"{{functionNameWithKind}} is equivalent to `{{replacementFunction}}`. Use `{{replacementFunction}}` directly."}}},"unicorn/no-document-cookie":{create(e){nY.listen({context:e})},meta:{type:"problem",docs:{description:"Do not use `document.cookie` directly.",recommended:"unopinionated"},messages:{[nX]:"Do not use `document.cookie` directly."}}},"unicorn/prefer-add-event-listener":n3,"unicorn/prefer-array-index-of":n9,"unicorn/prefer-blob-reading-methods":{create:e=>{e.on("CallExpression",e=>{if(!rR(e,{methods:["readAsText","readAsArrayBuffer"],argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let t=e.callee.property,r=t.name;return{node:t,messageId:n7,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:{[n7]:"Prefer `Blob#{{replacement}}()` over `FileReader#{{method}}(blob)`."}}},"unicorn/prefer-date-now":{create:e=>{e.on("CallExpression",e=>{if(rR(e,{methods:["getTime","valueOf"],argumentsLength:0,optionalCall:!1,optionalMember:!1})&&au(e.callee.object)){let t=e.callee.property;return an(e,{node:t,messageId:at,data:{method:t.name}})}if(rA(e,{names:["Number","BigInt"],argumentsLength:1,optional:!1})&&au(e.arguments[0])){let{name:t}=e.callee;return"Number"===t?an(e,{messageId:ar}):an(e.arguments[0])}}),e.on("UnaryExpression",t=>{if(("+"===t.operator||"-"===t.operator)&&au(t.argument))return an("-"===t.operator?t.argument:t,{},e)}),e.on("AssignmentExpression",e=>{if(("-="===e.operator||"*="===e.operator||"/="===e.operator||"%="===e.operator||"**="===e.operator)&&au(e.right))return an(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])au(t)&&(yield an(t))})},meta:{type:"suggestion",docs:{description:"Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.",recommended:"unopinionated"},fixable:"code",messages:{[ae]:"Prefer `Date.now()` over `new Date()`.",[at]:"Prefer `Date.now()` over `Date#{{method}}()`.",[ar]:"Prefer `Date.now()` over `Number(new Date())`."}}},"unicorn/prefer-dom-node-dataset":{create:e=>{e.on("CallExpression",t=>{if(!((rR(t,{method:"setAttribute",argumentsLength:2,optionalCall:!1,optionalMember:!1})||rR(t,{methods:["removeAttribute","hasAttribute"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||rR(t,{method:"getAttribute",argumentsLength:1,optionalCall:!1}))&&rb(t.arguments[0])))return;let r=t.callee.property.name;if(("AwaitExpression"!==t.parent.type||t.parent.argument!==t||"getAttribute"!==r)&&t.arguments[0].value.toLowerCase().startsWith("data-"))return{node:t,messageId:ai,data:{method:t.callee.property.name},fix:function(e,t){let r=e.callee.property.name;if(!("setAttribute"===r&&function e(t){return("MemberExpression"===t.type||"CallExpression"===t.type)&&(!!t.optional||"MemberExpression"===t.type&&e(t.object))}(e.callee))){if(("setAttribute"!==r||r_(e.parent))&&("removeAttribute"!==r||r_(e.parent)))return u=>{let[n]=e.arguments,a=n.value.toLowerCase().slice(5).replaceAll(/-[a-z]/g,e=>e[1].toUpperCase()),{sourceCode:i}=t,o="",s=`${i.getText(e.callee.object)}${e.callee.optional?"?":""}.dataset`;switch(r){case"setAttribute":case"getAttribute":case"removeAttribute":o=aa(a)?`.${a}`:`[${rH(a,n.raw.charAt(0))}]`,o=`${s}${o}`,"setAttribute"===r?o+=` = ${i.getText(e.arguments[1])}`:"removeAttribute"===r&&(o=`delete ${o}`);break;case"hasAttribute":o=`Object.hasOwn(${s}, ${rH(a,n.raw.charAt(0))})`}return u.replaceText(e,o)}}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Prefer using `.dataset` on DOM elements over calling attribute methods.",recommended:"unopinionated"},fixable:"code",messages:{[ai]:"Prefer `.dataset` over `{{method}}(…)`."}}},"unicorn/prefer-modern-math-apis":{create:e=>{let t=[];e.on("CallExpression",t=>{if(!rR(t,{object:"Math",method:"sqrt",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let r=ap(t.arguments[0]);if(r.some(e=>!("BinaryExpression"===e.type&&("*"===e.operator&&ux(e.left,e.right)||"**"===e.operator&&rh(e.right,2)))))return;let u=1===r.length?"abs":"hypot",n=new Set(1===r.length?[]:r.map(e=>e.parent));return{node:t.callee.property,messageId:ao,data:{replacement:`Math.${u}(…)`,description:"Math.sqrt(…)"},*fix(a){let{sourceCode:i}=e;for(let r of(yield a.replaceText(t.callee.property,u),n)){let t=i.getTokenAfter(r.left,e=>"Punctuator"===e.type&&"+"===e.value);yield nl(t,",",a,e),yield u4(r,a,e)}for(let t of r)yield a.removeRange([rm(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 af){let u=t(r,e);u&&(yield u)}})},meta:{type:"suggestion",docs:{description:"Prefer modern `Math` APIs over legacy patterns.",recommended:"unopinionated"},fixable:"code",messages:{[ao]:"Prefer `{{replacement}}` over `{{description}}`."}}},"unicorn/number-literal-case":ay,"unicorn/prefer-number-properties":av,"unicorn/prefer-reflect-apply":{create:e=>{e.on("CallExpression",t=>{if(!rR(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,u=((e,t)=>{if("apply"===t3(e.callee)&&2===e.arguments.length&&aA(e.arguments[0],e.arguments[1]))return r=>r.replaceText(e,aC(t,e.callee.object,e.arguments[0],e.arguments[1]))})(t,r)||((e,t)=>{if("call"===t3(e.callee)&&"apply"===t3(e.callee.object)&&"prototype"===t3(e.callee.object.object)&&e.callee.object.object.object?.type==="Identifier"&&"Function"===e.callee.object.object.object.name&&3===e.arguments.length&&aA(e.arguments[1],e.arguments[2]))return r=>r.replaceText(e,aC(t,e.arguments[0],e.arguments[1],e.arguments[2]))})(t,r);if(u)return{node:t,messageId:aE,fix:u}})},meta:{type:"suggestion",docs:{description:"Prefer `Reflect.apply()` over `Function#apply()`.",recommended:"unopinionated"},fixable:"code",messages:{[aE]:"Prefer `Reflect.apply()` over `Function#apply()`."}}},"unicorn/prefer-set-size":{create:e=>{let{sourceCode:t}=e;e.on("MemberExpression",r=>{var u;if(!rP(r,{property:"length",optional:!1}))return;let n="ArrayExpression"===(u=r.object).type&&1===u.elements.length&&u.elements[0]?.type==="SpreadElement"?u.elements[0].argument:rR(u,{object:"Array",method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})?u.arguments[0]:void 0;if(n&&function(e,t){if(aF(e))return!0;if("Identifier"!==e.type)return!1;let r=tR(t,e);if(!r||1!==r.defs.length)return!1;let[u]=r.defs;if("Variable"!==u.type||"const"!==u.kind)return!1;let n=u.node;return"VariableDeclarator"===n.type&&"Identifier"===n.id.type&&aF(u.node.init)}(n,t.getScope(n)))return{node:r.property,messageId:aS,fix:function(e,t,r){let{sourceCode:u}=e,{object:n,property:a}=t;if(!(u.getCommentsInside(n).length>u.getCommentsInside(r).length))return function*(i){yield i.replaceText(a,"size"),yield i.replaceText(n,u.getText(r)),"ArrayExpression"===n.type&&(yield nr(i,t,e))}}(e,r,n)}})},meta:{type:"suggestion",docs:{description:"Prefer using `Set#size` instead of `Array#length`.",recommended:"unopinionated"},fixable:"code",messages:{[aS]:"Prefer using `Set#size` instead of `Array#length`."}}},"unicorn/prefer-string-replace-all":{create:e=>{e.on("CallExpression",t=>{if(!rR(t,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1}))return;let{arguments:[r],callee:{property:u}}=t;if(!((e,t)=>{if(rx(e))return e.regex.flags.includes("g");if(rC(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=t0(e,t);if(!r)return!1;let{value:u}=r;return"[object RegExp]"===Object.prototype.toString.call(u)&&u.global})(r,e.sourceCode.getScope(r)))return;let n=u.name,a=function(e){let t;if(!rx(e))return;let{pattern:r,flags:u}=e.regex;if("g"!==u.replace("u","").replace("v",""))return;try{t=ak(r,u,{unicodePropertyEscape:u.includes("u"),unicodeSet:u.includes("v"),namedGroups:!0,lookbehind:!0})}catch{return}let n="alternative"===t.type?t.body:[t];if(!n.some(e=>"value"!==e.type))return"'"+n.map(e=>{let{kind:t,codePoint:r,raw:u}=e;if("controlLetter"===t)return 13===r?String.raw`\r`:10===r?String.raw`\n`:9===r?String.raw`\t`:String.raw`\u{${r.toString(16)}}`;if("octal"===t)return String.raw`\u{${r.toString(16)}}`;let n=u;return("identifier"===t&&(n=n.slice(1)),"'"===n||"\\"===n)?`\\${n}`:n}).join("")+"'"}(r);if("replaceAll"===n){if(!a)return;return{node:r,messageId:a_,data:{replacement:a.length<20?a:"a string literal"},fix:e=>e.replaceText(r,a)}}return{node:u,messageId:aT,*fix(e){yield e.insertTextAfter(u,"All"),a&&(yield e.replaceText(r,a))}}})},meta:{type:"suggestion",docs:{description:"Prefer `String#replaceAll()` over regex searches with the global flag.",recommended:"unopinionated"},fixable:"code",messages:{[aT]:"Prefer `String#replaceAll()` over `String#replace()`.",[a_]:"This pattern can be replaced with {{replacement}}."}}},"unicorn/prefer-string-slice":{create:e=>{e.on("CallExpression",t=>{if(!rR(t,{methods:["substr","substring"]}))return;let r=t.callee.property.name;return{node:t,messageId:r,*fix(u,{abort:n}){if(yield u.replaceText(t.callee.property,"slice"),0!==t.arguments.length){if(t.arguments.length>2||t.arguments.some(e=>"SpreadElement"===e.type))return n();yield("substr"===r?function*({node:e,fixer:t,context:r,abort:u}){let n=e.arguments,[a,i]=n;if(!i)return;let{sourceCode:o}=r,s=t0(a,o.getScope(e)),d=rm(i,r);if(s?.value===0){if(rD(i)||aB(i))return;if("number"==typeof aI(i)){let e;return void(yield(e=String(Math.max(0,aI(i))),u6(t,i,e,r)))}return yield t.insertTextBeforeRange(d,"Math.max(0, "),void(yield t.insertTextAfterRange(d,")"))}if(n.every(e=>rD(e))){let e;return void(yield(e=String(a.value+i.value),u6(t,i,e,r)))}return u()}:function*({node:e,fixer:t,context:r,abort:u}){let[n,a]=e.arguments,i=n?aI(n):void 0,o=rg(n,r);if(!a){if(aB(n))return;if(void 0!==i)return void(yield u6(t,n,String(Math.max(0,i)),r));let e=rm(n,r);return yield t.insertTextBeforeRange(e,"Math.max(0, "),void(yield t.insertTextAfterRange(e,")"))}let s=aI(a),d=rg(a,r);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 u6(t,n,String(e[0]),r)),e[1]!==s&&(yield u6(t,a,String(e[1]),r));return}if(0===i||0===s){yield u6(t,n,"0",r),yield u6(t,a,`Math.max(0, ${0===i?d:o})`,r);return}return u()})({node:t,fixer:u,context:e,abort:n})}}}})},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()`."}}},"unicorn/prefer-string-trim-start-end":{create:e=>{e.on("CallExpression",e=>{if(!rR(e,{methods:["trimLeft","trimRight"],argumentsLength:0,optionalCall:!1}))return;let t=e.callee.property,r=t.name,u="trimLeft"===r?"trimStart":"trimEnd";return{node:t,messageId:aP,data:{method:r,replacement:u},fix:e=>e.replaceText(t,u)}})},meta:{type:"suggestion",docs:{description:"Prefer `String#trimStart()` / `String#trimEnd()` over `String#trimLeft()` / `String#trimRight()`.",recommended:"unopinionated"},fixable:"code",messages:{[aP]:"Prefer `String#{{replacement}}()` over `String#{{method}}()`."}}},"unicorn/no-unreadable-iife":{create:e=>{e.on("CallExpression",t=>{if("ArrowFunctionExpression"===t.callee.type&&"BlockStatement"!==t.callee.body.type&&ry(t.callee.body,e))return{node:t,loc:u$(rm(t.callee.body,e),e),messageId:aR}})},meta:{type:"suggestion",docs:{description:"Disallow unreadable IIFEs.",recommended:"unopinionated"},hasSuggestions:!1,messages:{[aR]:"IIFE with parenthesized arrow function body is considered unreadable."}}},"unicorn/throw-new-error":{create:e=>{e.on("CallExpression",t=>{let{callee:r}=t;if(("Identifier"===r.type&&aj.test(r.name)||"MemberExpression"===r.type&&!r.computed&&"Identifier"===r.property.type&&aj.test(r.property.name))&&!rP(r,{object:"Data",property:"TaggedError",computed:!1}))return{node:t,messageId:aL,fix:r=>nu(t,e,r)}})},meta:{type:"suggestion",docs:{description:"Require `new` when creating an error.",recommended:"unopinionated"},fixable:"code",messages:{[aL]:"Use `new` when creating an error."}}},"unicorn/escape-case":{create:e=>{let t="lowercase"===e.options[0];e.on("Literal",e=>{if(rb(e))return a1({node:e,original:e.raw,lowercase:t})}),e.on("Literal",e=>{if(rx(e))return a1({node:e,original:e.raw,regex:a0,lowercase:t})}),e.on("TemplateElement",r=>{if(!rN(r.parent,["String.raw"]))return a1({node:r,original:r.value.raw,lowercase:t,fix:(t,u)=>nd(r,u,e,t)})})},meta:{type:"suggestion",docs:{description:"Require escape sequences to use uppercase or lowercase values.",recommended:"unopinionated"},fixable:"code",schema:[{enum:["uppercase","lowercase"]}],defaultOptions:["uppercase"],messages:{[aX]:"Use uppercase characters for the value of the escape sequence.",[aY]:"Use lowercase characters for the value of the escape sequence."}}},"unicorn/no-hex-escape":{create:e=>{e.on("Literal",t=>{if(rb(t)||rx(t))return a2(e,t,t.raw)}),e.on("TemplateElement",t=>{if(!rN(t.parent,["String.raw"]))return a2(e,t,t.value.raw)})},meta:{type:"suggestion",docs:{description:"Enforce the use of Unicode escapes instead of hexadecimal escapes.",recommended:"unopinionated"},fixable:"code",messages:{[a3]:"Use Unicode escapes instead of hexadecimal escapes."}}},"unicorn/prefer-prototype-methods":{create:function(e){let{sourceCode:t}=e,r=[];e.on("CallExpression",e=>{r.push(e)}),e.onExit("Program",function*(u){let n=new WeakMap;for(let{node:e,path:r}of new rs(t.getScope(u)).iterateGlobalReferences(Object.fromEntries(a4.map(e=>[e,{[rs.READ]:!0}]))))n.set(e,r);for(let t of r)yield function(e,{context:t,globalReferences:r}){let u;rR(e,{object:"Reflect",method:"apply",minimumArguments:1,optionalCall:!1,optionalMember:!1})?u=e.arguments[0]:rR(e,{methods:["apply","bind","call"],optionalCall:!1,optionalMember:!1})&&(u=e.callee.object);let{isGlobalReference:n,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(!rP(e,{optional:!1}))return;let u=e.object;if(rk(u)||rT(u))return{constructorName:"ArrayExpression"===u.type?"Array":"Object",methodName:t3(e,t.sourceCode.getScope(e))}}(u,{context:t,globalReferences:r})??{};if(a)return{node:u,messageId:i?"known-method":"unknown-method",data:{constructorName:a,methodName:i},*fix(r){if(n)return void(yield r.replaceText(u,`${a}.prototype.${i}`));if(rP(u)){let n=u.object;yield r.replaceText(n,`${a}.prototype`),("ArrayExpression"===n.type||"ObjectExpression"===n.type)&&(yield nr(r,e,t))}}}}(t,{context:e,globalReferences:n})})},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`."}}},"unicorn/error-message":{create:e=>{e.on(["CallExpression","NewExpression"],t=>{if(!(rS(t,{names:a5,optional:!1})&&e.sourceCode.isGlobalReference(t.callee)))return;let r=t.callee.name,u=a7.has(r)?a7.get(r):0,n=t.arguments;if(n.some((e,t)=>t<=u&&"SpreadElement"===e.type))return;let a=n[u];if(!a)return{node:t,messageId:a8,data:{constructorName:r}};if("ArrayExpression"===a.type||"ObjectExpression"===a.type)return{node:a,messageId:a9};let i=t0(a,e.sourceCode.getScope(a));if(!i)return;let{value:o}=i;return"string"!=typeof o?{node:a,messageId:a9}:""===o?{node:a,messageId:a6}:void 0})},meta:{type:"problem",docs:{description:"Enforce passing a `message` value when creating a built-in error.",recommended:"unopinionated"},messages:{[a8]:"Pass a message to the `{{constructorName}}` constructor.",[a6]:"Error message should not be an empty string.",[a9]:"Error message should be a string."}}},"unicorn/no-instanceof-builtins":is,"unicorn/prefer-type-error":{create:e=>{e.on("ThrowStatement",e=>{let t;if(rC(e.argument,{name:"Error"})&&e.parent&&e.parent.body&&1===e.parent.body.length&&e.parent.parent&&"IfStatement"===(t=e.parent.parent).type&&iy(t.test)){let t=e.argument.callee;return{node:t,messageId:id,fix:e=>e.insertTextBefore(t,"Type")}}})},meta:{type:"suggestion",docs:{description:"Enforce throwing `TypeError` in type checking conditions.",recommended:"unopinionated"},fixable:"code",messages:{[id]:"`new Error()` is too unspecific for a type check. Use `new TypeError()` instead."}}},"unicorn/consistent-destructuring":{create:e=>{let{sourceCode:t}=e,r=new Map;e.on("VariableDeclarator",e=>{"ObjectPattern"===e.id.type&&e.init&&"Literal"!==e.init.type&&(e=>{for(;e;){if(e.computed)return!1;if("MemberExpression"!==e.type)break;e=e.object}return"Identifier"===e.type||"ThisExpression"===e.type})(e.init)&&r.set(t.getText(e.init),{scope:t.getScope(e),variables:t.getDeclaredVariables(e),objectPattern:e.id})}),e.on("MemberExpression",e=>{if(e.computed||rS(e.parent)&&e.parent.callee===e||ui(e))return;let u=r.get(t.getText(e.object));if(!u)return;let{scope:n,objectPattern:a}=u,i=t.getScope(e);if(!((e,t)=>{for(;e;){if(e===t)return!0;e=e.upper}return!1})(i,n))return;let o=a.properties.filter(e=>"Property"===e.type&&"Identifier"===e.key.type&&"Identifier"===e.value.type),s=a.properties.at(-1),d=s&&"RestElement"===s.type,l=t.getText(e),c=t.getText(e.property),f=o.find(e=>e.key.name===c);if(!f&&(d||r9(c,[i])!==c))return;if("MemberExpression"===e.parent.type)return{node:e,messageId:ih};let p=f?f.value.name:c;return{node:e,messageId:ih,suggest:[{messageId:ib,data:{expression:l,property:p},*fix(t){let{properties:r}=a,u=r.at(-1);yield t.replaceText(e,p),f||(yield u?t.insertTextAfter(u,`, ${p}`):t.replaceText(a,`{${p}}`))}}]}})},meta:{type:"suggestion",docs:{description:"Use destructured variables over properties.",recommended:!1},hasSuggestions:!0,messages:{[ih]:"Use destructured variables over properties.",[ib]:"Replace `{{expression}}` with destructured property `{{property}}`."}}},"unicorn/new-for-builtins":{create:e=>{iE.listen({context:e}),iA.listen({context:e})},meta:{type:"suggestion",docs:{description:"Enforce the use of `new` for all builtins, except `String`, `Number`, `Boolean`, `Symbol` and `BigInt`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{enforce:"Use `new {{name}}()` instead of `{{name}}()`.",disallow:"Use `{{name}}()` instead of `new {{name}}()`.",[ix]:"Use `String(new Date())` instead of `Date()`.",[iv]:"Switch to `String(new Date())`."}}},"unicorn/prefer-single-call":ik,"unicorn/no-process-exit":{create:e=>{let t;if(0===e.sourceCode.lines[0].indexOf("#!"))return;let r=!1,u=[];e.on("CallExpression",e=>{rL(e)&&i_(e.arguments[0])&&(r=!0)}),e.on("ImportDeclaration",e=>{"Literal"===e.source.type&&i_(e.source)&&(r=!0)}),e.on("CallExpression",e=>{rR(e,{object:"process",methods:["on","once"],minimumArguments:1,optionalCall:!1,optionalMember:!1})&&(t=e)}),e.onExit("CallExpression",e=>{e===t&&(t=void 0)}),e.on("CallExpression",e=>{!t&&rR(e,{object:"process",method:"exit",optionalCall:!1,optionalMember:!1})&&u.push(e)}),e.onExit("Program",function*(){if(!r)for(let e of u)yield{node:e,messageId:iT}})},meta:{type:"suggestion",docs:{description:"Disallow `process.exit()`.",recommended:"unopinionated"},messages:{[iT]:"Only use `process.exit()` in CLI apps. Throw an error instead."}}},"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:u,readonly:n,accessibility:a,decorators:i,key:o}=e;return!(!iO(e)&&"MethodDefinition"!==e.type||!r||t||"PrivateIdentifier"===o.type||u||n||void 0!==a||Array.isArray(i)&&i.length>0)}(e))))return{node:t,loc:function(e,t){let{sourceCode:r}=t,{body:u}=e,n=r.getTokenBefore(u),{start:a}=r.getLoc(e),{end:i}=r.getLoc(n);return{start:a,end:i}}(t,e),messageId:iL,fix:function(e,t){let{type:r,id:u,body:n,declare:a,abstract:i,implements:o,parent:s}=e;if(a||i||Array.isArray(o)&&o.length>0||"ClassExpression"===r&&u)return;let d="ClassDeclaration"===e.type&&"ExportDefaultDeclaration"===e.parent.type&&e.parent.declaration===e;if(d&&u)return;let{sourceCode:l}=t;for(let e of n.body)if(iO(e)&&(e.typeAnnotation||e.value&&l.getText(e.value).includes("this")))return;return function*(u){let a=l.getFirstToken(e);if(rV(a,{expected:{type:"Keyword",value:"class"},ruleId:"no-static-only-class"}),d||"ClassExpression"===r)if("ClassExpression"===r&&"ReturnStatement"===s.type&&l.getLoc(n).start.line!==l.getLoc(s).start.line&&l.text.slice(l.getRange(a)[1],l.getRange(n)[0]).trim()){yield u.replaceText(a,"{");let e=l.getFirstToken(n);yield u.remove(e)}else yield u.replaceText(a,""),yield u7(a,t,u);else yield u.replaceText(a,"const"),yield u.insertTextBefore(n,"= "),yield u.insertTextAfter(n,";");for(let e of n.body)yield function*(e,t,r){let{sourceCode:u}=t,n=u.getFirstToken(e);rV(n,{expected:{type:"Keyword",value:"static"},ruleId:"no-static-only-class"}),yield r.remove(n),yield u7(n,t,r);let a=iO(e)?u.getLastToken(e):u.getTokenAfter(e),i=tN(a);if(iO(e)){let{key:t,value:n}=e;if(n){let e=u.getTokenAfter(t,ij);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,u)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Disallow classes that only have static members.",recommended:"unopinionated"},fixable:"code",messages:{[iL]:"Use an object instead of a class with only static members."}}},"unicorn/no-unreadable-array-destructuring":{create:e=>{let{sourceCode:t}=e;e.on("ArrayPattern",r=>{let{elements:u,parent:n}=r;if(u.length<3||!u.some((e,t,r)=>null===e&&null===r[t+1]))return;let a={node:r,messageId:iN},i=u.filter(e=>null!==e);if("VariableDeclarator"===n.type&&n.id===r&&null!==n.init&&1===i.length){let[o]=i;"AssignmentPattern"!==o.type&&(a.fix=function*(a){let i=u.indexOf(o),s="RestElement"===o.type,d=s?o.argument:o;yield a.replaceText(r,t.getText(d));let l=s?`.slice(${i})`:`[${i}]`,c=n.init;!ry(c,e)&&uL(c,e)?(yield a.insertTextBefore(c,"("),yield a.insertTextAfter(n,`)${l}`)):yield a.insertTextAfter(n,l),yield nr(a,r,e)})}return a})},meta:{type:"suggestion",docs:{description:"Disallow unreadable array destructuring.",recommended:"unopinionated"},fixable:"code",messages:{[iN]:"Array destructuring may not contain consecutive ignored values."}}},"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)||rS(r.parent.parent)&&r.parent.parent.arguments.includes(r.parent)))))return;let u=r.parent,n=t.getFirstToken(u),a=u.parent.type;return{node:n,messageId:i$,data:{argumentType:"ArrayExpression"===r.type?"array":"object",parentDescription:iV[a]},*fix(i){let o;yield i.remove(n),yield u4(r,i,e);let s=t.getFirstToken(r);yield i.remove(s);let[d,l]=t.getLastTokens(r,2);if(yield i.remove(l),tO(d)&&(yield i.remove(d)),rk(r)||rT(r)){let e=t.getTokenAfter(u);tO(e)&&(yield i.remove(e))}if("CallExpression"===a||"NewExpression"===a)for(let[e,u]of(o=t.getFirstToken(r),r.elements.map((e,u,n)=>{if(u===n.length-1){let e=t.getLastToken(r,{skip:1});return tO(e)?e:void 0}let a=t.getTokenAfter(e||o,tO);return o=a,a})).entries())r.elements[e]||(yield i.insertTextBefore(u,"undefined"))}}}),e.on("ArrayExpression",t=>{if(!iW(t))return;let{parent:r}=t;if(!("ForOfStatement"===r.type&&r.right===t||"YieldExpression"===r.type&&r.delegate&&r.argument===t||(rC(r,{names:["Map","WeakMap","Set","WeakSet"],argumentsLength:1})||rC(r,{names:ie,minimumArguments:1})||rR(r,{object:"Promise",methods:["all","allSettled","any","race"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||rR(r,{objects:["Array",...ie],method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})||rR(r,{object:"Object",method:"fromEntries",argumentsLength:1,optionalCall:!1,optionalMember:!1}))&&r.arguments[0]===t))return;let u="",n=iM;switch(r.type){case"ForOfStatement":n=iz;break;case"YieldExpression":n=iU;break;case"NewExpression":u=`new ${r.callee.name}(…)`;break;case"CallExpression":u=`${r.callee.object.name}.${r.callee.property.name}(…)`}return{node:t,messageId:n,data:{parentDescription:u},fix:r=>iZ(r,t,e)}}),e.on("ArrayExpression",t=>{if(!iW(t))return;let r=t.elements[0].argument;if(!(rR(r,{methods:["concat","copyWithin","flat","slice","splice","toReversed","toSorted","toSpliced","with"],optionalCall:!1,optionalMember:!1})||rR(r,{method:"split",optionalCall:!1,optionalMember:!1})||rR(r,{object:"Object",methods:["keys","values"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||"AwaitExpression"===r.type&&rR(r.argument,{object:"Promise",methods:["all","allSettled"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||rR(r,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1})||rC(r,{name:"Array"})))return;let u={node:t,messageId:iq};return rC(r,{name:"Array"})||"CallExpression"===r.type&&"MemberExpression"===r.callee.type&&"Identifier"===r.callee.property.type&&"slice"===r.callee.property.name?u:Object.assign(u,{fix:r=>iZ(r,t,e)})})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary spread.",recommended:"unopinionated"},fixable:"code",messages:{[i$]:"Spread an {{argumentType}} literal in {{parentDescription}} is unnecessary.",[iM]:"`{{parentDescription}}` accepts iterable as argument, it's unnecessary to convert to an array.",[iz]:"`for…of` can iterate over iterable, it's unnecessary to convert to an array.",[iU]:"`yield*` can delegate iterable, it's unnecessary to convert to an array.",[iq]:"Unnecessarily cloning an array."}}},"unicorn/no-useless-switch-case":{create:e=>{e.on("SwitchStatement",function*(t){let{cases:r}=t;if(!(r.length<2)&&null===r.at(-1).test)for(let t=r.length-2;t>=0;t--){let u=r[t];if(!iJ(u))break;yield{node:u,loc:function(e,t){let{sourceCode:r}=t,u=e.test||r.getFirstToken(e),n=r.getTokenAfter(u,t$);return{start:r.getLoc(e).start,end:r.getLoc(n).end}}(u,e),messageId:iG,suggest:[{messageId:iH,fix:e=>e.remove(u)}]}}})},meta:{type:"suggestion",docs:{description:"Disallow useless case in switch statements.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[iG]:"Useless case in switch statement.",[iH]:"Remove this case."}}},"unicorn/no-useless-undefined":iY,"unicorn/numeric-separators-style":i3,"unicorn/prefer-array-find":ol,"unicorn/prefer-array-flat-map":{create:e=>{e.on("CallExpression",t=>{if(!(rR(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)&&rR(t.callee.object,{method:"map",optionalCall:!1})))return;let r=t.callee.object;if(rO(r.callee.object,of))return;let{sourceCode:u}=e,n=r.callee.property;return{node:t,loc:{start:u.getLoc(n).start,end:u.getLoc(t).end},messageId:oc,*fix(r){yield ni(r,t,e),yield r.replaceText(n,"flatMap")}}})},meta:{type:"suggestion",docs:{description:"Prefer `.flatMap(…)` over `.map(…).flat()`.",recommended:"unopinionated"},fixable:"code",messages:{[oc]:"Prefer `.flatMap(…)` over `.map(…).flat()`."}}},"unicorn/prefer-array-flat":oD,"unicorn/prefer-array-some":oA,"unicorn/prefer-code-point":{create:e=>{e.on("CallExpression",e=>{if(rR(e,{method:"charCodeAt",optionalCall:!1}))return oC(e.callee.property,"codePointAt")}),e.on("MemberExpression",e=>{if(rP(e,{object:"String",property:"fromCharCode",optional:!1}))return oC(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()`."}}},"unicorn/prefer-default-parameters":{create:e=>{let{sourceCode:t}=e,r=[],u=(e,u,n,a)=>{let i,o=r.at(-1);if(!o||!u||!n||"Identifier"!==u.type||"LogicalExpression"!==n.type||"||"!==n.operator&&"??"!==n.operator||"Identifier"!==n.left.type||"Literal"!==n.right.type)return;let{name:s}=u,{left:{name:d},right:{raw:l}}=n;if(a&&s!==d)return;let c=tR(t.getScope(e),d);if(!c)return;let{references:f}=c,{params:p}=o,m=p.find(e=>"Identifier"===e.type&&e.name===d);if(((e,t,r)=>{for(let u of t.body.body){if(u===r)break;if(ow(e,u))return!0}return!1})(t,o,e)||a&&f[0].identifier!==u||!a&&f.length>1||(i=p.at(-1),!m||m!==i))return;let g=((e,t)=>{if("ArrowFunctionExpression"!==t.type||t.params.length>1)return!1;let[r]=t.params,u=e.getTokenBefore(r),n=e.getTokenAfter(r);return!n||!u||"("!==u.value||")"!==n.value})(t,o)?`(${s} = ${l})`:`${s} = ${l}`;return{node:e,messageId:oS,suggest:[{messageId:oF,fix:r=>[r.replaceText(m,g),((e,t,r)=>{let{line:u}=t.getLoc(r).start,{column:n}=t.getLoc(r).end,a=t.getText(r),i=t.lines[u-1],o=i.trim()===a,s=" "===i[n];if(o)return e.removeRange([t.getIndexFromLoc({line:u,column:0}),t.getIndexFromLoc({line:u+1,column:0})]);if(s){let[u,n]=t.getRange(r);return e.removeRange([u,n+1])}return e.remove(r)})(r,t,e)]}]}};e.on(rI,e=>{r.push(e)}),e.onExit(rI,()=>{r.pop()}),e.on("AssignmentExpression",e=>{if("ExpressionStatement"===e.parent.type&&e.parent.expression===e)return u(e.parent,e.left,e.right,!0)}),e.on("VariableDeclarator",e=>{if("VariableDeclaration"===e.parent.type&&e.parent.declarations[0]===e)return u(e.parent,e.id,e.init,!1)})},meta:{type:"suggestion",docs:{description:"Prefer default parameters over reassignment.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[oS]:"Prefer default parameters over reassignment.",[oF]:"Replace reassignment with default parameter."}}},"unicorn/prefer-logical-operator-over-ternary":{create:e=>{let{sourceCode:t}=e;e.on("ConditionalExpression",r=>{let{test:u,consequent:n,alternate:a}=r;return o_(u,n,t)?oI({context:e,conditionalExpression:r,left:u,right:a}):"UnaryExpression"===u.type&&"!"===u.operator&&u.prefix&&o_(u.argument,a,t)?oI({context:e,conditionalExpression:r,left:u.argument,right:n}):void 0})},meta:{type:"suggestion",docs:{description:"Prefer using a logical operator over a ternary.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[ok]:"Prefer using a logical operator over a ternary.",[oT]:"Switch to `{{operator}}` operator."}}},"unicorn/prefer-optional-catch-binding":{create:e=>{e.on("CatchClause",t=>{let r=t.param;if(!r)return;let{sourceCode:u}=e;if(u.getDeclaredVariables(r.parent).some(e=>e.references.length>0))return;let{type:n,name:a,parent:i}=r;return{node:r,messageId:"Identifier"===n?oB:oP,data:{name:a},*fix(e){let t=u.getTokenBefore(r);rV(t,{test:tM,expected:"(",ruleId:"prefer-optional-catch-binding"});let n=u.getTokenAfter(r);rV(n,{test:tz,expected:")",ruleId:"prefer-optional-catch-binding"}),yield e.remove(t),yield e.remove(r),yield e.remove(n);let[,a]=u.getRange(n),[o]=u.getRange(i.body),s=u.text.slice(a,o),d=s.length-s.trimStart().length;0!==d&&(yield e.removeRange([a,a+d]))}}})},meta:{type:"suggestion",docs:{description:"Prefer omitting the `catch` binding parameter.",recommended:"unopinionated"},fixable:"code",messages:{[oB]:"Remove unused catch binding `{{name}}`.",[oP]:"Remove unused catch binding."}}},"unicorn/prefer-regexp-test":oM,"unicorn/prefer-set-has":{create:e=>{e.on("Identifier",t=>{let{parent:r}=t;if(!("VariableDeclarator"===r.type&&r.id===t&&r.init&&"VariableDeclaration"===r.parent.type&&r.parent.declarations.includes(r)&&("ExportNamedDeclaration"!==r.parent.parent.type||r.parent.parent.declaration!==r.parent)&&("ArrayExpression"===r.init.type||rS(r.init,{name:"Array",optional:!1})||rR(r.init,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1})||rR(r.init,{methods:oq,optionalCall:!1,optionalMember:!1}))))return;let u=tR(e.sourceCode.getScope(t),t);if(!u)return;let n=un(u).filter(e=>e!==t);if(0===n.length||n.some(e=>!(rR(e.parent.parent,{method:"includes",optionalCall:!1,optionalMember:!1,argumentsLength:1})&&e.parent.object===e))||1===n.length&&n.every(e=>!((e,t)=>{let r=t.parent.parent.parent,{parent:u}=e.parent;for(;u&&u!==r;){if(oW.has(u.type))return!0;u=u.parent}return!1})(e,t)))return;let a={node:t,messageId:oz,data:{name:t.name}},i=function*(e){for(let r of(yield e.insertTextBefore(t.parent.init,"new Set("),yield e.insertTextAfter(t.parent.init,")"),n))yield e.replaceText(r.parent.property,"has")};return t.typeAnnotation?a.suggest=[{messageId:oU,fix:i}]:a.fix=i,a})},meta:{type:"suggestion",docs:{description:"Prefer `Set#has()` over `Array#includes()` when checking for existence or non-existence.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[oz]:"`{{name}}` should be a `Set`, and use `{{name}}.has()` to check existence or non-existence.",[oU]:"Switch `{{name}}` to `Set`."}}},"unicorn/prefer-string-raw":{create:e=>{e.on("Literal",t=>{if(!rb(t)||function(e){let{parent:t}=e,{type:r}=t;return rF(t)||("Property"===r||"PropertyDefinition"===r||"MethodDefinition"===r||"AccessorProperty"===r)&&!t.computed&&t.key===e||("TSAbstractPropertyDefinition"===r||"TSAbstractMethodDefinition"===r||"TSAbstractAccessorProperty"===r||"TSPropertySignature"===r)&&t.key===e||("ImportDeclaration"===r||"ExportNamedDeclaration"===r||"ExportAllDeclaration"===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)||oV(t))return;let{sourceCode:r}=e,{raw:u}=t;if("\\"===u.at(-2)||!u.includes("\\\\")||u.includes("`")||u.includes("${")||r.getLoc(t).start.line!==r.getLoc(t).end.line)return;let n=oG(u.slice(1,-1),u.charAt(0));if(n===t.value)return{node:t,messageId:oZ,*fix(r){yield nr(r,t,e),yield r.replaceText(t,`String.raw\`${n}\``)}}}),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)||oG(t)!==e)||oV(t)))return{node:t,messageId:oZ,*fix(r){for(let u of(yield nr(r,t,e),yield r.insertTextBefore(t,"String.raw"),t.quasis)){let{cooked:t,raw:n}=u.value;t!==n&&(yield nd(u,t,e,r))}}}})},meta:{type:"suggestion",docs:{description:"Prefer using the `String.raw` tag to avoid escaping `\\`.",recommended:"unopinionated"},fixable:"code",messages:{[oZ]:"`String.raw` should be used to avoid escaping `\\`."}}},"unicorn/prefer-switch":oQ,"unicorn/require-number-to-fixed-digits-argument":{create:e=>{e.on("CallExpression",t=>{if(!rR(t,{method:"toFixed",argumentsLength:0,optionalCall:!1})||"NewExpression"===t.callee.object.type)return;let{sourceCode:r}=e,[u,n]=r.getLastTokens(t,2);return{loc:{start:r.getLoc(u).start,end:r.getLoc(n).end},messageId:o0,fix:r=>u5(r,t,"0",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the digits argument with `Number#toFixed()`.",recommended:"unopinionated"},fixable:"code",messages:{[o0]:"Missing the digits argument."}}},"unicorn/template-indent":{create:e=>{let{sourceCode:t}=e,r={...e.options[0]};r.comments=r.comments.map(e=>e.toLowerCase());let u=new WeakSet,n=n=>{let a;if("TemplateLiteral"!==n.type||u.has(n))return;u.add(n);let i="__PLACEHOLDER__"+Math.random(),o=n.quasis.map(e=>t.getText(e).slice(1,e.tail?-1:-2)).join(i),s=o.match(/\r?\n/);if(!s)return;let d=s[0],l=t.lines[t.getLoc(n).start.line-1].match(/^(\s*)\S/),c=l?l[1]:"";a="string"==typeof r.indent?r.indent:"number"==typeof r.indent?" ".repeat(r.indent):c.startsWith(" ")?" ":" ";let f=(function(e){let t=e.match(/^[ \t]*(?=\S)/gm);if(!t)return e;let r=1/0;for(let e of t)r=Math.min(r,e.length);return 0===r||r===1/0?e:e.replace(RegExp(`^[ \\t]{${r}}`,"gm"),"")})(o).replaceAll(RegExp(`^${d}|${d}[ ]*$`,"g"),""),p=d+function(e,t=1,r={}){let{indent:u=" ",includeEmptyLines:n=!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 u)throw TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof u}\``);return 0===t?e:e.replace(n?/^/gm:/^(?!\s*$)/gm,u.repeat(t))}(f,1,{indent:c+a})+d+c;if(p!==o)return{node:n,messageId:o1,fix:t=>p.split(i).map((r,u)=>nd(n.quasis[u],r,e,t))}};e.on("TemplateLiteral",e=>{if((e=>{if(r.comments.length>0){let u=t.getTokenBefore(e,{includeComments:!0});if(u?.type==="Block"&&r.comments.includes(u.value.trim().toLowerCase()))return!0}return!!(oV(e)||r.tags.length>0&&rN(e,r.tags)||r.functions.length>0&&"CallExpression"===e.parent.type&&e.parent.arguments.includes(e)&&rO(e.parent.callee,r.functions))})(e))return n(e)}),e.on(r.selectors,e=>n(e))},meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation.",recommended:!0},fixable:"code",schema:o3,defaultOptions:[{tags:["outdent","dedent","gql","sql","html","styled"],functions:["dedent","stripIndent"],selectors:[],comments:["HTML","indent"]}],messages:{[o1]:"Templates should be properly indented."}}},"unicorn/no-single-promise-in-promise-methods":{create:e=>{e.on("CallExpression",t=>{if(!(rR(t,{object:"Promise",methods:iR,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,u={node:t.arguments[0],messageId:iI,data:{method:r}},{sourceCode:n}=e;if("AwaitExpression"===t.parent.type&&t.parent.argument===t&&("all"!==r||r_(t.parent.parent)))return u.fix=r=>{let[u]=t.arguments[0].elements,n=rg(u,e);return ry(u,e)||"SequenceExpression"!==u.type&&"YieldExpression"!==u.type&&"ArrowFunctionExpression"!==u.type&&"ConditionalExpression"!==u.type&&"AssignmentExpression"!==u.type&&"LogicalExpression"!==u.type&&"BinaryExpression"!==u.type||(n=`(${n})`),r.replaceText(t,n)},u;return"all"===r?u:(u.suggest=[{messageId:iB,fix:r=>{let[u]=t.arguments[0].elements,n=rg(u,e);return ry(u,e)||"Identifier"===u.type||"MemberExpression"===u.type||(n=`(${n})`),uS(e.sourceCode.getTokenBefore(t),e,n)&&(n=`;${n}`),r.replaceText(t,n)}},{messageId:iP,fix:function*(e){let r=t.callee.property;yield e.replaceText(r,"resolve");let[u]=t.arguments,a=n.getFirstToken(u),[i,o]=n.getLastTokens(u,2);yield e.remove(a),yield e.remove(o),tO(i)&&(yield e.remove(i))}}],u)})},meta:{type:"suggestion",docs:{description:"Disallow passing single-element arrays to `Promise` methods.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[iI]:"Wrapping single-element array with `Promise.{{method}}()` is unnecessary.",[iB]:"Use the value directly.",[iP]:"Switch to `Promise.resolve(…)`."}}},"unicorn/no-await-in-promise-methods":{create:e=>{e.on("CallExpression",function*(t){if(rR(t,{object:"Promise",methods:o5,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:o2,data:{method:t.callee.property.name},suggest:[{messageId:o4,*fix(t){let u=e.sourceCode.getFirstToken(r);yield t.remove(u),yield u7(u,e,t)}}]})})},meta:{type:"suggestion",docs:{description:"Disallow using `await` in `Promise` method parameters.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[o2]:"Promise in `Promise.{{method}}()` should not be awaited.",[o4]:"Remove `await`."}}},"unicorn/no-negation-in-equality-check":{create:e=>{e.on("BinaryExpression",t=>{let{operator:r,left:u}=t;if(!("BinaryExpression"===t.type&&o9.has(t.operator)&&o7(u)&&!o7(u.argument)))return;let{sourceCode:n}=e,a=n.getFirstToken(u),i=`${r.startsWith("!")?"=":"!"}${r.slice(1)}`;return{node:a,messageId:o8,suggest:[{messageId:o6,data:{operator:i},*fix(o){yield nr(o,t,e);let s=n.getTokenAfter(a),{parent:d}=t;("ReturnStatement"===d.type||"ThrowStatement"===d.type)&&!ry(t,e)&&(uh(n.getFirstToken(d),s,e)||(yield u9(o,d,e))),yield o.remove(a),uS(n.getTokenBefore(a),e,s.value)&&(yield o.insertTextAfter(a,";"));let l=n.getTokenAfter(u,e=>"Punctuator"===e.type&&e.value===r);yield o.replaceText(l,i)}}]}})},meta:{type:"problem",docs:{description:"Disallow negated expression in equality check.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[o8]:"Negated expression is not allowed in equality check.",[o6]:"Switch to '{{operator}}' check."}}},"unicorn/no-unnecessary-slice-end":{create(e){se(e,{methods:["slice"],messageId:st})},meta:{type:"suggestion",docs:{description:"Disallow using `.length` or `Infinity` as the `end` argument of `{Array,String,TypedArray}#slice()`.",recommended:"unopinionated"},fixable:"code",messages:{[st]:"Passing `{{description}}` as the `end` argument is unnecessary."}}},"unicorn/no-lonely-if":{create:e=>{e.on("IfStatement",t=>{if(sl(t)&&("BlockStatement"===t.parent.type&&1===t.parent.body.length&&t.parent.body[0]===t&&sl(t.parent.parent)&&t.parent.parent.consequent===t.parent||sl(t.parent)&&t.parent.consequent===t))return{node:t,messageId:sd,fix:function(e,t){let{sourceCode:r}=t;return function*(u){let n=("BlockStatement"===e.parent.type?e.parent:e).parent,a={...n,...sf(n,r)},i={...e,...sf(e,r)};if(yield u.remove(i.ifToken),yield u7(i.ifToken,t,u),a.openingBraceToken){yield u.remove(a.openingBraceToken),yield u7(a.openingBraceToken,t,u),yield u.remove(a.closingBraceToken);let e=r.getTokenBefore(a.closingBraceToken,{includeComments:!0});yield u7(e,t,u)}for(let{test:e,openingParenthesisToken:r,closingParenthesisToken:n}of(yield u.insertTextBefore(a.openingParenthesisToken,"("),yield u.insertTextAfter(i.closingParenthesisToken,`)${"EmptyStatement"===i.consequent.type?"":" "}`),yield u.insertTextAfter(a.closingParenthesisToken," && "),[a,i]))(ry(e,t)||!sc(e))&&(yield u.remove(r),yield u.remove(n)),yield u7(n,t,u);if("BlockStatement"!==i.consequent.type){let e=r.getLastToken(i.consequent);if(tq(e)){let n=r.getTokenAfter(a);n&&uS(e,t,n.value)&&(yield u.insertTextBefore(n,";"))}}}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Disallow `if` statements as the only statement in `if` blocks without `else`.",recommended:"unopinionated"},fixable:"code",messages:{[sd]:"Unexpected `if` as the only statement in a `if` block without `else`."}}},"unicorn/no-magic-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!rR(t,{method:"flat",argumentsLength:1,optionalCall:!1}))return;let[r]=t.arguments;if(!rD(r)||1===r.value)return;let{sourceCode:u}=e,{openingParenthesisToken:n,closingParenthesisToken:a}=ue(t,e);if(!u.commentsExistBetween(n,a))return{node:r,messageId:sp}})},meta:{type:"suggestion",docs:{description:"Disallow a magic number as the `depth` argument in `Array#flat(…).`",recommended:"unopinionated"},messages:{[sp]:"Magic number as depth is not allowed."}}},"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:sm,*fix(u){if(yield function*(e,t,r){let{sourceCode:u}=r,{test:n}=t;if("UnaryExpression"===n.type){let a=u.getFirstToken(n);"IfStatement"===t.type&&(yield u4(n.argument,e,r)),yield e.remove(a);return}let a=u.getTokenAfter(n.left,e=>"Punctuator"===e.type&&e.value===n.operator);yield e.replaceText(a,"="+a.value.slice(1))}(u,t,e),yield function*(e,t,r){let u="IfStatement"===t.type,[n,a]=[t.consequent,t.alternate].map(e=>{let t=rm(e,r),n=r.sourceCode.text.slice(...t);return u&&"BlockStatement"!==e.type&&(n=`{${n}}`),{range:t,text:n}});if(n.text===a.text)return;let{sourceCode:i}=r;yield e.replaceTextRange(i.getRange(n),a.text),yield e.replaceTextRange(i.getRange(a),n.text)}(u,t,e),"ConditionalExpression"!==t.type||"UnaryExpression"!==r.type)return;yield nr(u,t,e);let{sourceCode:n}=e,{parent:a}=t,[i,o]=n.getFirstTokens(r,2);"ReturnStatement"!==a.type&&"ThrowStatement"!==a.type||a.argument!==t||uh(i,o,e)||ry(t,e)||ry(r,e)?uS(n.getTokenBefore(t),e,o.value)&&(yield u.insertTextBefore(t,";")):yield u9(u,a,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow negated conditions.",recommended:"unopinionated"},fixable:"code",messages:{[sm]:"Unexpected negated condition."}}},"unicorn/no-object-as-default-parameter":{create:e=>{e.on("AssignmentPattern",e=>{if(!("ObjectExpression"===e.right.type&&e.right.properties.length>0&&rB(e.parent)&&e.parent.params.includes(e)))return;let{left:t,right:r}=e;return"Identifier"===t.type?{node:t,messageId:sg,data:{parameter:t.name}}:{node:r,messageId:sy}})},meta:{type:"problem",docs:{description:"Disallow the use of objects as default parameters.",recommended:"unopinionated"},messages:{[sg]:"Do not use an object literal as default for parameter `{{parameter}}`.",[sy]:"Do not use an object literal as default."}}},"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,u=t.property.name,n=t.object,a=r;if(sb.has(u))return{method:u,target:n,argumentsNodes:a};if("call"!==u&&"apply"!==u)return;let i="apply"===u;if(u=sD(t.object),!sb.has(u))return;let{supportObjects:o}=sb.get(u),s=t.object.object;if(rk(s)||"slice"===u&&rh(s,"")||"prototype"===sD(s)&&"Identifier"===s.object.type&&o.has(s.object.name)){if([n]=r,i){let[,e]=r;if(!e||"ArrayExpression"!==e.type)return;a=e.elements}else a=r.slice(1);return{method:u,target:n,argumentsNodes:a}}}(t);if(!r)return;let{method:u,target:n,argumentsNodes:a}=r,{argumentsIndexes:i}=sb.get(u),o=i.map(e=>(function e(t,r){if(!t)return;let{type:u,operator:n,left:a,right:i}=t;if("BinaryExpression"===u&&"-"===n&&rD(i)&&i.value>0)return"MemberExpression"===a.type&&!a.computed&&!a.optional&&"Identifier"===a.property.type&&"length"===a.property.name&&ux(a.object,r)?a:e(a,r)})(a[e],n)).filter(Boolean);if(0!==o.length)return{node:t,messageId:sh,data:{method:u},*fix(t){for(let r of o)yield function(e,t,r){let[u,n]=rm(e,r);return t.removeRange([u,n+r.sourceCode.text.slice(n).match(/\S|$/).index])}(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Prefer negative index over `.length - index` when possible.",recommended:"unopinionated"},fixable:"code",messages:{[sh]:"Prefer negative index over length minus index for `{{method}}`."}}},"unicorn/prefer-node-protocol":{create:e=>{e.on("Literal",t=>{if(!(("ImportDeclaration"===t.parent.type||"ExportNamedDeclaration"===t.parent.type||"ImportExpression"===t.parent.type||"TSImportType"===t.parent.type)&&t.parent.source===t||(rR(t.parent,{object:"process",method:"getBuiltinModule",argumentsLength:1,optionalCall:!1,optionalMember:!1})||rL(t.parent))&&t.parent.arguments[0]===t))return;let{value:r}=t;if(!("string"==typeof r&&!r.startsWith(sA)&&sv(r)&&sv(`${sA}${r}`)))return;let u=e.sourceCode.getRange(t)[0]+1;return{node:t,messageId:sE,data:{moduleName:r},fix:e=>e.insertTextAfterRange([u,u],sA)}})},meta:{type:"suggestion",docs:{description:"Prefer using the `node:` protocol when importing Node.js builtin modules.",recommended:"unopinionated"},fixable:"code",messages:{[sE]:"Prefer `node:{{moduleName}}` over `{{moduleName}}`."}}},"unicorn/consistent-date-clone":{create:e=>{e.on("NewExpression",t=>{if(!rC(t,{name:"Date",argumentsLength:1}))return;let[r]=t.arguments;if(!rR(r,{method:"getTime",argumentsLength:0,optionalCall:!1,optionalMember:!1}))return;let{sourceCode:u}=e;return{node:r,loc:{start:u.getLoc(r.callee.property).start,end:u.getLoc(r).end},messageId:sC,fix:t=>ni(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Prefer passing `Date` directly to the constructor when cloning.",recommended:"unopinionated"},fixable:"code",messages:{[sC]:"Unnecessary `.getTime()` call."}}},"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 u=r.block.parent;if(["Property","MethodDefinition"].includes(u?.type)&&!u.computed&&["set","get"].includes(u.kind)&&sF(u.key)&&("get"===u.kind&&(sk(e,u)||"VariableDeclarator"===e.parent.type&&e.parent.init===e&&"ObjectPattern"===e.parent.id.type&&e.parent.id.properties.some(e=>"Property"===e.type&&!e.computed&&sw(e.key,u.key)))||"set"===u.kind&&((e,t)=>{if(!sk(e,t))return!1;let r=e.parent,{parent:u}=r;return("AssignmentExpression"===u.type||"AssignmentPattern"===u.type)&&u.left===r||"UpdateExpression"===u.type&&u.argument===r||"ArrayPattern"===u.type&&u.elements.includes(r)||"Property"===u.type&&u.value===r&&"ObjectPattern"===u.parent.type&&u.parent.properties.includes(r.parent)})(e,u)))return{node:e.parent,messageId:sS,data:{kind:u.kind}}})},meta:{type:"problem",docs:{description:"Disallow recursive access to `this` within getters and setters.",recommended:"unopinionated"},defaultOptions:[],messages:{[sS]:"Disallow recursive access to `this` within {{kind}}ters."}}},"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(!rP(r,{properties:["url","filename"],computed:!1,optional:!1}))return;let u=r.property.name;if("url"===u){if(sB(r.parent,t)&&r.parent.arguments[0]===r)return void(yield a(r.parent,{reportFilenameNode:!0}));if(rC(r.parent,{name:"URL",minimumArguments:1,maximumArguments:2})){var n;let e=r.parent,u=e.parent;if(1===e.arguments.length&&e.arguments[0]===r&&sB(u,t)&&u.arguments[0]===e)return void(yield a(u,{reportFilenameNode:!0}));2===e.arguments.length&&(n=e.arguments[0],n?.type==="Literal"&&("."===n.value||"./"===n.value))&&e.arguments[1]===r&&sB(u,t)&&u.arguments[0]===e&&(yield i(u,"dirname"))}return}function*a(e,{reportFilenameNode:r=!1}={}){let{parent:u}=e;if(sP(u,t)&&u.arguments[0]===e)return void(yield i(u,"dirname"));if(r&&(yield i(e,"filename")),"VariableDeclarator"!==u.type||u.init!==e||"Identifier"!==u.id.type||"VariableDeclaration"!==u.parent.type||"const"!==u.parent.kind)return;let n=tR(t.getScope(u.id),u.id);if(n)for(let e of n.references){if(!e.isReadOnly())continue;let{parent:r}=e.identifier;sP(r,t)&&r.arguments[0]===e.identifier&&(yield i(r,"dirname"))}}function i(e,t){return{node:e,messageId:"dirname"===t?sT:s_,fix:r=>r.replaceText(e,`import.meta.${t}`)}}"filename"===u&&(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:{[sT]:"Do not construct dirname.",[s_]:"Do not construct filename using `fileURLToPath()`."}}},"unicorn/no-unnecessary-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!(rR(t,{method:"flat",argumentsLength:1,optionalCall:!1})&&rh(t.arguments[0],1)))return;let[r]=t.arguments;return{node:r,messageId:sR,fix:t=>u8(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Disallow using `1` as the `depth` argument of `Array#flat()`.",recommended:"unopinionated"},fixable:"code",messages:{[sR]:"Passing `1` as the `depth` argument is unnecessary."}}},"unicorn/no-unnecessary-array-splice-count":{create(e){se(e,{methods:["splice","toSpliced"],messageId:sL})},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:{[sL]:"Passing `{{description}}` as the `{{argumentName}}` argument is unnecessary."}}},"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",u=>{let n,a=t.at(-1);if(!(a?.superClass&&"Identifier"===a.superClass.type&&a5.includes(a.superClass.name)&&e.sourceCode.isGlobalReference(a.superClass)&&(n=r.at(-1),n&&"MethodDefinition"===n.parent.type&&"constructor"===n.parent.kind&&n.parent.value===n&&a.body.body.includes(n.parent))&&rR(u,{object:"Error",method:"captureStackTrace",argumentsLength:2,optionalMember:!1})&&e.sourceCode.isGlobalReference(u.callee.object)))return;let[i,o]=u.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||rP(e,{property:"constructor",computed:!1,optional:!1})&&"ThisExpression"===e.object.type)return!0;if("Identifier"!==e.type||!t.id)return!1;let u=tR(r.sourceCode.getScope(e),e);return u&&1===u.defs.length&&"ClassName"===u.defs[0].type&&u.defs[0].node===t})(o,a,e))return;let s={node:u,messageId:sj},d="ChainExpression"===u.parent?u.parent.parent:u.parent;return"ExpressionStatement"===d.type&&"BlockStatement"===d.parent.type&&(s.fix=e=>e.remove(d)),s})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Error.captureStackTrace(…)`.",recommended:"unopinionated"},fixable:"code",messages:{[sj]:"Unnecessary `Error.captureStackTrace(…)` call."}}},"unicorn/prefer-class-fields":{create:e=>{let{sourceCode:t}=e;e.on("ClassBody",r=>{let u=r.body.find(e=>"constructor"===e.kind&&!e.computed&&!e.static&&"MethodDefinition"===e.type&&"FunctionExpression"===e.value.type);if(!u)return;let n=u.value.body.body.find(e=>"EmptyStatement"!==e.type);if(!(n?.type==="ExpressionStatement"&&"AssignmentExpression"===n.expression.type&&"="===n.expression.operator&&"MemberExpression"===n.expression.left.type&&"ThisExpression"===n.expression.left.object.type&&!n.expression.left.computed&&["Identifier","PrivateIdentifier"].includes(n.expression.left.property.type)&&"Literal"===n.expression.right.type))return;let a=n.expression.left.property.name,i=n.expression.right.raw,o=n.expression.left.property.type,s=r.body.find(e=>"PropertyDefinition"===e.type&&!e.computed&&!e.static&&e.key.type===o&&e.key.name===a),d={node:n,messageId:sO};function*l(o){if(yield((e,t,r)=>{let{line:u}=t.getLoc(e).start,n=t.getText(e);return t.lines[u-1].trim()===n?r.removeRange([t.getIndexFromLoc({line:u,column:0}),t.getIndexFromLoc({line:u+1,column:0})]):r.remove(e)})(n,t,o),s){if(s.value)return void(yield o.replaceText(s.value,i));let e=` = ${i}`,r=t.getLastToken(s);return tN(r)?void(yield o.insertTextBefore(r,e)):void(yield o.insertTextAfter(s,`${e};`))}let d=t.getLastToken(r),l=ur(u,e),c=`${l}${a} = ${i};
21
21
  `;"\n"!==t.getText()[t.getRange(d)[0]-1]&&(c=`
22
- ${c}`);let f=r.body.at(-1);"PropertyDefinition"===f.type&&";"!==t.getLastToken(f).value&&(c=`;${c}`),yield o.insertTextBefore(d,c)}return s?.value?d.suggest=[{messageId:sO,fix:l}]:d.fix=l,d})},meta:{type:"suggestion",docs:{description:"Prefer class field declarations over `this` assignments in constructors.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[sj]:"Prefer class field declaration over `this` assignment in constructor for static values.",[sO]:"Encountered same-named class field declaration and `this` assignment in constructor. Replace the class field declaration with the value from `this` assignment."}}},"unicorn/prefer-bigint-literals":{create:e=>{e.on("CallExpression",t=>{if(!rA(t,{name:"BigInt",argumentsLength:1,optional:!1}))return;let[r]=t.arguments,u=function(e){let t,r;if(rb(e)){let t,r=e.raw.slice(1,-1);try{t=BigInt(r)}catch{return}let u=0n===t?"0":r.trim();return u.startsWith("+")&&(u=u.slice(1).trim()),{shouldUseSuggestion:r.includes("+"),text:`${u}n`,bigint:t}}let u=!1,n=!1;for(;"UnaryExpression"===e.type&&e.prefix;)if("+"===e.operator)u=!0,e=e.argument;else{if("-"!==e.operator)return;n=!n,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:u}of[{prefix:"0b",base:2},{prefix:"0o",base:8},{prefix:"0x",base:16}])if(t.startsWith(e))return t.slice(2)===r.toString(u);return!t.includes("e")&&t===String(r)})(e)?r=`${i}n`:(r=`${t}n`,u=!0),n&&0n!==t&&(r=`-${r}`,t=-t),{shouldUseSuggestion:u,text:r,bigint:t}}}(r);if(!u)return;let n={node:t,messageId:sN},{shouldUseSuggestion:a,text:i,bigint:o}=u,s=r=>{let u=i;return!ry(t,e)&&o<0n&&(u=`(${u})`,uS(e.sourceCode.getTokenBefore(t),e,u)&&(u=`;${u}`)),r.replaceText(t,u)};return a||e.sourceCode.getCommentsInside(t).length>0?n.suggest=[{messageId:s$,data:{replacement:i.length<20?`\`${i}\``:"a bigint literal"},fix:s}]:n.fix=s,n})},meta:{type:"suggestion",docs:{description:"Prefer `BigInt` literals over the constructor.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[sN]:"Prefer using bigint literal over `BigInt(…)`.",[s$]:"Replace with {{replacement}}."}}},"unicorn/prefer-classlist-toggle":{create:e=>{let{sourceCode:t}=e;e.on(["IfStatement","ConditionalExpression"],r=>{let u=[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(!u.every(e=>sV(e,["add","remove"])))return;let[n,a]=u;if(n.callee.property.name!==a.callee.property.name&&sZ(n,a))return sq(r,function*(u){let i=rg(n.callee.object.object,e),o=rg(n.arguments[0],e),s="ConditionalExpression"===r.type,d="remove"===n.callee.property.name,l=r.test,c=sG(l,d,n),f=c?"":sW(l,e,d),p=n.callee.object.optional||a.callee.object.optional||c?.callee.object.optional,m=`${i}${p?"?":""}.classList.toggle(${o}${f?`, ${f}`:""})`;s||(m=`${m};`),uS(t.getTokenBefore(r),e,m)&&(m=`;${m}`),yield u.replaceText(r,m),s&&(yield nr(u,r,e))})}),e.on("ConditionalExpression",t=>{let r=[t.consequent,t.alternate];if(!(r.every(e=>rb(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&&sU(t.parent.object)&&rA(t.parent.parent,{optional:!1,argumentsLength:1})&&t.parent.parent.callee===t.parent))return;let u=t.parent,n=u.parent;return sq(n,function*(r){let a="remove"===t.consequent.value,i=t.test,o=sG(i,a,n)?"":sW(i,e,a);o&&(yield r.insertTextAfter(n.arguments[0],`, ${o}`)),yield nn(r,u,e,".toggle")},t)})},meta:{type:"suggestion",docs:{description:"Prefer using `Element#classList.toggle()` to toggle class names.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[sM]:"Prefer using `Element#classList.toggle()` to toggle class names.",[sz]:"Replace with `Element#classList.toggle()`."}}},"unicorn/require-module-attributes":{create:e=>{let{sourceCode:t}=e;e.on(["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"],e=>{let{source:r,attributes:u}=e;if(!r||Array.isArray(u)&&u.length>0)return;let n=t.getTokenAfter(r);if(n?.type!=="Keyword"||"with"!==n.value)return;let a=t.getTokenAfter(n),i=t.getTokenAfter(a);return{node:e,loc:{start:t.getLoc(a).start,end:t.getLoc(i).end},messageId:sH,data:{type:"ImportDeclaration"===e.type?"import statement":"export statement"},fix:e=>[n,i,a].map(t=>e.remove(t))}}),e.on("ImportExpression",r=>{let{options:u}=r;if(u?.type!=="ObjectExpression")return;let n=u.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)&&rT(e.value)),a=0===u.properties.length||n&&1===u.properties.length?u:n;if(!a)return;let i="Property"===a.type;return{node:n?.value??a,messageId:sH,data:{type:"import expression"},fix:r=>i?function*(e,t,r){let{sourceCode:u}=r;for(let r of u.getTokens(t))yield e.remove(r);let n=u.getTokenAfter(t);if(tO(n))yield e.remove(n);else{let{properties:r}=t.parent;if(r.length>1&&r.at(-1)===t){let r=u.getTokenBefore(t);yield e.remove(r)}}}(r,a,e):[t.getTokenBefore(a,tO),...t.getTokens(a),...rp(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:{[sH]:"{{type}} with empty attribute list is not allowed."}}},"unicorn/no-immediate-mutation":{create:e=>{for(let t of s8)e.on(["VariableDeclarator","AssignmentExpression"],r=>(function(e,t,{testValue:r,getProblematicNode:u,getProblem:n,getFix:a}){let i,o="AssignmentExpression"===t.type,[s,d]=(o?["left","right"]:["id","init"]).map(e=>t[e]);if(!("Identifier"===s.type&&r(d)))return;let l=t.parent;if(!(o&&"="===t.operator&&"ExpressionStatement"===l.type&&l.expression===t||!o&&"VariableDeclaration"===(i=t.parent).type&&i.declarations.at(-1)===t))return;let c=uM(l,e,1);if(c?.type!=="ExpressionStatement")return;let f="VariableDeclarator"===t.type?e.sourceCode.getDeclaredVariables(t).find(e=>1===e.defs.length&&e.defs[0].name===t.id):tR(e.sourceCode.getScope(t),t.left.name);if(!f)return;let p={context:e,variable:f,variableNode:s,valueNode:d,statement:l,nextExpressionStatement:c,assignType:o?"assignment":"declaration",getFix:a},m=u(p);if(m)return n(m,p)})(e,r,t))},meta:{type:"suggestion",docs:{description:"Disallow immediate mutation after variable assignment.",recommended:!0},fixable:"code",hasSuggestions:!0,messages:{[sJ]:"Immediate mutation on {{objectType}} is not allowed.",[sK]:"{{operation}} the elements to the {{assignType}}.",[sX]:"Move this property to the {{assignType}}.",[sY]:"{{description}} the {{assignType}}.",[sQ]:"Move the element to the {{assignType}}.",[s0]:"Move the entry to the {{assignType}}."}}},"unicorn/no-useless-collection-argument":{create:e=>{e.on("NewExpression",t=>{var r;let u;if(!rC(t,{names:["Set","Map","WeakSet","WeakMap"],argumentsLength:1}))return;let[n]=t.arguments,a="LogicalExpression"===n.type&&"??"===n.operator,i=a?n.right:n,o=rk(r=i)?"empty array":rh(r,"")?"empty string":rh(r,null)?"`null`":r$(r)?"`undefined`":void 0;if(!o)return;let s=!1;if(a)u=function*(t){let{sourceCode:r}=e,u=i.parent,{left:n}=u,a=ry(n,e),[,o]=a?rm(n,e):r.getRange(n),[,s]=r.getRange(u);yield t.removeRange([o,s]),(a||"SequenceExpression"!==n.type)&&(yield u4(u,t,e))};else e.sourceCode.getCommentsInside(i).length>0&&(s=!0),u=t=>u8(t,i,e);let d={node:i,messageId:s6,data:{description:o}};return s?d.suggest=[{messageId:s9,fix:u}]:d.fix=u,d})},meta:{type:"suggestion",docs:{description:"Disallow useless values or fallbacks in `Set`, `Map`, `WeakSet`, or `WeakMap`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[s6]:"The {{description}} is useless.",[s9]:"Remove the {{description}}"}}},"unicorn/prefer-response-static-json":{create:e=>{e.on("NewExpression",t=>{if(!rC(t,{name:"Response",minimumArguments:1}))return;let[r]=t.arguments;if(rR(r,{object:"JSON",method:"stringify",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return{node:r.callee,messageId:s7,*fix(u){yield u.insertTextAfter(t.callee,".json"),yield ne(t,e,u);let[n]=r.arguments,a=rm(r,e),i=rm(n,e);yield u.removeRange([a[0],i[0]]),yield u.removeRange([i[1],a[1]]),!ry(t,e)&&ry(t.callee,e)&&uS(e.sourceCode.getTokenBefore(t),e,"(")&&(yield u.insertTextBefore(t,";"))}}})},meta:{type:"suggestion",docs:{description:"Prefer `Response.json()` over `new Response(JSON.stringify())`.",recommended:"unopinionated"},fixable:"code",messages:{[s7]:"Prefer using `Response.json(…)` over `JSON.stringify()`."}}}}).map(([e,t])=>{let r;return[e,{meta:{schema:[],...t.meta,docs:{...t.meta.docs,url:(r=eY.basename(e,".js"),`https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v63.0.0/docs/rules/${r}.md`)}},create:uB(t.create)}]})))};module.exports=de;
22
+ ${c}`);let f=r.body.at(-1);"PropertyDefinition"===f.type&&";"!==t.getLastToken(f).value&&(c=`;${c}`),yield o.insertTextBefore(d,c)}return s?.value?d.suggest=[{messageId:sN,fix:l}]:d.fix=l,d})},meta:{type:"suggestion",docs:{description:"Prefer class field declarations over `this` assignments in constructors.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[sO]:"Prefer class field declaration over `this` assignment in constructor for static values.",[sN]:"Encountered same-named class field declaration and `this` assignment in constructor. Replace the class field declaration with the value from `this` assignment."}}},"unicorn/prefer-bigint-literals":{create:e=>{e.on("CallExpression",t=>{if(!rA(t,{name:"BigInt",argumentsLength:1,optional:!1}))return;let[r]=t.arguments,u=function(e){let t,r;if(rb(e)){let t,r=e.raw.slice(1,-1);try{t=BigInt(r)}catch{return}let u=0n===t?"0":r.trim();return u.startsWith("+")&&(u=u.slice(1).trim()),{shouldUseSuggestion:r.includes("+"),text:`${u}n`,bigint:t}}let u=!1,n=!1;for(;"UnaryExpression"===e.type&&e.prefix;)if("+"===e.operator)u=!0,e=e.argument;else{if("-"!==e.operator)return;n=!n,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:u}of[{prefix:"0b",base:2},{prefix:"0o",base:8},{prefix:"0x",base:16}])if(t.startsWith(e))return t.slice(2)===r.toString(u);return!t.includes("e")&&t===String(r)})(e)?r=`${i}n`:(r=`${t}n`,u=!0),n&&0n!==t&&(r=`-${r}`,t=-t),{shouldUseSuggestion:u,text:r,bigint:t}}}(r);if(!u)return;let n={node:t,messageId:s$},{shouldUseSuggestion:a,text:i,bigint:o}=u,s=r=>{let u=i;return!ry(t,e)&&o<0n&&(u=`(${u})`,uS(e.sourceCode.getTokenBefore(t),e,u)&&(u=`;${u}`)),r.replaceText(t,u)};return a||e.sourceCode.getCommentsInside(t).length>0?n.suggest=[{messageId:sM,data:{replacement:i.length<20?`\`${i}\``:"a bigint literal"},fix:s}]:n.fix=s,n})},meta:{type:"suggestion",docs:{description:"Prefer `BigInt` literals over the constructor.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[s$]:"Prefer using bigint literal over `BigInt(…)`.",[sM]:"Replace with {{replacement}}."}}},"unicorn/prefer-classlist-toggle":{create:e=>{let{sourceCode:t}=e;e.on(["IfStatement","ConditionalExpression"],r=>{let u=[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(!u.every(e=>sZ(e,["add","remove"])))return;let[n,a]=u;if(n.callee.property.name!==a.callee.property.name&&sG(n,a))return sW(r,function*(u){let i=rg(n.callee.object.object,e),o=rg(n.arguments[0],e),s="ConditionalExpression"===r.type,d="remove"===n.callee.property.name,l=r.test,c=sH(l,d,n),f=c?"":sV(l,e,d),p=n.callee.object.optional||a.callee.object.optional||c?.callee.object.optional,m=`${i}${p?"?":""}.classList.toggle(${o}${f?`, ${f}`:""})`;s||(m=`${m};`),uS(t.getTokenBefore(r),e,m)&&(m=`;${m}`),yield u.replaceText(r,m),s&&(yield nr(u,r,e))})}),e.on("ConditionalExpression",t=>{let r=[t.consequent,t.alternate];if(!(r.every(e=>rb(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&&sq(t.parent.object)&&rA(t.parent.parent,{optional:!1,argumentsLength:1})&&t.parent.parent.callee===t.parent))return;let u=t.parent,n=u.parent;return sW(n,function*(r){let a="remove"===t.consequent.value,i=t.test,o=sH(i,a,n)?"":sV(i,e,a);o&&(yield r.insertTextAfter(n.arguments[0],`, ${o}`)),yield nn(r,u,e,".toggle")},t)})},meta:{type:"suggestion",docs:{description:"Prefer using `Element#classList.toggle()` to toggle class names.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[sz]:"Prefer using `Element#classList.toggle()` to toggle class names.",[sU]:"Replace with `Element#classList.toggle()`."}}},"unicorn/require-module-attributes":{create:e=>{let{sourceCode:t}=e;e.on(["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"],e=>{let{source:r,attributes:u}=e;if(!r||Array.isArray(u)&&u.length>0)return;let n=t.getTokenAfter(r);if(n?.type!=="Keyword"||"with"!==n.value)return;let a=t.getTokenAfter(n),i=t.getTokenAfter(a);return{node:e,loc:{start:t.getLoc(a).start,end:t.getLoc(i).end},messageId:sJ,data:{type:"ImportDeclaration"===e.type?"import statement":"export statement"},fix:e=>[n,i,a].map(t=>e.remove(t))}}),e.on("ImportExpression",r=>{let{options:u}=r;if(u?.type!=="ObjectExpression")return;let n=u.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)&&rT(e.value)),a=0===u.properties.length||n&&1===u.properties.length?u:n;if(!a)return;let i="Property"===a.type;return{node:n?.value??a,messageId:sJ,data:{type:"import expression"},fix:r=>i?function*(e,t,r){let{sourceCode:u}=r;for(let r of u.getTokens(t))yield e.remove(r);let n=u.getTokenAfter(t);if(tO(n))yield e.remove(n);else{let{properties:r}=t.parent;if(r.length>1&&r.at(-1)===t){let r=u.getTokenBefore(t);yield e.remove(r)}}}(r,a,e):[t.getTokenBefore(a,tO),...t.getTokens(a),...rp(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:{[sJ]:"{{type}} with empty attribute list is not allowed."}}},"unicorn/no-immediate-mutation":{create:e=>{for(let t of s6)e.on(["VariableDeclarator","AssignmentExpression"],r=>(function(e,t,{testValue:r,getProblematicNode:u,getProblem:n,getFix:a}){let i,o="AssignmentExpression"===t.type,[s,d]=(o?["left","right"]:["id","init"]).map(e=>t[e]);if(!("Identifier"===s.type&&r(d)))return;let l=t.parent;if(!(o&&"="===t.operator&&"ExpressionStatement"===l.type&&l.expression===t||!o&&"VariableDeclaration"===(i=t.parent).type&&i.declarations.at(-1)===t))return;let c=uM(l,e,1);if(c?.type!=="ExpressionStatement")return;let f="VariableDeclarator"===t.type?e.sourceCode.getDeclaredVariables(t).find(e=>1===e.defs.length&&e.defs[0].name===t.id):tR(e.sourceCode.getScope(t),t.left.name);if(!f)return;let p={context:e,variable:f,variableNode:s,valueNode:d,statement:l,nextExpressionStatement:c,assignType:o?"assignment":"declaration",getFix:a},m=u(p);if(m)return n(m,p)})(e,r,t))},meta:{type:"suggestion",docs:{description:"Disallow immediate mutation after variable assignment.",recommended:!0},fixable:"code",hasSuggestions:!0,messages:{[sK]:"Immediate mutation on {{objectType}} is not allowed.",[sX]:"{{operation}} the elements to the {{assignType}}.",[sY]:"Move this property to the {{assignType}}.",[sQ]:"{{description}} the {{assignType}}.",[s0]:"Move the element to the {{assignType}}.",[s1]:"Move the entry to the {{assignType}}."}}},"unicorn/no-useless-collection-argument":{create:e=>{e.on("NewExpression",t=>{var r;let u;if(!rC(t,{names:["Set","Map","WeakSet","WeakMap"],argumentsLength:1}))return;let[n]=t.arguments,a="LogicalExpression"===n.type&&"??"===n.operator,i=a?n.right:n,o=rk(r=i)?"empty array":rh(r,"")?"empty string":rh(r,null)?"`null`":r$(r)?"`undefined`":void 0;if(!o)return;let s=!1;if(a)u=function*(t){let{sourceCode:r}=e,u=i.parent,{left:n}=u,a=ry(n,e),[,o]=a?rm(n,e):r.getRange(n),[,s]=r.getRange(u);yield t.removeRange([o,s]),(a||"SequenceExpression"!==n.type)&&(yield u4(u,t,e))};else e.sourceCode.getCommentsInside(i).length>0&&(s=!0),u=t=>u8(t,i,e);let d={node:i,messageId:s9,data:{description:o}};return s?d.suggest=[{messageId:s7,fix:u}]:d.fix=u,d})},meta:{type:"suggestion",docs:{description:"Disallow useless values or fallbacks in `Set`, `Map`, `WeakSet`, or `WeakMap`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[s9]:"The {{description}} is useless.",[s7]:"Remove the {{description}}"}}},"unicorn/prefer-response-static-json":{create:e=>{e.on("NewExpression",t=>{if(!rC(t,{name:"Response",minimumArguments:1}))return;let[r]=t.arguments;if(rR(r,{object:"JSON",method:"stringify",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return{node:r.callee,messageId:de,*fix(u){yield u.insertTextAfter(t.callee,".json"),yield ne(t,e,u);let[n]=r.arguments,a=rm(r,e),i=rm(n,e);yield u.removeRange([a[0],i[0]]),yield u.removeRange([i[1],a[1]]),!ry(t,e)&&ry(t.callee,e)&&uS(e.sourceCode.getTokenBefore(t),e,"(")&&(yield u.insertTextBefore(t,";"))}}})},meta:{type:"suggestion",docs:{description:"Prefer `Response.json()` over `new Response(JSON.stringify())`.",recommended:"unopinionated"},fixable:"code",messages:{[de]:"Prefer using `Response.json(…)` over `JSON.stringify()`."}}},"unicorn/filename-case":{create:e=>{let t=e.options[0]||{},r=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"]}(t),u=(t.ignore||[]).map(e=>eX.isRegExp(e)?e:RegExp(e,"u")),n=!1!==t.multipleFileExtensions,a=r.map(e=>dD[e].fn),i=e.physicalFilename;"<input>"!==i&&"<text>"!==i&&e.on("Program",()=>{let{basename:e,filename:t,middle:o,extension:s}=function(e,{multipleFileExtensions:t}){let r=eY.extname(e),u=eY.basename(e,r),n={basename:u+r,filename:u,middle:"",extension:r};if(t){let[e]=u.split(".");Object.assign(n,{filename:e,middle:u.slice(e.length)})}return n}(i,{multipleFileExtensions:n});if(db.has(e)||u.some(t=>t.test(e)))return;let{leading:d,words:l}=function(e){let t,{leading:r="",tailing:u=e}=(dx.exec(e)||{groups:{}}).groups,n=[];for(let e of u){let r=dh(e);t?.ignored===r?t.word+=e:(t={word:e,ignored:r},n.push(t))}return{leading:r,words:n}}(t);if(l.filter(({ignored:e})=>!e).every(({word:e})=>a.some(t=>t(e)===e)))return s!==s.toLowerCase()?{loc:{column:0,line:1},messageId:dy,data:{filename:t+o+s.toLowerCase(),extension:s}}:void 0;let c=function(e,t,{leading:r,trailing:u}){let{samples:n}=function(e,t=1/0){let r=e.reduce((e,{length:t})=>e*t,1),u=Array.from({length:Math.min(r,t)},(t,r)=>{let u=r,n=[];for(let t=e.length-1;t>=0;t--){let r=e[t],{length:a}=r,i=u%a;u=(u-i)/a,n.unshift(r[i])}return n});return{total:r,samples:u}}(e.map(({word:e,ignored:r})=>r?[e]:t.map(t=>t(e))));return[...new Set(n.map(e=>`${r}${e.join("")}${u}`))]}(l,a,{leading:d,trailing:o+s.toLowerCase()});return{loc:{column:0,line:1},messageId:dg,data:{chosenCases:dv(r.map(e=>dD[e].name)),renamedFilenames:dv(c.map(e=>`\`${e}\``))}}})},meta:{type:"suggestion",docs:{description:"Enforce a case style for filenames.",recommended:!0},schema:dE,defaultOptions:[],messages:{[dg]:"Filename is not in {{chosenCases}}. Rename it to {{renamedFilenames}}.",[dy]:"File extension `{{extension}}` is not in lowercase. Rename it to `{{filename}}`."}}}}).map(([e,t])=>{let r;return[e,{meta:{schema:[],...t.meta,docs:{...t.meta.docs,url:(r=eY.basename(e,".js"),`https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v63.0.0/docs/rules/${r}.md`)}},create:uB(t.create)}]})))};module.exports=dA;
package/dist/index.d.ts CHANGED
@@ -37,6 +37,13 @@ declare const plugin: {
37
37
  readonly name: "eslint-plugin-sukka/recommended_extra_with_typed_lint";
38
38
  readonly rules: Linter.RulesRecord;
39
39
  };
40
+ readonly recommended_react: {
41
+ readonly plugins: {
42
+ readonly sukka: /*elided*/ any;
43
+ };
44
+ readonly name: "eslint-plugin-sukka/recommended_react";
45
+ readonly rules: Linter.RulesRecord;
46
+ };
40
47
  };
41
48
  readonly rules: any;
42
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-sukka/eslint-plugin-sukka-full",
3
- "version": "8.8.0",
3
+ "version": "8.9.0",
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.0.3"
24
+ "eslint-plugin-sukka": "^9.1.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@masknet/eslint-plugin": "^0.4.1",
28
28
  "eslint-plugin-unicorn": "^63.0.0",
29
- "@eslint-sukka/rollup-config": "8.8.0"
29
+ "@eslint-sukka/rollup-config": "8.9.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "eslint": "*",