diff --git a/.eslintrc.js b/.eslintrc.js index 87d072a..008fb65 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -28,11 +28,8 @@ module.exports = { ], extends: [ 'plugin:cypress/recommended', + 'plugin:chai-friendly/recommended', ], - rules: { - // `expect(true).to.be.true` is a valid expression - 'no-unused-expressions': 'off', - }, }, ], } diff --git a/cypress/support/component.ts b/cypress/support/component.ts index e61b0d2..e1cf587 100644 --- a/cypress/support/component.ts +++ b/cypress/support/component.ts @@ -26,13 +26,13 @@ import type { ComponentOptionsWithoutProps, ComponentPropsOptions, FunctionalComponent, DefineComponent, ExtractDefaultPropTypes, MethodOptions, AllowedComponentProps, ComponentCustomProps, VNodeProps, - ComponentOptionsMixin, ComputedOptions, EmitsOptions, ExtractPropTypes, + ComponentOptionsMixin, ComputedOptions, EmitsOptions, ExtractPropTypes, App, } from 'vue' import type { Router } from 'vue-router' import { createMemoryHistory, createRouter } from 'vue-router' type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps -type RouterOptions = {router?: Router} +type RouterOptions = { router?: Router } export declare type CyMountOptions = & Omit, 'attachTo'> @@ -42,18 +42,24 @@ export declare type CyMountOptions = interface Mount { (originalComponent: { - new (...args: any[]): V + new(...args: any[]): V registerHooks(keys: string[]): void }, options?: MountingOptions): Cypress.Chainable + (originalComponent: { - new (...args: any[]): V + new(...args: any[]): V props(Props: P): any registerHooks(keys: string[]): void }, options?: CyMountOptions

): Cypress.Chainable + (originalComponent: FunctionalComponent, options?: CyMountOptions): Cypress.Chainable + , EE extends string = string, PP = PublicProps, Props = Readonly>, Defaults = ExtractDefaultPropTypes>(component: DefineComponent, options?: CyMountOptions & Omit, D>): Cypress.Chainable + (componentOptions: ComponentOptionsWithoutProps, options?: CyMountOptions): Cypress.Chainable + = {}, E extends EmitsOptions = Record, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, EE extends string = string, Props extends Readonly<{ [key in PropNames]?: any; }> = Readonly<{ [key in PropNames]?: any; }>>(componentOptions: ComponentOptionsWithArrayProps, options?: CyMountOptions): Cypress.Chainable + , RawBindings, D, C extends ComputedOptions = {}, M extends Record = {}, E extends EmitsOptions = Record, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, EE extends string = string>(componentOptions: ComponentOptionsWithObjectProps, options?: CyMountOptions & PublicProps, D>): Cypress.Chainable } @@ -80,17 +86,16 @@ Cypress.Commands.add('mount', (component: MountParams[0], options: MountParams[1 } options.global.plugins.push({ - install (app) { + install (app: App) { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion app.use(options.router!) }, - }) - - options.global.plugins.push({ - install (app) { + }, + { + install (app: App) { registerGlobalComponents(app) }, }) - return mount(component, options) + return mount(component as any, options) }) diff --git a/package.json b/package.json index 5ba4ecf..e0703b5 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ }, "devDependencies": { "@cypress/vue": "^5.0.2", - "@mutoe/eslint-config-preset-vue": "~1.4.0", + "@mutoe/eslint-config-preset-vue": "~2.1.2", "@pinia/testing": "^0.0.14", "@testing-library/cypress": "^8.0.3", "@types/marked": "^4.0.7", @@ -37,6 +37,7 @@ "concurrently": "^7.4.0", "cypress": "^11.2.0", "eslint": "^8.23.1", + "eslint-plugin-chai-friendly": "^0.7.2", "eslint-plugin-cypress": "^2.12.1", "husky": "^8.0.1", "lint-staged": "^13.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 22ae0f8..28db732 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2,7 +2,7 @@ lockfileVersion: 5.4 specifiers: '@cypress/vue': ^5.0.2 - '@mutoe/eslint-config-preset-vue': ~1.4.0 + '@mutoe/eslint-config-preset-vue': ~2.1.2 '@pinia/testing': ^0.0.14 '@testing-library/cypress': ^8.0.3 '@types/marked': ^4.0.7 @@ -11,6 +11,7 @@ specifiers: concurrently: ^7.4.0 cypress: ^11.2.0 eslint: ^8.23.1 + eslint-plugin-chai-friendly: ^0.7.2 eslint-plugin-cypress: ^2.12.1 husky: ^8.0.1 insane: ^2.6.2 @@ -34,7 +35,7 @@ dependencies: devDependencies: '@cypress/vue': 5.0.2_cypress@11.2.0+vue@3.2.45 - '@mutoe/eslint-config-preset-vue': 1.4.0_db7pcermtotvojzae6mkm3m3sa + '@mutoe/eslint-config-preset-vue': 2.1.2_db7pcermtotvojzae6mkm3m3sa '@pinia/testing': 0.0.14_pinia@2.0.27+vue@3.2.45 '@testing-library/cypress': 8.0.7_cypress@11.2.0 '@types/marked': 4.0.7 @@ -43,6 +44,7 @@ devDependencies: concurrently: 7.6.0 cypress: 11.2.0 eslint: 8.28.0 + eslint-plugin-chai-friendly: 0.7.2_eslint@8.28.0 eslint-plugin-cypress: 2.12.1_eslint@8.28.0 husky: 8.0.2 lint-staged: 13.0.4 @@ -214,16 +216,16 @@ packages: resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==} dev: true - /@mutoe/eslint-config-preset-basic/1.4.0_vbnhqcxlbs7ynbxw44hu2vq7eq: - resolution: {integrity: sha512-tLNZAWKjpqc+IPeKXJlsVs9Ivhuyf0f7Z8nAZYkrvHF5MTkrtfdAJND11lsljRM7NiPLBaIHh43j3fPZO1PVWQ==} + /@mutoe/eslint-config-preset-basic/2.1.2_vbnhqcxlbs7ynbxw44hu2vq7eq: + resolution: {integrity: sha512-H446pFOzfFyxVJDAZmiH3a2EbJFGvEfohgXBFOiCUVqGvHma0ZE+HZ73AHY6NP696Ut03YkXAAW1SDGNiulBzQ==} peerDependencies: eslint: ^8.17.0 dependencies: '@mutoe/eslint-config-preset-standard': 1.2.1_vbnhqcxlbs7ynbxw44hu2vq7eq eslint: 8.28.0 - eslint-plugin-eslint-comments: 3.2.0_eslint@8.28.0 - eslint-plugin-html: 6.2.0 + eslint-plugin-html: 7.1.0 eslint-plugin-jsonc: 2.5.0_eslint@8.28.0 + eslint-plugin-unicorn: 44.0.2_eslint@8.28.0 eslint-plugin-yml: 1.2.0_eslint@8.28.0 jsonc-eslint-parser: 2.1.0 yaml-eslint-parser: 1.1.0 @@ -250,13 +252,13 @@ packages: - supports-color dev: true - /@mutoe/eslint-config-preset-ts/1.4.0_hsf322ms6xhhd4b5ne6lb74y4a: - resolution: {integrity: sha512-sOgLOC5wSQ7NKSGlFSfdtQR4xlPvwsiDvZHE2v5mB9mNGVo3YYpr15jel+zkm3K2wkFQvQQaQb7rWpAe/YpNcA==} + /@mutoe/eslint-config-preset-ts/2.1.2_hsf322ms6xhhd4b5ne6lb74y4a: + resolution: {integrity: sha512-jgWsgsBgr6b89Y1RygKjEoc8FIp5WeX2eGBfIWObXkmsJdkQztMBqTDIAs2eC0Kk4mYOXvhIIw4GAA1xRd+0CA==} peerDependencies: eslint: ^8.17.0 typescript: '>=3.9' dependencies: - '@mutoe/eslint-config-preset-basic': 1.4.0_vbnhqcxlbs7ynbxw44hu2vq7eq + '@mutoe/eslint-config-preset-basic': 2.1.2_vbnhqcxlbs7ynbxw44hu2vq7eq '@typescript-eslint/eslint-plugin': 5.45.0_czs5uoqkd3podpy6vgtsxfc7au '@typescript-eslint/parser': 5.45.0_hsf322ms6xhhd4b5ne6lb74y4a eslint: 8.28.0 @@ -267,13 +269,13 @@ packages: - supports-color dev: true - /@mutoe/eslint-config-preset-vue/1.4.0_db7pcermtotvojzae6mkm3m3sa: - resolution: {integrity: sha512-/FmS/ynYlDHt2bBVatYxkL2vruzZhdLaRaqw+7xhzDkl+5Bi4bOfUKz6YII1etSisAIwakJlPExk2uhEevj/qg==} + /@mutoe/eslint-config-preset-vue/2.1.2_db7pcermtotvojzae6mkm3m3sa: + resolution: {integrity: sha512-BzLW5dcTmsozcAKfOcGJ8s5+OpjeBj/42c9z584AzNrUg7xPCmpOUznJ2yCNOQ1ozBsWOwwc03wGRMtcoGb6gg==} peerDependencies: eslint: ^8.17.0 vue: ^3 dependencies: - '@mutoe/eslint-config-preset-ts': 1.4.0_hsf322ms6xhhd4b5ne6lb74y4a + '@mutoe/eslint-config-preset-ts': 2.1.2_hsf322ms6xhhd4b5ne6lb74y4a eslint: 8.28.0 eslint-plugin-vue: 9.8.0_eslint@8.28.0 vue: 3.2.45 @@ -363,6 +365,10 @@ packages: resolution: {integrity: sha512-hcU9AIQVHmPnmjRK+XUUYlILlr9pQrsqSrwov/JK1pnf3GTQowVBhx54FbvM0AU/VXGH4i3+vgXS5EguR7fysA==} dev: true + /@types/normalize-package-data/2.4.1: + resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} + dev: true + /@types/parse-json/4.0.0: resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==} dev: true @@ -885,6 +891,11 @@ packages: ieee754: 1.2.1 dev: true + /builtin-modules/3.3.0: + resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==} + engines: {node: '>=6'} + dev: true + /builtins/5.0.1: resolution: {integrity: sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==} dependencies: @@ -943,6 +954,13 @@ packages: engines: {node: '>=8'} dev: true + /clean-regexp/1.0.0: + resolution: {integrity: sha512-GfisEZEJvzKrmGWkvfhgzcz/BllN1USeqD2V6tg14OAOgaCD2Z/PUEuxnAZ/nPvmaHRG7a8y77p1T/IRQ4D1Hw==} + engines: {node: '>=4'} + dependencies: + escape-string-regexp: 1.0.5 + dev: true + /clean-stack/2.2.0: resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==} engines: {node: '>=6'} @@ -1280,31 +1298,31 @@ packages: resolution: {integrity: sha512-NMt+m9zFMPZe0JcY9gN224Qvk6qLIdqex29clBvc/y75ZBX9YA9wNK3frsYvu2DI1xcCIwxwnX+TlsJ2DSOADg==} dev: true - /dom-serializer/1.4.1: - resolution: {integrity: sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==} + /dom-serializer/2.0.0: + resolution: {integrity: sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==} dependencies: domelementtype: 2.3.0 - domhandler: 4.3.1 - entities: 2.2.0 + domhandler: 5.0.3 + entities: 4.4.0 dev: true /domelementtype/2.3.0: resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==} dev: true - /domhandler/4.3.1: - resolution: {integrity: sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==} + /domhandler/5.0.3: + resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==} engines: {node: '>= 4'} dependencies: domelementtype: 2.3.0 dev: true - /domutils/2.8.0: - resolution: {integrity: sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==} + /domutils/3.0.1: + resolution: {integrity: sha512-z08c1l761iKhDFtfXO04C7kTdPBLi41zwOZl00WS8b5eiaebNpY00HKbztwBq+e3vyqWNwWF3mP9YLUeqIrF+Q==} dependencies: - dom-serializer: 1.4.1 + dom-serializer: 2.0.0 domelementtype: 2.3.0 - domhandler: 4.3.1 + domhandler: 5.0.3 dev: true /eastasianwidth/0.2.0: @@ -1339,12 +1357,8 @@ packages: ansi-colors: 4.1.3 dev: true - /entities/2.2.0: - resolution: {integrity: sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==} - dev: true - - /entities/3.0.1: - resolution: {integrity: sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==} + /entities/4.4.0: + resolution: {integrity: sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==} engines: {node: '>=0.12'} dev: true @@ -1679,6 +1693,15 @@ packages: - supports-color dev: true + /eslint-plugin-chai-friendly/0.7.2_eslint@8.28.0: + resolution: {integrity: sha512-LOIfGx5sZZ5FwM1shr2GlYAWV9Omdi+1/3byuVagvQNoGUuU0iHhp7AfjA1uR+4dJ4Isfb4+FwBJgQajIw9iAg==} + engines: {node: '>=0.10.0'} + peerDependencies: + eslint: '>=3.0.0' + dependencies: + eslint: 8.28.0 + dev: true + /eslint-plugin-cypress/2.12.1_eslint@8.28.0: resolution: {integrity: sha512-c2W/uPADl5kospNDihgiLc7n87t5XhUbFDoTl6CfVkmG+kDAb5Ux10V9PoLPu9N+r7znpc+iQlcmAqT1A/89HA==} peerDependencies: @@ -1699,21 +1722,10 @@ packages: regexpp: 3.2.0 dev: true - /eslint-plugin-eslint-comments/3.2.0_eslint@8.28.0: - resolution: {integrity: sha512-0jkOl0hfojIHHmEHgmNdqv4fmh7300NdpA9FFpF7zaoLvB/QeXOGNLIo86oAveJFrfB1p05kC8hpEMHM8DwWVQ==} - engines: {node: '>=6.5.0'} - peerDependencies: - eslint: '>=4.19.1' + /eslint-plugin-html/7.1.0: + resolution: {integrity: sha512-fNLRraV/e6j8e3XYOC9xgND4j+U7b1Rq+OygMlLcMg+wI/IpVbF+ubQa3R78EjKB9njT6TQOlcK5rFKBVVtdfg==} dependencies: - escape-string-regexp: 1.0.5 - eslint: 8.28.0 - ignore: 5.2.1 - dev: true - - /eslint-plugin-html/6.2.0: - resolution: {integrity: sha512-vi3NW0E8AJombTvt8beMwkL1R/fdRWl4QSNRNMhVQKWm36/X0KF0unGNAY4mqUF06mnwVWZcIcerrCnfn9025g==} - dependencies: - htmlparser2: 7.2.0 + htmlparser2: 8.0.1 dev: true /eslint-plugin-import/2.26.0_vbnhqcxlbs7ynbxw44hu2vq7eq: @@ -1785,6 +1797,29 @@ packages: eslint: 8.28.0 dev: true + /eslint-plugin-unicorn/44.0.2_eslint@8.28.0: + resolution: {integrity: sha512-GLIDX1wmeEqpGaKcnMcqRvMVsoabeF0Ton0EX4Th5u6Kmf7RM9WBl705AXFEsns56ESkEs0uyelLuUTvz9Tr0w==} + engines: {node: '>=14.18'} + peerDependencies: + eslint: '>=8.23.1' + dependencies: + '@babel/helper-validator-identifier': 7.19.1 + ci-info: 3.7.0 + clean-regexp: 1.0.0 + eslint: 8.28.0 + eslint-utils: 3.0.0_eslint@8.28.0 + esquery: 1.4.0 + indent-string: 4.0.0 + is-builtin-module: 3.2.0 + lodash: 4.17.21 + pluralize: 8.0.0 + read-pkg-up: 7.0.1 + regexp-tree: 0.1.24 + safe-regex: 2.1.1 + semver: 7.3.8 + strip-indent: 3.0.0 + dev: true + /eslint-plugin-vue/9.8.0_eslint@8.28.0: resolution: {integrity: sha512-E/AXwcTzunyzM83C2QqDHxepMzvI2y6x+mmeYHbVDQlKFqmKYvRrhaVixEeeG27uI44p9oKDFiyCRw4XxgtfHA==} engines: {node: ^14.17.0 || >=16.0.0} @@ -2084,6 +2119,14 @@ packages: to-regex-range: 5.0.1 dev: true + /find-up/4.1.0: + resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} + engines: {node: '>=8'} + dependencies: + locate-path: 5.0.0 + path-exists: 4.0.0 + dev: true + /find-up/5.0.0: resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} engines: {node: '>=10'} @@ -2346,13 +2389,17 @@ packages: hasBin: true dev: true - /htmlparser2/7.2.0: - resolution: {integrity: sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog==} + /hosted-git-info/2.8.9: + resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} + dev: true + + /htmlparser2/8.0.1: + resolution: {integrity: sha512-4lVbmc1diZC7GUJQtRQ5yBAeUCL1exyMwmForWkRLnwyzWBFxN633SALPMGYaWZvKe9j1pRZJpauvmxENSp/EA==} dependencies: domelementtype: 2.3.0 - domhandler: 4.3.1 - domutils: 2.8.0 - entities: 3.0.1 + domhandler: 5.0.3 + domutils: 3.0.1 + entities: 4.4.0 dev: true /http-signature/1.3.6: @@ -2469,6 +2516,13 @@ packages: has-tostringtag: 1.0.0 dev: true + /is-builtin-module/3.2.0: + resolution: {integrity: sha512-phDA4oSGt7vl1n5tJvTWooWWAsXLY+2xCnxNqvKhGEzujg+A43wPlPOyDg3C8XQHN+6k/JTQWJ/j0dQh/qr+Hw==} + engines: {node: '>=6'} + dependencies: + builtin-modules: 3.3.0 + dev: true + /is-callable/1.2.7: resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} engines: {node: '>= 0.4'} @@ -2799,6 +2853,13 @@ packages: wrap-ansi: 7.0.0 dev: true + /locate-path/5.0.0: + resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} + engines: {node: '>=8'} + dependencies: + p-locate: 4.1.0 + dev: true + /locate-path/6.0.0: resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} engines: {node: '>=10'} @@ -2905,6 +2966,11 @@ packages: engines: {node: '>=12'} dev: true + /min-indent/1.0.1: + resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==} + engines: {node: '>=4'} + dev: true + /minimatch/3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} dependencies: @@ -2982,6 +3048,15 @@ packages: es6-promise: 3.3.1 dev: true + /normalize-package-data/2.5.0: + resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==} + dependencies: + hosted-git-info: 2.8.9 + resolve: 1.22.1 + semver: 5.7.1 + validate-npm-package-license: 3.0.4 + dev: true + /normalize-path/3.0.0: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} @@ -3121,6 +3196,13 @@ packages: resolution: {integrity: sha512-o6E5qJV5zkAbIDNhGSIlyOhScKXgQrSRMilfph0clDfM0nEnBOlKlH4sWDmG95BW/CvwNz0vmm7dJVtU2KlMiA==} dev: true + /p-limit/2.3.0: + resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} + engines: {node: '>=6'} + dependencies: + p-try: 2.2.0 + dev: true + /p-limit/3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} @@ -3128,6 +3210,13 @@ packages: yocto-queue: 0.1.0 dev: true + /p-locate/4.1.0: + resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} + engines: {node: '>=8'} + dependencies: + p-limit: 2.3.0 + dev: true + /p-locate/5.0.0: resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} engines: {node: '>=10'} @@ -3142,6 +3231,11 @@ packages: aggregate-error: 3.1.0 dev: true + /p-try/2.2.0: + resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} + engines: {node: '>=6'} + dev: true + /parent-module/1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -3232,6 +3326,11 @@ packages: vue: 3.2.45 vue-demi: 0.13.11_vue@3.2.45 + /pluralize/8.0.0: + resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} + engines: {node: '>=4'} + dev: true + /postcss-selector-parser/6.0.11: resolution: {integrity: sha512-zbARubNdogI9j7WY4nQJBiNqQf3sLS3wCP4WfOidu+p28LofJqDH1tcXypGrcmMHhDk2t9wGhCsYe/+szLTy1g==} engines: {node: '>=4'} @@ -3306,6 +3405,25 @@ packages: resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} dev: true + /read-pkg-up/7.0.1: + resolution: {integrity: sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==} + engines: {node: '>=8'} + dependencies: + find-up: 4.1.0 + read-pkg: 5.2.0 + type-fest: 0.8.1 + dev: true + + /read-pkg/5.2.0: + resolution: {integrity: sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==} + engines: {node: '>=8'} + dependencies: + '@types/normalize-package-data': 2.4.1 + normalize-package-data: 2.5.0 + parse-json: 5.2.0 + type-fest: 0.6.0 + dev: true + /reftools/1.1.9: resolution: {integrity: sha512-OVede/NQE13xBQ+ob5CKd5KyeJYU2YInb1bmV4nRoOfquZPkAkxuOXicSe1PvqIuZZ4kD13sPKBbR7UFDmli6w==} dev: true @@ -3314,6 +3432,11 @@ packages: resolution: {integrity: sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==} dev: true + /regexp-tree/0.1.24: + resolution: {integrity: sha512-s2aEVuLhvnVJW6s/iPgEGK6R+/xngd2jNQ+xy4bXNDKxZKJH6jpPHY6kVeVv1IeLCHgswRj+Kl3ELaDjG6V1iw==} + hasBin: true + dev: true + /regexp.prototype.flags/1.4.3: resolution: {integrity: sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==} engines: {node: '>= 0.4'} @@ -3414,10 +3537,21 @@ packages: is-regex: 1.1.4 dev: true + /safe-regex/2.1.1: + resolution: {integrity: sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A==} + dependencies: + regexp-tree: 0.1.24 + dev: true + /safer-buffer/2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} dev: true + /semver/5.7.1: + resolution: {integrity: sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==} + hasBin: true + dev: true + /semver/6.3.0: resolution: {integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==} hasBin: true @@ -3543,6 +3677,28 @@ packages: resolution: {integrity: sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==} dev: true + /spdx-correct/3.1.1: + resolution: {integrity: sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==} + dependencies: + spdx-expression-parse: 3.0.1 + spdx-license-ids: 3.0.12 + dev: true + + /spdx-exceptions/2.3.0: + resolution: {integrity: sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==} + dev: true + + /spdx-expression-parse/3.0.1: + resolution: {integrity: sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==} + dependencies: + spdx-exceptions: 2.3.0 + spdx-license-ids: 3.0.12 + dev: true + + /spdx-license-ids/3.0.12: + resolution: {integrity: sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA==} + dev: true + /sshpk/1.17.0: resolution: {integrity: sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==} engines: {node: '>=0.10.0'} @@ -3627,6 +3783,13 @@ packages: engines: {node: '>=12'} dev: true + /strip-indent/3.0.0: + resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==} + engines: {node: '>=8'} + dependencies: + min-indent: 1.0.1 + dev: true + /strip-json-comments/3.1.1: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} @@ -3805,6 +3968,16 @@ packages: engines: {node: '>=10'} dev: true + /type-fest/0.6.0: + resolution: {integrity: sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==} + engines: {node: '>=8'} + dev: true + + /type-fest/0.8.1: + resolution: {integrity: sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==} + engines: {node: '>=8'} + dev: true + /typescript/4.8.4: resolution: {integrity: sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==} engines: {node: '>=4.2.0'} @@ -3850,6 +4023,13 @@ packages: hasBin: true dev: true + /validate-npm-package-license/3.0.4: + resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} + dependencies: + spdx-correct: 3.1.1 + spdx-expression-parse: 3.0.1 + dev: true + /verror/1.10.0: resolution: {integrity: sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==} engines: {'0': node >=0.6.0} diff --git a/src/router.ts b/src/router.ts index 035b5e4..93018fa 100644 --- a/src/router.ts +++ b/src/router.ts @@ -81,12 +81,10 @@ export const router = createRouter({ }) export function routerPush (name: AppRouteNames, params?: RouteParams): ReturnType { - if (params !== undefined) { - return router.push({ + return params !== undefined + ? router.push({ name, params, }) - } else { - return router.push({ name }) - } + : router.push({ name }) } diff --git a/src/utils/storage.ts b/src/utils/storage.ts index 71cd896..307c240 100644 --- a/src/utils/storage.ts +++ b/src/utils/storage.ts @@ -13,7 +13,7 @@ export default class Storage { try { const value = window[this.storageType].getItem(this.key) ?? '' return JSON.parse(value) - } catch (e) { + } catch { return null } } diff --git a/src/utils/test/wrap-tests.ts b/src/utils/test/wrap-tests.ts index d069528..39a7ce8 100644 --- a/src/utils/test/wrap-tests.ts +++ b/src/utils/test/wrap-tests.ts @@ -13,11 +13,11 @@ function wrapTests ({ task, list, fn, testName, only = false }: WrapTestsP const descFn = only ? context.only : context descFn(task, () => { - list.forEach((item, index) => { + for (const [index, item] of list.entries()) { const name = testName !== undefined ? testName(item, index) : '' // @ts-ignore it(name, () => fn(item)) - }) + } }) } wrapTests.only = function ({ task, list, fn, testName }: WrapTestsProps): ReturnType { diff --git a/src/utils/use-async.ts b/src/utils/use-async.ts index 44fa1ce..e4fffd9 100644 --- a/src/utils/use-async.ts +++ b/src/utils/use-async.ts @@ -16,14 +16,12 @@ export default function useAsync unknown> (fn: try { const result = await fn(...args) return result as ReturnType - } catch (e) { - if (isFetchError(e)) { - if (e.status === 401) { - await routerPush('login') - throw new Error('Need to login first') - } + } catch (error) { + if (isFetchError(error) && error.status === 401) { + await routerPush('login') + throw new Error('Need to login first') } - throw e + throw error } finally { active.value = false } diff --git a/tsconfig.app.json b/tsconfig.app.json index a953cf1..676161e 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -4,7 +4,8 @@ "exclude": ["src/**/*.spec.ts", "src/***/*.spec.tsx"], "compilerOptions": { "baseUrl": ".", - "lib": ["ESNext", "DOM", "DOM.Iterable"], + "noEmit": true, + "lib": ["ESNext", "DOM", "DOM.Iterable"] }, "references": [ { diff --git a/tsconfig.config.json b/tsconfig.config.json index dc94651..4277d72 100644 --- a/tsconfig.config.json +++ b/tsconfig.config.json @@ -3,6 +3,7 @@ "include": ["vite.config.*", "vitest.config.*", "cypress.config.*", ".eslintrc.js"], "compilerOptions": { "composite": true, + "noEmit": true, "types": ["node"] } } diff --git a/tsconfig.cypress-ct.json b/tsconfig.cypress-ct.json index 19ccf27..8d287df 100644 --- a/tsconfig.cypress-ct.json +++ b/tsconfig.cypress-ct.json @@ -6,11 +6,12 @@ "src/**/*.vue", "cypress/support/component.*", "cypress/support/commands.ts", - "cypress/fixtures/**/*", + "cypress/fixtures/**/*" ], "exclude": [], "compilerOptions": { "composite": true, "types": ["cypress", "@testing-library/cypress"], + "noEmit": true } }