From f1c226ed197f2209de03fb15caf627b0b1d6eecc Mon Sep 17 00:00:00 2001 From: kirillgroshkov Date: Mon, 31 Jul 2023 14:36:32 +0200 Subject: [PATCH] fix: extract eslint-vue-rules.js --- cfg/eslint-rules.js | 48 ------------------------------------ cfg/eslint-vue-rules.js | 52 +++++++++++++++++++++++++++++++++++++++ cfg/eslint-vue2.config.js | 1 + cfg/eslint-vue3.config.js | 1 + yarn.lock | 36 +++++++++++++-------------- 5 files changed, 72 insertions(+), 66 deletions(-) create mode 100644 cfg/eslint-vue-rules.js diff --git a/cfg/eslint-rules.js b/cfg/eslint-rules.js index 5c397c5..4875e84 100644 --- a/cfg/eslint-rules.js +++ b/cfg/eslint-rules.js @@ -445,53 +445,5 @@ module.exports = { '@typescript-eslint/dot-notation': 0, // not always desireable '@typescript-eslint/consistent-indexed-object-style': 0, // Record looses the name of the key '@typescript-eslint/no-unsafe-enum-comparison': 0, // not practically helpful - // non-default vue rules - 'vue/block-order': [ - 'error', - { - order: ['script', 'template', 'style'], - }, - ], - 'vue/component-api-style': [2, ['script-setup', 'composition', 'composition-vue2']], - 'vue/component-name-in-template-casing': [ - 2, - 'PascalCase', - { - registeredComponentsOnly: true, - }, - ], - 'vue/component-options-name-casing': [2, 'PascalCase'], - 'vue/custom-event-name-casing': [2, 'camelCase'], - 'vue/define-emits-declaration': [2, 'type-based'], - 'vue/define-macros-order': 2, - 'vue/define-props-declaration': 2, - 'vue/html-comment-content-spacing': 2, - 'vue/match-component-file-name': [ - 2, - { - extensions: ['vue', 'jsx'], - shouldMatchCase: true, - }, - ], - 'vue/match-component-import-name': 2, - 'vue/no-boolean-default': 2, - 'vue/no-deprecated-model-definition': 2, - 'vue/no-multiple-objects-in-class': 2, - 'vue/no-ref-object-destructure': 2, - 'vue/no-required-prop-with-default': 2, - 'vue/no-root-v-if': 2, - 'vue/no-this-in-before-route-enter': 2, - 'vue/padding-line-between-blocks': 2, - 'vue/prefer-define-options': 2, - 'vue/prefer-separate-static-class': 2, - 'vue/require-direct-export': 2, - 'vue/require-emit-validator': 2, - 'vue/require-expose': 2, - 'vue/require-macro-variable-name': 2, - 'vue/require-typed-object-prop': 2, - 'vue/require-typed-ref': 2, - 'vue/v-for-delimiter-style': [2, 'of'], - 'vue/valid-define-options': 2, - 'vue/eqeqeq': 2, }, } diff --git a/cfg/eslint-vue-rules.js b/cfg/eslint-vue-rules.js new file mode 100644 index 0000000..ae2f58d --- /dev/null +++ b/cfg/eslint-vue-rules.js @@ -0,0 +1,52 @@ +module.exports = { + rules: { + // non-default vue rules + 'vue/block-order': [ + 'error', + { + order: ['script', 'template', 'style'], + }, + ], + 'vue/component-api-style': [2, ['script-setup', 'composition', 'composition-vue2']], + 'vue/component-name-in-template-casing': [ + 2, + 'PascalCase', + { + registeredComponentsOnly: true, + }, + ], + 'vue/component-options-name-casing': [2, 'PascalCase'], + 'vue/custom-event-name-casing': [2, 'camelCase'], + 'vue/define-emits-declaration': [2, 'type-based'], + 'vue/define-macros-order': 2, + 'vue/define-props-declaration': 2, + 'vue/html-comment-content-spacing': 2, + 'vue/match-component-file-name': [ + 2, + { + extensions: ['vue', 'jsx'], + shouldMatchCase: true, + }, + ], + 'vue/match-component-import-name': 2, + 'vue/no-boolean-default': 2, + 'vue/no-deprecated-model-definition': 2, + 'vue/no-multiple-objects-in-class': 2, + 'vue/no-ref-object-destructure': 2, + 'vue/no-required-prop-with-default': 2, + 'vue/no-root-v-if': 2, + 'vue/no-this-in-before-route-enter': 2, + 'vue/padding-line-between-blocks': 2, + 'vue/prefer-define-options': 2, + 'vue/prefer-separate-static-class': 2, + 'vue/require-direct-export': 2, + 'vue/require-emit-validator': 2, + 'vue/require-expose': 2, + 'vue/require-macro-variable-name': 2, + 'vue/require-typed-object-prop': 2, + 'vue/require-typed-ref': 2, + 'vue/v-for-delimiter-style': [2, 'of'], + 'vue/valid-define-options': 2, + 'vue/eqeqeq': 2, + }, +} diff --git a/cfg/eslint-vue2.config.js b/cfg/eslint-vue2.config.js index dc34eae..6171eee 100644 --- a/cfg/eslint-vue2.config.js +++ b/cfg/eslint-vue2.config.js @@ -13,6 +13,7 @@ module.exports = { 'plugin:unicorn/recommended', 'plugin:vue/recommended', './eslint-rules.js', + './eslint-vue-rules.js', 'prettier', // must go last ], env: { diff --git a/cfg/eslint-vue3.config.js b/cfg/eslint-vue3.config.js index 3f5a128..cdd9d1e 100644 --- a/cfg/eslint-vue3.config.js +++ b/cfg/eslint-vue3.config.js @@ -13,6 +13,7 @@ module.exports = { 'plugin:unicorn/recommended', 'plugin:vue/vue3-recommended', './eslint-rules.js', + './eslint-vue-rules.js', 'prettier', // must go last ], env: { diff --git a/yarn.lock b/yarn.lock index 6aa5eaf..fbc7951 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1587,13 +1587,13 @@ braces@^3.0.2: fill-range "^7.0.1" browserslist@^4.21.9: - version "4.21.9" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.9.tgz#e11bdd3c313d7e2a9e87e8b4b0c7872b13897635" - integrity sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg== + version "4.21.10" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.10.tgz#dbbac576628c13d3b2231332cb2ec5a46e015bb0" + integrity sha512-bipEBdZfVH5/pwrvqc+Ub0kUPVfGUhlKxbvfD+z1BDnPEO/X98ruXGA1WP5ASpAFKan7Qr6j736IacbZQuAlKQ== dependencies: - caniuse-lite "^1.0.30001503" - electron-to-chromium "^1.4.431" - node-releases "^2.0.12" + caniuse-lite "^1.0.30001517" + electron-to-chromium "^1.4.477" + node-releases "^2.0.13" update-browserslist-db "^1.0.11" bs-logger@0.x: @@ -1685,10 +1685,10 @@ camelcase@^6.2.0, camelcase@^6.3.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001503: - version "1.0.30001517" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001517.tgz#90fabae294215c3495807eb24fc809e11dc2f0a8" - integrity sha512-Vdhm5S11DaFVLlyiKu4hiUTkpZu+y1KA/rZZqVQfOD5YdDT/eQKlkt7NaE0WGOFgX32diqt9MiP9CAiFeRklaA== +caniuse-lite@^1.0.30001517: + version "1.0.30001518" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001518.tgz#b3ca93904cb4699c01218246c4d77a71dbe97150" + integrity sha512-rup09/e3I0BKjncL+FesTayKtPrdwKhUufQFd3riFw1hHg8JmIFoInYfB102cFcY/pPgGmdyl/iy+jgiDi2vdA== chalk@5.2.0: version "5.2.0" @@ -1981,9 +1981,9 @@ decompress-response@^6.0.0: mimic-response "^3.1.0" dedent@^1.0.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.3.0.tgz#15d6809eb15b581d5587a2dc208f34118e35bee3" - integrity sha512-7glNLfvdsMzZm3FpRY1CHuI2lbYDR+71YmrhmTZjYFD5pfT0ACgnGRdrrC9Mk2uICnzkcdelCx5at787UDGOvg== + version "1.5.0" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.0.tgz#6e0fb8016002deba2d56927ebd7e3caf7e84e22a" + integrity sha512-3sSQTYoWKGcRHmHl6Y6opLpRJH55bxeGQ0Y1LCI5pZzUXvokVkj0FC4bi7uEwazxA9FQZ0Nv067Zt5kSUvXxEA== deep-is@^0.1.3: version "0.1.4" @@ -2068,7 +2068,7 @@ ecdsa-sig-formatter@1.0.11: dependencies: safe-buffer "^5.0.1" -electron-to-chromium@^1.4.431: +electron-to-chromium@^1.4.477: version "1.4.477" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.477.tgz#05669aa6f161ee9076a6805457e9bd9fe6d0dfd1" integrity sha512-shUVy6Eawp33dFBFIoYbIwLHrX0IZ857AlH9ug2o4rvbWmpaCUdBpQ5Zw39HRrfzAFm4APJE9V+E2A/WB0YqJw== @@ -2288,9 +2288,9 @@ eslint-plugin-unused-imports@^3.0.0: eslint-rule-composer "^0.3.0" eslint-plugin-vue@^9.0.0: - version "9.16.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-9.16.0.tgz#67b85756126e2a6989a5c2eeb8540a4afc91aa99" - integrity sha512-SonAuvQXFm9HBV9ww/YkYZVYPMR8ptxxuJwcKGnG9A65SyvNANP9MKlfnC49L6DIwt/YEQZwZWEMHOkL1d5s1A== + version "9.16.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-9.16.1.tgz#3508d9279d797b40889db76da2fd26524e9144e6" + integrity sha512-2FtnTqazA6aYONfDuOZTk0QzwhAwi7Z4+uJ7+GHeGxcKapjqWlDsRWDenvyG/utyOfAS5bVRmAG3cEWiYEz2bA== dependencies: "@eslint-community/eslint-utils" "^4.4.0" natural-compare "^1.4.0" @@ -4066,7 +4066,7 @@ node-int64@^0.4.0: resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== -node-releases@^2.0.12: +node-releases@^2.0.13: version "2.0.13" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.13.tgz#d5ed1627c23e3461e819b02e57b75e4899b1c81d" integrity sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==