eslint-plugin-sukka 4.0.2 → 4.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -3
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."}}});
|
|
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."}}});
|
|
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."}}});
|
|
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.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://github.com/SukkaW/eslint-config-sukka",
|
|
6
6
|
"repository": {
|
|
@@ -23,11 +23,10 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@eslint-sukka/shared": "4.0.
|
|
26
|
+
"@eslint-sukka/shared": "4.0.5"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@masknet/eslint-plugin": "^0.2.0",
|
|
30
|
-
"@types/node": "^20.8.3",
|
|
31
30
|
"eslint-plugin-unicorn": "48.0.1"
|
|
32
31
|
},
|
|
33
32
|
"scripts": {
|