eslint-plugin-sukka 4.0.2 → 4.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -12,4 +12,4 @@ ${n}break;
12
12
  ${n}`)}else yield r.insertTextAfter(e,`
13
13
  ${n}break;`)}(r,a,t,o),yield*function*(e,r,t){e&&"BlockStatement"!==e.type&&(yield r.insertTextBefore(e,`{
14
14
  ${t}`),yield r.insertTextAfter(e,`
15
- ${t}}`))}(r,a,o))}}}({discriminant:n,ifStatements:i},t,r)),yield o}}}},meta:{type:"suggestion",docs:{description:"Prefer `switch` over multiple `else-if`."},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{minimumCases:{type:"integer",minimum:2,default:3},emptyDefaultCase:{enum:["no-default-comment","do-nothing-comment","no-default-case"],default:"no-default-comment"}}}],messages:{[Co]:"Use `switch` instead of multiple `else-if`."}}});const{appendArgument:Cp}=lt,{isMethodCall:Cg}=fd,Cm="require-number-to-fixed-digits-argument";var Cy=Q({create:e=>({CallExpression(r){if(!Cg(r,{method:"toFixed",argumentsLength:0,optionalCall:!1,optionalMember:!1})||"NewExpression"===r.callee.object.type)return;let{sourceCode:t}=e,[n,u]=t.getLastTokens(r,2);return{loc:{start:n.loc.start,end:u.loc.end},messageId:Cm,fix:e=>Cp(e,r,"0",t)}}}),meta:{type:"suggestion",docs:{description:"Enforce using the digits argument with `Number#toFixed()`."},fixable:"code",messages:{[Cm]:"Missing the digits argument."}}});const Ch=RegExp("^\\s*(?<directive>eslint-disable(?:-(?:next-)?line)?)"),Cb=RegExp("^eslint-disable(?:-next-line|-line)?(?<ruleId>$|(?:\\s+(?:@(?:[\\w-]+\\/){1,2})?[\\w-]+)?)"),Cv=Symbol("rule-id-no-match");var Cx={rules:{"array/no-unneeded-flat-map":D,"browser/prefer-location-assign":S,"jsx/no-template-literal":w,"jsx/no-unneeded-nested":F,"string/no-locale-case":k,"string/no-simple-template-literal":I,"type/no-instanceof-wrapper":B,"unicode/no-bidi":z,"unicode/no-invisible":W,"ban-eslint-disable":function({name:e,meta:r,create:t,resolveOptions:n}){if(r.docs){var u;(u=r.docs).url??(u.url=new URL(e,"https://eslint-plugin.skk.moe/src/rules/").toString())}return Object.freeze({name:e,meta:r,create(e){let r=n?.(...e.options)??e.options[0],u=Object.entries(t(e,r));return Object.fromEntries(u.filter(e=>e[1]))}})}({name:"ban-eslint-disable",meta:{type:"problem",docs:{description:"Ban `eslint-disable` comment directive"},schema:[{oneOf:[{type:"boolean"},{type:"string",enum:["allow-with-description"]}]}],messages:{"do-not-use":"Do not use `{{directive}}`","require-description":"Include a description after the `{{directive}}` directive to explain why the `{{directive}}` is necessary.","require-specific-rule":"Enforce specifying rules to disable in `eslint-disable` comments. If you want to disable ESLint on a file altogether, you should ignore it through ESLint configuration."}},create:(e,r="allow-with-description")=>!1===r?{}:{Program(t){if(t.comments&&0!==t.comments.length)for(let n of t.comments){let t=function(e){let r=Ch.exec(e);return r?.groups?.directive}(n.value);if(t&&!("allow-with-description"===r&&n.value.includes("--"))){let u="allow-with-description"===r?"require-description":"do-not-use";e.report({node:n,data:{directive:t},messageId:u})}let u=function(e){let r=Cb.exec(e.trim());return r?r.groups?.ruleId:Cv}(n.value);u===Cv||u||e.report({node:n,messageId:"require-specific-rule"})}}}}),"no-redundant-variable":q,"no-single-return":Z,"prefer-early-return":H,"prefer-fetch":K,"prefer-timer-id":Y,"unicorn/better-regex":CE(vq,"unicorn/better-regex"),"unicorn/no-nested-ternary":CE(rs,"unicorn/no-nested-ternary"),"unicorn/prefer-event-target":CE(rc,"unicorn/prefer-event-target"),"unicorn/prefer-keyboard-event-key":CE(fE,"unicorn/prefer-keyboard-event-key"),"unicorn/prefer-text-content":CE(fS,"unicorn/prefer-text-content"),"unicorn/require-array-join-separator":CE(pF,"unicorn/require-array-join-separator"),"unicorn/no-thenable":CE(pN,"unicorn/no-thenable"),"unicorn/no-invalid-remove-event-listener":CE(pz,"unicorn/no-invalid-remove-event-listener"),"unicorn/consistent-function-scoping":CE(p0,"unicorn/consistent-function-scoping"),"unicorn/no-new-buffer":CE(gh,"unicorn/no-new-buffer"),"unicorn/no-console-spaces":CE(gD,"unicorn/no-console-spaces"),"unicorn/no-empty-file":CE(gk,"unicorn/no-empty-file"),"unicorn/no-useless-fallback-in-spread":CE(gO,"unicorn/no-useless-fallback-in-spread"),"unicorn/no-useless-length-check":CE(gU,"unicorn/no-useless-length-check"),"unicorn/no-useless-promise-resolve-reject":CE(gZ,"unicorn/no-useless-promise-resolve-reject"),"unicorn/no-zero-fractions":CE(gQ,"unicorn/no-zero-fractions"),"unicorn/prefer-export-from":CE(mn,"unicorn/prefer-export-from"),"unicorn/prefer-native-coercion-functions":CE(mp,"unicorn/prefer-native-coercion-functions"),"unicorn/no-document-cookie":CE(mE,"unicorn/no-document-cookie"),"unicorn/prefer-add-event-listener":CE(mO,"unicorn/prefer-add-event-listener"),"unicorn/prefer-array-index-of":CE(mH,"unicorn/prefer-array-index-of"),"unicorn/prefer-blob-reading-methods":CE(mX,"unicorn/prefer-blob-reading-methods"),"unicorn/prefer-date-now":CE(m6,"unicorn/prefer-date-now"),"unicorn/prefer-dom-node-dataset":CE(yo,"unicorn/prefer-dom-node-dataset"),"unicorn/prefer-modern-math-apis":CE(yC,"unicorn/prefer-modern-math-apis"),"unicorn/number-literal-case":CE(yM,"unicorn/number-literal-case"),"unicorn/prefer-number-properties":CE(yG,"unicorn/prefer-number-properties"),"unicorn/prefer-reflect-apply":CE(y2,"unicorn/prefer-reflect-apply"),"unicorn/prefer-set-size":CE(y7,"unicorn/prefer-set-size"),"unicorn/prefer-string-replace-all":CE(hc,"unicorn/prefer-string-replace-all"),"unicorn/prefer-string-slice":CE(hv,"unicorn/prefer-string-slice"),"unicorn/prefer-string-trim-start-end":CE(hA,"unicorn/prefer-string-trim-start-end"),"unicorn/no-unreadable-iife":CE(hw,"unicorn/no-unreadable-iife"),"unicorn/throw-new-error":CE(hP,"unicorn/throw-new-error"),"unicorn/escape-case":CE(vY,"unicorn/escape-case"),"unicorn/no-hex-escape":CE(v4,"unicorn/no-hex-escape"),"unicorn/prefer-prototype-methods":CE(v7,"unicorn/prefer-prototype-methods"),"unicorn/error-message":CE(xi,"unicorn/error-message"),"unicorn/no-instanceof-array":CE(xp,"unicorn/no-instanceof-array"),"unicorn/prefer-type-error":CE(xD,"unicorn/prefer-type-error"),"unicorn/consistent-destructuring":CE(xT,"unicorn/consistent-destructuring"),"unicorn/new-for-builtins":CE(xR,"unicorn/new-for-builtins"),"unicorn/no-array-method-this-argument":CE(xK,"unicorn/no-array-method-this-argument"),"unicorn/no-array-push-push":CE(x6,"unicorn/no-array-push-push"),"unicorn/no-process-exit":CE(En,"unicorn/no-process-exit"),"unicorn/no-static-only-class":CE(Ep,"unicorn/no-static-only-class"),"unicorn/no-unreadable-array-destructuring":CE(Eb,"unicorn/no-unreadable-array-destructuring"),"unicorn/no-useless-spread":CE(ER,"unicorn/no-useless-spread"),"unicorn/no-useless-switch-case":CE(EW,"unicorn/no-useless-switch-case"),"unicorn/no-useless-undefined":CE(E0,"unicorn/no-useless-undefined"),"unicorn/numeric-separators-style":CE(E6,"unicorn/numeric-separators-style"),"unicorn/prefer-array-find":CE(AT,"unicorn/prefer-array-find"),"unicorn/prefer-array-flat-map":CE(AO,"unicorn/prefer-array-flat-map"),"unicorn/prefer-array-flat":CE(A0,"unicorn/prefer-array-flat"),"unicorn/prefer-array-some":CE(Du,"unicorn/prefer-array-some"),"unicorn/prefer-code-point":CE(Do,"unicorn/prefer-code-point"),"unicorn/prefer-default-parameters":CE(Dv,"unicorn/prefer-default-parameters"),"unicorn/prefer-json-parse-buffer":CE(DT,"unicorn/prefer-json-parse-buffer"),"unicorn/prefer-logical-operator-over-ternary":CE(DN,"unicorn/prefer-logical-operator-over-ternary"),"unicorn/prefer-optional-catch-binding":CE(DU,"unicorn/prefer-optional-catch-binding"),"unicorn/prefer-prototype-methods":CE(v7,"unicorn/prefer-prototype-methods"),"unicorn/prefer-regexp-test":CE(D3,"unicorn/prefer-regexp-test"),"unicorn/prefer-set-has":CE(Cu,"unicorn/prefer-set-has"),"unicorn/prefer-switch":CE(Cl,"unicorn/prefer-switch"),"unicorn/require-number-to-fixed-digits-argument":CE(Cy,"unicorn/require-number-to-fixed-digits-argument")}};function CE(e,r){var t;return{meta:{schema:[],...e.meta,docs:{...e.meta.docs,url:en(r)}},create:(t=e.create,e=>{let r={},n=(e,t)=>{r[e]??(r[e]=[]),r[e].push(t)},u=new Proxy(e,{get:(e,r,t)=>"on"===r?(e,r)=>{let t=Array.isArray(e)?e:[e];for(let e of t)n(e,r)}:"onExit"===r?(e,r)=>{let t=Array.isArray(e)?e:[e];for(let e of t)n(`${e}:exit`,r)}:Reflect.get(e,r,t)});for(let[e,r]of Object.entries(t(u)??{}))n(e,r);return Object.fromEntries(Object.entries(r).map(([r,t])=>[r,(...r)=>{for(let n of t)!function(e,r){if(e)for(let t of(CA(e)||(e=[e]),e)){if(t.fix&&(t.fix=CS(t.fix)),CA(t.suggest))for(let e of t.suggest)e.fix&&(e.fix=CS(e.fix)),e.data={...t.data,...e.data};r.report(t)}}(n(...r),e)}]))})}}const CA=e=>"function"==typeof e?.[Symbol.iterator];class CD extends Error{}const CC={abort(){throw new CD("Fix aborted.")}};function CS(e){return r=>{let t=e(r,CC);if(CA(t))try{return[...t]}catch(e){if(e instanceof CD)return;throw e}return t}}module.exports=Cx;
15
+ ${t}}`))}(r,a,o))}}}({discriminant:n,ifStatements:i},t,r)),yield o}}}},meta:{type:"suggestion",docs:{description:"Prefer `switch` over multiple `else-if`."},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{minimumCases:{type:"integer",minimum:2,default:3},emptyDefaultCase:{enum:["no-default-comment","do-nothing-comment","no-default-case"],default:"no-default-comment"}}}],messages:{[Co]:"Use `switch` instead of multiple `else-if`."}}});const{appendArgument:Cp}=lt,{isMethodCall:Cg}=fd,Cm="require-number-to-fixed-digits-argument";var Cy=Q({create:e=>({CallExpression(r){if(!Cg(r,{method:"toFixed",argumentsLength:0,optionalCall:!1,optionalMember:!1})||"NewExpression"===r.callee.object.type)return;let{sourceCode:t}=e,[n,u]=t.getLastTokens(r,2);return{loc:{start:n.loc.start,end:u.loc.end},messageId:Cm,fix:e=>Cp(e,r,"0",t)}}}),meta:{type:"suggestion",docs:{description:"Enforce using the digits argument with `Number#toFixed()`."},fixable:"code",messages:{[Cm]:"Missing the digits argument."}}});function Ch({name:e,meta:r,create:t,resolveOptions:n}){if(r.docs){var u;(u=r.docs).url??(u.url=new URL(e,"https://eslint-plugin.skk.moe/src/rules/").toString())}return Object.freeze({name:e,meta:r,create(e){let r=n?.(...e.options)??e.options[0],u=Object.entries(t(e,r));return Object.fromEntries(u.filter(e=>e[1]))}})}const Cb=RegExp("^\\s*(?<directive>eslint-disable(?:-(?:next-)?line)?)"),Cv=RegExp("^eslint-disable(?:-next-line|-line)?(?<ruleId>$|(?:\\s+(?:@(?:[\\w-]+\\/){1,2})?[\\w-]+)?)"),Cx=Symbol("rule-id-no-match");var CE={rules:{"array/no-unneeded-flat-map":D,"browser/prefer-location-assign":S,"jsx/no-template-literal":w,"jsx/no-unneeded-nested":F,"string/no-locale-case":k,"string/no-simple-template-literal":I,"type/no-instanceof-wrapper":B,"unicode/no-bidi":z,"unicode/no-invisible":W,"ban-eslint-disable":Ch({name:"ban-eslint-disable",meta:{type:"problem",docs:{description:"Ban `eslint-disable` comment directive"},schema:[{oneOf:[{type:"boolean"},{type:"string",enum:["allow-with-description"]}]}],messages:{"do-not-use":"Do not use `{{directive}}`","require-description":"Include a description after the `{{directive}}` directive to explain why the `{{directive}}` is necessary.","require-specific-rule":"Enforce specifying rules to disable in `eslint-disable` comments. If you want to disable ESLint on a file altogether, you should ignore it through ESLint configuration."}},create:(e,r="allow-with-description")=>!1===r?{}:{Program(t){if(t.comments&&0!==t.comments.length)for(let n of t.comments){let t=function(e){let r=Cb.exec(e);return r?.groups?.directive}(n.value);if(t&&!("allow-with-description"===r&&n.value.includes("--"))){let u="allow-with-description"===r?"require-description":"do-not-use";e.report({node:n,data:{directive:t},messageId:u})}let u=function(e){let r=Cv.exec(e.trim());return r?r.groups?.ruleId:Cx}(n.value);u===Cx||u||e.report({node:n,messageId:"require-specific-rule"})}}}}),"no-redundant-variable":q,"no-single-return":Z,"prefer-early-return":H,"prefer-fetch":K,"prefer-timer-id":Y,"import-dedupe":Ch({name:"import-dedupe",meta:{type:"problem",docs:{description:"Fix duplication in imports"},fixable:"code",schema:[],messages:{"import-dedupe":"Expect no duplication in imports"}},create:e=>({ImportDeclaration(r){if(r.specifiers.length<=1)return;let t=new Set;r.specifiers.forEach(n=>{let u=n.local.name;t.has(u)&&e.report({node:r,loc:{start:n.loc.end,end:n.loc.start},messageId:"import-dedupe",fix(r){let t=n.range[0],u=n.range[1];return","===e.getSourceCode().text[u]&&(u+=1),r.removeRange([t,u])}}),t.add(u)})}})}),"unicorn/better-regex":CA(vq,"unicorn/better-regex"),"unicorn/no-nested-ternary":CA(rs,"unicorn/no-nested-ternary"),"unicorn/prefer-event-target":CA(rc,"unicorn/prefer-event-target"),"unicorn/prefer-keyboard-event-key":CA(fE,"unicorn/prefer-keyboard-event-key"),"unicorn/prefer-text-content":CA(fS,"unicorn/prefer-text-content"),"unicorn/require-array-join-separator":CA(pF,"unicorn/require-array-join-separator"),"unicorn/no-thenable":CA(pN,"unicorn/no-thenable"),"unicorn/no-invalid-remove-event-listener":CA(pz,"unicorn/no-invalid-remove-event-listener"),"unicorn/consistent-function-scoping":CA(p0,"unicorn/consistent-function-scoping"),"unicorn/no-new-buffer":CA(gh,"unicorn/no-new-buffer"),"unicorn/no-console-spaces":CA(gD,"unicorn/no-console-spaces"),"unicorn/no-empty-file":CA(gk,"unicorn/no-empty-file"),"unicorn/no-useless-fallback-in-spread":CA(gO,"unicorn/no-useless-fallback-in-spread"),"unicorn/no-useless-length-check":CA(gU,"unicorn/no-useless-length-check"),"unicorn/no-useless-promise-resolve-reject":CA(gZ,"unicorn/no-useless-promise-resolve-reject"),"unicorn/no-zero-fractions":CA(gQ,"unicorn/no-zero-fractions"),"unicorn/prefer-export-from":CA(mn,"unicorn/prefer-export-from"),"unicorn/prefer-native-coercion-functions":CA(mp,"unicorn/prefer-native-coercion-functions"),"unicorn/no-document-cookie":CA(mE,"unicorn/no-document-cookie"),"unicorn/prefer-add-event-listener":CA(mO,"unicorn/prefer-add-event-listener"),"unicorn/prefer-array-index-of":CA(mH,"unicorn/prefer-array-index-of"),"unicorn/prefer-blob-reading-methods":CA(mX,"unicorn/prefer-blob-reading-methods"),"unicorn/prefer-date-now":CA(m6,"unicorn/prefer-date-now"),"unicorn/prefer-dom-node-dataset":CA(yo,"unicorn/prefer-dom-node-dataset"),"unicorn/prefer-modern-math-apis":CA(yC,"unicorn/prefer-modern-math-apis"),"unicorn/number-literal-case":CA(yM,"unicorn/number-literal-case"),"unicorn/prefer-number-properties":CA(yG,"unicorn/prefer-number-properties"),"unicorn/prefer-reflect-apply":CA(y2,"unicorn/prefer-reflect-apply"),"unicorn/prefer-set-size":CA(y7,"unicorn/prefer-set-size"),"unicorn/prefer-string-replace-all":CA(hc,"unicorn/prefer-string-replace-all"),"unicorn/prefer-string-slice":CA(hv,"unicorn/prefer-string-slice"),"unicorn/prefer-string-trim-start-end":CA(hA,"unicorn/prefer-string-trim-start-end"),"unicorn/no-unreadable-iife":CA(hw,"unicorn/no-unreadable-iife"),"unicorn/throw-new-error":CA(hP,"unicorn/throw-new-error"),"unicorn/escape-case":CA(vY,"unicorn/escape-case"),"unicorn/no-hex-escape":CA(v4,"unicorn/no-hex-escape"),"unicorn/prefer-prototype-methods":CA(v7,"unicorn/prefer-prototype-methods"),"unicorn/error-message":CA(xi,"unicorn/error-message"),"unicorn/no-instanceof-array":CA(xp,"unicorn/no-instanceof-array"),"unicorn/prefer-type-error":CA(xD,"unicorn/prefer-type-error"),"unicorn/consistent-destructuring":CA(xT,"unicorn/consistent-destructuring"),"unicorn/new-for-builtins":CA(xR,"unicorn/new-for-builtins"),"unicorn/no-array-method-this-argument":CA(xK,"unicorn/no-array-method-this-argument"),"unicorn/no-array-push-push":CA(x6,"unicorn/no-array-push-push"),"unicorn/no-process-exit":CA(En,"unicorn/no-process-exit"),"unicorn/no-static-only-class":CA(Ep,"unicorn/no-static-only-class"),"unicorn/no-unreadable-array-destructuring":CA(Eb,"unicorn/no-unreadable-array-destructuring"),"unicorn/no-useless-spread":CA(ER,"unicorn/no-useless-spread"),"unicorn/no-useless-switch-case":CA(EW,"unicorn/no-useless-switch-case"),"unicorn/no-useless-undefined":CA(E0,"unicorn/no-useless-undefined"),"unicorn/numeric-separators-style":CA(E6,"unicorn/numeric-separators-style"),"unicorn/prefer-array-find":CA(AT,"unicorn/prefer-array-find"),"unicorn/prefer-array-flat-map":CA(AO,"unicorn/prefer-array-flat-map"),"unicorn/prefer-array-flat":CA(A0,"unicorn/prefer-array-flat"),"unicorn/prefer-array-some":CA(Du,"unicorn/prefer-array-some"),"unicorn/prefer-code-point":CA(Do,"unicorn/prefer-code-point"),"unicorn/prefer-default-parameters":CA(Dv,"unicorn/prefer-default-parameters"),"unicorn/prefer-json-parse-buffer":CA(DT,"unicorn/prefer-json-parse-buffer"),"unicorn/prefer-logical-operator-over-ternary":CA(DN,"unicorn/prefer-logical-operator-over-ternary"),"unicorn/prefer-optional-catch-binding":CA(DU,"unicorn/prefer-optional-catch-binding"),"unicorn/prefer-prototype-methods":CA(v7,"unicorn/prefer-prototype-methods"),"unicorn/prefer-regexp-test":CA(D3,"unicorn/prefer-regexp-test"),"unicorn/prefer-set-has":CA(Cu,"unicorn/prefer-set-has"),"unicorn/prefer-switch":CA(Cl,"unicorn/prefer-switch"),"unicorn/require-number-to-fixed-digits-argument":CA(Cy,"unicorn/require-number-to-fixed-digits-argument")}};function CA(e,r){var t;return{meta:{schema:[],...e.meta,docs:{...e.meta.docs,url:en(r)}},create:(t=e.create,e=>{let r={},n=(e,t)=>{r[e]??(r[e]=[]),r[e].push(t)},u=new Proxy(e,{get:(e,r,t)=>"on"===r?(e,r)=>{let t=Array.isArray(e)?e:[e];for(let e of t)n(e,r)}:"onExit"===r?(e,r)=>{let t=Array.isArray(e)?e:[e];for(let e of t)n(`${e}:exit`,r)}:Reflect.get(e,r,t)});for(let[e,r]of Object.entries(t(u)??{}))n(e,r);return Object.fromEntries(Object.entries(r).map(([r,t])=>[r,(...r)=>{for(let n of t)!function(e,r){if(e)for(let t of(CD(e)||(e=[e]),e)){if(t.fix&&(t.fix=C_(t.fix)),CD(t.suggest))for(let e of t.suggest)e.fix&&(e.fix=C_(e.fix)),e.data={...t.data,...e.data};r.report(t)}}(n(...r),e)}]))})}}const CD=e=>"function"==typeof e?.[Symbol.iterator];class CC extends Error{}const CS={abort(){throw new CC("Fix aborted.")}};function C_(e){return r=>{let t=e(r,CS);if(CD(t))try{return[...t]}catch(e){if(e instanceof CC)return;throw e}return t}}module.exports=CE;
package/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@ declare const _default: {
17
17
  'prefer-early-return': any;
18
18
  'prefer-fetch': any;
19
19
  'prefer-timer-id': any;
20
+ 'import-dedupe': any;
20
21
  'unicorn/better-regex': eslint.Rule.RuleModule;
21
22
  'unicorn/no-nested-ternary': eslint.Rule.RuleModule;
22
23
  'unicorn/prefer-event-target': eslint.Rule.RuleModule;
package/dist/index.js CHANGED
@@ -12,4 +12,4 @@ ${n}break;
12
12
  ${n}`)}else yield r.insertTextAfter(e,`
13
13
  ${n}break;`)}(r,a,t,o),yield*function*(e,r,t){e&&"BlockStatement"!==e.type&&(yield r.insertTextBefore(e,`{
14
14
  ${t}`),yield r.insertTextAfter(e,`
15
- ${t}}`))}(r,a,o))}}}({discriminant:n,ifStatements:i},t,r)),yield o}}}},meta:{type:"suggestion",docs:{description:"Prefer `switch` over multiple `else-if`."},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{minimumCases:{type:"integer",minimum:2,default:3},emptyDefaultCase:{enum:["no-default-comment","do-nothing-comment","no-default-case"],default:"no-default-comment"}}}],messages:{[Co]:"Use `switch` instead of multiple `else-if`."}}});const{appendArgument:Cp}=lt,{isMethodCall:Cg}=fd,Cm="require-number-to-fixed-digits-argument";var Cy=Q({create:e=>({CallExpression(r){if(!Cg(r,{method:"toFixed",argumentsLength:0,optionalCall:!1,optionalMember:!1})||"NewExpression"===r.callee.object.type)return;let{sourceCode:t}=e,[n,u]=t.getLastTokens(r,2);return{loc:{start:n.loc.start,end:u.loc.end},messageId:Cm,fix:e=>Cp(e,r,"0",t)}}}),meta:{type:"suggestion",docs:{description:"Enforce using the digits argument with `Number#toFixed()`."},fixable:"code",messages:{[Cm]:"Missing the digits argument."}}});const Ch=RegExp("^\\s*(?<directive>eslint-disable(?:-(?:next-)?line)?)"),Cb=RegExp("^eslint-disable(?:-next-line|-line)?(?<ruleId>$|(?:\\s+(?:@(?:[\\w-]+\\/){1,2})?[\\w-]+)?)"),Cv=Symbol("rule-id-no-match");var Cx={rules:{"array/no-unneeded-flat-map":D,"browser/prefer-location-assign":S,"jsx/no-template-literal":w,"jsx/no-unneeded-nested":F,"string/no-locale-case":k,"string/no-simple-template-literal":I,"type/no-instanceof-wrapper":B,"unicode/no-bidi":z,"unicode/no-invisible":W,"ban-eslint-disable":function({name:e,meta:r,create:t,resolveOptions:n}){if(r.docs){var u;(u=r.docs).url??(u.url=new URL(e,"https://eslint-plugin.skk.moe/src/rules/").toString())}return Object.freeze({name:e,meta:r,create(e){let r=n?.(...e.options)??e.options[0],u=Object.entries(t(e,r));return Object.fromEntries(u.filter(e=>e[1]))}})}({name:"ban-eslint-disable",meta:{type:"problem",docs:{description:"Ban `eslint-disable` comment directive"},schema:[{oneOf:[{type:"boolean"},{type:"string",enum:["allow-with-description"]}]}],messages:{"do-not-use":"Do not use `{{directive}}`","require-description":"Include a description after the `{{directive}}` directive to explain why the `{{directive}}` is necessary.","require-specific-rule":"Enforce specifying rules to disable in `eslint-disable` comments. If you want to disable ESLint on a file altogether, you should ignore it through ESLint configuration."}},create:(e,r="allow-with-description")=>!1===r?{}:{Program(t){if(t.comments&&0!==t.comments.length)for(let n of t.comments){let t=function(e){let r=Ch.exec(e);return r?.groups?.directive}(n.value);if(t&&!("allow-with-description"===r&&n.value.includes("--"))){let u="allow-with-description"===r?"require-description":"do-not-use";e.report({node:n,data:{directive:t},messageId:u})}let u=function(e){let r=Cb.exec(e.trim());return r?r.groups?.ruleId:Cv}(n.value);u===Cv||u||e.report({node:n,messageId:"require-specific-rule"})}}}}),"no-redundant-variable":q,"no-single-return":Z,"prefer-early-return":H,"prefer-fetch":K,"prefer-timer-id":Y,"unicorn/better-regex":CE(vq,"unicorn/better-regex"),"unicorn/no-nested-ternary":CE(rs,"unicorn/no-nested-ternary"),"unicorn/prefer-event-target":CE(rc,"unicorn/prefer-event-target"),"unicorn/prefer-keyboard-event-key":CE(fE,"unicorn/prefer-keyboard-event-key"),"unicorn/prefer-text-content":CE(fS,"unicorn/prefer-text-content"),"unicorn/require-array-join-separator":CE(pF,"unicorn/require-array-join-separator"),"unicorn/no-thenable":CE(pN,"unicorn/no-thenable"),"unicorn/no-invalid-remove-event-listener":CE(pz,"unicorn/no-invalid-remove-event-listener"),"unicorn/consistent-function-scoping":CE(p0,"unicorn/consistent-function-scoping"),"unicorn/no-new-buffer":CE(gh,"unicorn/no-new-buffer"),"unicorn/no-console-spaces":CE(gD,"unicorn/no-console-spaces"),"unicorn/no-empty-file":CE(gk,"unicorn/no-empty-file"),"unicorn/no-useless-fallback-in-spread":CE(gO,"unicorn/no-useless-fallback-in-spread"),"unicorn/no-useless-length-check":CE(gU,"unicorn/no-useless-length-check"),"unicorn/no-useless-promise-resolve-reject":CE(gZ,"unicorn/no-useless-promise-resolve-reject"),"unicorn/no-zero-fractions":CE(gQ,"unicorn/no-zero-fractions"),"unicorn/prefer-export-from":CE(mn,"unicorn/prefer-export-from"),"unicorn/prefer-native-coercion-functions":CE(mp,"unicorn/prefer-native-coercion-functions"),"unicorn/no-document-cookie":CE(mE,"unicorn/no-document-cookie"),"unicorn/prefer-add-event-listener":CE(mO,"unicorn/prefer-add-event-listener"),"unicorn/prefer-array-index-of":CE(mH,"unicorn/prefer-array-index-of"),"unicorn/prefer-blob-reading-methods":CE(mX,"unicorn/prefer-blob-reading-methods"),"unicorn/prefer-date-now":CE(m6,"unicorn/prefer-date-now"),"unicorn/prefer-dom-node-dataset":CE(yo,"unicorn/prefer-dom-node-dataset"),"unicorn/prefer-modern-math-apis":CE(yC,"unicorn/prefer-modern-math-apis"),"unicorn/number-literal-case":CE(yM,"unicorn/number-literal-case"),"unicorn/prefer-number-properties":CE(yG,"unicorn/prefer-number-properties"),"unicorn/prefer-reflect-apply":CE(y2,"unicorn/prefer-reflect-apply"),"unicorn/prefer-set-size":CE(y7,"unicorn/prefer-set-size"),"unicorn/prefer-string-replace-all":CE(hc,"unicorn/prefer-string-replace-all"),"unicorn/prefer-string-slice":CE(hv,"unicorn/prefer-string-slice"),"unicorn/prefer-string-trim-start-end":CE(hA,"unicorn/prefer-string-trim-start-end"),"unicorn/no-unreadable-iife":CE(hw,"unicorn/no-unreadable-iife"),"unicorn/throw-new-error":CE(hP,"unicorn/throw-new-error"),"unicorn/escape-case":CE(vY,"unicorn/escape-case"),"unicorn/no-hex-escape":CE(v4,"unicorn/no-hex-escape"),"unicorn/prefer-prototype-methods":CE(v7,"unicorn/prefer-prototype-methods"),"unicorn/error-message":CE(xi,"unicorn/error-message"),"unicorn/no-instanceof-array":CE(xp,"unicorn/no-instanceof-array"),"unicorn/prefer-type-error":CE(xD,"unicorn/prefer-type-error"),"unicorn/consistent-destructuring":CE(xT,"unicorn/consistent-destructuring"),"unicorn/new-for-builtins":CE(xR,"unicorn/new-for-builtins"),"unicorn/no-array-method-this-argument":CE(xK,"unicorn/no-array-method-this-argument"),"unicorn/no-array-push-push":CE(x6,"unicorn/no-array-push-push"),"unicorn/no-process-exit":CE(En,"unicorn/no-process-exit"),"unicorn/no-static-only-class":CE(Ep,"unicorn/no-static-only-class"),"unicorn/no-unreadable-array-destructuring":CE(Eb,"unicorn/no-unreadable-array-destructuring"),"unicorn/no-useless-spread":CE(ER,"unicorn/no-useless-spread"),"unicorn/no-useless-switch-case":CE(EW,"unicorn/no-useless-switch-case"),"unicorn/no-useless-undefined":CE(E0,"unicorn/no-useless-undefined"),"unicorn/numeric-separators-style":CE(E6,"unicorn/numeric-separators-style"),"unicorn/prefer-array-find":CE(AT,"unicorn/prefer-array-find"),"unicorn/prefer-array-flat-map":CE(AO,"unicorn/prefer-array-flat-map"),"unicorn/prefer-array-flat":CE(A0,"unicorn/prefer-array-flat"),"unicorn/prefer-array-some":CE(Du,"unicorn/prefer-array-some"),"unicorn/prefer-code-point":CE(Do,"unicorn/prefer-code-point"),"unicorn/prefer-default-parameters":CE(Dv,"unicorn/prefer-default-parameters"),"unicorn/prefer-json-parse-buffer":CE(DT,"unicorn/prefer-json-parse-buffer"),"unicorn/prefer-logical-operator-over-ternary":CE(DN,"unicorn/prefer-logical-operator-over-ternary"),"unicorn/prefer-optional-catch-binding":CE(DU,"unicorn/prefer-optional-catch-binding"),"unicorn/prefer-prototype-methods":CE(v7,"unicorn/prefer-prototype-methods"),"unicorn/prefer-regexp-test":CE(D3,"unicorn/prefer-regexp-test"),"unicorn/prefer-set-has":CE(Cu,"unicorn/prefer-set-has"),"unicorn/prefer-switch":CE(Cl,"unicorn/prefer-switch"),"unicorn/require-number-to-fixed-digits-argument":CE(Cy,"unicorn/require-number-to-fixed-digits-argument")}};function CE(e,r){var t;return{meta:{schema:[],...e.meta,docs:{...e.meta.docs,url:en(r)}},create:(t=e.create,e=>{let r={},n=(e,t)=>{r[e]??(r[e]=[]),r[e].push(t)},u=new Proxy(e,{get:(e,r,t)=>"on"===r?(e,r)=>{let t=Array.isArray(e)?e:[e];for(let e of t)n(e,r)}:"onExit"===r?(e,r)=>{let t=Array.isArray(e)?e:[e];for(let e of t)n(`${e}:exit`,r)}:Reflect.get(e,r,t)});for(let[e,r]of Object.entries(t(u)??{}))n(e,r);return Object.fromEntries(Object.entries(r).map(([r,t])=>[r,(...r)=>{for(let n of t)!function(e,r){if(e)for(let t of(CA(e)||(e=[e]),e)){if(t.fix&&(t.fix=CS(t.fix)),CA(t.suggest))for(let e of t.suggest)e.fix&&(e.fix=CS(e.fix)),e.data={...t.data,...e.data};r.report(t)}}(n(...r),e)}]))})}}const CA=e=>"function"==typeof e?.[Symbol.iterator];class CD extends Error{}const CC={abort(){throw new CD("Fix aborted.")}};function CS(e){return r=>{let t=e(r,CC);if(CA(t))try{return[...t]}catch(e){if(e instanceof CD)return;throw e}return t}}module.exports=Cx;
15
+ ${t}}`))}(r,a,o))}}}({discriminant:n,ifStatements:i},t,r)),yield o}}}},meta:{type:"suggestion",docs:{description:"Prefer `switch` over multiple `else-if`."},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{minimumCases:{type:"integer",minimum:2,default:3},emptyDefaultCase:{enum:["no-default-comment","do-nothing-comment","no-default-case"],default:"no-default-comment"}}}],messages:{[Co]:"Use `switch` instead of multiple `else-if`."}}});const{appendArgument:Cp}=lt,{isMethodCall:Cg}=fd,Cm="require-number-to-fixed-digits-argument";var Cy=Q({create:e=>({CallExpression(r){if(!Cg(r,{method:"toFixed",argumentsLength:0,optionalCall:!1,optionalMember:!1})||"NewExpression"===r.callee.object.type)return;let{sourceCode:t}=e,[n,u]=t.getLastTokens(r,2);return{loc:{start:n.loc.start,end:u.loc.end},messageId:Cm,fix:e=>Cp(e,r,"0",t)}}}),meta:{type:"suggestion",docs:{description:"Enforce using the digits argument with `Number#toFixed()`."},fixable:"code",messages:{[Cm]:"Missing the digits argument."}}});function Ch({name:e,meta:r,create:t,resolveOptions:n}){if(r.docs){var u;(u=r.docs).url??(u.url=new URL(e,"https://eslint-plugin.skk.moe/src/rules/").toString())}return Object.freeze({name:e,meta:r,create(e){let r=n?.(...e.options)??e.options[0],u=Object.entries(t(e,r));return Object.fromEntries(u.filter(e=>e[1]))}})}const Cb=RegExp("^\\s*(?<directive>eslint-disable(?:-(?:next-)?line)?)"),Cv=RegExp("^eslint-disable(?:-next-line|-line)?(?<ruleId>$|(?:\\s+(?:@(?:[\\w-]+\\/){1,2})?[\\w-]+)?)"),Cx=Symbol("rule-id-no-match");var CE={rules:{"array/no-unneeded-flat-map":D,"browser/prefer-location-assign":S,"jsx/no-template-literal":w,"jsx/no-unneeded-nested":F,"string/no-locale-case":k,"string/no-simple-template-literal":I,"type/no-instanceof-wrapper":B,"unicode/no-bidi":z,"unicode/no-invisible":W,"ban-eslint-disable":Ch({name:"ban-eslint-disable",meta:{type:"problem",docs:{description:"Ban `eslint-disable` comment directive"},schema:[{oneOf:[{type:"boolean"},{type:"string",enum:["allow-with-description"]}]}],messages:{"do-not-use":"Do not use `{{directive}}`","require-description":"Include a description after the `{{directive}}` directive to explain why the `{{directive}}` is necessary.","require-specific-rule":"Enforce specifying rules to disable in `eslint-disable` comments. If you want to disable ESLint on a file altogether, you should ignore it through ESLint configuration."}},create:(e,r="allow-with-description")=>!1===r?{}:{Program(t){if(t.comments&&0!==t.comments.length)for(let n of t.comments){let t=function(e){let r=Cb.exec(e);return r?.groups?.directive}(n.value);if(t&&!("allow-with-description"===r&&n.value.includes("--"))){let u="allow-with-description"===r?"require-description":"do-not-use";e.report({node:n,data:{directive:t},messageId:u})}let u=function(e){let r=Cv.exec(e.trim());return r?r.groups?.ruleId:Cx}(n.value);u===Cx||u||e.report({node:n,messageId:"require-specific-rule"})}}}}),"no-redundant-variable":q,"no-single-return":Z,"prefer-early-return":H,"prefer-fetch":K,"prefer-timer-id":Y,"import-dedupe":Ch({name:"import-dedupe",meta:{type:"problem",docs:{description:"Fix duplication in imports"},fixable:"code",schema:[],messages:{"import-dedupe":"Expect no duplication in imports"}},create:e=>({ImportDeclaration(r){if(r.specifiers.length<=1)return;let t=new Set;r.specifiers.forEach(n=>{let u=n.local.name;t.has(u)&&e.report({node:r,loc:{start:n.loc.end,end:n.loc.start},messageId:"import-dedupe",fix(r){let t=n.range[0],u=n.range[1];return","===e.getSourceCode().text[u]&&(u+=1),r.removeRange([t,u])}}),t.add(u)})}})}),"unicorn/better-regex":CA(vq,"unicorn/better-regex"),"unicorn/no-nested-ternary":CA(rs,"unicorn/no-nested-ternary"),"unicorn/prefer-event-target":CA(rc,"unicorn/prefer-event-target"),"unicorn/prefer-keyboard-event-key":CA(fE,"unicorn/prefer-keyboard-event-key"),"unicorn/prefer-text-content":CA(fS,"unicorn/prefer-text-content"),"unicorn/require-array-join-separator":CA(pF,"unicorn/require-array-join-separator"),"unicorn/no-thenable":CA(pN,"unicorn/no-thenable"),"unicorn/no-invalid-remove-event-listener":CA(pz,"unicorn/no-invalid-remove-event-listener"),"unicorn/consistent-function-scoping":CA(p0,"unicorn/consistent-function-scoping"),"unicorn/no-new-buffer":CA(gh,"unicorn/no-new-buffer"),"unicorn/no-console-spaces":CA(gD,"unicorn/no-console-spaces"),"unicorn/no-empty-file":CA(gk,"unicorn/no-empty-file"),"unicorn/no-useless-fallback-in-spread":CA(gO,"unicorn/no-useless-fallback-in-spread"),"unicorn/no-useless-length-check":CA(gU,"unicorn/no-useless-length-check"),"unicorn/no-useless-promise-resolve-reject":CA(gZ,"unicorn/no-useless-promise-resolve-reject"),"unicorn/no-zero-fractions":CA(gQ,"unicorn/no-zero-fractions"),"unicorn/prefer-export-from":CA(mn,"unicorn/prefer-export-from"),"unicorn/prefer-native-coercion-functions":CA(mp,"unicorn/prefer-native-coercion-functions"),"unicorn/no-document-cookie":CA(mE,"unicorn/no-document-cookie"),"unicorn/prefer-add-event-listener":CA(mO,"unicorn/prefer-add-event-listener"),"unicorn/prefer-array-index-of":CA(mH,"unicorn/prefer-array-index-of"),"unicorn/prefer-blob-reading-methods":CA(mX,"unicorn/prefer-blob-reading-methods"),"unicorn/prefer-date-now":CA(m6,"unicorn/prefer-date-now"),"unicorn/prefer-dom-node-dataset":CA(yo,"unicorn/prefer-dom-node-dataset"),"unicorn/prefer-modern-math-apis":CA(yC,"unicorn/prefer-modern-math-apis"),"unicorn/number-literal-case":CA(yM,"unicorn/number-literal-case"),"unicorn/prefer-number-properties":CA(yG,"unicorn/prefer-number-properties"),"unicorn/prefer-reflect-apply":CA(y2,"unicorn/prefer-reflect-apply"),"unicorn/prefer-set-size":CA(y7,"unicorn/prefer-set-size"),"unicorn/prefer-string-replace-all":CA(hc,"unicorn/prefer-string-replace-all"),"unicorn/prefer-string-slice":CA(hv,"unicorn/prefer-string-slice"),"unicorn/prefer-string-trim-start-end":CA(hA,"unicorn/prefer-string-trim-start-end"),"unicorn/no-unreadable-iife":CA(hw,"unicorn/no-unreadable-iife"),"unicorn/throw-new-error":CA(hP,"unicorn/throw-new-error"),"unicorn/escape-case":CA(vY,"unicorn/escape-case"),"unicorn/no-hex-escape":CA(v4,"unicorn/no-hex-escape"),"unicorn/prefer-prototype-methods":CA(v7,"unicorn/prefer-prototype-methods"),"unicorn/error-message":CA(xi,"unicorn/error-message"),"unicorn/no-instanceof-array":CA(xp,"unicorn/no-instanceof-array"),"unicorn/prefer-type-error":CA(xD,"unicorn/prefer-type-error"),"unicorn/consistent-destructuring":CA(xT,"unicorn/consistent-destructuring"),"unicorn/new-for-builtins":CA(xR,"unicorn/new-for-builtins"),"unicorn/no-array-method-this-argument":CA(xK,"unicorn/no-array-method-this-argument"),"unicorn/no-array-push-push":CA(x6,"unicorn/no-array-push-push"),"unicorn/no-process-exit":CA(En,"unicorn/no-process-exit"),"unicorn/no-static-only-class":CA(Ep,"unicorn/no-static-only-class"),"unicorn/no-unreadable-array-destructuring":CA(Eb,"unicorn/no-unreadable-array-destructuring"),"unicorn/no-useless-spread":CA(ER,"unicorn/no-useless-spread"),"unicorn/no-useless-switch-case":CA(EW,"unicorn/no-useless-switch-case"),"unicorn/no-useless-undefined":CA(E0,"unicorn/no-useless-undefined"),"unicorn/numeric-separators-style":CA(E6,"unicorn/numeric-separators-style"),"unicorn/prefer-array-find":CA(AT,"unicorn/prefer-array-find"),"unicorn/prefer-array-flat-map":CA(AO,"unicorn/prefer-array-flat-map"),"unicorn/prefer-array-flat":CA(A0,"unicorn/prefer-array-flat"),"unicorn/prefer-array-some":CA(Du,"unicorn/prefer-array-some"),"unicorn/prefer-code-point":CA(Do,"unicorn/prefer-code-point"),"unicorn/prefer-default-parameters":CA(Dv,"unicorn/prefer-default-parameters"),"unicorn/prefer-json-parse-buffer":CA(DT,"unicorn/prefer-json-parse-buffer"),"unicorn/prefer-logical-operator-over-ternary":CA(DN,"unicorn/prefer-logical-operator-over-ternary"),"unicorn/prefer-optional-catch-binding":CA(DU,"unicorn/prefer-optional-catch-binding"),"unicorn/prefer-prototype-methods":CA(v7,"unicorn/prefer-prototype-methods"),"unicorn/prefer-regexp-test":CA(D3,"unicorn/prefer-regexp-test"),"unicorn/prefer-set-has":CA(Cu,"unicorn/prefer-set-has"),"unicorn/prefer-switch":CA(Cl,"unicorn/prefer-switch"),"unicorn/require-number-to-fixed-digits-argument":CA(Cy,"unicorn/require-number-to-fixed-digits-argument")}};function CA(e,r){var t;return{meta:{schema:[],...e.meta,docs:{...e.meta.docs,url:en(r)}},create:(t=e.create,e=>{let r={},n=(e,t)=>{r[e]??(r[e]=[]),r[e].push(t)},u=new Proxy(e,{get:(e,r,t)=>"on"===r?(e,r)=>{let t=Array.isArray(e)?e:[e];for(let e of t)n(e,r)}:"onExit"===r?(e,r)=>{let t=Array.isArray(e)?e:[e];for(let e of t)n(`${e}:exit`,r)}:Reflect.get(e,r,t)});for(let[e,r]of Object.entries(t(u)??{}))n(e,r);return Object.fromEntries(Object.entries(r).map(([r,t])=>[r,(...r)=>{for(let n of t)!function(e,r){if(e)for(let t of(CD(e)||(e=[e]),e)){if(t.fix&&(t.fix=C_(t.fix)),CD(t.suggest))for(let e of t.suggest)e.fix&&(e.fix=C_(e.fix)),e.data={...t.data,...e.data};r.report(t)}}(n(...r),e)}]))})}}const CD=e=>"function"==typeof e?.[Symbol.iterator];class CC extends Error{}const CS={abort(){throw new CC("Fix aborted.")}};function C_(e){return r=>{let t=e(r,CS);if(CD(t))try{return[...t]}catch(e){if(e instanceof CC)return;throw e}return t}}module.exports=CE;
package/dist/index.mjs CHANGED
@@ -12,4 +12,4 @@ ${u}break;
12
12
  ${u}`)}else yield r.insertTextAfter(e,`
