From 7fe1f95d9d6cfeb583a17f047a1697538c031990 Mon Sep 17 00:00:00 2001 From: YunYouJun Date: Sun, 15 Sep 2024 18:26:51 +0800 Subject: [PATCH] ci: fix nuxt lint --- app/components/help/HelpAbout.vue | 29 ++++ app/pages/cookbooks/index.vue | 2 + app/pages/help.vue | 278 ++++++++++++++---------------- app/pages/index.vue | 32 ++-- app/utils/index.ts | 2 + eslint.config.js | 14 +- nuxt.config.ts | 1 + package.json | 5 +- pnpm-lock.yaml | 254 ++++++++++++++++++++++++++- scripts/convert.ts | 16 +- test/recipe.test.ts | 2 +- 11 files changed, 455 insertions(+), 180 deletions(-) create mode 100644 app/components/help/HelpAbout.vue diff --git a/app/components/help/HelpAbout.vue b/app/components/help/HelpAbout.vue new file mode 100644 index 0000000..bffea96 --- /dev/null +++ b/app/components/help/HelpAbout.vue @@ -0,0 +1,29 @@ + diff --git a/app/pages/cookbooks/index.vue b/app/pages/cookbooks/index.vue index 137d197..b0e22b7 100644 --- a/app/pages/cookbooks/index.vue +++ b/app/pages/cookbooks/index.vue @@ -1,4 +1,6 @@ diff --git a/app/utils/index.ts b/app/utils/index.ts index 0d510f4..33c8a01 100644 --- a/app/utils/index.ts +++ b/app/utils/index.ts @@ -1,5 +1,7 @@ import { meat, staple, vegetable } from '~/data/food' +export * from './cookbook' + const foodItems = [...vegetable, ...meat, ...staple] const foodEmojiMap = new Map() foodItems.forEach((item) => { diff --git a/eslint.config.js b/eslint.config.js index b0f3d78..92a0259 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,8 +1,12 @@ +// @ts-check import antfu from '@antfu/eslint-config' +import nuxt from './.nuxt/eslint.config.mjs' -export default antfu( - { - unocss: true, - formatters: true, - }, +export default nuxt( + antfu( + { + unocss: true, + formatters: true, + }, + ), ) diff --git a/nuxt.config.ts b/nuxt.config.ts index 04d9f2e..4113bb4 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -17,6 +17,7 @@ export default defineNuxtConfig({ '@pinia/nuxt', '@nuxt/test-utils/module', + '@nuxt/eslint', '@nuxtjs/color-mode', '@vite-pwa/nuxt', diff --git a/package.json b/package.json index e191154..faf666b 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "@iconify-json/ri": "^1.2.0", "@iconify-json/twemoji": "^1.2.0", "@nuxt/devtools": "^1.4.2", + "@nuxt/eslint": "^0.5.7", "@nuxt/test-utils": "^3.14.2", "@nuxtjs/color-mode": "^3.5.1", "@pinia/nuxt": "^0.5.4", @@ -66,13 +67,13 @@ "simple-git-hooks": "^2.11.1", "star-markdown-css": "^0.5.1", "tsx": "^4.19.1", - "typescript": "^5.5.4", + "typescript": "5.5.4", "unocss": "^0.62.3", "vitest": "^2.1.1", "vue-tsc": "^2.1.6" }, "resolutions": { - "@typescript-eslint/utils": "^8.2.0" + "@typescript-eslint/utils": "^8.5.0" }, "simple-git-hooks": { "pre-commit": "pnpm lint-staged" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1876504..9583778 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,9 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +overrides: + '@typescript-eslint/utils': ^8.5.0 + importers: .: @@ -45,6 +48,9 @@ importers: '@nuxt/devtools': specifier: ^1.4.2 version: 1.4.2(rollup@4.21.3)(vite@5.4.5(@types/node@22.5.5)(sass@1.78.0)(terser@5.32.0))(vue@3.5.5(typescript@5.5.4))(webpack-sources@3.2.3) + '@nuxt/eslint': + specifier: ^0.5.7 + version: 0.5.7(eslint@9.10.0(jiti@1.21.6))(magicast@0.3.5)(rollup@4.21.3)(typescript@5.5.4)(vite@5.4.5(@types/node@22.5.5)(sass@1.78.0)(terser@5.32.0))(webpack-sources@3.2.3) '@nuxt/test-utils': specifier: ^3.14.2 version: 3.14.2(@vue/test-utils@2.4.6)(h3@1.12.0)(jsdom@25.0.0)(magicast@0.3.5)(nitropack@2.9.7(magicast@0.3.5)(webpack-sources@3.2.3))(rollup@4.21.3)(vite@5.4.5(@types/node@22.5.5)(sass@1.78.0)(terser@5.32.0))(vitest@2.1.1(@types/node@22.5.5)(jsdom@25.0.0)(sass@1.78.0)(terser@5.32.0))(vue-router@4.4.5(vue@3.5.5(typescript@5.5.4)))(vue@3.5.5(typescript@5.5.4))(webpack-sources@3.2.3) @@ -130,7 +136,7 @@ importers: specifier: ^4.19.1 version: 4.19.1 typescript: - specifier: ^5.5.4 + specifier: 5.5.4 version: 5.5.4 unocss: specifier: ^0.62.3 @@ -208,6 +214,10 @@ packages: peerDependencies: ajv: '>=8' + '@apidevtools/json-schema-ref-parser@11.7.0': + resolution: {integrity: sha512-pRrmXMCwnmrkS3MLgAIW5dXRzeTv6GLjkjb4HmxNnvAKXN1Nfzp4KmGADBQvlVUcqi+a5D+hfGDLLnd5NnYxog==} + engines: {node: '>= 16'} + '@babel/code-frame@7.24.7': resolution: {integrity: sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==} engines: {node: '>=6.9.0'} @@ -1285,10 +1295,20 @@ packages: resolution: {integrity: sha512-lpHyRyplhGPL5mGEh6M9O5nnKk0Gz4bFI+Zu6tKlPpDUN7XshWvH9C/px4UVm87IAANE0W81CEsNGbS1KlzXpA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@eslint/config-array@0.17.1': + resolution: {integrity: sha512-BlYOpej8AQ8Ev9xVqroV7a02JK3SkBAaN9GfMMH9W6Ch8FlQlkjGw4Ir7+FgYwfirivAf4t+GtzuAxqfukmISA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@eslint/config-array@0.18.0': resolution: {integrity: sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@eslint/config-inspector@0.5.4': + resolution: {integrity: sha512-WB/U/B6HdRiIt/CfbcqqFp7Svz+3INLtnGcuMT2hnU39S3cb9JGGkvB1T6lbIlDoQ9VRnhc4riIFFoicGRZ2mw==} + hasBin: true + peerDependencies: + eslint: ^8.50.0 || ^9.0.0 + '@eslint/eslintrc@3.1.0': resolution: {integrity: sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1400,6 +1420,9 @@ packages: resolution: {integrity: sha512-f5DRIOZf7wxogefH03RjMPMdBF7ADTWUMoOs9kaJo06EfwF+aFhMZMDZxHg/Xe12hptN9xoZjGso2fdjapBRIA==} engines: {node: '>=10'} + '@jsdevtools/ono@7.1.3': + resolution: {integrity: sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==} + '@kwsites/file-exists@1.1.1': resolution: {integrity: sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==} @@ -1426,14 +1449,26 @@ packages: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} + '@nodelib/fs.scandir@3.0.0': + resolution: {integrity: sha512-ktI9+PxfHYtKjF3cLTUAh2N+b8MijCRPNwKJNqTVdL0gB0QxLU2rIRaZ1t71oEa3YBDE6bukH1sR0+CDnpp/Mg==} + engines: {node: '>=16.14.0'} + '@nodelib/fs.stat@2.0.5': resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} engines: {node: '>= 8'} + '@nodelib/fs.stat@3.0.0': + resolution: {integrity: sha512-2tQOI38s19P9i7X/Drt0v8iMA+KMsgdhB/dyPER+e+2Y8L1Z7QvnuRdW/uLuf5YRFUYmnj4bMA6qCuZHFI1GDQ==} + engines: {node: '>=16.14.0'} + '@nodelib/fs.walk@1.2.8': resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + '@nodelib/fs.walk@2.0.0': + resolution: {integrity: sha512-54voNDBobGdMl3BUXSu7UaDh1P85PGHWlJ5e0XhPugo1JulOyCtp2I+5ri4wplGDJ8QGwPEQW7/x3yTLU7yF1A==} + engines: {node: '>=16.14.0'} + '@nuxt/devalue@2.0.2': resolution: {integrity: sha512-GBzP8zOc7CGWyFQS6dv1lQz8VVpz5C2yRszbXufwG/9zhStTIH50EtD87NmWbTMwXDvZLNg8GIpb1UFdH93JCA==} @@ -1452,6 +1487,28 @@ packages: peerDependencies: vite: '*' + '@nuxt/eslint-config@0.5.7': + resolution: {integrity: sha512-B+snO9NS9+v2657Z84tMbW3hLxjauIUkk2m4vnYjb9xfAFdoQwK07q6aaf7LzvagmVFmQiclT9LbJMvlRqzmsA==} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + + '@nuxt/eslint-plugin@0.5.7': + resolution: {integrity: sha512-vYQYs/L87g2pBIoTmkk2mgYBqePTQDnhk87nGqsosKbfQ80xj9kkN3dsVb6BDQFk0zik4THWpXmnfjkvsjm/eg==} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + + '@nuxt/eslint@0.5.7': + resolution: {integrity: sha512-t2GoH8BIfDVysZ5Y9kPBTnT9rcUSJcXTeY5Fa93//qmHJba3kIpoETy3qJe/v75R1giGgIPO+Iydt6uXZ2jjJQ==} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + eslint-webpack-plugin: ^4.1.0 + vite-plugin-eslint2: ^4.4.0 + peerDependenciesMeta: + eslint-webpack-plugin: + optional: true + vite-plugin-eslint2: + optional: true + '@nuxt/kit@3.13.1': resolution: {integrity: sha512-FkUL349lp/3nVfTIyws4UDJ3d2jyv5Pk1DC1HQUCOkSloYYMdbRcQAUcb4fe2TCLNWvHM+FhU8jnzGTzjALZYA==} engines: {node: ^14.18.0 || >=16.10.0} @@ -2069,7 +2126,7 @@ packages: '@vitest/eslint-plugin@1.1.4': resolution: {integrity: sha512-kudjgefmJJ7xQ2WfbUU6pZbm7Ou4gLYRaao/8Ynide3G0QhVKHd978sDyWX4KOH0CCMH9cyrGAkFd55eGzJ48Q==} peerDependencies: - '@typescript-eslint/utils': '>= 8.0' + '@typescript-eslint/utils': ^8.5.0 eslint: '>= 8.57.0' typescript: '>= 5.0.0' vitest: '*' @@ -2128,6 +2185,12 @@ packages: '@volar/typescript@2.4.5': resolution: {integrity: sha512-mcT1mHvLljAEtHviVcBuOyAwwMKz1ibXTi5uYtP/pf4XxoAzpdkQ+Br2IC0NPCvLCbjPZmbf3I0udndkfB1CDg==} + '@voxpelli/config-array-find-files@0.1.2': + resolution: {integrity: sha512-jOva73R+0Nc5/pyS/piBSjQzO4EehME7rPSkBpPC9PYSta+yj3OpF14v0m0HLLYLVNuyHbBjQh5QvGIZwTH2eA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + '@eslint/config-array': '>=0.16.0' + '@vue-macros/common@1.14.0': resolution: {integrity: sha512-xwQhDoEXRNXobNQmdqOD20yUGdVLVLZe4zhDlT9q/E+z+mvT3wukaAoJG80XRnv/BcgOOCVpxqpkQZ3sNTgjWA==} engines: {node: '>=16.14.0'} @@ -3358,6 +3421,11 @@ packages: resolution: {integrity: sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + eslint-typegen@0.3.2: + resolution: {integrity: sha512-YD/flDDDYoBszomo6wVAJ01HcEWTLfOb04+Mwir8/oR66t2bnajw+qUI6JfBoBQO3HbebcCmEtgjKgWVB67ggQ==} + peerDependencies: + eslint: ^8.45.0 || ^9.0.0 + eslint-visitor-keys@3.4.3: resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -3519,6 +3587,10 @@ packages: resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} engines: {node: '>=10'} + find-up@7.0.0: + resolution: {integrity: sha512-YyZM99iHrqLKjmt4LJDj58KI+fYyufRLBSYcqycxf//KpBk9FoewoGX0450m9nB44qrZnovzC2oeP5hUibxc/g==} + engines: {node: '>=18'} + flat-cache@4.0.1: resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} engines: {node: '>=16'} @@ -4106,6 +4178,9 @@ packages: json-parse-even-better-errors@2.3.1: resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + json-schema-to-typescript-lite@14.1.0: + resolution: {integrity: sha512-b8K6P3aiLgiYKYcHacgZKrwPXPyjekqRPV5vkNfBt0EoohcOSXEbcuGzgi6KQmsAhuy5Mh2KMxofXodRhMxURA==} + json-schema-traverse@0.4.1: resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} @@ -4209,6 +4284,10 @@ packages: resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} engines: {node: '>=10'} + locate-path@7.2.0: + resolution: {integrity: sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + lodash.debounce@4.0.8: resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==} @@ -4728,6 +4807,10 @@ packages: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} + p-limit@4.0.0: + resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + p-locate@4.1.0: resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} engines: {node: '>=8'} @@ -4736,6 +4819,10 @@ packages: resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} engines: {node: '>=10'} + p-locate@6.0.0: + resolution: {integrity: sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + p-try@2.2.0: resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} engines: {node: '>=6'} @@ -4786,6 +4873,10 @@ packages: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} + path-exists@5.0.0: + resolution: {integrity: sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + path-is-absolute@1.0.1: resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} engines: {node: '>=0.10.0'} @@ -6428,6 +6519,10 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} + yocto-queue@1.1.1: + resolution: {integrity: sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==} + engines: {node: '>=12.20'} + zhead@2.2.4: resolution: {integrity: sha512-8F0OI5dpWIA5IGG5NHUg9staDwz/ZPxZtvGVf01j7vHqSyZ0raHY+78atOVxRqb73AotX22uV1pXt3gYSstGag==} @@ -6508,6 +6603,12 @@ snapshots: jsonpointer: 5.0.1 leven: 3.1.0 + '@apidevtools/json-schema-ref-parser@11.7.0': + dependencies: + '@jsdevtools/ono': 7.1.3 + '@types/json-schema': 7.0.15 + js-yaml: 4.1.0 + '@babel/code-frame@7.24.7': dependencies: '@babel/highlight': 7.24.7 @@ -7569,6 +7670,14 @@ snapshots: '@eslint/compat@1.1.1': {} + '@eslint/config-array@0.17.1': + dependencies: + '@eslint/object-schema': 2.1.4 + debug: 4.3.7 + minimatch: 3.1.2 + transitivePeerDependencies: + - supports-color + '@eslint/config-array@0.18.0': dependencies: '@eslint/object-schema': 2.1.4 @@ -7577,6 +7686,31 @@ snapshots: transitivePeerDependencies: - supports-color + '@eslint/config-inspector@0.5.4(eslint@9.10.0(jiti@1.21.6))': + dependencies: + '@eslint/config-array': 0.17.1 + '@voxpelli/config-array-find-files': 0.1.2(@eslint/config-array@0.17.1) + bundle-require: 5.0.0(esbuild@0.21.5) + cac: 6.7.14 + chokidar: 3.6.0 + esbuild: 0.21.5 + eslint: 9.10.0(jiti@1.21.6) + fast-glob: 3.3.2 + find-up: 7.0.0 + get-port-please: 3.1.2 + h3: 1.12.0 + minimatch: 9.0.5 + mlly: 1.7.1 + mrmime: 2.0.0 + open: 10.1.0 + picocolors: 1.1.0 + ws: 8.18.0 + transitivePeerDependencies: + - bufferutil + - supports-color + - uWebSockets.js + - utf-8-validate + '@eslint/eslintrc@3.1.0': dependencies: ajv: 6.12.6 @@ -7714,6 +7848,8 @@ snapshots: string-argv: 0.3.2 type-detect: 4.1.0 + '@jsdevtools/ono@7.1.3': {} + '@kwsites/file-exists@1.1.1': dependencies: debug: 4.3.7 @@ -7753,13 +7889,25 @@ snapshots: '@nodelib/fs.stat': 2.0.5 run-parallel: 1.2.0 + '@nodelib/fs.scandir@3.0.0': + dependencies: + '@nodelib/fs.stat': 3.0.0 + run-parallel: 1.2.0 + '@nodelib/fs.stat@2.0.5': {} + '@nodelib/fs.stat@3.0.0': {} + '@nodelib/fs.walk@1.2.8': dependencies: '@nodelib/fs.scandir': 2.1.5 fastq: 1.17.1 + '@nodelib/fs.walk@2.0.0': + dependencies: + '@nodelib/fs.scandir': 3.0.0 + fastq: 1.17.1 + '@nuxt/devalue@2.0.2': {} '@nuxt/devtools-kit@1.4.2(magicast@0.3.5)(rollup@4.21.3)(vite@5.4.5(@types/node@22.5.5)(sass@1.78.0)(terser@5.32.0))(webpack-sources@3.2.3)': @@ -7835,6 +7983,65 @@ snapshots: - vue - webpack-sources + '@nuxt/eslint-config@0.5.7(eslint@9.10.0(jiti@1.21.6))(typescript@5.5.4)': + dependencies: + '@eslint/js': 9.10.0 + '@nuxt/eslint-plugin': 0.5.7(eslint@9.10.0(jiti@1.21.6))(typescript@5.5.4) + '@stylistic/eslint-plugin': 2.8.0(eslint@9.10.0(jiti@1.21.6))(typescript@5.5.4) + '@typescript-eslint/eslint-plugin': 8.5.0(@typescript-eslint/parser@8.5.0(eslint@9.10.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.10.0(jiti@1.21.6))(typescript@5.5.4) + '@typescript-eslint/parser': 8.5.0(eslint@9.10.0(jiti@1.21.6))(typescript@5.5.4) + eslint: 9.10.0(jiti@1.21.6) + eslint-config-flat-gitignore: 0.3.0(eslint@9.10.0(jiti@1.21.6)) + eslint-flat-config-utils: 0.4.0 + eslint-plugin-import-x: 4.2.1(eslint@9.10.0(jiti@1.21.6))(typescript@5.5.4) + eslint-plugin-jsdoc: 50.2.3(eslint@9.10.0(jiti@1.21.6)) + eslint-plugin-regexp: 2.6.0(eslint@9.10.0(jiti@1.21.6)) + eslint-plugin-unicorn: 55.0.0(eslint@9.10.0(jiti@1.21.6)) + eslint-plugin-vue: 9.28.0(eslint@9.10.0(jiti@1.21.6)) + globals: 15.9.0 + local-pkg: 0.5.0 + pathe: 1.1.2 + vue-eslint-parser: 9.4.3(eslint@9.10.0(jiti@1.21.6)) + transitivePeerDependencies: + - supports-color + - typescript + + '@nuxt/eslint-plugin@0.5.7(eslint@9.10.0(jiti@1.21.6))(typescript@5.5.4)': + dependencies: + '@typescript-eslint/types': 8.5.0 + '@typescript-eslint/utils': 8.5.0(eslint@9.10.0(jiti@1.21.6))(typescript@5.5.4) + eslint: 9.10.0(jiti@1.21.6) + transitivePeerDependencies: + - supports-color + - typescript + + '@nuxt/eslint@0.5.7(eslint@9.10.0(jiti@1.21.6))(magicast@0.3.5)(rollup@4.21.3)(typescript@5.5.4)(vite@5.4.5(@types/node@22.5.5)(sass@1.78.0)(terser@5.32.0))(webpack-sources@3.2.3)': + dependencies: + '@eslint/config-inspector': 0.5.4(eslint@9.10.0(jiti@1.21.6)) + '@nuxt/devtools-kit': 1.4.2(magicast@0.3.5)(rollup@4.21.3)(vite@5.4.5(@types/node@22.5.5)(sass@1.78.0)(terser@5.32.0))(webpack-sources@3.2.3) + '@nuxt/eslint-config': 0.5.7(eslint@9.10.0(jiti@1.21.6))(typescript@5.5.4) + '@nuxt/eslint-plugin': 0.5.7(eslint@9.10.0(jiti@1.21.6))(typescript@5.5.4) + '@nuxt/kit': 3.13.1(magicast@0.3.5)(rollup@4.21.3)(webpack-sources@3.2.3) + chokidar: 3.6.0 + eslint: 9.10.0(jiti@1.21.6) + eslint-flat-config-utils: 0.4.0 + eslint-typegen: 0.3.2(eslint@9.10.0(jiti@1.21.6)) + find-up: 7.0.0 + get-port-please: 3.1.2 + mlly: 1.7.1 + pathe: 1.1.2 + unimport: 3.12.0(rollup@4.21.3)(webpack-sources@3.2.3) + transitivePeerDependencies: + - bufferutil + - magicast + - rollup + - supports-color + - typescript + - uWebSockets.js + - utf-8-validate + - vite + - webpack-sources + '@nuxt/kit@3.13.1(magicast@0.3.5)(rollup@4.21.3)(webpack-sources@3.2.3)': dependencies: '@nuxt/schema': 3.13.1(rollup@4.21.3)(webpack-sources@3.2.3) @@ -8800,6 +9007,11 @@ snapshots: path-browserify: 1.0.1 vscode-uri: 3.0.8 + '@voxpelli/config-array-find-files@0.1.2(@eslint/config-array@0.17.1)': + dependencies: + '@eslint/config-array': 0.17.1 + '@nodelib/fs.walk': 2.0.0 + '@vue-macros/common@1.14.0(rollup@4.21.3)(vue@3.5.5(typescript@5.5.4))': dependencies: '@babel/types': 7.25.6 @@ -9374,6 +9586,11 @@ snapshots: dependencies: run-applescript: 7.0.0 + bundle-require@5.0.0(esbuild@0.21.5): + dependencies: + esbuild: 0.21.5 + load-tsconfig: 0.2.5 + bundle-require@5.0.0(esbuild@0.23.1): dependencies: esbuild: 0.23.1 @@ -10319,6 +10536,12 @@ snapshots: esrecurse: 4.3.0 estraverse: 5.3.0 + eslint-typegen@0.3.2(eslint@9.10.0(jiti@1.21.6)): + dependencies: + eslint: 9.10.0(jiti@1.21.6) + json-schema-to-typescript-lite: 14.1.0 + ohash: 1.1.3 + eslint-visitor-keys@3.4.3: {} eslint-visitor-keys@4.0.0: {} @@ -10515,6 +10738,12 @@ snapshots: locate-path: 6.0.0 path-exists: 4.0.0 + find-up@7.0.0: + dependencies: + locate-path: 7.2.0 + path-exists: 5.0.0 + unicorn-magic: 0.1.0 + flat-cache@4.0.1: dependencies: flatted: 3.3.1 @@ -11118,6 +11347,11 @@ snapshots: json-parse-even-better-errors@2.3.1: {} + json-schema-to-typescript-lite@14.1.0: + dependencies: + '@apidevtools/json-schema-ref-parser': 11.7.0 + '@types/json-schema': 7.0.15 + json-schema-traverse@0.4.1: {} json-schema-traverse@1.0.0: {} @@ -11241,6 +11475,10 @@ snapshots: dependencies: p-locate: 5.0.0 + locate-path@7.2.0: + dependencies: + p-locate: 6.0.0 + lodash.debounce@4.0.8: {} lodash.defaults@4.2.0: {} @@ -12096,6 +12334,10 @@ snapshots: dependencies: yocto-queue: 0.1.0 + p-limit@4.0.0: + dependencies: + yocto-queue: 1.1.1 + p-locate@4.1.0: dependencies: p-limit: 2.3.0 @@ -12104,6 +12346,10 @@ snapshots: dependencies: p-limit: 3.1.0 + p-locate@6.0.0: + dependencies: + p-limit: 4.0.0 + p-try@2.2.0: {} package-json-from-dist@1.0.0: {} @@ -12151,6 +12397,8 @@ snapshots: path-exists@4.0.0: {} + path-exists@5.0.0: {} + path-is-absolute@1.0.1: {} path-is-inside@1.0.2: {} @@ -13972,6 +14220,8 @@ snapshots: yocto-queue@0.1.0: {} + yocto-queue@1.1.1: {} + zhead@2.2.4: {} zip-stream@6.0.1: diff --git a/scripts/convert.ts b/scripts/convert.ts index bb26663..a9a4c57 100644 --- a/scripts/convert.ts +++ b/scripts/convert.ts @@ -10,7 +10,11 @@ function run() { const lines = csvData.split(/\r?\n/) const headers = 'name,stuff,bv,difficulty,tags,methods,tools,' - if (lines[0].trim() !== headers) { + if (lines.length < 2) { + throw new Error('No data in csv file') + } + + if (lines[0]?.trim() !== headers) { consola.warn(`Headers Changed: ${lines[0]}`) return } @@ -21,13 +25,17 @@ function run() { lines.slice(1).forEach((line) => { if (line) { const attrs = line.split(',') - const stuff = attrs[1].trim().split(sep) + if (attrs.length < 7) { + consola.warn(`Invalid line: ${line}`) + return + } + const stuff = attrs[1]?.trim().split(sep) || [] recipeJson.push({ - name: attrs[0].trim(), + name: attrs[0]?.trim() || '', stuff, // link: attrs[2].trim(), // bv id - bv: attrs[2].trim().replace('https://www.bilibili.com/video/', ''), + bv: attrs[2]?.trim().replace('https://www.bilibili.com/video/', ''), difficulty: attrs[3] && attrs[3].trim() as RecipeItem['difficulty'], tags: attrs[4] ? attrs[4].trim().split(sep) : [], methods: attrs[5] ? (attrs[5].trim().split(sep)) as RecipeItem['methods'] : [], diff --git a/test/recipe.test.ts b/test/recipe.test.ts index b5cba24..eb414a6 100644 --- a/test/recipe.test.ts +++ b/test/recipe.test.ts @@ -1,6 +1,6 @@ import { createPinia, setActivePinia } from 'pinia' import { beforeEach, describe, expect, it } from 'vitest' -import { useRecipeStore } from '../composables/store' +import { useRecipeStore } from '../app/composables/store' describe('recipe interaction', () => { beforeEach(() => {