@iqrf/eslint-config 0.3.2 → 0.3.4

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.mjs ADDED
@@ -0,0 +1 @@
1
+ import e from"node:fs";import t from"eslint-config-flat-gitignore";import n from"eslint-plugin-eslint-comments";import r from"eslint-plugin-cypress/flat";import i from"node:path";import a from"node:process";import o from"eslint-plugin-import-x";import s from"@eslint/js";import c from"globals";import l from"eslint-plugin-jsdoc";import u from"eslint-plugin-jsonc";import d from"@eslint/markdown";import f from"eslint-plugin-math";import p from"eslint-plugin-n";import m from"eslint-plugin-perfectionist";import h from"eslint-plugin-pinia";import g from"eslint-plugin-promise";import _ from"eslint-plugin-regexp";import v from"@stylistic/eslint-plugin";import y from"typescript-eslint";import{getPackageInfoSync as b,isPackageExists as x}from"local-pkg";import ee from"eslint-plugin-unicorn";import S from"@vitest/eslint-plugin";import C from"eslint-plugin-vue";import w from"eslint-plugin-vue-scoped-css";import T from"eslint-plugin-vuetify";import te from"vue-eslint-parser";import ne from"@intlify/eslint-plugin-vue-i18n";const E=[{plugins:{"eslint-comments":n},rules:{"eslint-comments/no-aggregating-enable":`error`,"eslint-comments/no-duplicate-disable":`error`,"eslint-comments/no-unlimited-disable":`error`,"eslint-comments/no-unused-enable":`error`}}],D=[r.configs.recommended],O=e=>({"import-x/consistent-type-specifier-style":[`error`,`prefer-inline`],"import-x/no-named-as-default-member":`off`,"import-x/no-unresolved":[`warn`,e.vue?{ignore:[`^virtual:`]}:{}],"import-x/order":[`error`,{alphabetize:{order:`asc`,caseInsensitive:!0},pathGroups:[{pattern:`@/**`,group:`internal`}],groups:[`builtin`,`external`,`internal`,`parent`,`sibling`,`index`,`object`,`type`],"newlines-between":`always`}]}),k=e=>[e.typescript?{languageOptions:{ecmaVersion:2022,parserOptions:{ecmaVersion:2022,sourceType:`module`}},plugins:{"import-x":o},rules:{...o.configs.recommended.rules,...o.configs.typescript.rules,...O(e)},settings:{...o.configs.typescript.settings,"import-x/resolver":{node:{extensions:[`.ts`,`.tsx`,`.js`,`.jsx`]},typescript:{alwaysTryTypes:!0,project:i.join(a.cwd(),`tsconfig.json`)}}}}:{languageOptions:{ecmaVersion:2022,parserOptions:{ecmaVersion:2022,sourceType:`module`}},plugins:{"import-x":o},rules:{...o.configs.recommended.rules,...O(e)}}],A=e=>[{languageOptions:{ecmaVersion:2022,globals:{...c.browser,...c.es2022,...c.node,document:`readonly`,navigator:`readonly`,window:`readonly`},parserOptions:{ecmaVersion:2022,sourceType:`module`},sourceType:`module`},rules:{...s.configs.recommended.rules,"array-callback-return":`error`,"comma-dangle":`off`,"default-case-last":`error`,eqeqeq:[`error`,`always`],indent:[`error`,`tab`,{SwitchCase:1}],"linebreak-style":[`error`,`unix`],"no-alert":`error`,"no-array-constructor":`error`,"no-caller":`error`,"no-console":[`warn`,{allow:[`warn`,`error`]}],"no-eval":`error`,"no-extra-bind":`error`,"no-implied-eval":`error`,"no-invalid-regexp":`error`,"no-iterator":`error`,"no-lonely-if":`error`,"no-new":`error`,"no-new-func":`error`,"no-new-wrappers":`error`,"no-proto":`error`,"no-template-curly-in-string":`error`,"no-throw-literal":`error`,"no-unmodified-loop-condition":`error`,"no-unused-vars":e.typescript?`off`:`warn`,"no-unreachable-loop":`error`,"no-useless-call":`error`,"no-useless-computed-key":`error`,"no-useless-concat":`error`,"no-useless-rename":`error`,"no-useless-return":`error`,"no-var":`error`,"prefer-const":`error`,"prefer-exponentiation-operator":`error`,"prefer-rest-params":`error`,"prefer-spread":`error`,"prefer-template":`error`,quotes:[`error`,`single`],semi:[`error`,`always`],"unicode-bom":[`error`,`never`],"vars-on-top":`warn`,yoda:[`error`,`never`]}}],j=[l.configs[`flat/recommended`],{settings:{jsdoc:{tagNamePreference:{constant:`const`,const:`const`,member:`var`,returns:`return`}}}}],M=[...u.configs[`flat/recommended-with-json`],{rules:{"jsonc/array-bracket-spacing":[`error`,`never`],"jsonc/array-element-newline":[`error`,`consistent`],"jsonc/comma-style":[`error`,`last`],"jsonc/indent":[`error`,`tab`,{}],"jsonc/key-spacing":[`error`,{beforeColon:!1,afterColon:!0,mode:`strict`}],"jsonc/object-curly-newline":[`error`,{consistent:!0,multiline:!0}]}}],N=[{files:[`**/*.md`],plugins:{markdown:d},language:`markdown/gfm`,processor:d.processors.markdown,rules:{"markdown/fenced-code-language":`error`,"markdown/heading-increment":`error`,"markdown/no-duplicate-definitions":`error`,"markdown/no-empty-definitions":`error`,"markdown/no-empty-images":`error`,"markdown/no-empty-links":`error`,"markdown/no-invalid-label-refs":`error`,"markdown/no-missing-atx-heading-space":`error`,"markdown/no-missing-label-refs":`error`,"markdown/no-missing-link-fragments":`error`,"markdown/no-multiple-h1":`error`,"markdown/no-reversed-media-syntax":`error`,"markdown/no-space-in-emphasis":`error`,"markdown/no-unused-definitions":`error`,"markdown/require-alt-text":`error`,"markdown/table-column-count":`error`}}],P=[f.configs.recommended],F=[p.configs[`flat/recommended`],{rules:{"n/no-missing-import":`off`,"n/no-missing-require":`off`}}],I=[{plugins:{perfectionist:m},rules:{"perfectionist/sort-array-includes":[`error`,{type:`alphabetical`,order:`asc`,ignoreCase:!1}],"perfectionist/sort-exports":[`error`,{type:`alphabetical`,order:`asc`,fallbackSort:{type:`line-length`,order:`asc`},ignoreCase:!1,partitionByNewLine:!0}],"perfectionist/sort-named-exports":[`error`,{type:`alphabetical`,order:`asc`,fallbackSort:{type:`line-length`,order:`asc`},ignoreCase:!1}],"perfectionist/sort-named-imports":[`error`,{type:`alphabetical`,order:`asc`,fallbackSort:{type:`line-length`,order:`asc`},ignoreCase:!1}]}}],re=[{plugins:{pinia:h},rules:{...h.configs[`recommended-flat`].rules}}],L=[{...g.configs[`flat/recommended`],rules:{...g.configs[`flat/recommended`].rules,"promise/always-return":`warn`,"promise/prefer-await-to-then":`warn`,"promise/prefer-catch":`error`}}],R=[{files:[`**/*.js`,`**/*.jsx`,`**/*.ts`,`**/*.tsx`,`**/*.vue`],plugins:{regexp:_},rules:{..._.configs[`flat/recommended`].rules,"regexp/no-unused-capturing-group":`warn`,"regexp/prefer-quantifier":`error`}}],z=[{plugins:{"@stylistic":v},rules:{"@stylistic/array-bracket-newline":[`error`,`consistent`],"@stylistic/array-bracket-spacing":[`error`,`never`],"@stylistic/array-element-newline":[`error`,{consistent:!0,multiline:!0}],"@stylistic/arrow-spacing":[`error`,{after:!0,before:!0}],"@stylistic/brace-style":[`error`,`1tbs`],"@stylistic/comma-dangle":[`error`,`always-multiline`],"@stylistic/comma-spacing":[`error`,{after:!0,before:!1}],"@stylistic/comma-style":[`error`,`last`],"@stylistic/computed-property-spacing":[`error`,`never`],"@stylistic/curly-newline":[`error`,{consistent:!0}],"@stylistic/eol-last":[`error`,`always`],"@stylistic/function-call-argument-newline":[`error`,`consistent`],"@stylistic/function-paren-newline":[`error`,`consistent`],"@stylistic/implicit-arrow-linebreak":[`error`,`beside`],"@stylistic/key-spacing":[`error`,{afterColon:!0,beforeColon:!1}],"@stylistic/keyword-spacing":[`error`,{after:!0,before:!0}],"@stylistic/linebreak-style":[`error`,`unix`],"@stylistic/max-len":[`warn`,{code:150,ignoreRegExpLiterals:!0,ignoreStrings:!0,ignoreTemplateLiterals:!0,ignoreTrailingComments:!0,ignoreUrls:!0}],"@stylistic/member-delimiter-style":[`error`,{multiline:{delimiter:`semi`,requireLast:!0},singleline:{delimiter:`semi`,requireLast:!1},multilineDetection:`brackets`}],"@stylistic/new-parens":[`error`,`always`],"@stylistic/newline-per-chained-call":[`error`,{ignoreChainWithDepth:3}],"@stylistic/no-extra-parens":[`error`,`all`,{nestedBinaryExpressions:!1,ternaryOperandBinaryExpressions:!1}],"@stylistic/no-extra-semi":`error`,"@stylistic/no-floating-decimal":`error`,"@stylistic/no-mixed-operators":`error`,"@stylistic/no-mixed-spaces-and-tabs":[`error`,`smart-tabs`],"@stylistic/no-multi-spaces":`error`,"@stylistic/no-multiple-empty-lines":`error`,"@stylistic/no-trailing-spaces":`error`,"@stylistic/no-whitespace-before-property":`error`,"@stylistic/nonblock-statement-body-position":[`error`,`beside`],"@stylistic/object-curly-newline":[`error`,{consistent:!0}],"@stylistic/object-curly-spacing":[`error`,`always`],"@stylistic/rest-spread-spacing":[`error`,`never`],"@stylistic/semi":[`error`,`always`],"@stylistic/semi-spacing":[`error`,{after:!0,before:!1}],"@stylistic/semi-style":[`error`,`last`],"@stylistic/space-before-blocks":[`error`,`always`],"@stylistic/space-before-function-paren":[`error`,{anonymous:`always`,named:`never`,asyncArrow:`always`}],"@stylistic/space-in-parens":[`error`,`never`],"@stylistic/space-unary-ops":`error`,"@stylistic/spaced-comment":[`error`,`always`,{markers:[`/`]}],"@stylistic/switch-colon-spacing":[`error`,{before:!1,after:!0}],"@stylistic/template-curly-spacing":[`error`,`never`],"@stylistic/type-annotation-spacing":`error`,"@stylistic/type-generic-spacing":`error`,"@stylistic/type-named-tuple-spacing":`error`}}],ie=!!(!a.env.CI&&(a.env.VSCODE_PID||a.env.JETBRAINS_IDE||a.env.VIM)),B=x(`cypress`),V=x(`pinia`),H=x(`typescript`),U=x(`vitest`),W=x(`nuxt`)||x(`vitepress`)||x(`vue`)||x(`vuepress`),G=x(`vue-i18n`),K=x(`vuetify`),ae=b(`vue`)?.version;function q(e){let t={};for(let n of e){let e=Array.isArray(n)?n:[n];for(let n of e)n.rules&&Object.assign(t,n.rules)}return t}const J=[{files:[`**/*.ts`,`**/*.tsx`,`**/*.md/*.ts`],languageOptions:{parser:y.parser,parserOptions:{sourceType:`module`,projectService:!0}},plugins:{"@typescript-eslint":y.plugin},rules:{...q(y.configs.recommendedTypeChecked),...q(y.configs.stylisticTypeChecked),...q(y.configs.strictTypeChecked),"@typescript-eslint/ban-ts-comment":`off`,"@typescript-eslint/consistent-type-imports":[`error`,{prefer:`type-imports`,fixStyle:`inline-type-imports`}],"@typescript-eslint/dot-notation":[`error`,{allowKeywords:!0}],"@typescript-eslint/explicit-member-accessibility":`error`,"@typescript-eslint/no-duplicate-enum-values":`warn`,"@typescript-eslint/no-dynamic-delete":`warn`,"@typescript-eslint/no-empty-function":[`error`,{allow:[`arrowFunctions`]}],"@typescript-eslint/no-explicit-any":`warn`,"@typescript-eslint/no-extraneous-class":`off`,"@typescript-eslint/no-inferrable-types":`off`,"@typescript-eslint/no-unsafe-call":`warn`,"@typescript-eslint/no-unused-expressions":[`error`,{allowShortCircuit:!0,allowTernary:!0}]}},...V?[{files:[`src/store/**/*.ts`],rules:{"@typescript-eslint/unbound-method":`off`}}]:[]],Y=[{languageOptions:{ecmaVersion:2024},plugins:{unicorn:ee},rules:{"unicorn/better-regex":`error`,"unicorn/catch-error-name":`error`,"unicorn/consistent-destructuring":`error`,"unicorn/consistent-empty-array-spread":`error`,"unicorn/consistent-existence-index-check":`error`,"unicorn/custom-error-definition":`error`,"unicorn/error-message":`error`,"unicorn/explicit-length-check":`error`,"unicorn/new-for-builtins":`error`,"unicorn/no-abusive-eslint-disable":`error`,"unicorn/no-accessor-recursion":`error`,"unicorn/no-anonymous-default-export":`error`,"unicorn/no-array-callback-reference":`error`,"unicorn/no-array-for-each":`error`,"unicorn/no-array-method-this-argument":`error`,"unicorn/no-await-in-promise-methods":`error`,"unicorn/no-document-cookie":`error`,"unicorn/no-instanceof-array":`error`,"unicorn/no-lonely-if":`warn`,"unicorn/no-negation-in-equality-check":`error`,"unicorn/no-nested-ternary":`error`,"unicorn/no-single-promise-in-promise-methods":`error`,"unicorn/no-this-assignment":`error`,"unicorn/no-typeof-undefined":`error`,"unicorn/no-unnecessary-array-splice-count":`error`,"unicorn/no-unnecessary-await":`error`,"unicorn/no-unnecessary-slice-end":`error`,"unicorn/no-unreadable-iife":`warn`,"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":`warn`,"unicorn/number-literal-case":`error`,"unicorn/numeric-separators-style":[`warn`,{onlyIfContainsSeparator:!1,hexadecimal:{minimumDigits:0,groupLength:2},binary:{minimumDigits:0,groupLength:4},octal:{minimumDigits:0,groupLength:3},number:{minimumDigits:0,groupLength:3}}],"unicorn/prefer-array-index-of":`error`,"unicorn/prefer-date-now":`error`,"unicorn/prefer-default-parameters":`error`,"unicorn/prefer-dom-node-append":`error`,"unicorn/prefer-dom-node-remove":`error`,"unicorn/prefer-export-from":`error`,"unicorn/prefer-modern-math-apis":`error`,"unicorn/prefer-node-protocol":`error`,"unicorn/prefer-number-properties":`error`,"unicorn/prefer-optional-catch-binding":`error`,"unicorn/prefer-regexp-test":`error`,"unicorn/prefer-set-size":`error`,"unicorn/prefer-string-replace-all":`error`,"unicorn/prefer-string-starts-ends-with":`error`,"unicorn/prefer-string-trim-start-end":`error`,"unicorn/prefer-structured-clone":`error`,"unicorn/prefer-switch":[`error`,{emptyDefaultCase:`no-default-case`,minimumCases:3}],"unicorn/require-array-join-separator":`error`,"unicorn/require-module-attributes":`error`,"unicorn/require-module-specifiers":`error`,"unicorn/require-number-to-fixed-digits-argument":`error`,"unicorn/switch-case-braces":[`error`,`avoid`],"unicorn/throw-new-error":`error`}}],X=[{files:[`**/*.test.*`],plugins:{vitest:S},languageOptions:{globals:{...S.environments.env.globals}},rules:{...S.configs.recommended.rules,"vitest/consistent-test-it":[`error`,{fn:`test`}],"vitest/no-alias-methods":`warn`,"vitest/no-duplicate-hooks":`warn`,"vitest/no-focused-tests":`warn`,"vitest/no-test-return-statement":`error`,"vitest/prefer-called-with":`warn`,"vitest/prefer-comparison-matcher":`warn`,"vitest/prefer-each":`warn`,"vitest/prefer-equality-matcher":`warn`,"vitest/prefer-expect-assertions":`error`,"vitest/prefer-expect-resolves":`warn`,"vitest/prefer-hooks-in-order":`warn`,"vitest/prefer-hooks-on-top":`warn`,"vitest/prefer-mock-promise-shorthand":`warn`,"vitest/prefer-spy-on":`warn`,"vitest/prefer-strict-boolean-matchers":`warn`,"vitest/prefer-to-contain":`warn`,"vitest/prefer-to-have-length":`warn`,"vitest/require-mock-type-parameters":`error`,"vitest/require-to-throw-message":`warn`,"vitest/require-top-level-describe":`warn`},settings:{vitest:{typecheck:!0}}}];function Z(){let e=b(`vue`,{paths:[process.cwd()]});return e&&typeof e.version==`string`&&!Number.isNaN(+e.version[0])?+e.version[0]:3}const oe=Z()===3?[...C.configs[`flat/recommended`],...w.configs[`flat/recommended`]]:[...C.configs[`flat/vue2-recommended`],...w.configs[`flat/vue2-recommended`]],se=[...T.configs[`flat/base`],...T.configs[`flat/recommended`]].map(e=>(`plugins`in e&&e.plugins!==void 0&&`vue`in e.plugins&&delete e.plugins.vue,e)),Q=e=>[...oe,...e.vuetify?se:[],{files:[`**/*.vue`],languageOptions:{ecmaVersion:2022,parser:te,parserOptions:{ecmaVersion:2022,ecmaFeatures:{jsx:!0},extraFileExtensions:[`.vue`],parser:e.typescript?y.parser:null,sourceType:`module`}},rules:{"vue/array-bracket-newline":[`error`,`consistent`],"vue/array-bracket-spacing":[`error`,`never`],"vue/array-element-newline":[`error`,{consistent:!0,multiline:!0}],"vue/arrow-spacing":[`error`,{after:!0,before:!0}],"vue/brace-style":[`error`,`1tbs`],"vue/comma-dangle":[`error`,`always-multiline`],"vue/comma-spacing":[`error`,{after:!0,before:!1}],"vue/comma-style":[`error`,`last`],"vue/component-api-style":[`error`,[`script-setup`,`composition`]],"vue/define-emits-declaration":[`error`,`type-literal`],"vue/define-macros-order":[`error`,{defineExposeLast:!0,order:[`defineOptions`,`defineModel`,`defineProps`,`defineEmits`,`defineSlots`]}],"vue/eqeqeq":[`error`,`always`],"vue/html-indent":[`warn`,`tab`],"vue/html-quotes":[`warn`,`single`],"vue/key-spacing":[`error`,{afterColon:!0,beforeColon:!1}],"vue/keyword-spacing":[`error`,{after:!0,before:!0}],"vue/max-attributes-per-line":[`warn`,{singleline:3}],"vue/multi-word-component-names":`off`,"vue/no-console":`error`,"vue/no-constant-condition":`error`,"vue/no-empty-component-block":`error`,"vue/no-extra-parens":[`error`,`all`,{nestedBinaryExpressions:!1,ternaryOperandBinaryExpressions:!1}],"vue/no-import-compiler-macros":`error`,"vue/no-ref-object-reactivity-loss":`error`,"vue/no-root-v-if":`warn`,"vue/no-sparse-arrays":`error`,"vue/no-template-target-blank":`error`,"vue/no-undef-components":[`error`,{ignorePatterns:[`^client-only$`,`^ClientOnly$`,`^router-link$`,`^router-view$`,`^RouterLink$`,`^RouterView$`,`^v-+`,`^V[A-Z]+`]}],"vue/no-undef-properties":`error`,"vue/no-unused-emit-declarations":`error`,"vue/no-unused-properties":`warn`,"vue/no-unused-refs":`error`,"vue/no-useless-concat":`error`,"vue/no-useless-mustaches":`error`,"vue/object-curly-newline":[`error`,{consistent:!0}],"vue/object-curly-spacing":[`error`,`always`],"vue/padding-line-between-blocks":[`error`,`always`],"vue/prefer-define-options":`error`,"vue/prefer-template":`error`,"vue/prefer-use-template-ref":`error`,"vue/require-macro-variable-name":[`error`,{defineProps:`componentProps`}],"vue/require-typed-object-prop":`error`,"vue/require-typed-ref":`error`,"vue/space-in-parens":[`error`,`never`],"vue/space-unary-ops":`error`,"vue/template-curly-spacing":[`error`,`never`]}}],$=[...ne.configs.recommended,{settings:{"vue-i18n":{localeDir:i.join(a.cwd(),`/src/locales/*.json`),messageSyntaxVersion:`^11.0.0`}}}];function ce(n={},r=[]){let{cypress:i=B,ignores:a=[`.pnpm-store/`,`coverage/`,`dist/`],import:o=!0,jsdoc:s=!0,markdown:c=!0,node:l=!1,perfectionist:u=!0,pinia:d=V,promise:f=!0,regExp:p=!0,typescript:m=H,vitest:h=U,vue:g=W,vueI18n:_=G,vuetify:v=K}=n,y=[];a.length>0&&y.push({ignores:a});let b=[`.gitignore`,`.eslintignore`].filter(t=>e.existsSync(t));return b.length>0&&y.push(t({files:b})),y.push(...A({typescript:m})),y.push(...E),m&&y.push(...J),o&&y.push(...k({typescript:m,vue:g})),d&&y.push(...re),f&&y.push(...L),p&&y.push(...R),c&&y.push(...N),l&&y.push(...F),u&&y.push(...I),g&&y.push(...Q({typescript:m,vuetify:v})),_&&y.push(...$),h&&y.push(...X),s&&y.push(...j),i&&y.push(...D),y.push(...M),y.push(...z),y.push(...Y),y.push(...P),Object.keys(r).length>0&&y.push(...Array.isArray(r)?r:[r]),y}export{E as comments,D as cypress,Z as getVueVersion,B as hasCypress,V as hasPinia,H as hasTypescript,U as hasVitest,W as hasVue,G as hasVueI18n,K as hasVuetify,k as imports,ce as iqrfEslint,ie as isInEditor,A as javascript,j as jsDoc,M as json,N as markdown,P as math,F as node,I as perfectionist,re as pinia,L as promise,R as regexp,z as stylistic,J as typescript,Y as unicorn,ae as versionVue,X as vitest,Q as vue,$ as vueI18n};
package/package.json CHANGED
@@ -15,40 +15,40 @@
15
15
  ],
