productive-eslint 2.0.2 → 2.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.config.js +1 -1
- package/package.json +1 -1
package/dist/index.config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@antfu/eslint-config";import t from"@eslint/css";import n from"eslint-plugin-prettier";import{isPackageExists as r}from"local-pkg";import i from"eslint-plugin-boundaries";import a from"eslint-plugin-import";import o from"eslint-plugin-prefer-arrow-functions";import s from"eslint-plugin-perfectionist";import{AST_NODE_TYPES as c,ESLintUtils as l}from"@typescript-eslint/utils";import u from"eslint-plugin-promise";import ee from"@smarttools/eslint-plugin-rxjs";import d from"eslint-plugin-sonarjs";let f=function(e){return e.EASY=`easy`,e.HARD=`hard`,e.MEDIUM=`medium`,e}({});const p=[f.EASY,f.MEDIUM,f.HARD],m=e=>{let t=p.indexOf(e);return t===-1?0:t},h=(e,t)=>{let n=m(t),r=p.filter(e=>m(e)<=n),[i]=r,a=i?e[i]:null,o=a?(()=>{let{rules:e,...t}=a;return t})():{},s={};for(let t of r){let n=e[t];n.rules&&Object.keys(n.rules).length>0&&Object.assign(s,n.rules)}return Object.keys(s).length>0?{...o,rules:s}:o},g={name:`boundaries`,plugins:{boundaries:i},settings:{"boundaries/elements":[{pattern:`app`,type:`app`},{capture:[`page`],pattern:`pages/*`,type:`pages`},{capture:[`widget`],pattern:`widgets/*`,type:`widgets`},{capture:[`feature`],pattern:`features/*`,type:`features`},{capture:[`entity`],pattern:`entities/*`,type:`entities`},{capture:[`segment`],pattern:`shared/*`,type:`shared`}],"boundaries/include":[`src/**/*`],"import/resolver":{typescript:{alwaysTryTypes:!0}}}},_={},v={},y={"boundaries/element-types":[`error`,{default:`allow`,message:"${file.type} is not allowed to import (${dependency.type})",rules:[{disallow:[`app`,`pages`,`widgets`,`features`,`entities`],from:[`shared`],message:"Shared module must not import upper layers (${dependency.type})"},{disallow:[`app`,`pages`,`widgets`,`features`],from:[`entities`],message:"Entity must not import upper layers (${dependency.type})"},{disallow:[[`entities`,{entity:"!${entity}"}]],from:[`entities`],message:`Entity must not import other entity`},{disallow:[`app`,`pages`,`widgets`],from:[`features`],message:"Feature must not import upper layers (${dependency.type})"},{disallow:[[`features`,{feature:"!${feature}"}]],from:[`features`],message:`Feature must not import other feature`},{disallow:[`app`,`pages`],from:[`widgets`],message:"Feature must not import upper layers (${dependency.type})"},{disallow:[[`widgets`,{widget:"!${widget}"}]],from:[`widgets`],message:`Widget must not import other widget`},{disallow:[`app`],from:[`pages`],message:"Page must not import upper layers (${dependency.type})"},{disallow:[[`pages`,{page:"!${page}"}]],from:[`pages`],message:`Page must not import other page`}]}],"boundaries/entry-point":[`error`,{default:`disallow`,rules:[{allow:`**`,target:[`shared`]},{allow:`index.{ts,vue}`,target:[`app`,`pages`,`widgets`,`features`,`entities`]}]}]},b={[f.EASY]:{...g,rules:_},[f.HARD]:{rules:y},[f.MEDIUM]:{rules:v}},x={name:`imports`,plugins:{import:a},settings:{"import/resolver":{typescript:!0}}},S={"import/consistent-type-specifier-style":[`error`,`prefer-top-level`],"import/extensions":[`error`,`ignorePackages`,{js:`never`,jsx:`never`,ts:`never`,tsx:`never`}],"import/first":`error`,"import/newline-after-import":[`error`,{count:1}],"import/no-commonjs":`error`,"import/no-duplicates":`error`,"import/no-empty-named-blocks":`error`,"import/no-mutable-exports":`error`,"import/no-named-default":`error`,"import/no-namespace":`error`,"import/no-relative-packages":`error`,"import/no-self-import":`error`,"import/no-useless-path-segments":`error`},C={"import/export":`error`,"import/no-cycle":`error`},w={[f.EASY]:{...x,rules:S},[f.HARD]:{},[f.MEDIUM]:{rules:C}},T={plugins:{"prefer-arrow-functions":o}},E={"antfu/no-top-level-await":`off`,"arrow-body-style":[`error`,`as-needed`],curly:[`error`,`all`],"default-case":`error`,"grouped-accessor-pairs":`error`,"id-length":[`error`,{exceptions:[`t`]}],"logical-assignment-operators":[`error`,`always`,{enforceForIfStatements:!0}],"no-empty-function":`error`,"no-empty-static-block":`error`,"no-inner-declarations":`error`,"no-object-constructor":`error`,"no-shadow":`error`,"no-throw-literal":`off`,"no-unused-private-class-members":`error`,"no-useless-concat":`error`,"no-useless-escape":`error`,"no-void":[`error`,{allowAsStatement:!0}],"operator-assignment":`error`,"prefer-arrow-functions/prefer-arrow-functions":`error`,"prefer-object-spread":`error`,"unused-imports/no-unused-vars":`off`},D={"consistent-this":`error`,"dot-notation":`off`,"for-direction":`error`,"new-cap":[`error`,{capIsNew:!1,newIsCap:!0,properties:!0}],"no-bitwise":`error`,"no-constant-binary-expression":`error`,"no-constant-condition":`error`,"no-constructor-return":`error`,"no-implicit-coercion":[`error`,{disallowTemplateShorthand:!0}],"no-invalid-this":`error`,"no-param-reassign":[`error`,{ignorePropertyModificationsFor:[`accumulator`,`ctx`,`context`,`req`,`request`,`res`,`response`,`$scope`,`staticContext`,`ref`,`model`],ignorePropertyModificationsForRegex:[`^.*(?:Ref|Model)$`],props:!0}],"no-promise-executor-return":`error`,"no-restricted-syntax":`off`,"no-return-assign":`error`,"no-script-url":`error`,"no-sequences":`error`,"prefer-promise-reject-errors":`off`},O={complexity:[`error`,{max:12}],"max-depth":[`error`,2],"require-atomic-updates":`error`},k={[f.EASY]:{...T,rules:E},[f.HARD]:{rules:O},[f.MEDIUM]:{rules:D}},A={"jsdoc/no-bad-blocks":`error`,"jsdoc/require-jsdoc":[`error`,{checkConstructors:!1,contexts:[`TSPropertySignature`,`TSMethodSignature`,`TSTypeAliasDeclaration`,`TSInterfaceDeclaration`,`TSEnumDeclaration`,`MethodDefinition`,`ClassDeclaration`,`ArrowFunctionExpression`,`ObjectExpression`,`PropertyDefinition`],enableFixer:!1,publicOnly:!0}]},j={[f.EASY]:{files:[`./src/**/*`],rules:A},[f.HARD]:{},[f.MEDIUM]:{}},M={...(s.configs?.[`recommended-natural`]).rules,"perfectionist/sort-exports":[`error`,{customGroups:[{elementNamePattern:`/lib/`,groupName:`lib`},{elementNamePattern:`/model/`,groupName:`model`},{elementNamePattern:`/ui/`,groupName:`ui`}],groups:[`lib`,`model`,`ui`],type:`natural`}],"perfectionist/sort-imports":[`error`,{customGroups:[{elementNamePattern:`/shared/`,groupName:`shared`},{elementNamePattern:`/entities/`,groupName:`entities`},{elementNamePattern:`/features/`,groupName:`features`},{elementNamePattern:`/widgets/`,groupName:`widgets`},{elementNamePattern:`/pages/`,groupName:`pages`}],groups:[`shared`,`entities`,`features`,`widgets`,`pages`,`type-import`,[`value-builtin`,`value-external`],`type-internal`,`value-internal`,[`type-parent`,`type-sibling`,`type-index`],[`value-parent`,`value-sibling`,`value-index`],`ts-equals-import`,`unknown`],type:`natural`}],"perfectionist/sort-intersection-types":[`error`,{groups:[`conditional`,`function`,`import`,`intersection`,`keyword`,`literal`,`named`,`object`,`operator`,`tuple`,`union`,`nullish`]}],"perfectionist/sort-modules":[`error`,{groups:[`declare-enum`,`enum`,[`declare-interface`,`declare-type`],[`interface`,`type`],`declare-class`,`class`,`declare-function`,`function`,`export-enum`,[`export-interface`,`export-type`],`export-class`,`export-function`]}],"perfectionist/sort-union-types":[`error`,{groups:[`conditional`,`function`,`import`,`intersection`,`keyword`,`literal`,`named`,`object`,`operator`,`tuple`,`union`,`nullish`]}]},N={[f.EASY]:{plugins:{perfectionist:s},rules:M},[f.HARD]:{},[f.MEDIUM]:{}},P=l.RuleCreator.withoutDocs({create:e=>({IfStatement:t=>{let{options:[n]}=e;if(n<2)throw Error(`Depth should be 2 or above`);let r=0,{parent:i}=t;for(;i.type===c.BlockStatement&&i.parent.type===c.IfStatement&&r!==n-1;)r+=1,i=i.parent;r===n-1&&e.report({data:{depth:n},messageId:`tooManyNestedIfStatements`,node:t})}}),defaultOptions:[3],meta:{docs:{description:`Prevent excessive use of nested if statements`},messages:{tooManyNestedIfStatements:`Too many nested if statements, maximum allowed is {{ depth }}`},schema:{description:`Allowed number of nested if statements`,items:{type:`integer`},type:`array`},type:`problem`}}),F=l.RuleCreator.withoutDocs({create:e=>({IfStatement:t=>{t.alternate&&e.report({messageId:`noElse`,node:t.alternate})}}),defaultOptions:[],meta:{docs:{description:`Prevent use of else statements`},messages:{noElse:`else/elseIf statements make code harder to read and are better replaced with an early return or omitting the else block entirely`},schema:[],type:`problem`}}),I=l.RuleCreator.withoutDocs({create:e=>({TSEnumDeclaration:t=>{t.const||e.report({messageId:`preferConstEnum`,node:t})}}),defaultOptions:[],meta:{docs:{description:`Prefer const enums over regular ones`},messages:{preferConstEnum:`Regular enums are compiled into functions, which is a redundant runtime overhead. Use const enums, as they are ignored during compilation, and their member accesses are compiled into plain strings`},schema:[],type:`problem`}}),L={name:`productive`,plugins:{productive:{rules:{"no-abusive-nested-if":P,"no-else":F,"prefer-const-enum":I}}}},te={},R={},z={"productive/no-abusive-nested-if":[`error`,2],"productive/no-else":`error`,"productive/prefer-const-enum":`off`},B={[f.EASY]:{...L,rules:te},[f.HARD]:{rules:z},[f.MEDIUM]:{rules:R}},V={name:`promise`,plugins:{promise:u}},H={"promise/always-return":`error`,"promise/catch-or-return":`error`,"promise/no-multiple-resolved":`error`,"promise/no-new-statics":`error`,"promise/no-return-in-finally":`error`,"promise/no-return-wrap":`error`,"promise/param-names":`error`,"promise/valid-params":`error`},U={"promise/prefer-await-to-then":`error`},W={"promise/no-nesting":`error`,"promise/no-promise-in-callback":`error`},G={[f.EASY]:{...V,rules:H},[f.HARD]:{rules:W},[f.MEDIUM]:{rules:U}},K={files:[`**/*.{ts,tsx,js,jsx,mjs,cjs}`],name:`rxjs`,plugins:{rxjs:ee}},q={"rxjs/no-compat":`error`,"rxjs/no-create":`error`,"rxjs/no-ignored-error":`error`,"rxjs/no-ignored-observable":`error`,"rxjs/no-ignored-replay-buffer":`error`,"rxjs/no-ignored-subscribe":`error`,"rxjs/no-ignored-subscription":`error`,"rxjs/no-implicit-any-catch":`error`,"rxjs/no-index":`error`,"rxjs/no-internal":`error`,"rxjs/no-topromise":`error`,"rxjs/no-unbound-methods":`error`,"rxjs/prefer-observer":`error`},J={"rxjs/finnish":`error`,"rxjs/no-async-subscribe":`error`,"rxjs/no-cyclic-action":`error`,"rxjs/no-exposed-subjects":`error`,"rxjs/no-ignored-notifier":`error`,"rxjs/no-ignored-takewhile-value":`error`,"rxjs/no-redundant-notify":`error`,"rxjs/no-subclass":`error`,"rxjs/no-subject-unsubscribe":`error`,"rxjs/no-subject-value":`error`,"rxjs/no-unsafe-catch":`error`,"rxjs/no-unsafe-first":`error`,"rxjs/no-unsafe-subject-next":`error`,"rxjs/no-unsafe-takeuntil":`error`,"rxjs/suffix-subjects":`error`,"rxjs/throw-error":`error`},Y={"rxjs/no-connectable":`error`,"rxjs/no-nested-subscribe":`error`,"rxjs/no-sharereplay":`error`,"rxjs/no-subscribe-handlers":`error`,"rxjs/no-unsafe-switchmap":`error`},X={[f.EASY]:{...K,rules:q},[f.HARD]:{rules:Y},[f.MEDIUM]:{rules:J}},Z={name:`sonarjs`,plugins:{sonarjs:d}},Q={"sonarjs/no-fallthrough":`error`,"sonarjs/no-redundant-boolean":`error`,"sonarjs/no-redundant-jump":`error`,"sonarjs/non-existent-operator":`error`,"sonarjs/prefer-immediate-return":`error`,"sonarjs/public-static-readonly":`error`},ne={"sonarjs/bool-param-default":`error`,"sonarjs/comma-or-logical-or-case":`error`,"sonarjs/future-reserved-words":`error`,"sonarjs/index-of-compare-to-positive-number":`error`,"sonarjs/link-with-target-blank":`error`,"sonarjs/no-array-delete":`error`,"sonarjs/no-duplicate-in-composite":`error`,"sonarjs/no-for-in-iterable":`error`,"sonarjs/no-function-declaration-in-block":`error`,"sonarjs/no-global-this":`error`,"sonarjs/no-globals-shadowing":`error`,"sonarjs/no-identical-conditions":`error`,"sonarjs/no-identical-expressions":`error`,"sonarjs/no-identical-functions":`error`,"sonarjs/no-ignored-return":`error`,"sonarjs/no-in-misuse":`error`,"sonarjs/no-incorrect-string-concat":`error`,"sonarjs/no-internal-api-use":`error`,"sonarjs/no-misleading-array-reverse":`error`,"sonarjs/no-nested-template-literals":`error`,"sonarjs/no-redundant-assignments":`error`,"sonarjs/no-redundant-optional":`error`,"sonarjs/no-selector-parameter":`error`,"sonarjs/no-small-switch":`error`,"sonarjs/no-try-promise":`error`,"sonarjs/no-undefined-assignment":`error`,"sonarjs/no-unthrown-error":`error`,"sonarjs/no-unused-collection":`error`,"sonarjs/no-unused-function-argument":`error`,"sonarjs/no-use-of-empty-return-value":`error`,"sonarjs/no-useless-intersection":`error`,"sonarjs/object-alt-content":`error`,"sonarjs/post-message":`error`,"sonarjs/prefer-promise-shorthand":`error`,"sonarjs/reduce-initial-value":`error`,"sonarjs/strings-comparison":`error`,"sonarjs/table-header":`error`,"sonarjs/table-header-reference":`error`},re={"sonarjs/expression-complexity":[`error`,{max:2}],"sonarjs/no-all-duplicated-branches":`error`,"sonarjs/no-async-constructor":`error`,"sonarjs/no-invariant-returns":`error`,"sonarjs/no-nested-switch":`error`,"sonarjs/too-many-break-or-continue-in-loop":`error`},ie={[f.EASY]:{...Z,rules:Q},[f.HARD]:{rules:re},[f.MEDIUM]:{rules:ne}},ae={"@typescript-eslint/array-type":`error`,"@typescript-eslint/class-literal-property-style":`error`,"@typescript-eslint/consistent-generic-constructors":`error`,"@typescript-eslint/consistent-indexed-object-style":`error`,"@typescript-eslint/consistent-type-assertions":`error`,"@typescript-eslint/default-param-last":`error`,"@typescript-eslint/dot-notation":[`error`,{allowIndexSignaturePropertyAccess:!0}],"@typescript-eslint/explicit-function-return-type":[`error`,{allowExpressions:!0}],"@typescript-eslint/explicit-member-accessibility":[`error`,{overrides:{constructors:`no-public`}}],"@typescript-eslint/naming-convention":[`error`,{format:null,selector:[`objectLiteralProperty`]},{format:null,selector:`import`},{format:[`StrictPascalCase`],selector:[`enum`,`class`]},{format:[`UPPER_CASE`],selector:[`enumMember`]},{format:[`StrictPascalCase`],prefix:[`I`],selector:[`interface`]},{format:[`StrictPascalCase`],prefix:[`T`],selector:[`typeAlias`]},{format:[`StrictPascalCase`],selector:[`typeParameter`]},{format:[`strictCamelCase`,`UPPER_CASE`],modifiers:[`const`],selector:`variable`},{format:[`camelCase`],leadingUnderscore:`allow`,modifiers:[`unused`],selector:`parameter`}],"@typescript-eslint/no-base-to-string":`error`,"@typescript-eslint/no-confusing-void-expression":`error`,"@typescript-eslint/no-duplicate-type-constituents":`error`,"@typescript-eslint/no-dynamic-delete":`error`,"@typescript-eslint/no-empty-object-type":[`error`,{allowInterfaces:`always`}],"@typescript-eslint/no-explicit-any":`error`,"@typescript-eslint/no-floating-promises":`error`,"@typescript-eslint/no-inferrable-types":`error`,"@typescript-eslint/no-loop-func":`error`,"@typescript-eslint/no-magic-numbers":[`error`,{enforceConst:!0,ignore:[0,1,100,-1],ignoreClassFieldInitialValues:!0,ignoreDefaultValues:!0,ignoreEnums:!0}],"@typescript-eslint/no-meaningless-void-operator":`error`,"@typescript-eslint/no-redundant-type-constituents":`error`,"@typescript-eslint/no-unnecessary-boolean-literal-compare":`error`,"@typescript-eslint/no-unnecessary-condition":`error`,"@typescript-eslint/no-unnecessary-qualifier":`error`,"@typescript-eslint/no-unnecessary-template-expression":`error`,"@typescript-eslint/no-unnecessary-type-arguments":`error`,"@typescript-eslint/no-unnecessary-type-assertion":`error`,"@typescript-eslint/no-unnecessary-type-conversion":`error`,"@typescript-eslint/no-unsafe-argument":`error`,"@typescript-eslint/no-unsafe-assignment":`error`,"@typescript-eslint/no-unsafe-call":`error`,"@typescript-eslint/no-unsafe-enum-comparison":`error`,"@typescript-eslint/no-unsafe-member-access":`error`,"@typescript-eslint/no-unsafe-return":`error`,"@typescript-eslint/no-unsafe-unary-minus":`error`,"@typescript-eslint/no-useless-constructor":`error`,"@typescript-eslint/no-useless-empty-export":`error`,"@typescript-eslint/only-throw-error":`error`,"@typescript-eslint/prefer-destructuring":`error`,"@typescript-eslint/prefer-function-type":`error`,"@typescript-eslint/prefer-nullish-coalescing":`error`,"@typescript-eslint/prefer-optional-chain":`error`,"@typescript-eslint/related-getter-setter-pairs":`error`,"@typescript-eslint/require-array-sort-compare":[`error`,{ignoreStringArrays:!1}],"@typescript-eslint/require-await":`error`,"@typescript-eslint/return-await":`error`,"@typescript-eslint/switch-exhaustiveness-check":`error`,"@typescript-eslint/unbound-method":`error`,"@typescript-eslint/unified-signatures":`error`},oe={"@typescript-eslint/class-methods-use-this":`error`,"@typescript-eslint/init-declarations":`error`,"@typescript-eslint/max-params":[`error`,{max:3}],"@typescript-eslint/no-extraneous-class":`error`,"@typescript-eslint/no-invalid-void-type":`error`,"@typescript-eslint/no-misused-promises":`error`,"@typescript-eslint/no-misused-spread":`error`,"@typescript-eslint/no-mixed-enums":`error`,"@typescript-eslint/parameter-properties":`error`,"@typescript-eslint/prefer-enum-initializers":`error`,"@typescript-eslint/prefer-promise-reject-errors":`error`,"@typescript-eslint/prefer-reduce-type-parameter":`error`,"@typescript-eslint/prefer-return-this-type":`error`,"@typescript-eslint/restrict-template-expressions":`error`},$={"@typescript-eslint/no-non-null-assertion":`error`,"@typescript-eslint/prefer-readonly":`error`},se={[f.EASY]:{rules:ae},[f.HARD]:{rules:$},[f.MEDIUM]:{rules:oe}},ce={"unicorn/no-empty-file":`error`,"unicorn/no-new-array":`error`,"unicorn/no-unnecessary-array-flat-depth":`error`,"unicorn/no-unnecessary-array-splice-count":`error`,"unicorn/no-unnecessary-await":`error`,"unicorn/no-unnecessary-slice-end":`error`,"unicorn/no-unused-properties":`error`,"unicorn/no-useless-fallback-in-spread":`error`,"unicorn/no-useless-length-check":`error`,"unicorn/no-useless-promise-resolve-reject":`error`,"unicorn/no-useless-spread":`error`,"unicorn/no-useless-switch-case":`error`,"unicorn/no-useless-undefined":`error`,"unicorn/no-zero-fractions":`error`,"unicorn/numeric-separators-style":`error`,"unicorn/prefer-add-event-listener":`error`,"unicorn/prefer-array-find":`error`,"unicorn/prefer-array-flat":`error`,"unicorn/prefer-array-flat-map":`error`,"unicorn/prefer-array-index-of":`error`,"unicorn/prefer-array-some":`error`,"unicorn/prefer-at":`error`,"unicorn/prefer-blob-reading-methods":`error`,"unicorn/prefer-code-point":`error`,"unicorn/prefer-date-now":`error`,"unicorn/prefer-default-parameters":`error`,"unicorn/prefer-dom-node-append":`error`,"unicorn/prefer-dom-node-dataset":`error`,"unicorn/prefer-dom-node-remove":`error`,"unicorn/prefer-dom-node-text-content":`error`,"unicorn/prefer-event-target":`error`,"unicorn/prefer-export-from":`error`,"unicorn/prefer-global-this":`error`,"unicorn/prefer-import-meta-properties":`error`,"unicorn/prefer-includes":`error`,"unicorn/prefer-json-parse-buffer":`error`,"unicorn/prefer-keyboard-event-key":`error`,"unicorn/prefer-logical-operator-over-ternary":`error`,"unicorn/prefer-math-min-max":`error`,"unicorn/prefer-math-trunc":`error`,"unicorn/prefer-modern-dom-apis":`error`,"unicorn/prefer-modern-math-apis":`error`,"unicorn/prefer-native-coercion-functions":`error`,"unicorn/prefer-negative-index":`error`,"unicorn/prefer-number-properties":`error`,"unicorn/prefer-object-from-entries":`error`,"unicorn/prefer-optional-catch-binding":`error`,"unicorn/prefer-prototype-methods":`error`,"unicorn/prefer-query-selector":`error`,"unicorn/prefer-reflect-apply":`error`,"unicorn/prefer-regexp-test":`error`,"unicorn/prefer-set-has":`error`,"unicorn/prefer-set-size":`error`,"unicorn/prefer-single-call":`error`,"unicorn/prefer-spread":`error`,"unicorn/prefer-string-raw":`error`,"unicorn/prefer-string-replace-all":`error`,"unicorn/prefer-string-slice":`error`,"unicorn/prefer-string-starts-ends-with":`error`,"unicorn/prefer-string-trim-start-end":`error`,"unicorn/prefer-structured-clone":`error`,"unicorn/prefer-switch":`error`,"unicorn/prefer-ternary":`error`,"unicorn/prefer-top-level-await":`error`,"unicorn/prefer-type-error":`error`,"unicorn/require-array-join-separator":`error`,"unicorn/switch-case-braces":`error`,"unicorn/throw-new-error":`error`},le={"unicorn/consistent-date-clone":`error`,"unicorn/consistent-destructuring":`error`,"unicorn/consistent-existence-index-check":`error`,"unicorn/custom-error-definition":`error`,"unicorn/explicit-length-check":`error`,"unicorn/no-abusive-eslint-disable":`error`,"unicorn/no-accessor-recursion":`error`,"unicorn/no-array-callback-reference":`error`,"unicorn/no-array-for-each":`error`,"unicorn/no-for-loop":`error`,"unicorn/no-hex-escape":`error`,"unicorn/no-lonely-if":`error`,"unicorn/no-magic-array-flat-depth":`error`,"unicorn/no-named-default":`error`,"unicorn/no-negated-condition":`error`,"unicorn/no-negation-in-equality-check":`error`,"unicorn/no-nested-ternary":`error`,"unicorn/no-single-promise-in-promise-methods":`error`,"unicorn/no-typeof-undefined":`error`,"unicorn/no-unreadable-array-destructuring":`error`,"unicorn/relative-url-style":`error`,"unicorn/require-number-to-fixed-digits-argument":`error`,"unicorn/require-post-message-target-origin":`error`},ue={"unicorn/no-array-method-this-argument":`error`,"unicorn/no-await-in-promise-methods":`error`,"unicorn/no-document-cookie":`error`,"unicorn/no-invalid-remove-event-listener":`error`,"unicorn/no-object-as-default-parameter":`error`},de={[f.EASY]:{rules:ce},[f.HARD]:{rules:ue},[f.MEDIUM]:{rules:le}},fe={"vue/attribute-hyphenation":[`error`,`never`],"vue/attributes-order":[`error`,{alphabetical:!0}],"vue/block-lang":[`error`,{script:{lang:`ts`}}],"vue/block-order":[`error`,{order:[`script`,`template`,`style`]}],"vue/comment-directive":[`error`,{reportUnusedDisableDirectives:!0}],"vue/component-api-style":[`error`,[`script-setup`]],"vue/component-name-in-template-casing":[`error`,`PascalCase`],"vue/component-options-name-casing":[`error`,`PascalCase`],"vue/custom-event-name-casing":[`error`,`camelCase`],"vue/define-macros-order":[`error`,{defineExposeLast:!0,order:[`defineOptions`,`defineModel`,`defineProps`,`defineEmits`,`defineSlots`]}],"vue/define-props-declaration":`error`,"vue/define-props-destructuring":`error`,"vue/enforce-style-attribute":[`error`,{allow:[`module`]}],"vue/html-comment-content-spacing":[`error`,`always`,{exceptions:[`-`]}],"vue/html-self-closing":[`error`,{html:{void:`always`}}],"vue/jsx-uses-vars":`error`,"vue/no-arrow-functions-in-watch":`error`,"vue/no-deprecated-delete-set":`error`,"vue/no-deprecated-destroyed-lifecycle":`error`,"vue/no-deprecated-dollar-listeners-api":`error`,"vue/no-deprecated-dollar-scopedslots-api":`error`,"vue/no-deprecated-events-api":`error`,"vue/no-deprecated-filter":`error`,"vue/no-deprecated-functional-template":`error`,"vue/no-deprecated-html-element-is":`error`,"vue/no-deprecated-inline-template":`error`,"vue/no-deprecated-model-definition":`error`,"vue/no-deprecated-props-default-this":`error`,"vue/no-deprecated-router-link-tag-prop":`error`,"vue/no-deprecated-scope-attribute":`error`,"vue/no-deprecated-slot-attribute":`error`,"vue/no-deprecated-slot-scope-attribute":`error`,"vue/no-deprecated-v-bind-sync":`error`,"vue/no-deprecated-v-is":`error`,"vue/no-deprecated-v-on-native-modifier":`error`,"vue/no-deprecated-v-on-number-modifiers":`error`,"vue/no-deprecated-vue-config-keycodes":`error`,"vue/no-dupe-v-else-if":`error`,"vue/no-duplicate-attributes":`error`,"vue/no-empty-component-block":`error`,"vue/no-empty-pattern":`error`,"vue/no-export-in-script-setup":`error`,"vue/no-expose-after-await":`error`,"vue/no-implicit-coercion":`error`,"vue/no-import-compiler-macros":`error`,"vue/no-irregular-whitespace":`error`,"vue/no-lifecycle-after-await":`error`,"vue/no-lone-template":`error`,"vue/no-loss-of-precision":`error`,"vue/no-multiple-objects-in-class":`error`,"vue/no-multiple-slot-args":`error`,"vue/no-mutating-props":`error`,"vue/no-parsing-error":`error`,"vue/no-ref-as-operand":`error`,"vue/no-ref-object-reactivity-loss":`error`,"vue/no-required-prop-with-default":`error`,"vue/no-reserved-component-names":`error`,"vue/no-reserved-keys":`error`,"vue/no-reserved-props":`error`,"vue/no-restricted-block":`error`,"vue/no-restricted-syntax":[`error`,`DebuggerStatement`,`LabeledStatement`,`WithStatement`,{message:`Use ref instead of reactive for code consistency`,selector:`CallExpression[callee.name="reactive"]`}],"vue/no-restricted-v-bind":[`error`,`/^v-/`],"vue/no-side-effects-in-computed-properties":`error`,"vue/no-template-key":`error`,"vue/no-template-shadow":`error`,"vue/no-template-target-blank":`error`,"vue/no-textarea-mustache":`error`,"vue/no-unused-components":`error`,"vue/no-unused-refs":`error`,"vue/no-unused-vars":`error`,"vue/no-use-v-else-with-v-for":`error`,"vue/no-use-v-if-with-v-for":`error`,"vue/no-useless-mustaches":`error`,"vue/no-useless-template-attributes":`error`,"vue/no-useless-v-bind":`error`,"vue/no-v-for-template-key-on-child":`error`,"vue/no-watch-after-await":`error`,"vue/object-shorthand":[`error`,`always`,{avoidQuotes:!0,ignoreConstructors:!1}],"vue/order-in-components":`error`,"vue/padding-line-between-blocks":[`error`,`always`],"vue/prefer-import-from-vue":`error`,"vue/prefer-separate-static-class":`error`,"vue/prefer-template":`error`,"vue/prefer-true-attribute-shorthand":`error`,"vue/prefer-use-template-ref":`error`,"vue/prop-name-casing":[`error`,`camelCase`],"vue/require-component-is":`error`,"vue/require-explicit-emits":`error`,"vue/require-macro-variable-name":`error`,"vue/require-render-return":`error`,"vue/require-toggle-inside-transition":`error`,"vue/require-typed-ref":`error`,"vue/require-v-for-key":`error`,"vue/slot-name-casing":`error`,"vue/this-in-template":`error`,"vue/use-v-on-exact":`error`,"vue/v-bind-style":[`error`,`shorthand`,{sameNameShorthand:`always`}],"vue/v-for-delimiter-style":[`error`,`of`],"vue/v-if-else-key":`error`,"vue/v-on-event-hyphenation":[`error`,`never`,{autofix:!0}],"vue/v-on-handler-style":[`error`,[`method`,`inline-function`],{ignoreIncludesComment:!0}],"vue/v-on-style":`error`,"vue/v-slot-style":[`error`,{atComponent:`v-slot`,default:`v-slot`,named:`longform`}],"vue/valid-attribute-name":`error`,"vue/valid-define-emits":`error`,"vue/valid-define-options":`error`,"vue/valid-define-props":`error`,"vue/valid-next-tick":`error`,"vue/valid-template-root":`error`,"vue/valid-v-bind":`error`,"vue/valid-v-cloak":`error`,"vue/valid-v-else":`error`,"vue/valid-v-else-if":`error`,"vue/valid-v-for":`error`,"vue/valid-v-html":`error`,"vue/valid-v-if":`error`,"vue/valid-v-is":`error`,"vue/valid-v-memo":`error`,"vue/valid-v-model":`error`,"vue/valid-v-on":`error`,"vue/valid-v-once":`error`,"vue/valid-v-pre":`error`,"vue/valid-v-show":`error`,"vue/valid-v-slot":`error`,"vue/valid-v-text":`error`},pe={"vue/eqeqeq":[`error`,`smart`],"vue/html-button-has-type":`error`,"vue/no-async-in-computed-properties":`error`,"vue/no-child-content":`error`,"vue/no-console":`error`,"vue/no-constant-condition":`error`,"vue/no-duplicate-attr-inheritance":`error`,"vue/no-root-v-if":`error`,"vue/no-sparse-arrays":`error`,"vue/no-static-inline-styles":`error`,"vue/no-v-html":`error`,"vue/no-v-text":`error`,"vue/no-v-text-v-html-on-component":`error`},me={[f.EASY]:{rules:fe},[f.HARD]:{},[f.MEDIUM]:{rules:pe}},he=({ignores:i=[],strictness:a=f.HARD})=>e({ignores:i,imports:!1}).remove(`antfu/stylistic/rules`).override(`antfu/perfectionist/setup`,h(N,a)).override(`antfu/javascript/rules`,h(k,a)).override(`antfu/typescript/rules`,h(se,a)).override(`antfu/disables/config-files`,{files:[`**/*.plugin.?([cm])[jt]s?(x)`],rules:{"@typescript-eslint/naming-convention":`off`,"@typescript-eslint/no-magic-numbers":`off`,"no-template-curly-in-string":`off`}}).override(`antfu/disables/dts`,{rules:{"import/no-default-export":`off`}}).override(`antfu/unicorn/rules`,h(de,a)).override(`antfu/jsdoc/rules`,e=>({...e,...h(j,a)})).append(h(w,a)).append({...t.configs.recommended,name:`css`}).append(h(b,a)).append({name:`prettier`,plugins:{prettier:n},rules:{"prettier/prettier":`error`}}).append(h(G,a)).append(h(ie,a)).append(h(B,a)).onResolved(e=>{let t=e.find(e=>e.name===`antfu/vue/rules`);t&&(t.rules=h(me,a).rules??{}),r(`rxjs`)&&e.push(h(X,a))});export{f as StrictnessPreset,he as default};
|
|
1
|
+
import e from"@antfu/eslint-config";import t from"@eslint/css";import n from"eslint-plugin-prettier";import{isPackageExists as r}from"local-pkg";import i from"eslint-plugin-boundaries";import a from"eslint-plugin-import";import o from"eslint-plugin-prefer-arrow-functions";import s from"eslint-plugin-perfectionist";import{AST_NODE_TYPES as c,ESLintUtils as l}from"@typescript-eslint/utils";import u from"eslint-plugin-promise";import ee from"@smarttools/eslint-plugin-rxjs";import d from"eslint-plugin-sonarjs";let f=function(e){return e.EASY=`easy`,e.HARD=`hard`,e.MEDIUM=`medium`,e}({});const p=[f.EASY,f.MEDIUM,f.HARD],m=e=>{let t=p.indexOf(e);return t===-1?0:t},h=(e,t)=>{let n=m(t),r=p.filter(e=>m(e)<=n),[i]=r,a=i?e[i]:null,o=a?(()=>{let{rules:e,...t}=a;return t})():{},s={};for(let t of r){let n=e[t];n.rules&&Object.keys(n.rules).length>0&&Object.assign(s,n.rules)}return Object.keys(s).length>0?{...o,rules:s}:o},g={name:`boundaries`,plugins:{boundaries:i},settings:{"boundaries/elements":[{pattern:`app`,type:`app`},{capture:[`page`],pattern:`pages/*`,type:`pages`},{capture:[`widget`],pattern:`widgets/*`,type:`widgets`},{capture:[`feature`],pattern:`features/*`,type:`features`},{capture:[`entity`],pattern:`entities/*`,type:`entities`},{capture:[`segment`],pattern:`shared/*`,type:`shared`}],"boundaries/include":[`src/**/*`],"import/resolver":{typescript:{alwaysTryTypes:!0}}}},_={},v={},y={"boundaries/element-types":[`error`,{default:`allow`,message:"${file.type} is not allowed to import (${dependency.type})",rules:[{disallow:[`app`,`pages`,`widgets`,`features`,`entities`],from:[`shared`],message:"Shared module must not import upper layers (${dependency.type})"},{disallow:[`app`,`pages`,`widgets`,`features`],from:[`entities`],message:"Entity must not import upper layers (${dependency.type})"},{disallow:[[`entities`,{entity:"!${entity}"}]],from:[`entities`],message:`Entity must not import other entity`},{disallow:[`app`,`pages`,`widgets`],from:[`features`],message:"Feature must not import upper layers (${dependency.type})"},{disallow:[[`features`,{feature:"!${feature}"}]],from:[`features`],message:`Feature must not import other feature`},{disallow:[`app`,`pages`],from:[`widgets`],message:"Feature must not import upper layers (${dependency.type})"},{disallow:[[`widgets`,{widget:"!${widget}"}]],from:[`widgets`],message:`Widget must not import other widget`},{disallow:[`app`],from:[`pages`],message:"Page must not import upper layers (${dependency.type})"},{disallow:[[`pages`,{page:"!${page}"}]],from:[`pages`],message:`Page must not import other page`}]}],"boundaries/entry-point":[`error`,{default:`disallow`,rules:[{allow:`**`,target:[`shared`]},{allow:`index.{ts,vue}`,target:[`app`,`pages`,`widgets`,`features`,`entities`]}]}]},b={[f.EASY]:{...g,rules:_},[f.HARD]:{rules:y},[f.MEDIUM]:{rules:v}},x={name:`imports`,plugins:{import:a},settings:{"import/resolver":{typescript:!0}}},S={"import/consistent-type-specifier-style":[`error`,`prefer-top-level`],"import/extensions":[`error`,`ignorePackages`,{js:`never`,jsx:`never`,ts:`never`,tsx:`never`}],"import/first":`error`,"import/newline-after-import":[`error`,{count:1}],"import/no-commonjs":`error`,"import/no-duplicates":`error`,"import/no-empty-named-blocks":`error`,"import/no-mutable-exports":`error`,"import/no-named-default":`error`,"import/no-namespace":`error`,"import/no-relative-packages":`error`,"import/no-self-import":`error`,"import/no-useless-path-segments":`error`},C={"import/export":`error`,"import/no-cycle":`error`},w={[f.EASY]:{...x,rules:S},[f.HARD]:{},[f.MEDIUM]:{rules:C}},T={plugins:{"prefer-arrow-functions":o}},E={"antfu/no-top-level-await":`off`,"arrow-body-style":[`error`,`as-needed`],curly:[`error`,`all`],"default-case":`error`,"dot-notation":`off`,"grouped-accessor-pairs":`error`,"id-length":[`error`,{exceptions:[`t`]}],"logical-assignment-operators":[`error`,`always`,{enforceForIfStatements:!0}],"no-empty-function":`error`,"no-empty-static-block":`error`,"no-inner-declarations":`error`,"no-object-constructor":`error`,"no-restricted-syntax":`off`,"no-shadow":`error`,"no-throw-literal":`off`,"no-unused-private-class-members":`error`,"no-useless-concat":`error`,"no-useless-escape":`error`,"no-void":[`error`,{allowAsStatement:!0}],"operator-assignment":`error`,"prefer-arrow-functions/prefer-arrow-functions":`error`,"prefer-object-spread":`error`,"prefer-promise-reject-errors":`off`,"unused-imports/no-unused-vars":`off`},D={"consistent-this":`error`,"for-direction":`error`,"new-cap":[`error`,{capIsNew:!1,newIsCap:!0,properties:!0}],"no-bitwise":`error`,"no-constant-binary-expression":`error`,"no-constant-condition":`error`,"no-constructor-return":`error`,"no-implicit-coercion":[`error`,{disallowTemplateShorthand:!0}],"no-invalid-this":`error`,"no-param-reassign":[`error`,{ignorePropertyModificationsFor:[`accumulator`,`ctx`,`context`,`req`,`request`,`res`,`response`,`$scope`,`staticContext`,`ref`,`model`],ignorePropertyModificationsForRegex:[`^.*(?:Ref|Model)$`],props:!0}],"no-promise-executor-return":`error`,"no-return-assign":`error`,"no-script-url":`error`,"no-sequences":`error`},O={complexity:[`error`,{max:12}],"max-depth":[`error`,2],"require-atomic-updates":`error`},k={[f.EASY]:{...T,rules:E},[f.HARD]:{rules:O},[f.MEDIUM]:{rules:D}},A={"jsdoc/no-bad-blocks":`error`,"jsdoc/require-jsdoc":[`error`,{checkConstructors:!1,contexts:[`TSPropertySignature`,`TSMethodSignature`,`TSTypeAliasDeclaration`,`TSInterfaceDeclaration`,`TSEnumDeclaration`,`MethodDefinition`,`ClassDeclaration`,`ArrowFunctionExpression`,`ObjectExpression`,`PropertyDefinition`],enableFixer:!1,publicOnly:!0}]},j={[f.EASY]:{files:[`./src/**/*`],rules:A},[f.HARD]:{},[f.MEDIUM]:{}},M={...(s.configs?.[`recommended-natural`]).rules,"perfectionist/sort-exports":[`error`,{customGroups:[{elementNamePattern:`/lib/`,groupName:`lib`},{elementNamePattern:`/model/`,groupName:`model`},{elementNamePattern:`/ui/`,groupName:`ui`}],groups:[`lib`,`model`,`ui`],type:`natural`}],"perfectionist/sort-imports":[`error`,{customGroups:[{elementNamePattern:`/shared/`,groupName:`shared`},{elementNamePattern:`/entities/`,groupName:`entities`},{elementNamePattern:`/features/`,groupName:`features`},{elementNamePattern:`/widgets/`,groupName:`widgets`},{elementNamePattern:`/pages/`,groupName:`pages`}],groups:[`shared`,`entities`,`features`,`widgets`,`pages`,`type-import`,[`value-builtin`,`value-external`],`type-internal`,`value-internal`,[`type-parent`,`type-sibling`,`type-index`],[`value-parent`,`value-sibling`,`value-index`],`ts-equals-import`,`unknown`],type:`natural`}],"perfectionist/sort-intersection-types":[`error`,{groups:[`conditional`,`function`,`import`,`intersection`,`keyword`,`literal`,`named`,`object`,`operator`,`tuple`,`union`,`nullish`]}],"perfectionist/sort-modules":[`error`,{groups:[`declare-enum`,`enum`,[`declare-interface`,`declare-type`],[`interface`,`type`],`declare-class`,`class`,`declare-function`,`function`,`export-enum`,[`export-interface`,`export-type`],`export-class`,`export-function`]}],"perfectionist/sort-union-types":[`error`,{groups:[`conditional`,`function`,`import`,`intersection`,`keyword`,`literal`,`named`,`object`,`operator`,`tuple`,`union`,`nullish`]}]},N={[f.EASY]:{plugins:{perfectionist:s},rules:M},[f.HARD]:{},[f.MEDIUM]:{}},P=l.RuleCreator.withoutDocs({create:e=>({IfStatement:t=>{let{options:[n]}=e;if(n<2)throw Error(`Depth should be 2 or above`);let r=0,{parent:i}=t;for(;i.type===c.BlockStatement&&i.parent.type===c.IfStatement&&r!==n-1;)r+=1,i=i.parent;r===n-1&&e.report({data:{depth:n},messageId:`tooManyNestedIfStatements`,node:t})}}),defaultOptions:[3],meta:{docs:{description:`Prevent excessive use of nested if statements`},messages:{tooManyNestedIfStatements:`Too many nested if statements, maximum allowed is {{ depth }}`},schema:{description:`Allowed number of nested if statements`,items:{type:`integer`},type:`array`},type:`problem`}}),F=l.RuleCreator.withoutDocs({create:e=>({IfStatement:t=>{t.alternate&&e.report({messageId:`noElse`,node:t.alternate})}}),defaultOptions:[],meta:{docs:{description:`Prevent use of else statements`},messages:{noElse:`else/elseIf statements make code harder to read and are better replaced with an early return or omitting the else block entirely`},schema:[],type:`problem`}}),I=l.RuleCreator.withoutDocs({create:e=>({TSEnumDeclaration:t=>{t.const||e.report({messageId:`preferConstEnum`,node:t})}}),defaultOptions:[],meta:{docs:{description:`Prefer const enums over regular ones`},messages:{preferConstEnum:`Regular enums are compiled into functions, which is a redundant runtime overhead. Use const enums, as they are ignored during compilation, and their member accesses are compiled into plain strings`},schema:[],type:`problem`}}),L={name:`productive`,plugins:{productive:{rules:{"no-abusive-nested-if":P,"no-else":F,"prefer-const-enum":I}}}},te={},R={},z={"productive/no-abusive-nested-if":[`error`,2],"productive/no-else":`error`,"productive/prefer-const-enum":`off`},B={[f.EASY]:{...L,rules:te},[f.HARD]:{rules:z},[f.MEDIUM]:{rules:R}},V={name:`promise`,plugins:{promise:u}},H={"promise/always-return":`error`,"promise/catch-or-return":`error`,"promise/no-multiple-resolved":`error`,"promise/no-new-statics":`error`,"promise/no-return-in-finally":`error`,"promise/no-return-wrap":`error`,"promise/param-names":`error`,"promise/valid-params":`error`},U={"promise/prefer-await-to-then":`error`},W={"promise/no-nesting":`error`,"promise/no-promise-in-callback":`error`},G={[f.EASY]:{...V,rules:H},[f.HARD]:{rules:W},[f.MEDIUM]:{rules:U}},K={files:[`**/*.{ts,tsx,js,jsx,mjs,cjs}`],name:`rxjs`,plugins:{rxjs:ee}},q={"rxjs/no-compat":`error`,"rxjs/no-create":`error`,"rxjs/no-ignored-error":`error`,"rxjs/no-ignored-observable":`error`,"rxjs/no-ignored-replay-buffer":`error`,"rxjs/no-ignored-subscribe":`error`,"rxjs/no-ignored-subscription":`error`,"rxjs/no-implicit-any-catch":`error`,"rxjs/no-index":`error`,"rxjs/no-internal":`error`,"rxjs/no-topromise":`error`,"rxjs/no-unbound-methods":`error`,"rxjs/prefer-observer":`error`},J={"rxjs/finnish":`error`,"rxjs/no-async-subscribe":`error`,"rxjs/no-cyclic-action":`error`,"rxjs/no-exposed-subjects":`error`,"rxjs/no-ignored-notifier":`error`,"rxjs/no-ignored-takewhile-value":`error`,"rxjs/no-redundant-notify":`error`,"rxjs/no-subclass":`error`,"rxjs/no-subject-unsubscribe":`error`,"rxjs/no-subject-value":`error`,"rxjs/no-unsafe-catch":`error`,"rxjs/no-unsafe-first":`error`,"rxjs/no-unsafe-subject-next":`error`,"rxjs/no-unsafe-takeuntil":`error`,"rxjs/suffix-subjects":`error`,"rxjs/throw-error":`error`},Y={"rxjs/no-connectable":`error`,"rxjs/no-nested-subscribe":`error`,"rxjs/no-sharereplay":`error`,"rxjs/no-subscribe-handlers":`error`,"rxjs/no-unsafe-switchmap":`error`},X={[f.EASY]:{...K,rules:q},[f.HARD]:{rules:Y},[f.MEDIUM]:{rules:J}},Z={name:`sonarjs`,plugins:{sonarjs:d}},Q={"sonarjs/no-fallthrough":`error`,"sonarjs/no-redundant-boolean":`error`,"sonarjs/no-redundant-jump":`error`,"sonarjs/non-existent-operator":`error`,"sonarjs/prefer-immediate-return":`error`,"sonarjs/public-static-readonly":`error`},ne={"sonarjs/bool-param-default":`error`,"sonarjs/comma-or-logical-or-case":`error`,"sonarjs/future-reserved-words":`error`,"sonarjs/index-of-compare-to-positive-number":`error`,"sonarjs/link-with-target-blank":`error`,"sonarjs/no-array-delete":`error`,"sonarjs/no-duplicate-in-composite":`error`,"sonarjs/no-for-in-iterable":`error`,"sonarjs/no-function-declaration-in-block":`error`,"sonarjs/no-global-this":`error`,"sonarjs/no-globals-shadowing":`error`,"sonarjs/no-identical-conditions":`error`,"sonarjs/no-identical-expressions":`error`,"sonarjs/no-identical-functions":`error`,"sonarjs/no-ignored-return":`error`,"sonarjs/no-in-misuse":`error`,"sonarjs/no-incorrect-string-concat":`error`,"sonarjs/no-internal-api-use":`error`,"sonarjs/no-misleading-array-reverse":`error`,"sonarjs/no-nested-template-literals":`error`,"sonarjs/no-redundant-assignments":`error`,"sonarjs/no-redundant-optional":`error`,"sonarjs/no-selector-parameter":`error`,"sonarjs/no-small-switch":`error`,"sonarjs/no-try-promise":`error`,"sonarjs/no-undefined-assignment":`error`,"sonarjs/no-unthrown-error":`error`,"sonarjs/no-unused-collection":`error`,"sonarjs/no-unused-function-argument":`error`,"sonarjs/no-use-of-empty-return-value":`error`,"sonarjs/no-useless-intersection":`error`,"sonarjs/object-alt-content":`error`,"sonarjs/post-message":`error`,"sonarjs/prefer-promise-shorthand":`error`,"sonarjs/reduce-initial-value":`error`,"sonarjs/strings-comparison":`error`,"sonarjs/table-header":`error`,"sonarjs/table-header-reference":`error`},re={"sonarjs/expression-complexity":[`error`,{max:2}],"sonarjs/no-all-duplicated-branches":`error`,"sonarjs/no-async-constructor":`error`,"sonarjs/no-invariant-returns":`error`,"sonarjs/no-nested-switch":`error`,"sonarjs/too-many-break-or-continue-in-loop":`error`},ie={[f.EASY]:{...Z,rules:Q},[f.HARD]:{rules:re},[f.MEDIUM]:{rules:ne}},ae={"@typescript-eslint/array-type":`error`,"@typescript-eslint/class-literal-property-style":`error`,"@typescript-eslint/consistent-generic-constructors":`error`,"@typescript-eslint/consistent-indexed-object-style":`error`,"@typescript-eslint/consistent-type-assertions":`error`,"@typescript-eslint/default-param-last":`error`,"@typescript-eslint/explicit-function-return-type":[`error`,{allowExpressions:!0}],"@typescript-eslint/explicit-member-accessibility":[`error`,{overrides:{constructors:`no-public`}}],"@typescript-eslint/naming-convention":[`error`,{format:null,selector:[`objectLiteralProperty`]},{format:null,selector:`import`},{format:[`StrictPascalCase`],selector:[`enum`,`class`]},{format:[`UPPER_CASE`],selector:[`enumMember`]},{format:[`StrictPascalCase`],prefix:[`I`],selector:[`interface`]},{format:[`StrictPascalCase`],prefix:[`T`],selector:[`typeAlias`]},{format:[`StrictPascalCase`],selector:[`typeParameter`]},{format:[`strictCamelCase`,`UPPER_CASE`],modifiers:[`const`],selector:`variable`},{format:[`camelCase`],leadingUnderscore:`allow`,modifiers:[`unused`],selector:`parameter`}],"@typescript-eslint/no-base-to-string":`error`,"@typescript-eslint/no-confusing-void-expression":`error`,"@typescript-eslint/no-duplicate-type-constituents":`error`,"@typescript-eslint/no-dynamic-delete":`error`,"@typescript-eslint/no-empty-object-type":[`error`,{allowInterfaces:`always`}],"@typescript-eslint/no-explicit-any":`error`,"@typescript-eslint/no-floating-promises":`error`,"@typescript-eslint/no-inferrable-types":`error`,"@typescript-eslint/no-loop-func":`error`,"@typescript-eslint/no-magic-numbers":[`error`,{enforceConst:!0,ignore:[0,1,100,-1],ignoreClassFieldInitialValues:!0,ignoreDefaultValues:!0,ignoreEnums:!0}],"@typescript-eslint/no-meaningless-void-operator":`error`,"@typescript-eslint/no-redundant-type-constituents":`error`,"@typescript-eslint/no-unnecessary-boolean-literal-compare":`error`,"@typescript-eslint/no-unnecessary-condition":`error`,"@typescript-eslint/no-unnecessary-qualifier":`error`,"@typescript-eslint/no-unnecessary-template-expression":`error`,"@typescript-eslint/no-unnecessary-type-arguments":`error`,"@typescript-eslint/no-unnecessary-type-assertion":`error`,"@typescript-eslint/no-unnecessary-type-conversion":`error`,"@typescript-eslint/no-unsafe-argument":`error`,"@typescript-eslint/no-unsafe-assignment":`error`,"@typescript-eslint/no-unsafe-call":`error`,"@typescript-eslint/no-unsafe-enum-comparison":`error`,"@typescript-eslint/no-unsafe-member-access":`error`,"@typescript-eslint/no-unsafe-return":`error`,"@typescript-eslint/no-unsafe-unary-minus":`error`,"@typescript-eslint/no-useless-constructor":`error`,"@typescript-eslint/no-useless-empty-export":`error`,"@typescript-eslint/only-throw-error":`error`,"@typescript-eslint/prefer-destructuring":`error`,"@typescript-eslint/prefer-function-type":`error`,"@typescript-eslint/prefer-nullish-coalescing":`error`,"@typescript-eslint/prefer-optional-chain":`error`,"@typescript-eslint/related-getter-setter-pairs":`error`,"@typescript-eslint/require-array-sort-compare":[`error`,{ignoreStringArrays:!1}],"@typescript-eslint/require-await":`error`,"@typescript-eslint/return-await":`error`,"@typescript-eslint/switch-exhaustiveness-check":`error`,"@typescript-eslint/unbound-method":`error`,"@typescript-eslint/unified-signatures":`error`},oe={"@typescript-eslint/class-methods-use-this":`error`,"@typescript-eslint/init-declarations":`error`,"@typescript-eslint/max-params":[`error`,{max:3}],"@typescript-eslint/no-extraneous-class":`error`,"@typescript-eslint/no-invalid-void-type":`error`,"@typescript-eslint/no-misused-promises":`error`,"@typescript-eslint/no-misused-spread":`error`,"@typescript-eslint/no-mixed-enums":`error`,"@typescript-eslint/parameter-properties":`error`,"@typescript-eslint/prefer-enum-initializers":`error`,"@typescript-eslint/prefer-promise-reject-errors":`error`,"@typescript-eslint/prefer-reduce-type-parameter":`error`,"@typescript-eslint/prefer-return-this-type":`error`,"@typescript-eslint/restrict-template-expressions":`error`},$={"@typescript-eslint/no-non-null-assertion":`error`,"@typescript-eslint/prefer-readonly":`error`},se={[f.EASY]:{rules:ae},[f.HARD]:{rules:$},[f.MEDIUM]:{rules:oe}},ce={"unicorn/no-empty-file":`error`,"unicorn/no-new-array":`error`,"unicorn/no-unnecessary-array-flat-depth":`error`,"unicorn/no-unnecessary-array-splice-count":`error`,"unicorn/no-unnecessary-await":`error`,"unicorn/no-unnecessary-slice-end":`error`,"unicorn/no-unused-properties":`error`,"unicorn/no-useless-fallback-in-spread":`error`,"unicorn/no-useless-length-check":`error`,"unicorn/no-useless-promise-resolve-reject":`error`,"unicorn/no-useless-spread":`error`,"unicorn/no-useless-switch-case":`error`,"unicorn/no-useless-undefined":`error`,"unicorn/no-zero-fractions":`error`,"unicorn/numeric-separators-style":`error`,"unicorn/prefer-add-event-listener":`error`,"unicorn/prefer-array-find":`error`,"unicorn/prefer-array-flat":`error`,"unicorn/prefer-array-flat-map":`error`,"unicorn/prefer-array-index-of":`error`,"unicorn/prefer-array-some":`error`,"unicorn/prefer-at":`error`,"unicorn/prefer-blob-reading-methods":`error`,"unicorn/prefer-code-point":`error`,"unicorn/prefer-date-now":`error`,"unicorn/prefer-default-parameters":`error`,"unicorn/prefer-dom-node-append":`error`,"unicorn/prefer-dom-node-dataset":`error`,"unicorn/prefer-dom-node-remove":`error`,"unicorn/prefer-dom-node-text-content":`error`,"unicorn/prefer-event-target":`error`,"unicorn/prefer-export-from":`error`,"unicorn/prefer-global-this":`error`,"unicorn/prefer-import-meta-properties":`error`,"unicorn/prefer-includes":`error`,"unicorn/prefer-json-parse-buffer":`error`,"unicorn/prefer-keyboard-event-key":`error`,"unicorn/prefer-logical-operator-over-ternary":`error`,"unicorn/prefer-math-min-max":`error`,"unicorn/prefer-math-trunc":`error`,"unicorn/prefer-modern-dom-apis":`error`,"unicorn/prefer-modern-math-apis":`error`,"unicorn/prefer-native-coercion-functions":`error`,"unicorn/prefer-negative-index":`error`,"unicorn/prefer-number-properties":`error`,"unicorn/prefer-object-from-entries":`error`,"unicorn/prefer-optional-catch-binding":`error`,"unicorn/prefer-prototype-methods":`error`,"unicorn/prefer-query-selector":`error`,"unicorn/prefer-reflect-apply":`error`,"unicorn/prefer-regexp-test":`error`,"unicorn/prefer-set-has":`error`,"unicorn/prefer-set-size":`error`,"unicorn/prefer-single-call":`error`,"unicorn/prefer-spread":`error`,"unicorn/prefer-string-raw":`error`,"unicorn/prefer-string-replace-all":`error`,"unicorn/prefer-string-slice":`error`,"unicorn/prefer-string-starts-ends-with":`error`,"unicorn/prefer-string-trim-start-end":`error`,"unicorn/prefer-structured-clone":`error`,"unicorn/prefer-switch":`error`,"unicorn/prefer-ternary":`error`,"unicorn/prefer-top-level-await":`error`,"unicorn/prefer-type-error":`error`,"unicorn/require-array-join-separator":`error`,"unicorn/switch-case-braces":`error`,"unicorn/throw-new-error":`error`},le={"unicorn/consistent-date-clone":`error`,"unicorn/consistent-destructuring":`error`,"unicorn/consistent-existence-index-check":`error`,"unicorn/custom-error-definition":`error`,"unicorn/explicit-length-check":`error`,"unicorn/no-abusive-eslint-disable":`error`,"unicorn/no-accessor-recursion":`error`,"unicorn/no-array-callback-reference":`error`,"unicorn/no-array-for-each":`error`,"unicorn/no-for-loop":`error`,"unicorn/no-hex-escape":`error`,"unicorn/no-lonely-if":`error`,"unicorn/no-magic-array-flat-depth":`error`,"unicorn/no-named-default":`error`,"unicorn/no-negated-condition":`error`,"unicorn/no-negation-in-equality-check":`error`,"unicorn/no-nested-ternary":`error`,"unicorn/no-single-promise-in-promise-methods":`error`,"unicorn/no-typeof-undefined":`error`,"unicorn/no-unreadable-array-destructuring":`error`,"unicorn/relative-url-style":`error`,"unicorn/require-number-to-fixed-digits-argument":`error`,"unicorn/require-post-message-target-origin":`error`},ue={"unicorn/no-array-method-this-argument":`error`,"unicorn/no-await-in-promise-methods":`error`,"unicorn/no-document-cookie":`error`,"unicorn/no-invalid-remove-event-listener":`error`,"unicorn/no-object-as-default-parameter":`error`},de={[f.EASY]:{rules:ce},[f.HARD]:{rules:ue},[f.MEDIUM]:{rules:le}},fe={"vue/attribute-hyphenation":[`error`,`never`],"vue/attributes-order":[`error`,{alphabetical:!0}],"vue/block-lang":[`error`,{script:{lang:`ts`}}],"vue/block-order":[`error`,{order:[`script`,`template`,`style`]}],"vue/comment-directive":[`error`,{reportUnusedDisableDirectives:!0}],"vue/component-api-style":[`error`,[`script-setup`]],"vue/component-name-in-template-casing":[`error`,`PascalCase`],"vue/component-options-name-casing":[`error`,`PascalCase`],"vue/custom-event-name-casing":[`error`,`camelCase`],"vue/define-macros-order":[`error`,{defineExposeLast:!0,order:[`defineOptions`,`defineModel`,`defineProps`,`defineEmits`,`defineSlots`]}],"vue/define-props-declaration":`error`,"vue/define-props-destructuring":`error`,"vue/enforce-style-attribute":[`error`,{allow:[`module`]}],"vue/html-comment-content-spacing":[`error`,`always`,{exceptions:[`-`]}],"vue/html-self-closing":[`error`,{html:{void:`always`}}],"vue/jsx-uses-vars":`error`,"vue/no-arrow-functions-in-watch":`error`,"vue/no-deprecated-delete-set":`error`,"vue/no-deprecated-destroyed-lifecycle":`error`,"vue/no-deprecated-dollar-listeners-api":`error`,"vue/no-deprecated-dollar-scopedslots-api":`error`,"vue/no-deprecated-events-api":`error`,"vue/no-deprecated-filter":`error`,"vue/no-deprecated-functional-template":`error`,"vue/no-deprecated-html-element-is":`error`,"vue/no-deprecated-inline-template":`error`,"vue/no-deprecated-model-definition":`error`,"vue/no-deprecated-props-default-this":`error`,"vue/no-deprecated-router-link-tag-prop":`error`,"vue/no-deprecated-scope-attribute":`error`,"vue/no-deprecated-slot-attribute":`error`,"vue/no-deprecated-slot-scope-attribute":`error`,"vue/no-deprecated-v-bind-sync":`error`,"vue/no-deprecated-v-is":`error`,"vue/no-deprecated-v-on-native-modifier":`error`,"vue/no-deprecated-v-on-number-modifiers":`error`,"vue/no-deprecated-vue-config-keycodes":`error`,"vue/no-dupe-v-else-if":`error`,"vue/no-duplicate-attributes":`error`,"vue/no-empty-component-block":`error`,"vue/no-empty-pattern":`error`,"vue/no-export-in-script-setup":`error`,"vue/no-expose-after-await":`error`,"vue/no-implicit-coercion":`error`,"vue/no-import-compiler-macros":`error`,"vue/no-irregular-whitespace":`error`,"vue/no-lifecycle-after-await":`error`,"vue/no-lone-template":`error`,"vue/no-loss-of-precision":`error`,"vue/no-multiple-objects-in-class":`error`,"vue/no-multiple-slot-args":`error`,"vue/no-mutating-props":`error`,"vue/no-parsing-error":`error`,"vue/no-ref-as-operand":`error`,"vue/no-ref-object-reactivity-loss":`error`,"vue/no-required-prop-with-default":`error`,"vue/no-reserved-component-names":`error`,"vue/no-reserved-keys":`error`,"vue/no-reserved-props":`error`,"vue/no-restricted-block":`error`,"vue/no-restricted-syntax":[`error`,`DebuggerStatement`,`LabeledStatement`,`WithStatement`,{message:`Use ref instead of reactive for code consistency`,selector:`CallExpression[callee.name="reactive"]`}],"vue/no-restricted-v-bind":[`error`,`/^v-/`],"vue/no-side-effects-in-computed-properties":`error`,"vue/no-template-key":`error`,"vue/no-template-shadow":`error`,"vue/no-template-target-blank":`error`,"vue/no-textarea-mustache":`error`,"vue/no-unused-components":`error`,"vue/no-unused-refs":`error`,"vue/no-unused-vars":`error`,"vue/no-use-v-else-with-v-for":`error`,"vue/no-use-v-if-with-v-for":`error`,"vue/no-useless-mustaches":`error`,"vue/no-useless-template-attributes":`error`,"vue/no-useless-v-bind":`error`,"vue/no-v-for-template-key-on-child":`error`,"vue/no-watch-after-await":`error`,"vue/object-shorthand":[`error`,`always`,{avoidQuotes:!0,ignoreConstructors:!1}],"vue/order-in-components":`error`,"vue/padding-line-between-blocks":[`error`,`always`],"vue/prefer-import-from-vue":`error`,"vue/prefer-separate-static-class":`error`,"vue/prefer-template":`error`,"vue/prefer-true-attribute-shorthand":`error`,"vue/prefer-use-template-ref":`error`,"vue/prop-name-casing":[`error`,`camelCase`],"vue/require-component-is":`error`,"vue/require-explicit-emits":`error`,"vue/require-macro-variable-name":`error`,"vue/require-render-return":`error`,"vue/require-toggle-inside-transition":`error`,"vue/require-typed-ref":`error`,"vue/require-v-for-key":`error`,"vue/slot-name-casing":`error`,"vue/this-in-template":`error`,"vue/use-v-on-exact":`error`,"vue/v-bind-style":[`error`,`shorthand`,{sameNameShorthand:`always`}],"vue/v-for-delimiter-style":[`error`,`of`],"vue/v-if-else-key":`error`,"vue/v-on-event-hyphenation":[`error`,`never`,{autofix:!0}],"vue/v-on-handler-style":[`error`,[`method`,`inline-function`],{ignoreIncludesComment:!0}],"vue/v-on-style":`error`,"vue/v-slot-style":[`error`,{atComponent:`v-slot`,default:`v-slot`,named:`longform`}],"vue/valid-attribute-name":`error`,"vue/valid-define-emits":`error`,"vue/valid-define-options":`error`,"vue/valid-define-props":`error`,"vue/valid-next-tick":`error`,"vue/valid-template-root":`error`,"vue/valid-v-bind":`error`,"vue/valid-v-cloak":`error`,"vue/valid-v-else":`error`,"vue/valid-v-else-if":`error`,"vue/valid-v-for":`error`,"vue/valid-v-html":`error`,"vue/valid-v-if":`error`,"vue/valid-v-is":`error`,"vue/valid-v-memo":`error`,"vue/valid-v-model":`error`,"vue/valid-v-on":`error`,"vue/valid-v-once":`error`,"vue/valid-v-pre":`error`,"vue/valid-v-show":`error`,"vue/valid-v-slot":`error`,"vue/valid-v-text":`error`},pe={"vue/eqeqeq":[`error`,`smart`],"vue/html-button-has-type":`error`,"vue/no-async-in-computed-properties":`error`,"vue/no-child-content":`error`,"vue/no-console":`error`,"vue/no-constant-condition":`error`,"vue/no-duplicate-attr-inheritance":`error`,"vue/no-root-v-if":`error`,"vue/no-sparse-arrays":`error`,"vue/no-static-inline-styles":`error`,"vue/no-v-html":`error`,"vue/no-v-text":`error`,"vue/no-v-text-v-html-on-component":`error`},me={[f.EASY]:{rules:fe},[f.HARD]:{},[f.MEDIUM]:{rules:pe}},he=({ignores:i=[],strictness:a=f.HARD})=>e({ignores:i,imports:!1}).remove(`antfu/stylistic/rules`).override(`antfu/perfectionist/setup`,h(N,a)).override(`antfu/javascript/rules`,h(k,a)).override(`antfu/typescript/rules`,h(se,a)).override(`antfu/disables/config-files`,{files:[`**/*.plugin.?([cm])[jt]s?(x)`],rules:{"@typescript-eslint/naming-convention":`off`,"@typescript-eslint/no-magic-numbers":`off`,"no-template-curly-in-string":`off`}}).override(`antfu/disables/dts`,{rules:{"import/no-default-export":`off`}}).override(`antfu/unicorn/rules`,h(de,a)).override(`antfu/jsdoc/rules`,e=>({...e,...h(j,a)})).append(h(w,a)).append({...t.configs.recommended,name:`css`}).append(h(b,a)).append({name:`prettier`,plugins:{prettier:n},rules:{"prettier/prettier":`error`}}).append(h(G,a)).append(h(ie,a)).append(h(B,a)).onResolved(e=>{let t=e.find(e=>e.name===`antfu/vue/rules`);t&&(t.rules=h(me,a).rules??{}),r(`rxjs`)&&e.push(h(X,a))});export{f as StrictnessPreset,he as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "productive-eslint",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.3",
|
|
5
5
|
"description": "Mildly strict and sufficiently practical ESLint config. Powered by @antfu/eslint-config and based on Evgeny Orekhov's eslint-config-hardcore",
|
|
6
6
|
"author": "Bogdan Binitskiy",
|
|
7
7
|
"contributors": [
|