13
13
  ${u}break;`)}(r,a,t,o),yield*function*(e,r,t){e&&"BlockStatement"!==e.type&&(yield r.insertTextBefore(e,`{
14
14
  ${t}`),yield r.insertTextAfter(e,`
15
- ${t}}`))}(r,a,o))}}}({discriminant:u,ifStatements:i},t,r)),yield o}}}},meta:{type:"suggestion",docs:{description:"Prefer `switch` over multiple `else-if`."},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{minimumCases:{type:"integer",minimum:2,default:3},emptyDefaultCase:{enum:["no-default-comment","do-nothing-comment","no-default-case"],default:"no-default-comment"}}}],messages:{[Cn]:"Use `switch` instead of multiple `else-if`."}}});let{appendArgument:Cc}=f7,{isMethodCall:Cf}=fi,Cl="require-number-to-fixed-digits-argument";var Cp=J({create:e=>({CallExpression(r){if(!Cf(r,{method:"toFixed",argumentsLength:0,optionalCall:!1,optionalMember:!1})||"NewExpression"===r.callee.object.type)return;let{sourceCode:t}=e,[u,n]=t.getLastTokens(r,2);return{loc:{start:u.loc.start,end:n.loc.end},messageId:Cl,fix:e=>Cc(e,r,"0",t)}}}),meta:{type:"suggestion",docs:{description:"Enforce using the digits argument with `Number#toFixed()`."},fixable:"code",messages:{[Cl]:"Missing the digits argument."}}});let Cg=RegExp("^\\s*(?<directive>eslint-disable(?:-(?:next-)?line)?)"),Cm=RegExp("^eslint-disable(?:-next-line|-line)?(?<ruleId>$|(?:\\s+(?:@(?:[\\w-]+\\/){1,2})?[\\w-]+)?)"),Cy=Symbol("rule-id-no-match");var Ch={rules:{"array/no-unneeded-flat-map":x,"browser/prefer-location-assign":A,"jsx/no-template-literal":C,"jsx/no-unneeded-nested":S,"string/no-locale-case":w,"string/no-simple-template-literal":T,"type/no-instanceof-wrapper":P,"unicode/no-bidi":L,"unicode/no-invisible":$,"ban-eslint-disable":function({name:e,meta:r,create:t,resolveOptions:u}){if(r.docs){var n;(n=r.docs).url??(n.url=new URL(e,"https://eslint-plugin.skk.moe/src/rules/").toString())}return Object.freeze({name:e,meta:r,create(e){let r=u?.(...e.options)??e.options[0],n=Object.entries(t(e,r));return Object.fromEntries(n.filter(e=>e[1]))}})}({name:"ban-eslint-disable",meta:{type:"problem",docs:{description:"Ban `eslint-disable` comment directive"},schema:[{oneOf:[{type:"boolean"},{type:"string",enum:["allow-with-description"]}]}],messages:{"do-not-use":"Do not use `{{directive}}`","require-description":"Include a description after the `{{directive}}` directive to explain why the `{{directive}}` is necessary.","require-specific-rule":"Enforce specifying rules to disable in `eslint-disable` comments. If you want to disable ESLint on a file altogether, you should ignore it through ESLint configuration."}},create:(e,r="allow-with-description")=>!1===r?{}:{Program(t){if(t.comments&&0!==t.comments.length)for(let u of t.comments){let t=function(e){let r=Cg.exec(e);return r?.groups?.directive}(u.value);if(t&&!("allow-with-description"===r&&u.value.includes("--"))){let n="allow-with-description"===r?"require-description":"do-not-use";e.report({node:u,data:{directive:t},messageId:n})}let n=function(e){let r=Cm.exec(e.trim());return r?r.groups?.ruleId:Cy}(u.value);n===Cy||n||e.report({node:u,messageId:"require-specific-rule"})}}}}),"no-redundant-variable":z,"no-single-return":W,"prefer-early-return":V,"prefer-fetch":Z,"prefer-timer-id":K,"unicorn/better-regex":Cb(vz,"unicorn/better-regex"),"unicorn/no-nested-ternary":Cb(ra,"unicorn/no-nested-ternary"),"unicorn/prefer-event-target":Cb(ro,"unicorn/prefer-event-target"),"unicorn/prefer-keyboard-event-key":Cb(fb,"unicorn/prefer-keyboard-event-key"),"unicorn/prefer-text-content":Cb(fA,"unicorn/prefer-text-content"),"unicorn/require-array-join-separator":Cb(pS,"unicorn/require-array-join-separator"),"unicorn/no-thenable":Cb(pB,"unicorn/no-thenable"),"unicorn/no-invalid-remove-event-listener":Cb(pL,"unicorn/no-invalid-remove-event-listener"),"unicorn/consistent-function-scoping":Cb(pX,"unicorn/consistent-function-scoping"),"unicorn/no-new-buffer":Cb(gg,"unicorn/no-new-buffer"),"unicorn/no-console-spaces":Cb(gx,"unicorn/no-console-spaces"),"unicorn/no-empty-file":Cb(gw,"unicorn/no-empty-file"),"unicorn/no-useless-fallback-in-spread":Cb(gI,"unicorn/no-useless-fallback-in-spread"),"unicorn/no-useless-length-check":Cb(gM,"unicorn/no-useless-length-check"),"unicorn/no-useless-promise-resolve-reject":Cb(gW,"unicorn/no-useless-promise-resolve-reject"),"unicorn/no-zero-fractions":Cb(gJ,"unicorn/no-zero-fractions"),"unicorn/prefer-export-from":Cb(me,"unicorn/prefer-export-from"),"unicorn/prefer-native-coercion-functions":Cb(mc,"unicorn/prefer-native-coercion-functions"),"unicorn/no-document-cookie":Cb(mb,"unicorn/no-document-cookie"),"unicorn/prefer-add-event-listener":Cb(mI,"unicorn/prefer-add-event-listener"),"unicorn/prefer-array-index-of":Cb(mV,"unicorn/prefer-array-index-of"),"unicorn/prefer-blob-reading-methods":Cb(mH,"unicorn/prefer-blob-reading-methods"),"unicorn/prefer-date-now":Cb(m4,"unicorn/prefer-date-now"),"unicorn/prefer-dom-node-dataset":Cb(yn,"unicorn/prefer-dom-node-dataset"),"unicorn/prefer-modern-math-apis":Cb(yE,"unicorn/prefer-modern-math-apis"),"unicorn/number-literal-case":Cb(yR,"unicorn/number-literal-case"),"unicorn/prefer-number-properties":Cb(yq,"unicorn/prefer-number-properties"),"unicorn/prefer-reflect-apply":Cb(yQ,"unicorn/prefer-reflect-apply"),"unicorn/prefer-set-size":Cb(y8,"unicorn/prefer-set-size"),"unicorn/prefer-string-replace-all":Cb(ho,"unicorn/prefer-string-replace-all"),"unicorn/prefer-string-slice":Cb(hy,"unicorn/prefer-string-slice"),"unicorn/prefer-string-trim-start-end":Cb(hv,"unicorn/prefer-string-trim-start-end"),"unicorn/no-unreadable-iife":Cb(hC,"unicorn/no-unreadable-iife"),"unicorn/throw-new-error":Cb(hF,"unicorn/throw-new-error"),"unicorn/escape-case":Cb(vK,"unicorn/escape-case"),"unicorn/no-hex-escape":Cb(v1,"unicorn/no-hex-escape"),"unicorn/prefer-prototype-methods":Cb(v8,"unicorn/prefer-prototype-methods"),"unicorn/error-message":Cb(xu,"unicorn/error-message"),"unicorn/no-instanceof-array":Cb(xc,"unicorn/no-instanceof-array"),"unicorn/prefer-type-error":Cb(xx,"unicorn/prefer-type-error"),"unicorn/consistent-destructuring":Cb(x_,"unicorn/consistent-destructuring"),"unicorn/new-for-builtins":Cb(xj,"unicorn/new-for-builtins"),"unicorn/no-array-method-this-argument":Cb(xZ,"unicorn/no-array-method-this-argument"),"unicorn/no-array-push-push":Cb(x4,"unicorn/no-array-push-push"),"unicorn/no-process-exit":Cb(Ee,"unicorn/no-process-exit"),"unicorn/no-static-only-class":Cb(Ec,"unicorn/no-static-only-class"),"unicorn/no-unreadable-array-destructuring":Cb(Em,"unicorn/no-unreadable-array-destructuring"),"unicorn/no-useless-spread":Cb(Ej,"unicorn/no-useless-spread"),"unicorn/no-useless-switch-case":Cb(E$,"unicorn/no-useless-switch-case"),"unicorn/no-useless-undefined":Cb(EX,"unicorn/no-useless-undefined"),"unicorn/numeric-separators-style":Cb(E4,"unicorn/numeric-separators-style"),"unicorn/prefer-array-find":Cb(A_,"unicorn/prefer-array-find"),"unicorn/prefer-array-flat-map":Cb(AI,"unicorn/prefer-array-flat-map"),"unicorn/prefer-array-flat":Cb(AX,"unicorn/prefer-array-flat"),"unicorn/prefer-array-some":Cb(Dr,"unicorn/prefer-array-some"),"unicorn/prefer-code-point":Cb(Dn,"unicorn/prefer-code-point"),"unicorn/prefer-default-parameters":Cb(Dy,"unicorn/prefer-default-parameters"),"unicorn/prefer-json-parse-buffer":Cb(D_,"unicorn/prefer-json-parse-buffer"),"unicorn/prefer-logical-operator-over-ternary":Cb(DB,"unicorn/prefer-logical-operator-over-ternary"),"unicorn/prefer-optional-catch-binding":Cb(DM,"unicorn/prefer-optional-catch-binding"),"unicorn/prefer-prototype-methods":Cb(v8,"unicorn/prefer-prototype-methods"),"unicorn/prefer-regexp-test":Cb(D0,"unicorn/prefer-regexp-test"),"unicorn/prefer-set-has":Cb(Cr,"unicorn/prefer-set-has"),"unicorn/prefer-switch":Cb(Cd,"unicorn/prefer-switch"),"unicorn/require-number-to-fixed-digits-argument":Cb(Cp,"unicorn/require-number-to-fixed-digits-argument")}};function Cb(e,r){var t;return{meta:{schema:[],...e.meta,docs:{...e.meta.docs,url:ee(r)}},create:(t=e.create,e=>{let r={},u=(e,t)=>{r[e]??(r[e]=[]),r[e].push(t)},n=new Proxy(e,{get:(e,r,t)=>"on"===r?(e,r)=>{let t=Array.isArray(e)?e:[e];for(let e of t)u(e,r)}:"onExit"===r?(e,r)=>{let t=Array.isArray(e)?e:[e];for(let e of t)u(`${e}:exit`,r)}:Reflect.get(e,r,t)});for(let[e,r]of Object.entries(t(n)??{}))u(e,r);return Object.fromEntries(Object.entries(r).map(([r,t])=>[r,(...r)=>{for(let u of t)!function(e,r){if(e)for(let t of(Cv(e)||(e=[e]),e)){if(t.fix&&(t.fix=CA(t.fix)),Cv(t.suggest))for(let e of t.suggest)e.fix&&(e.fix=CA(e.fix)),e.data={...t.data,...e.data};r.report(t)}}(u(...r),e)}]))})}}let Cv=e=>"function"==typeof e?.[Symbol.iterator];class Cx extends Error{}let CE={abort(){throw new Cx("Fix aborted.")}};function CA(e){return r=>{let t=e(r,CE);if(Cv(t))try{return[...t]}catch(e){if(e instanceof Cx)return;throw e}return t}}export{Ch as default};
15
+ ${t}}`))}(r,a,o))}}}({discriminant:u,ifStatements:i},t,r)),yield o}}}},meta:{type:"suggestion",docs:{description:"Prefer `switch` over multiple `else-if`."},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{minimumCases:{type:"integer",minimum:2,default:3},emptyDefaultCase:{enum:["no-default-comment","do-nothing-comment","no-default-case"],default:"no-default-comment"}}}],messages:{[Cn]:"Use `switch` instead of multiple `else-if`."}}});let{appendArgument:Cc}=f7,{isMethodCall:Cf}=fi,Cl="require-number-to-fixed-digits-argument";var Cp=J({create:e=>({CallExpression(r){if(!Cf(r,{method:"toFixed",argumentsLength:0,optionalCall:!1,optionalMember:!1})||"NewExpression"===r.callee.object.type)return;let{sourceCode:t}=e,[u,n]=t.getLastTokens(r,2);return{loc:{start:u.loc.start,end:n.loc.end},messageId:Cl,fix:e=>Cc(e,r,"0",t)}}}),meta:{type:"suggestion",docs:{description:"Enforce using the digits argument with `Number#toFixed()`."},fixable:"code",messages:{[Cl]:"Missing the digits argument."}}});function Cg({name:e,meta:r,create:t,resolveOptions:u}){if(r.docs){var n;(n=r.docs).url??(n.url=new URL(e,"https://eslint-plugin.skk.moe/src/rules/").toString())}return Object.freeze({name:e,meta:r,create(e){let r=u?.(...e.options)??e.options[0],n=Object.entries(t(e,r));return Object.fromEntries(n.filter(e=>e[1]))}})}let Cm=RegExp("^\\s*(?<directive>eslint-disable(?:-(?:next-)?line)?)"),Cy=RegExp("^eslint-disable(?:-next-line|-line)?(?<ruleId>$|(?:\\s+(?:@(?:[\\w-]+\\/){1,2})?[\\w-]+)?)"),Ch=Symbol("rule-id-no-match");var Cb={rules:{"array/no-unneeded-flat-map":x,"browser/prefer-location-assign":A,"jsx/no-template-literal":C,"jsx/no-unneeded-nested":S,"string/no-locale-case":w,"string/no-simple-template-literal":T,"type/no-instanceof-wrapper":P,"unicode/no-bidi":L,"unicode/no-invisible":$,"ban-eslint-disable":Cg({name:"ban-eslint-disable",meta:{type:"problem",docs:{description:"Ban `eslint-disable` comment directive"},schema:[{oneOf:[{type:"boolean"},{type:"string",enum:["allow-with-description"]}]}],messages:{"do-not-use":"Do not use `{{directive}}`","require-description":"Include a description after the `{{directive}}` directive to explain why the `{{directive}}` is necessary.","require-specific-rule":"Enforce specifying rules to disable in `eslint-disable` comments. If you want to disable ESLint on a file altogether, you should ignore it through ESLint configuration."}},create:(e,r="allow-with-description")=>!1===r?{}:{Program(t){if(t.comments&&0!==t.comments.length)for(let u of t.comments){let t=function(e){let r=Cm.exec(e);return r?.groups?.directive}(u.value);if(t&&!("allow-with-description"===r&&u.value.includes("--"))){let n="allow-with-description"===r?"require-description":"do-not-use";e.report({node:u,data:{directive:t},messageId:n})}let n=function(e){let r=Cy.exec(e.trim());return r?r.groups?.ruleId:Ch}(u.value);n===Ch||n||e.report({node:u,messageId:"require-specific-rule"})}}}}),"no-redundant-variable":z,"no-single-return":W,"prefer-early-return":V,"prefer-fetch":Z,"prefer-timer-id":K,"import-dedupe":Cg({name:"import-dedupe",meta:{type:"problem",docs:{description:"Fix duplication in imports"},fixable:"code",schema:[],messages:{"import-dedupe":"Expect no duplication in imports"}},create:e=>({ImportDeclaration(r){if(r.specifiers.length<=1)return;let t=new Set;r.specifiers.forEach(u=>{let n=u.local.name;t.has(n)&&e.report({node:r,loc:{start:u.loc.end,end:u.loc.start},messageId:"import-dedupe",fix(r){let t=u.range[0],n=u.range[1];return","===e.getSourceCode().text[n]&&(n+=1),r.removeRange([t,n])}}),t.add(n)})}})}),"unicorn/better-regex":Cv(vz,"unicorn/better-regex"),"unicorn/no-nested-ternary":Cv(ra,"unicorn/no-nested-ternary"),"unicorn/prefer-event-target":Cv(ro,"unicorn/prefer-event-target"),"unicorn/prefer-keyboard-event-key":Cv(fb,"unicorn/prefer-keyboard-event-key"),"unicorn/prefer-text-content":Cv(fA,"unicorn/prefer-text-content"),"unicorn/require-array-join-separator":Cv(pS,"unicorn/require-array-join-separator"),"unicorn/no-thenable":Cv(pB,"unicorn/no-thenable"),"unicorn/no-invalid-remove-event-listener":Cv(pL,"unicorn/no-invalid-remove-event-listener"),"unicorn/consistent-function-scoping":Cv(pX,"unicorn/consistent-function-scoping"),"unicorn/no-new-buffer":Cv(gg,"unicorn/no-new-buffer"),"unicorn/no-console-spaces":Cv(gx,"unicorn/no-console-spaces"),"unicorn/no-empty-file":Cv(gw,"unicorn/no-empty-file"),"unicorn/no-useless-fallback-in-spread":Cv(gI,"unicorn/no-useless-fallback-in-spread"),"unicorn/no-useless-length-check":Cv(gM,"unicorn/no-useless-length-check"),"unicorn/no-useless-promise-resolve-reject":Cv(gW,"unicorn/no-useless-promise-resolve-reject"),"unicorn/no-zero-fractions":Cv(gJ,"unicorn/no-zero-fractions"),"unicorn/prefer-export-from":Cv(me,"unicorn/prefer-export-from"),"unicorn/prefer-native-coercion-functions":Cv(mc,"unicorn/prefer-native-coercion-functions"),"unicorn/no-document-cookie":Cv(mb,"unicorn/no-document-cookie"),"unicorn/prefer-add-event-listener":Cv(mI,"unicorn/prefer-add-event-listener"),"unicorn/prefer-array-index-of":Cv(mV,"unicorn/prefer-array-index-of"),"unicorn/prefer-blob-reading-methods":Cv(mH,"unicorn/prefer-blob-reading-methods"),"unicorn/prefer-date-now":Cv(m4,"unicorn/prefer-date-now"),"unicorn/prefer-dom-node-dataset":Cv(yn,"unicorn/prefer-dom-node-dataset"),"unicorn/prefer-modern-math-apis":Cv(yE,"unicorn/prefer-modern-math-apis"),"unicorn/number-literal-case":Cv(yR,"unicorn/number-literal-case"),"unicorn/prefer-number-properties":Cv(yq,"unicorn/prefer-number-properties"),"unicorn/prefer-reflect-apply":Cv(yQ,"unicorn/prefer-reflect-apply"),"unicorn/prefer-set-size":Cv(y8,"unicorn/prefer-set-size"),"unicorn/prefer-string-replace-all":Cv(ho,"unicorn/prefer-string-replace-all"),"unicorn/prefer-string-slice":Cv(hy,"unicorn/prefer-string-slice"),"unicorn/prefer-string-trim-start-end":Cv(hv,"unicorn/prefer-string-trim-start-end"),"unicorn/no-unreadable-iife":Cv(hC,"unicorn/no-unreadable-iife"),"unicorn/throw-new-error":Cv(hF,"unicorn/throw-new-error"),"unicorn/escape-case":Cv(vK,"unicorn/escape-case"),"unicorn/no-hex-escape":Cv(v1,"unicorn/no-hex-escape"),"unicorn/prefer-prototype-methods":Cv(v8,"unicorn/prefer-prototype-methods"),"unicorn/error-message":Cv(xu,"unicorn/error-message"),"unicorn/no-instanceof-array":Cv(xc,"unicorn/no-instanceof-array"),"unicorn/prefer-type-error":Cv(xx,"unicorn/prefer-type-error"),"unicorn/consistent-destructuring":Cv(x_,"unicorn/consistent-destructuring"),"unicorn/new-for-builtins":Cv(xj,"unicorn/new-for-builtins"),"unicorn/no-array-method-this-argument":Cv(xZ,"unicorn/no-array-method-this-argument"),"unicorn/no-array-push-push":Cv(x4,"unicorn/no-array-push-push"),"unicorn/no-process-exit":Cv(Ee,"unicorn/no-process-exit"),"unicorn/no-static-only-class":Cv(Ec,"unicorn/no-static-only-class"),"unicorn/no-unreadable-array-destructuring":Cv(Em,"unicorn/no-unreadable-array-destructuring"),"unicorn/no-useless-spread":Cv(Ej,"unicorn/no-useless-spread"),"unicorn/no-useless-switch-case":Cv(E$,"unicorn/no-useless-switch-case"),"unicorn/no-useless-undefined":Cv(EX,"unicorn/no-useless-undefined"),"unicorn/numeric-separators-style":Cv(E4,"unicorn/numeric-separators-style"),"unicorn/prefer-array-find":Cv(A_,"unicorn/prefer-array-find"),"unicorn/prefer-array-flat-map":Cv(AI,"unicorn/prefer-array-flat-map"),"unicorn/prefer-array-flat":Cv(AX,"unicorn/prefer-array-flat"),"unicorn/prefer-array-some":Cv(Dr,"unicorn/prefer-array-some"),"unicorn/prefer-code-point":Cv(Dn,"unicorn/prefer-code-point"),"unicorn/prefer-default-parameters":Cv(Dy,"unicorn/prefer-default-parameters"),"unicorn/prefer-json-parse-buffer":Cv(D_,"unicorn/prefer-json-parse-buffer"),"unicorn/prefer-logical-operator-over-ternary":Cv(DB,"unicorn/prefer-logical-operator-over-ternary"),"unicorn/prefer-optional-catch-binding":Cv(DM,"unicorn/prefer-optional-catch-binding"),"unicorn/prefer-prototype-methods":Cv(v8,"unicorn/prefer-prototype-methods"),"unicorn/prefer-regexp-test":Cv(D0,"unicorn/prefer-regexp-test"),"unicorn/prefer-set-has":Cv(Cr,"unicorn/prefer-set-has"),"unicorn/prefer-switch":Cv(Cd,"unicorn/prefer-switch"),"unicorn/require-number-to-fixed-digits-argument":Cv(Cp,"unicorn/require-number-to-fixed-digits-argument")}};function Cv(e,r){var t;return{meta:{schema:[],...e.meta,docs:{...e.meta.docs,url:ee(r)}},create:(t=e.create,e=>{let r={},u=(e,t)=>{r[e]??(r[e]=[]),r[e].push(t)},n=new Proxy(e,{get:(e,r,t)=>"on"===r?(e,r)=>{let t=Array.isArray(e)?e:[e];for(let e of t)u(e,r)}:"onExit"===r?(e,r)=>{let t=Array.isArray(e)?e:[e];for(let e of t)u(`${e}:exit`,r)}:Reflect.get(e,r,t)});for(let[e,r]of Object.entries(t(n)??{}))u(e,r);return Object.fromEntries(Object.entries(r).map(([r,t])=>[r,(...r)=>{for(let u of t)!function(e,r){if(e)for(let t of(Cx(e)||(e=[e]),e)){if(t.fix&&(t.fix=CD(t.fix)),Cx(t.suggest))for(let e of t.suggest)e.fix&&(e.fix=CD(e.fix)),e.data={...t.data,...e.data};r.report(t)}}(u(...r),e)}]))})}}let Cx=e=>"function"==typeof e?.[Symbol.iterator];class CE extends Error{}let CA={abort(){throw new CE("Fix aborted.")}};function CD(e){return r=>{let t=e(r,CA);if(Cx(t))try{return[...t]}catch(e){if(e instanceof CE)return;throw e}return t}}export{Cb as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-sukka",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/SukkaW/eslint-config-sukka",
6
6
  "repository": {
@@ -23,7 +23,7 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "@eslint-sukka/shared": "4.0.2"
26
+ "@eslint-sukka/shared": "4.0.3"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@masknet/eslint-plugin": "^0.2.0",