16
16
  "description": "ESLint configuration for IQRF projects",
17
17
  "dependencies": {
18
- "@eslint/js": "^9.38.0",
19
- "@eslint/markdown": "^7.5.0",
18
+ "@eslint/js": "^9.39.1",
19
+ "@eslint/markdown": "^7.5.1",
20
20
  "@intlify/eslint-plugin-vue-i18n": "^4.1.0",
21
- "@stylistic/eslint-plugin": "^5.5.0",
22
- "@typescript-eslint/parser": "^8.46.2",
23
- "@vitest/eslint-plugin": "^1.3.26",
21
+ "@stylistic/eslint-plugin": "^5.6.1",
22
+ "@typescript-eslint/parser": "^8.47.0",
23
+ "@vitest/eslint-plugin": "^1.4.3",
24
24
  "eslint-config-flat-gitignore": "^2.1.0",
25
25
  "eslint-import-resolver-typescript": "^4.4.4",
26
26
  "eslint-plugin-cypress": "^5.2.0",
27
27
  "eslint-plugin-eslint-comments": "^3.2.0",
28
28
  "eslint-plugin-import-x": "^4.16.1",
29
- "eslint-plugin-jsdoc": "^61.1.9",
29
+ "eslint-plugin-jsdoc": "^61.4.0",
30
30
  "eslint-plugin-jsonc": "^2.21.0",
31
- "eslint-plugin-math": "^0.13.0",
31
+ "eslint-plugin-math": "^0.13.1",
32
32
  "eslint-plugin-n": "^17.23.1",
33
33
  "eslint-plugin-perfectionist": "^4.15.1",
34
- "eslint-plugin-pinia": "^0.4.1",
34
+ "eslint-plugin-pinia": "^0.4.2",
35
35
  "eslint-plugin-promise": "^7.2.1",
36
36
  "eslint-plugin-regexp": "^2.10.0",
37
37
  "eslint-plugin-unicorn": "^62.0.0",
38
38
  "eslint-plugin-vue": "^10.5.1",
39
39
  "eslint-plugin-vue-scoped-css": "^2.12.0",
40
40
  "eslint-plugin-vuetify": "^2.5.3",
41
- "globals": "^16.4.0",
41
+ "globals": "^16.5.0",
42
42
  "local-pkg": "^1.1.2",
43
- "typescript-eslint": "^8.46.2",
43
+ "typescript-eslint": "^8.47.0",
44
44
  "vue-eslint-parser": "^10.2.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@types/node": "^24.9.1",
47
+ "@types/node": "^24.10.1",
48
48
  "bumpp": "^10.3.1",
49
- "eslint": "^9.38.0",
49
+ "eslint": "9.38.0",
50
50
  "eslint-plugin-eslint-plugin": "^7.2.0",
51
- "tsdown": "^0.15.10",
51
+ "tsdown": "^0.16.6",
52
52
  "tsx": "^4.20.6",
53
53
  "typescript": "^5.9.3"
54
54
  },
