From 0df5884fad92e6419eac4ce8988657fde4aa0adf Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Mon, 22 Apr 2024 00:03:27 +1200 Subject: [PATCH] feat: more tweaks --- package.json | 1 + pnpm-lock.yaml | 114 +++++++++++++++++++++++++++++++++++++++++ project-dictionary.txt | 1 + src/configs/vue.ts | 27 ++++++---- src/factory.ts | 3 +- 5 files changed, 136 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 3ab1a35dd..f51555c65 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "@commitlint/cli": "19.2.2", "@commitlint/config-conventional": "19.2.2", "@cspell/dict-cryptocurrencies": "5.0.0", + "@intlify/eslint-plugin-vue-i18n": "2.0.0", "@semantic-release/changelog": "6.0.3", "@semantic-release/commit-analyzer": "12.0.0", "@semantic-release/git": "10.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0eb01d5fd..147d10a45 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -34,6 +34,9 @@ devDependencies: '@cspell/dict-cryptocurrencies': specifier: 5.0.0 version: 5.0.0 + '@intlify/eslint-plugin-vue-i18n': + specifier: 2.0.0 + version: 2.0.0(eslint@9.0.0) '@semantic-release/changelog': specifier: 6.0.3 version: 6.0.3(semantic-release@23.0.8) @@ -282,6 +285,13 @@ packages: '@babel/types': 7.23.6 dev: true + /@babel/runtime@7.24.4: + resolution: {integrity: sha512-dkxf7+hn8mFBwKjs9bvBlArzLVxVbS8usaPUDd5p2a9JCL9tB8OaOVN1isD4+Xyk4ns89/xeOmbQvgdK7IIVdA==} + engines: {node: '>=6.9.0'} + dependencies: + regenerator-runtime: 0.14.1 + dev: true + /@babel/types@7.23.6: resolution: {integrity: sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg==} engines: {node: '>=6.9.0'} @@ -1058,6 +1068,23 @@ packages: resolution: {integrity: sha512-/oJdlHbVtMRfC0+17aaLG/5hqMrup40VcQztWRrIy1oLRNQDwXdOjR/x3+g8kknu61LqmDAmbpeBXJnN62WvRg==} dev: true + /@eslint/eslintrc@1.4.1: + resolution: {integrity: sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + ajv: 6.12.6 + debug: 4.3.4 + espree: 9.6.1 + globals: 13.24.0 + ignore: 5.3.1 + import-fresh: 3.3.0 + js-yaml: 4.1.0 + minimatch: 3.1.2 + strip-json-comments: 3.1.1 + transitivePeerDependencies: + - supports-color + dev: true + /@eslint/eslintrc@2.1.4: resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -1112,6 +1139,53 @@ packages: /@humanwhocodes/object-schema@2.0.3: resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==} + /@intlify/core-base@9.13.1: + resolution: {integrity: sha512-+bcQRkJO9pcX8d0gel9ZNfrzU22sZFSA0WVhfXrf5jdJOS24a+Bp8pozuS9sBI9Hk/tGz83pgKfmqcn/Ci7/8w==} + engines: {node: '>= 16'} + dependencies: + '@intlify/message-compiler': 9.13.1 + '@intlify/shared': 9.13.1 + dev: true + + /@intlify/eslint-plugin-vue-i18n@2.0.0(eslint@9.0.0): + resolution: {integrity: sha512-ECBD0TvQNa56XKyuM6FPIGAAl7MP6ODcgjBQJrzucNxcTb8fYTWmZ+xgBuvmvAtA0iE0D4Wp18UMild2N0bGyw==} + engines: {node: ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 + dependencies: + '@eslint/eslintrc': 1.4.1 + '@intlify/core-base': 9.13.1 + '@intlify/message-compiler': 9.13.1 + debug: 4.3.4 + eslint: 9.0.0 + glob: 8.1.0 + ignore: 5.3.1 + is-language-code: 3.1.0 + js-yaml: 4.1.0 + json5: 2.2.3 + jsonc-eslint-parser: 2.4.0 + lodash: 4.17.21 + parse5: 7.1.2 + semver: 7.6.0 + vue-eslint-parser: 9.4.2(eslint@9.0.0) + yaml-eslint-parser: 1.2.2 + transitivePeerDependencies: + - supports-color + dev: true + + /@intlify/message-compiler@9.13.1: + resolution: {integrity: sha512-SKsVa4ajYGBVm7sHMXd5qX70O2XXjm55zdZB3VeMFCvQyvLew/dLvq3MqnaIsTMF1VkkOb9Ttr6tHcMlyPDL9w==} + engines: {node: '>= 16'} + dependencies: + '@intlify/shared': 9.13.1 + source-map-js: 1.2.0 + dev: true + + /@intlify/shared@9.13.1: + resolution: {integrity: sha512-u3b6BKGhE6j/JeRU6C/RL2FgyJfy6LakbtfeVF8fJXURpZZTzfh3e05J0bu0XPw447Q6/WUp3C4ajv4TMS4YsQ==} + engines: {node: '>= 16'} + dev: true + /@isaacs/cliui@8.0.2: resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} @@ -4526,6 +4600,17 @@ packages: path-is-absolute: 1.0.1 dev: true + /glob@8.1.0: + resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} + engines: {node: '>=12'} + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 5.1.6 + once: 1.4.0 + dev: true + /global-directory@4.0.1: resolution: {integrity: sha512-wHTUcDUoZ1H5/0iVqEudYW4/kAlN5cZ3j/bXn0Dpbizl9iaUVeWSHqiOjsgk6OW2bkLclbBjzewBz6weQ1zA2Q==} engines: {node: '>=18'} @@ -5017,6 +5102,12 @@ packages: engines: {node: '>= 4'} dev: true + /is-language-code@3.1.0: + resolution: {integrity: sha512-zJdQ3QTeLye+iphMeK3wks+vXSRFKh68/Pnlw7aOfApFSEIOhYa8P9vwwa6QrImNNBMJTiL1PpYF0f4BxDuEgA==} + dependencies: + '@babel/runtime': 7.24.4 + dev: true + /is-negative-zero@2.0.3: resolution: {integrity: sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==} engines: {node: '>= 0.4'} @@ -5263,6 +5354,12 @@ packages: minimist: 1.2.8 dev: true + /json5@2.2.3: + resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} + engines: {node: '>=6'} + hasBin: true + dev: true + /jsonc-eslint-parser@2.4.0: resolution: {integrity: sha512-WYDyuc/uFcGp6YtM2H0uKmUwieOuzeE/5YocFJLnLfclZ4inf3mRn8ZVy1s7Hxji7Jxm6Ss8gqpexD/GlKoGgg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -5758,6 +5855,13 @@ packages: dependencies: brace-expansion: 1.1.11 + /minimatch@5.1.6: + resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} + engines: {node: '>=10'} + dependencies: + brace-expansion: 2.0.1 + dev: true + /minimatch@9.0.3: resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} engines: {node: '>=16 || 14 >=14.17'} @@ -6340,6 +6444,12 @@ packages: resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==} dev: true + /parse5@7.1.2: + resolution: {integrity: sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==} + dependencies: + entities: 4.5.0 + dev: true + /path-exists@3.0.0: resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==} engines: {node: '>=4'} @@ -6657,6 +6767,10 @@ packages: '@eslint-community/regexpp': 4.10.0 dev: true + /regenerator-runtime@0.14.1: + resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} + dev: true + /regexp-ast-analysis@0.7.1: resolution: {integrity: sha512-sZuz1dYW/ZsfG17WSAG7eS85r5a0dDsvg+7BiiYR5o6lKCAtUrEwdmRmaGF6rwVj3LcmAeYkOWKEPlbPzN3Y3A==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} diff --git a/project-dictionary.txt b/project-dictionary.txt index c55a34800..9156b29c8 100644 --- a/project-dictionary.txt +++ b/project-dictionary.txt @@ -10,6 +10,7 @@ fred garply grault iife +intlify jiti knip litecoin diff --git a/src/configs/vue.ts b/src/configs/vue.ts index 4a6a33e16..e4143f212 100644 --- a/src/configs/vue.ts +++ b/src/configs/vue.ts @@ -47,15 +47,18 @@ export async function vue( const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic; - const [pluginVue, parserVue, processorVueBlocks] = (await loadPackages([ - "eslint-plugin-vue", - "vue-eslint-parser", - "eslint-processor-vue-blocks", - ])) as [ - PluginVue, - typeof import("vue-eslint-parser"), - (typeof import("eslint-processor-vue-blocks"))["default"], - ]; + const [pluginVue, pluginVueI18n, parserVue, processorVueBlocks] = + (await loadPackages([ + "eslint-plugin-vue", + "@intlify/eslint-plugin-vue-i18n", + "vue-eslint-parser", + "eslint-processor-vue-blocks", + ])) as [ + PluginVue, + ESLint.Plugin, + typeof import("vue-eslint-parser"), + (typeof import("eslint-processor-vue-blocks"))["default"], + ]; const parserTs = await interopDefault( import("@typescript-eslint/parser"), @@ -84,6 +87,7 @@ export async function vue( }, plugins: { vue: pluginVue, + "vue-i18n": pluginVueI18n, }, }, { @@ -191,6 +195,11 @@ export async function vue( "vue/space-infix-ops": "error", "vue/space-unary-ops": ["error", { nonwords: false, words: true }], + "vue-i18n/no-html-messages": "warn", + "vue-i18n/no-missing-keys": "warn", + "vue-i18n/no-raw-text": "warn", + "vue-i18n/no-v-html": "warn", + ...(stylistic === false ? {} : { diff --git a/src/factory.ts b/src/factory.ts index 7f47b8e79..b15417027 100644 --- a/src/factory.ts +++ b/src/factory.ts @@ -37,11 +37,12 @@ import { const VuePackages = ["vue", "nuxt", "vitepress", "@slidev/cli"]; export const defaultPluginRenaming = { + "@intlify/vue-i18n": "vue-i18n", "@stylistic": "style", "@typescript-eslint": "ts", "import-x": "import", - "optimize-regex": "regexp", n: "node", + "optimize-regex": "regexp", sonarjs: "sonar", vitest: "test", yml: "yaml",