@@ -78,9 +78,12 @@
78
78
  "type": "git",
79
79
  "url": "git+https://gitlab.iqrf.org/open-source/iqrf-gateway-webapp-utils/eslint-config.git"
80
80
  },
81
+ "overrides": {
82
+ "eslint": "9.38.0"
83
+ },
81
84
  "type": "module",
82
85
  "types": "dist/index.d.ts",
83
- "version": "0.3.2",
86
+ "version": "0.3.4",
84
87
  "scripts": {
85
88
  "build": "tsdown",
86
89
  "lint": "npm run lint:js && npm run lint:ts",
package/dist/index.js DELETED
@@ -1,839 +0,0 @@
1
- import fs from "node:fs";
2
- import configGitignore from "eslint-config-flat-gitignore";
3
- import pluginEslintComments from "eslint-plugin-eslint-comments";
4
- import pluginCypress from "eslint-plugin-cypress/flat";
5
- import path from "node:path";
6
- import process$1 from "node:process";
7
- import pluginImport from "eslint-plugin-import-x";
8
- import pluginEslint from "@eslint/js";
9
- import globals from "globals";
10
- import pluginJsDoc from "eslint-plugin-jsdoc";
11
- import pluginJson from "eslint-plugin-jsonc";
12
- import pluginMarkdown from "@eslint/markdown";
13
- import pluginMath from "eslint-plugin-math";
14
- import pluginNode from "eslint-plugin-n";
15
- import pluginPerfectionist from "eslint-plugin-perfectionist";
16
- import pluginPinia from "eslint-plugin-pinia";
17
- import pluginPromise from "eslint-plugin-promise";
18
- import pluginRegexp from "eslint-plugin-regexp";
19
- import pluginStylistic from "@stylistic/eslint-plugin";
20
- import tsEslint from "typescript-eslint";
21
- import { getPackageInfoSync, isPackageExists } from "local-pkg";
22
- import pluginUnicorn from "eslint-plugin-unicorn";
23
- import pluginVitest from "@vitest/eslint-plugin";
24
- import pluginVue from "eslint-plugin-vue";
25
- import pluginVueScopedCSS from "eslint-plugin-vue-scoped-css";
26
- import pluginVuetify from "eslint-plugin-vuetify";
27
- import parserVue from "vue-eslint-parser";
28
- import pluginVueI18n from "@intlify/eslint-plugin-vue-i18n";
29
-
30
- //#region src/configs/comments.ts
31
- const comments = [{
32
- plugins: { "eslint-comments": pluginEslintComments },
33
- rules: {
34
- "eslint-comments/no-aggregating-enable": "error",
35
- "eslint-comments/no-duplicate-disable": "error",
36
- "eslint-comments/no-unlimited-disable": "error",
37
- "eslint-comments/no-unused-enable": "error"
38
- }
39
- }];
40
-
41
- //#endregion
42
- //#region src/configs/cypress.ts
43
- const cypress = [pluginCypress.configs.recommended];
44
-
45
- //#endregion
46
- //#region src/configs/imports.ts
47
- const commonRules = (options) => ({
48
- "import-x/consistent-type-specifier-style": ["error", "prefer-inline"],
49
- "import-x/no-named-as-default-member": "off",
50
- "import-x/no-unresolved": ["warn", options.vue ? { ignore: ["^virtual:"] } : {}],
51
- "import-x/order": ["error", {
52
- "alphabetize": {
53
- "order": "asc",
54
- "caseInsensitive": true
55
- },
56
- "pathGroups": [{
57
- "pattern": "@/**",
58
- "group": "internal"
59
- }],
60
- "groups": [
61
- "builtin",
62
- "external",
63
- "internal",
64
- "parent",
65
- "sibling",
66
- "index",
67
- "object",
68
- "type"
69
- ],
70
- "newlines-between": "always"
71
- }]
72
- });
73
- const imports = (options) => [options.typescript ? {
74
- languageOptions: {
75
- ecmaVersion: 2022,
76
- parserOptions: {
77
- ecmaVersion: 2022,
78
- sourceType: "module"
79
- }
80
- },
81
- plugins: { "import-x": pluginImport },
82
- rules: {
83
- ...pluginImport.configs.recommended.rules,
84
- ...pluginImport.configs.typescript.rules,
85
- ...commonRules(options)
86
- },
87
- settings: {
88
- ...pluginImport.configs.typescript.settings,
89
- "import-x/resolver": {
90
- "node": { extensions: [
91
- ".ts",
92
- ".tsx",
93
- ".js",
94
- ".jsx"
95
- ] },
96
- "typescript": {
97
- "alwaysTryTypes": true,
98
- "project": path.join(process$1.cwd(), "tsconfig.json")
99
- }
100
- }
101
- }
102
- } : {
103
- languageOptions: {
104
- ecmaVersion: 2022,
105
- parserOptions: {
106
- ecmaVersion: 2022,
107
- sourceType: "module"
108
- }
109
- },
110
- plugins: { "import-x": pluginImport },
111
- rules: {
112
- ...pluginImport.configs.recommended.rules,
113
- ...commonRules(options)
114
- }
115
- }];
116
-
117
- //#endregion
118
- //#region src/configs/javascript.ts
119
- const javascript = (options) => [{
120
- languageOptions: {
121
- ecmaVersion: 2022,
122
- globals: {
123
- ...globals.browser,
124
- ...globals.es2022,
125
- ...globals.node,
126
- document: "readonly",
127
- navigator: "readonly",
128
- window: "readonly"
129
- },
130
- parserOptions: {
131
- ecmaVersion: 2022,
132
- sourceType: "module"
133
- },
134
- sourceType: "module"
135
- },
136
- rules: {
137
- ...pluginEslint.configs.recommended.rules,
138
- "array-callback-return": "error",
139
- "comma-dangle": "off",
140
- "default-case-last": "error",
141
- "eqeqeq": ["error", "always"],
142
- "indent": [
143
- "error",
144
- "tab",
145
- { "SwitchCase": 1 }
146
- ],
147
- "linebreak-style": ["error", "unix"],
148
- "no-alert": "error",
149
- "no-array-constructor": "error",
150
- "no-caller": "error",
151
- "no-console": ["warn", { allow: ["warn", "error"] }],
152
- "no-eval": "error",
153
- "no-extra-bind": "error",
154
- "no-implied-eval": "error",
155
- "no-invalid-regexp": "error",
156
- "no-iterator": "error",
157
- "no-lonely-if": "error",
158
- "no-new": "error",
159
- "no-new-func": "error",
160
- "no-new-wrappers": "error",
161
- "no-proto": "error",
162
- "no-template-curly-in-string": "error",
163
- "no-throw-literal": "error",
164
- "no-unmodified-loop-condition": "error",
165
- "no-unused-vars": options.typescript ? "off" : "warn",
166
- "no-unreachable-loop": "error",
167
- "no-useless-call": "error",
168
- "no-useless-computed-key": "error",
169
- "no-useless-concat": "error",
170
- "no-useless-rename": "error",
171
- "no-useless-return": "error",
172
- "no-var": "error",
173
- "prefer-const": "error",
174
- "prefer-exponentiation-operator": "error",
175
- "prefer-rest-params": "error",
176
- "prefer-spread": "error",
177
- "prefer-template": "error",
178
- "quotes": ["error", "single"],
179
- "semi": ["error", "always"],
180
- "unicode-bom": ["error", "never"],
181
- "vars-on-top": "warn",
182
- "yoda": ["error", "never"]
183
- }
184
- }];
185
-
186
- //#endregion
187
- //#region src/configs/jsdoc.ts
188
- const jsDoc = [pluginJsDoc.configs["flat/recommended"], { settings: { jsdoc: { tagNamePreference: {
189
- constant: "const",
190
- const: "const",
191
- member: "var",
192
- returns: "return"
193
- } } } }];
194
-
195
- //#endregion
196
- //#region src/configs/json.ts
197
- const json = [...pluginJson.configs["flat/recommended-with-json"], { rules: {
198
- "jsonc/array-bracket-spacing": ["error", "never"],
199
- "jsonc/array-element-newline": ["error", "consistent"],
200
- "jsonc/comma-style": ["error", "last"],
201
- "jsonc/indent": [
202
- "error",
203
- "tab",
204
- {}
205
- ],
206
- "jsonc/key-spacing": ["error", {
207
- "beforeColon": false,
208
- "afterColon": true,
209
- "mode": "strict"
210
- }],
211
- "jsonc/object-curly-newline": ["error", {
212
- "consistent": true,
213
- "multiline": true
214
- }]
215
- } }];
216
-
217
- //#endregion
218
- //#region src/configs/markdown.ts
219
- const markdown = [{
220
- files: ["**/*.md"],
221
- plugins: { markdown: pluginMarkdown },
222
- language: "markdown/gfm",
223
- processor: pluginMarkdown.processors.markdown,
224
- rules: {
225
- "markdown/fenced-code-language": "error",
226
- "markdown/heading-increment": "error",
227
- "markdown/no-duplicate-definitions": "error",
228
- "markdown/no-empty-definitions": "error",
229
- "markdown/no-empty-images": "error",
230
- "markdown/no-empty-links": "error",
231
- "markdown/no-invalid-label-refs": "error",
232
- "markdown/no-missing-atx-heading-space": "error",
233
- "markdown/no-missing-label-refs": "error",
234
- "markdown/no-missing-link-fragments": "error",
235
- "markdown/no-multiple-h1": "error",
236
- "markdown/no-reversed-media-syntax": "error",
237
- "markdown/no-space-in-emphasis": "error",
238
- "markdown/no-unused-definitions": "error",
239
- "markdown/require-alt-text": "error",
240
- "markdown/table-column-count": "error"
241
- }
242
- }];
243
-
244
- //#endregion
245
- //#region src/configs/math.ts
246
- const math = [pluginMath.configs.recommended];
247
-
248
- //#endregion
249
- //#region src/configs/node.ts
250
- const node = [pluginNode.configs["flat/recommended"], { rules: {
251
- "n/no-missing-import": "off",
252
- "n/no-missing-require": "off"
253
- } }];
254
-
255
- //#endregion
256
- //#region src/configs/perfectionist.ts
257
- const perfectionist = [{
258
- plugins: { perfectionist: pluginPerfectionist },
259
- rules: {
260
- "perfectionist/sort-array-includes": ["error", {
261
- "type": "alphabetical",
262
- "order": "asc",
263
- "ignoreCase": false
264
- }],
265
- "perfectionist/sort-exports": ["error", {
266
- "type": "alphabetical",
267
- "order": "asc",
268
- "fallbackSort": {
269
- "type": "line-length",
270
- "order": "asc"
271
- },
272
- "ignoreCase": false,
273
- "partitionByNewLine": true
274
- }],
275
- "perfectionist/sort-named-exports": ["error", {
276
- "type": "alphabetical",
277
- "order": "asc",
278
- "fallbackSort": {
279
- "type": "line-length",
280
- "order": "asc"
281
- },
282
- "ignoreCase": false
283
- }],
284
- "perfectionist/sort-named-imports": ["error", {
285
- "type": "alphabetical",
286
- "order": "asc",
287
- "fallbackSort": {
288
- "type": "line-length",
289
- "order": "asc"
290
- },
291
- "ignoreCase": false
292
- }]
293
- }
294
- }];
295
-
296
- //#endregion
297
- //#region src/configs/pinia.ts
298
- const pinia = [{
299
- plugins: { pinia: pluginPinia },
300
- rules: { ...pluginPinia.configs["recommended-flat"].rules }
301
- }];
302
-
303
- //#endregion
304
- //#region src/configs/promise.ts
305
- const promise = [{
306
- ...pluginPromise.configs["flat/recommended"],
307
- rules: {
308
- ...pluginPromise.configs["flat/recommended"].rules,
309
- "promise/always-return": "warn",
310
- "promise/prefer-await-to-then": "warn",
311
- "promise/prefer-catch": "error"
312
- }
313
- }];
314
-
315
- //#endregion
316
- //#region src/configs/regexp.ts
317
- const regexp = [{
318
- files: [
319
- "**/*.js",
320
- "**/*.jsx",
321
- "**/*.ts",
322
- "**/*.tsx",
323
- "**/*.vue"
324
- ],
325
- plugins: { regexp: pluginRegexp },
326
- rules: {
327
- ...pluginRegexp.configs["flat/recommended"].rules,
328
- "regexp/no-unused-capturing-group": "warn",
329
- "regexp/prefer-quantifier": "error"
330
- }
331
- }];
332
-
333
- //#endregion
334
- //#region src/configs/stylistic.ts
335
- const stylistic = [{
336
- plugins: { "@stylistic": pluginStylistic },
337
- rules: {
338
- "@stylistic/array-bracket-newline": ["error", "consistent"],
339
- "@stylistic/array-bracket-spacing": ["error", "never"],
340
- "@stylistic/array-element-newline": ["error", {
341
- "consistent": true,
342
- "multiline": true
343
- }],
344
- "@stylistic/arrow-spacing": ["error", {
345
- "after": true,
346
- "before": true
347
- }],
348
- "@stylistic/brace-style": ["error", "1tbs"],
349
- "@stylistic/comma-dangle": ["error", "always-multiline"],
350
- "@stylistic/comma-spacing": ["error", {
351
- "after": true,
352
- "before": false
353
- }],
354
- "@stylistic/comma-style": ["error", "last"],
355
- "@stylistic/computed-property-spacing": ["error", "never"],
356
- "@stylistic/curly-newline": ["error", { "consistent": true }],
357
- "@stylistic/eol-last": ["error", "always"],
358
- "@stylistic/function-call-argument-newline": ["error", "consistent"],
359
- "@stylistic/function-paren-newline": ["error", "consistent"],
360
- "@stylistic/implicit-arrow-linebreak": ["error", "beside"],
361
- "@stylistic/key-spacing": ["error", {
362
- "afterColon": true,
363
- "beforeColon": false
364
- }],
365
- "@stylistic/keyword-spacing": ["error", {
366
- "after": true,
367
- "before": true
368
- }],
369
- "@stylistic/linebreak-style": ["error", "unix"],
370
- "@stylistic/max-len": ["warn", {
371
- "code": 150,
372
- "ignoreRegExpLiterals": true,
373
- "ignoreStrings": true,
374
- "ignoreTemplateLiterals": true,
375
- "ignoreTrailingComments": true,
376
- "ignoreUrls": true
377
- }],
378
- "@stylistic/member-delimiter-style": ["error", {
379
- "multiline": {
380
- "delimiter": "semi",
381
- "requireLast": true
382
- },
383
- "singleline": {
384
- "delimiter": "semi",
385
- "requireLast": false
386
- },
387
- "multilineDetection": "brackets"
388
- }],
389
- "@stylistic/new-parens": ["error", "always"],
390
- "@stylistic/newline-per-chained-call": ["error", { "ignoreChainWithDepth": 3 }],
391
- "@stylistic/no-extra-parens": [
392
- "error",
393
- "all",
394
- {
395
- "nestedBinaryExpressions": false,
396
- "ternaryOperandBinaryExpressions": false
397
- }
398
- ],
399
- "@stylistic/no-extra-semi": "error",
400
- "@stylistic/no-floating-decimal": "error",
401
- "@stylistic/no-mixed-operators": "error",
402
- "@stylistic/no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
403
- "@stylistic/no-multi-spaces": "error",
404
- "@stylistic/no-multiple-empty-lines": "error",
405
- "@stylistic/no-trailing-spaces": "error",
406
- "@stylistic/no-whitespace-before-property": "error",
407
- "@stylistic/nonblock-statement-body-position": ["error", "beside"],
408
- "@stylistic/object-curly-newline": ["error", { "consistent": true }],
409
- "@stylistic/object-curly-spacing": ["error", "always"],
410
- "@stylistic/rest-spread-spacing": ["error", "never"],
411
- "@stylistic/semi": ["error", "always"],
412
- "@stylistic/semi-spacing": ["error", {
413
- "after": true,
414
- "before": false
415
- }],
416
- "@stylistic/semi-style": ["error", "last"],
417
- "@stylistic/space-before-blocks": ["error", "always"],
418
- "@stylistic/space-before-function-paren": ["error", {
419
- "anonymous": "always",
420
- "named": "never",
421
- "asyncArrow": "always"
422
- }],
423
- "@stylistic/space-in-parens": ["error", "never"],
424
- "@stylistic/space-unary-ops": "error",
425
- "@stylistic/spaced-comment": [
426
- "error",
427
- "always",
428
- { "markers": ["/"] }
429
- ],
430
- "@stylistic/switch-colon-spacing": ["error", {
431
- "before": false,
432
- "after": true
433
- }],
434
- "@stylistic/template-curly-spacing": ["error", "never"],
435
- "@stylistic/type-annotation-spacing": "error",
436
- "@stylistic/type-generic-spacing": "error",
437
- "@stylistic/type-named-tuple-spacing": "error"
438
- }
439
- }];
440
-
441
- //#endregion
442
- //#region src/env.ts
443
- /**
444
- * @const {boolean} isInEditor Is the code running in an editor?
445
- */
446
- const isInEditor = !!(!process$1.env.CI && (process$1.env.VSCODE_PID || process$1.env.JETBRAINS_IDE || process$1.env.VIM));
447
- /**
448
- * @const {boolean} hasCypress Does the project have Cypress installed?
449
- */
450
- const hasCypress = isPackageExists("cypress");
451
- /**
452
- * @const {boolean} hasPinia Does the project have Pinia installed?
453
- */
454
- const hasPinia = isPackageExists("pinia");
455
- /**
456
- * @const {boolean} hasTypescript Does the project have TypeScript installed?
457
- */
458
- const hasTypescript = isPackageExists("typescript");
459
- /**
460
- * @const {boolean} hasVitest Does the project have Vitest installed?
461
- */
462
- const hasVitest = isPackageExists("vitest");
463
- /**
464
- * @const {boolean} hasVue Does the project have Vue installed?
465
- */
466
- const hasVue = isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("vue") || isPackageExists("vuepress");
467
- /**
468
- * @const {boolean} hasVueI18n Does the project have vue-i18n installed?
469
- */
470
- const hasVueI18n = isPackageExists("vue-i18n");
471
- /**
472
- * @const {boolean} hasVuetify Does the project have Vuetify installed?
473
- */
474
- const hasVuetify = isPackageExists("vuetify");
475
- /**
476
- * @const {string | undefined} versionVue Vue version
477
- */
478
- const versionVue = getPackageInfoSync("vue")?.version;
479
-
480
- //#endregion
481
- //#region src/configs/typescript.ts
482
- /**
483
- * Extracts rules from ESLint configurations
484
- * @param {(Linter.Config | Linter.Config[])[]} configs ESLint configurations
485
- * @return {Linter.RulesRecord} Extracted rules
486
- */
487
- function extractRules(configs$1) {
488
- const rules = {};
489
- for (const config of configs$1) {
490
- const configsArray = Array.isArray(config) ? config : [config];
491
- for (const c of configsArray) if (c.rules) Object.assign(rules, c.rules);
492
- }
493
- return rules;
494
- }
495
- const typescript = [{
496
- files: [
497
- "**/*.ts",
498
- "**/*.tsx",
499
- "**/*.md/*.ts"
500
- ],
501
- languageOptions: {
502
- parser: tsEslint.parser,
503
- parserOptions: {
504
- sourceType: "module",
505
- project: path.join(process$1.cwd(), "tsconfig.json"),
506
- projectService: true
507
- }
508
- },
509
- plugins: { "@typescript-eslint": tsEslint.plugin },
510
- rules: {
511
- ...extractRules(tsEslint.configs.recommendedTypeChecked),
512
- ...extractRules(tsEslint.configs.stylisticTypeChecked),
513
- ...extractRules(tsEslint.configs.strictTypeChecked),
514
- "@typescript-eslint/ban-ts-comment": "off",
515
- "@typescript-eslint/consistent-type-imports": ["error", {
516
- prefer: "type-imports",
517
- fixStyle: "inline-type-imports"
518
- }],
519
- "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
520
- "@typescript-eslint/explicit-member-accessibility": "error",
521
- "@typescript-eslint/no-duplicate-enum-values": "warn",
522
- "@typescript-eslint/no-dynamic-delete": "warn",
523
- "@typescript-eslint/no-empty-function": ["error", { allow: ["arrowFunctions"] }],
524
- "@typescript-eslint/no-explicit-any": "warn",
525
- "@typescript-eslint/no-extraneous-class": "off",
526
- "@typescript-eslint/no-inferrable-types": "off",
527
- "@typescript-eslint/no-unsafe-call": "warn",
528
- "@typescript-eslint/no-unused-expressions": ["error", {
529
- allowShortCircuit: true,
530
- allowTernary: true
531
- }]
532
- }
533
- }, ...hasPinia ? [{
534
- files: ["src/store/**/*.ts"],
535
- rules: { "@typescript-eslint/unbound-method": "off" }
536
- }] : []];
537
-
538
- //#endregion
539
- //#region src/configs/unicorn.ts
540
- const unicorn = [{
541
- languageOptions: { ecmaVersion: 2024 },
542
- plugins: { unicorn: pluginUnicorn },
543
- rules: {
544
- "unicorn/better-regex": "error",
545
- "unicorn/catch-error-name": "error",
546
- "unicorn/consistent-destructuring": "error",
547
- "unicorn/consistent-empty-array-spread": "error",
548
- "unicorn/consistent-existence-index-check": "error",
549
- "unicorn/custom-error-definition": "error",
550
- "unicorn/error-message": "error",
551
- "unicorn/explicit-length-check": "error",
552
- "unicorn/new-for-builtins": "error",
553
- "unicorn/no-abusive-eslint-disable": "error",
554
- "unicorn/no-accessor-recursion": "error",
555
- "unicorn/no-anonymous-default-export": "error",
556
- "unicorn/no-array-callback-reference": "error",
557
- "unicorn/no-array-for-each": "error",
558
- "unicorn/no-array-method-this-argument": "error",
559
- "unicorn/no-await-in-promise-methods": "error",
560
- "unicorn/no-document-cookie": "error",
561
- "unicorn/no-instanceof-array": "error",
562
- "unicorn/no-lonely-if": "warn",
563
- "unicorn/no-negation-in-equality-check": "error",
564
- "unicorn/no-nested-ternary": "error",
565
- "unicorn/no-single-promise-in-promise-methods": "error",
566
- "unicorn/no-this-assignment": "error",
567
- "unicorn/no-typeof-undefined": "error",
568
- "unicorn/no-unnecessary-array-splice-count": "error",
569
- "unicorn/no-unnecessary-await": "error",
570
- "unicorn/no-unnecessary-slice-end": "error",
571
- "unicorn/no-unreadable-iife": "warn",
572
- "unicorn/no-useless-fallback-in-spread": "error",
573
- "unicorn/no-useless-length-check": "error",
574
- "unicorn/no-useless-promise-resolve-reject": "error",
575
- "unicorn/no-useless-spread": "error",
576
- "unicorn/no-useless-switch-case": "error",
577
- "unicorn/no-useless-undefined": "error",
578
- "unicorn/no-zero-fractions": "warn",
579
- "unicorn/number-literal-case": "error",
580
- "unicorn/numeric-separators-style": ["warn", {
581
- onlyIfContainsSeparator: false,
582
- hexadecimal: {
583
- minimumDigits: 0,
584
- groupLength: 2
585
- },
586
- binary: {
587
- minimumDigits: 0,
588
- groupLength: 4
589
- },
590
- octal: {
591
- minimumDigits: 0,
592
- groupLength: 3
593
- },
594
- number: {
595
- minimumDigits: 0,
596
- groupLength: 3
597
- }
598
- }],
599
- "unicorn/prefer-array-index-of": "error",
600
- "unicorn/prefer-date-now": "error",
601
- "unicorn/prefer-default-parameters": "error",
602
- "unicorn/prefer-dom-node-append": "error",
603
- "unicorn/prefer-dom-node-remove": "error",
604
- "unicorn/prefer-export-from": "error",
605
- "unicorn/prefer-modern-math-apis": "error",
606
- "unicorn/prefer-node-protocol": "error",
607
- "unicorn/prefer-number-properties": "error",
608
- "unicorn/prefer-optional-catch-binding": "error",
609
- "unicorn/prefer-regexp-test": "error",
610
- "unicorn/prefer-set-size": "error",
611
- "unicorn/prefer-string-replace-all": "error",
612
- "unicorn/prefer-string-starts-ends-with": "error",
613
- "unicorn/prefer-string-trim-start-end": "error",
614
- "unicorn/prefer-structured-clone": "error",
615
- "unicorn/prefer-switch": ["error", {
616
- "emptyDefaultCase": "no-default-case",
617
- "minimumCases": 3
618
- }],
619
- "unicorn/require-array-join-separator": "error",
620
- "unicorn/require-module-attributes": "error",
621
- "unicorn/require-module-specifiers": "error",
622
- "unicorn/require-number-to-fixed-digits-argument": "error",
623
- "unicorn/switch-case-braces": ["error", "avoid"],
624
- "unicorn/throw-new-error": "error"
625
- }
626
- }];
627
-
628
- //#endregion
629
- //#region src/configs/vitest.ts
630
- const vitest = [{
631
- files: ["**/*.test.*"],
632
- plugins: { vitest: pluginVitest },
633
- languageOptions: { globals: { ...pluginVitest.environments.env.globals } },
634
- rules: {
635
- ...pluginVitest.configs.recommended.rules,
636
- "vitest/consistent-test-it": ["error", { fn: "test" }],
637
- "vitest/no-alias-methods": "warn",
638
- "vitest/no-duplicate-hooks": "warn",
639
- "vitest/no-focused-tests": "warn",
640
- "vitest/no-test-return-statement": "error",
641
- "vitest/prefer-called-with": "warn",
642
- "vitest/prefer-comparison-matcher": "warn",
643
- "vitest/prefer-each": "warn",
644
- "vitest/prefer-equality-matcher": "warn",
645
- "vitest/prefer-expect-assertions": "error",
646
- "vitest/prefer-expect-resolves": "warn",
647
- "vitest/prefer-hooks-in-order": "warn",
648
- "vitest/prefer-hooks-on-top": "warn",
649
- "vitest/prefer-mock-promise-shorthand": "warn",
650
- "vitest/prefer-spy-on": "warn",
651
- "vitest/prefer-strict-boolean-matchers": "warn",
652
- "vitest/prefer-to-contain": "warn",
653
- "vitest/prefer-to-have-length": "warn",
654
- "vitest/require-mock-type-parameters": "error",
655
- "vitest/require-to-throw-message": "warn",
656
- "vitest/require-top-level-describe": "warn"
657
- },
658
- settings: { vitest: { typecheck: true } }
659
- }];
660
-
661
- //#endregion
662
- //#region src/configs/vue.ts
663
- /**
664
- * Retrieves the Vue version from the package.json file.
665
- * @return {number} Vue version
666
- */
667
- function getVueVersion() {
668
- const pkg = getPackageInfoSync("vue", { paths: [process.cwd()] });
669
- if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) return +pkg.version[0];
670
- return 3;
671
- }
672
- const configs = getVueVersion() === 3 ? [...pluginVue.configs["flat/recommended"], ...pluginVueScopedCSS.configs["flat/recommended"]] : [...pluginVue.configs["flat/vue2-recommended"], ...pluginVueScopedCSS.configs["flat/vue2-recommended"]];
673
- const vuetifyConfigs = [...pluginVuetify.configs["flat/base"], ...pluginVuetify.configs["flat/recommended"]].map((config) => {
674
- if ("plugins" in config && config.plugins !== void 0 && "vue" in config.plugins) delete config.plugins.vue;
675
- return config;
676
- });
677
- const vue = (options) => [
678
- ...configs,
679
- ...options.vuetify ? vuetifyConfigs : [],
680
- {
681
- files: ["**/*.vue"],
682
- languageOptions: {
683
- ecmaVersion: 2022,
684
- parser: parserVue,
685
- parserOptions: {
686
- ecmaVersion: 2022,
687
- ecmaFeatures: { jsx: true },
688
- extraFileExtensions: [".vue"],
689
- parser: options.typescript ? tsEslint.parser : null,
690
- sourceType: "module"
691
- }
692
- },
693
- rules: {
694
- "vue/array-bracket-newline": ["error", "consistent"],
695
- "vue/array-bracket-spacing": ["error", "never"],
696
- "vue/array-element-newline": ["error", {
697
- "consistent": true,
698
- "multiline": true
699
- }],
700
- "vue/arrow-spacing": ["error", {
701
- "after": true,
702
- "before": true
703
- }],
704
- "vue/brace-style": ["error", "1tbs"],
705
- "vue/comma-dangle": ["error", "always-multiline"],
706
- "vue/comma-spacing": ["error", {
707
- "after": true,
708
- "before": false
709
- }],
710
- "vue/comma-style": ["error", "last"],
711
- "vue/component-api-style": ["error", ["script-setup", "composition"]],
712
- "vue/define-emits-declaration": ["error", "type-literal"],
713
- "vue/define-macros-order": ["error", {
714
- "defineExposeLast": true,
715
- "order": [
716
- "defineOptions",
717
- "defineModel",
718
- "defineProps",
719
- "defineEmits",
720
- "defineSlots"
721
- ]
722
- }],
723
- "vue/eqeqeq": ["error", "always"],
724
- "vue/html-indent": ["warn", "tab"],
725
- "vue/html-quotes": ["warn", "single"],
726
- "vue/key-spacing": ["error", {
727
- "afterColon": true,
728
- "beforeColon": false
729
- }],
730
- "vue/keyword-spacing": ["error", {
731
- "after": true,
732
- "before": true
733
- }],
734
- "vue/max-attributes-per-line": ["warn", { "singleline": 3 }],
735
- "vue/multi-word-component-names": "off",
736
- "vue/no-console": "error",
737
- "vue/no-constant-condition": "error",
738
- "vue/no-empty-component-block": "error",
739
- "vue/no-extra-parens": [
740
- "error",
741
- "all",
742
- {
743
- "nestedBinaryExpressions": false,
744
- "ternaryOperandBinaryExpressions": false
745
- }
746
- ],
747
- "vue/no-import-compiler-macros": "error",
748
- "vue/no-ref-object-reactivity-loss": "error",
749
- "vue/no-root-v-if": "warn",
750
- "vue/no-sparse-arrays": "error",
751
- "vue/no-template-target-blank": "error",
752
- "vue/no-undef-components": ["error", { ignorePatterns: [
753
- "^client-only$",
754
- "^ClientOnly$",
755
- "^router-link$",
756
- "^router-view$",
757
- "^RouterLink$",
758
- "^RouterView$",
759
- "^v-+",
760
- "^V[A-Z]+"
761
- ] }],
762
- "vue/no-undef-properties": "error",
763
- "vue/no-unused-emit-declarations": "error",
764
- "vue/no-unused-properties": "warn",
765
- "vue/no-unused-refs": "error",
766
- "vue/no-useless-concat": "error",
767
- "vue/no-useless-mustaches": "error",
768
- "vue/object-curly-newline": ["error", { "consistent": true }],
769
- "vue/object-curly-spacing": ["error", "always"],
770
- "vue/padding-line-between-blocks": ["error", "always"],
771
- "vue/prefer-define-options": "error",
772
- "vue/prefer-template": "error",
773
- "vue/prefer-use-template-ref": "error",
774
- "vue/require-macro-variable-name": ["error", { "defineProps": "componentProps" }],
775
- "vue/require-typed-object-prop": "error",
776
- "vue/require-typed-ref": "error",
777
- "vue/space-in-parens": ["error", "never"],
778
- "vue/space-unary-ops": "error",
779
- "vue/template-curly-spacing": ["error", "never"]
780
- }
781
- }
782
- ];
783
-
784
- //#endregion
785
- //#region src/configs/vue-i18n.ts
786
- const vueI18n = [...pluginVueI18n.configs.recommended, { settings: { "vue-i18n": {
787
- localeDir: path.join(process$1.cwd(), "/src/locales/*.json"),
788
- messageSyntaxVersion: "^11.0.0"
789
- } } }];
790
-
791
- //#endregion
792
- //#region src/index.ts
793
- /**
794
- * Generate ESLint configuration.
795
- * @param {Partial<IqrfEslintOptions>} options Configuration options.
796
- * @param {Linter.Config | Linter.Config[]} config Additional ESLint configuration.
797
- * @return {Linter.Config[]} Generated ESLint configuration.
798
- */
799
- function iqrfEslint(options = {}, config = []) {
800
- const { cypress: enableCypress = hasCypress, ignores = [
801
- ".pnpm-store/",
802
- "coverage/",
803
- "dist/"
804
- ], import: enableImport = true, jsdoc: enableJsDoc = true, markdown: enableMarkdown = true, node: enableNode = false, perfectionist: enablePerfectionist = true, pinia: enablePinia = hasPinia, promise: enablePromise = true, regExp: enableRegExp = true, typescript: enableTypescript = hasTypescript, vitest: enableVitest = hasVitest, vue: enableVue = hasVue, vueI18n: enableVueI18n = hasVueI18n, vuetify: enableVuetify = hasVuetify } = options;
805
- const configs$1 = [];
806
- if (ignores.length > 0) configs$1.push({ ignores });
807
- const ignoreFiles = [".gitignore", ".eslintignore"].filter((path$1) => fs.existsSync(path$1));
808
- if (ignoreFiles.length > 0) configs$1.push(configGitignore({ files: ignoreFiles }));
809
- configs$1.push(...javascript({ typescript: enableTypescript }));
810
- configs$1.push(...comments);
811
- if (enableTypescript) configs$1.push(...typescript);
812
- if (enableImport) configs$1.push(...imports({
813
- typescript: enableTypescript,
814
- vue: enableVue
815
- }));
816
- if (enablePinia) configs$1.push(...pinia);
817
- if (enablePromise) configs$1.push(...promise);
818
- if (enableRegExp) configs$1.push(...regexp);
819
- if (enableMarkdown) configs$1.push(...markdown);
820
- if (enableNode) configs$1.push(...node);
821
- if (enablePerfectionist) configs$1.push(...perfectionist);
822
- if (enableVue) configs$1.push(...vue({
823
- typescript: enableTypescript,
824
- vuetify: enableVuetify
825
- }));
826
- if (enableVueI18n) configs$1.push(...vueI18n);
827
- if (enableVitest) configs$1.push(...vitest);
828
- if (enableJsDoc) configs$1.push(...jsDoc);
829
- if (enableCypress) configs$1.push(...cypress);
830
- configs$1.push(...json);
831
- configs$1.push(...stylistic);
832
- configs$1.push(...unicorn);
833
- configs$1.push(...math);
834
- if (Object.keys(config).length > 0) configs$1.push(...Array.isArray(config) ? config : [config]);
835
- return configs$1;
836
- }
837
-
838
- //#endregion
839
- export { comments, cypress, getVueVersion, hasCypress, hasPinia, hasTypescript, hasVitest, hasVue, hasVueI18n, hasVuetify, imports, iqrfEslint, isInEditor, javascript, jsDoc, json, markdown, math, node, perfectionist, pinia, promise, regexp, stylistic, typescript, unicorn, versionVue, vitest, vue, vueI18n };
File without changes