From 4d917db2f181d81738835e35b112d905ce8923a2 Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Sat, 23 Sep 2023 23:17:25 +0200 Subject: [PATCH 1/2] chore(deps): add eslint unicorn --- .eslintrc.js | 59 +++++++++++++++ package.json | 1 + pnpm-lock.yaml | 200 ++++++++++++++++++++++++++++++++----------------- 3 files changed, 191 insertions(+), 69 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 2da31cb76ff..2e9045ae093 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -18,6 +18,7 @@ module.exports = defineConfig({ 'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended-type-checked', 'plugin:prettier/recommended', + 'plugin:unicorn/recommended', ], parser: '@typescript-eslint/parser', parserOptions: { @@ -36,6 +37,64 @@ module.exports = defineConfig({ 'deprecation/deprecation': 'error', + 'unicorn/no-array-reduce': 'off', + 'unicorn/no-nested-ternary': 'off', + 'unicorn/no-null': 'off', + 'unicorn/no-useless-switch-case': 'off', + 'unicorn/number-literal-case': 'off', + // TODO @Shinigami92 2023-09-23: prefer-at should be turned on when we drop support for Node 14 + 'unicorn/prefer-at': 'off', + // TODO @Shinigami92 2023-09-23: prefer-string-replace-all should be turned on when we drop support for Node 14 + 'unicorn/prefer-string-replace-all': 'off', + + // TODO @Shinigami92 2023-09-23: All following unicorn rules are turned on by default through the unicorn/recommended set + // they should be turned on individually, removed or potentially configured to our needs + // But read https://github.com/faker-js/faker/pull/2417 for more + 'unicorn/better-regex': 'off', + 'unicorn/catch-error-name': 'off', + 'unicorn/consistent-destructuring': 'off', + 'unicorn/consistent-function-scoping': 'off', + 'unicorn/escape-case': 'off', + 'unicorn/explicit-length-check': 'off', + 'unicorn/filename-case': 'off', + 'unicorn/import-style': 'off', + 'unicorn/no-array-callback-reference': 'off', + 'unicorn/no-array-for-each': 'off', + 'unicorn/no-array-push-push': 'off', + 'unicorn/no-await-expression-member': 'off', + 'unicorn/no-console-spaces': 'off', + 'unicorn/no-for-loop': 'off', + 'unicorn/no-hex-escape': 'off', + 'unicorn/no-instanceof-array': 'off', + 'unicorn/no-negated-condition': 'off', + 'unicorn/no-new-array': 'off', + 'unicorn/no-object-as-default-parameter': 'off', + 'unicorn/no-process-exit': 'off', + 'unicorn/no-zero-fractions': 'off', + 'unicorn/numeric-separators-style': 'off', + 'unicorn/prefer-array-flat-map': 'off', + 'unicorn/prefer-array-some': 'off', + 'unicorn/prefer-code-point': 'off', + 'unicorn/prefer-date-now': 'off', + 'unicorn/prefer-export-from': 'off', + 'unicorn/prefer-includes': 'off', + 'unicorn/prefer-module': 'off', + 'unicorn/prefer-native-coercion-functions': 'off', + 'unicorn/prefer-negative-index': 'off', + 'unicorn/prefer-node-protocol': 'off', + 'unicorn/prefer-number-properties': 'off', + 'unicorn/prefer-object-from-entries': 'off', + 'unicorn/prefer-optional-catch-binding': 'off', + 'unicorn/prefer-spread': 'off', + 'unicorn/prefer-string-slice': 'off', + 'unicorn/prefer-string-starts-ends-with': 'off', + 'unicorn/prefer-ternary': 'off', + 'unicorn/prefer-top-level-await': 'off', + 'unicorn/prevent-abbreviations': 'off', + 'unicorn/require-array-join-separator': 'off', + 'unicorn/switch-case-braces': 'off', + 'unicorn/text-encoding-identifier-case': 'off', + '@typescript-eslint/array-type': [ 'error', { default: 'array-simple', readonly: 'generic' }, diff --git a/package.json b/package.json index dc40e453b8f..c4a8ffa6569 100644 --- a/package.json +++ b/package.json @@ -109,6 +109,7 @@ "eslint-plugin-deprecation": "~2.0.0", "eslint-plugin-jsdoc": "~46.8.1", "eslint-plugin-prettier": "~5.0.0", + "eslint-plugin-unicorn": "~48.0.1", "eslint-plugin-vitest": "~0.3.1", "glob": "~10.3.4", "npm-run-all": "~4.1.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c9b91a33e61..a97811354b5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,7 +12,7 @@ devDependencies: version: 13.0.1 '@types/node': specifier: ~20.6.2 - version: 20.6.2 + version: 20.6.4 '@types/sanitize-html': specifier: ~2.9.0 version: 2.9.0 @@ -30,10 +30,10 @@ devDependencies: version: 6.7.2(eslint@8.49.0)(typescript@4.9.5) '@vitest/coverage-v8': specifier: ~0.34.4 - version: 0.34.4(vitest@0.34.4) + version: 0.34.5(vitest@0.34.5) '@vitest/ui': specifier: ~0.34.4 - version: 0.34.4(vitest@0.34.4) + version: 0.34.5(vitest@0.34.5) '@vueuse/core': specifier: ~10.4.1 version: 10.4.1(vue@3.3.4) @@ -63,16 +63,19 @@ devDependencies: version: 2.0.0(eslint@8.49.0)(typescript@4.9.5) eslint-plugin-jsdoc: specifier: ~46.8.1 - version: 46.8.1(eslint@8.49.0) + version: 46.8.2(eslint@8.49.0) eslint-plugin-prettier: specifier: ~5.0.0 version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.0.3) + eslint-plugin-unicorn: + specifier: ~48.0.1 + version: 48.0.1(eslint@8.49.0) eslint-plugin-vitest: specifier: ~0.3.1 - version: 0.3.1(@typescript-eslint/eslint-plugin@6.7.2)(eslint@8.49.0)(vitest@0.34.4) + version: 0.3.1(@typescript-eslint/eslint-plugin@6.7.2)(eslint@8.49.0)(vitest@0.34.5) glob: specifier: ~10.3.4 - version: 10.3.4 + version: 10.3.6 npm-run-all: specifier: ~4.1.5 version: 4.1.5 @@ -108,13 +111,13 @@ devDependencies: version: 13.11.0 vite: specifier: ~4.4.9 - version: 4.4.9(@types/node@20.6.2) + version: 4.4.9(@types/node@20.6.4) vitepress: specifier: 1.0.0-beta.7 - version: 1.0.0-beta.7(@algolia/client-search@4.19.1)(@types/node@20.6.2)(search-insights@2.8.2) + version: 1.0.0-beta.7(@algolia/client-search@4.19.1)(@types/node@20.6.4)(search-insights@2.8.2) vitest: specifier: ~0.34.4 - version: 0.34.4(@vitest/ui@0.34.4) + version: 0.34.5(@vitest/ui@0.34.5) vue: specifier: ~3.3.4 version: 3.3.4 @@ -464,7 +467,7 @@ packages: resolution: {integrity: sha512-NfsJX4PdzhwSkfJukczyUiZGc7zNNWZcEAyqeISpDnn0PTfzMJR1aR8xAIPskBejIxBJbIgCCMzbaYa9SXepIg==} dependencies: '@esbuild-kit/core-utils': 3.3.2 - get-tsconfig: 4.7.0 + get-tsconfig: 4.7.2 dev: true /@esbuild-kit/core-utils@3.3.2: @@ -478,7 +481,7 @@ packages: resolution: {integrity: sha512-FxEMIkJKnodyA1OaCUoEvbYRkoZlLZ4d/eXFu9Fh8CbBBgP5EmZxrfTRyN0qpXZ4vOvqnE5YdRdcrmUUXuU+dA==} dependencies: '@esbuild-kit/core-utils': 3.3.2 - get-tsconfig: 4.7.0 + get-tsconfig: 4.7.2 dev: true /@esbuild/android-arm64@0.18.20: @@ -899,7 +902,7 @@ packages: ajv: 6.12.6 debug: 4.3.4(supports-color@8.1.1) espree: 9.6.1 - globals: 13.21.0 + globals: 13.22.0 ignore: 5.2.4 import-fresh: 3.3.0 js-yaml: 4.1.0 @@ -1171,12 +1174,12 @@ packages: resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==} dev: true - /@types/node@18.17.17: - resolution: {integrity: sha512-cOxcXsQ2sxiwkykdJqvyFS+MLQPLvIdwh5l6gNg8qF6s+C7XSkEWOZjK+XhUZd+mYvHV/180g2cnCcIl4l06Pw==} + /@types/node@18.17.19: + resolution: {integrity: sha512-+pMhShR3Or5GR0/sp4Da7FnhVmTalWm81M6MkEldbwjETSaPalw138Z4KdpQaistvqQxLB7Cy4xwYdxpbSOs9Q==} dev: true - /@types/node@20.6.2: - resolution: {integrity: sha512-Y+/1vGBHV/cYk6OI1Na/LHzwnlNCAfU3ZNGrc1LdRe/LAIbdDPTTv/HU3M7yXN448aTVDq3eKRm2cg7iKLb8gw==} + /@types/node@20.6.4: + resolution: {integrity: sha512-nU6d9MPY0NBUMiE/nXd2IIoC4OLvsLpwAjheoAeuzgvDZA1Cb10QYg+91AF6zQiKWRN5i1m07x6sMe0niBznoQ==} dev: true /@types/normalize-package-data@2.4.1: @@ -1213,7 +1216,7 @@ packages: resolution: {integrity: sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==} requiresBuild: true dependencies: - '@types/node': 20.6.2 + '@types/node': 20.6.4 dev: true optional: true @@ -1395,12 +1398,12 @@ packages: vite: ^4.0.0 vue: ^3.2.25 dependencies: - vite: 4.4.9(@types/node@20.6.2) + vite: 4.4.9(@types/node@20.6.4) vue: 3.3.4 dev: true - /@vitest/coverage-v8@0.34.4(vitest@0.34.4): - resolution: {integrity: sha512-TZ5ghzhmg3COQqfBShL+zRQEInHmV9TSwghTdfkHpCTyTOr+rxo6x41vCNcVfWysWULtqtBVpY6YFNovxnESfA==} + /@vitest/coverage-v8@0.34.5(vitest@0.34.5): + resolution: {integrity: sha512-97xjhRTSdmeeHCm2nNHhT3hLsMYkAhHXm/rwj6SZ3voka8xiCJrwgtfIjoZIFEL4OO0KezGmVuHWQXcMunULIA==} peerDependencies: vitest: '>=0.32.0 <1' dependencies: @@ -1415,58 +1418,58 @@ packages: std-env: 3.4.3 test-exclude: 6.0.0 v8-to-istanbul: 9.1.0 - vitest: 0.34.4(@vitest/ui@0.34.4) + vitest: 0.34.5(@vitest/ui@0.34.5) transitivePeerDependencies: - supports-color dev: true - /@vitest/expect@0.34.4: - resolution: {integrity: sha512-XlMKX8HyYUqB8dsY8Xxrc64J2Qs9pKMt2Z8vFTL4mBWXJsg4yoALHzJfDWi8h5nkO4Zua4zjqtapQ/IluVkSnA==} + /@vitest/expect@0.34.5: + resolution: {integrity: sha512-/3RBIV9XEH+nRpRMqDJBufKIOQaYUH2X6bt0rKSCW0MfKhXFLYsR5ivHifeajRSTsln0FwJbitxLKHSQz/Xwkw==} dependencies: - '@vitest/spy': 0.34.4 - '@vitest/utils': 0.34.4 + '@vitest/spy': 0.34.5 + '@vitest/utils': 0.34.5 chai: 4.3.8 dev: true - /@vitest/runner@0.34.4: - resolution: {integrity: sha512-hwwdB1StERqUls8oV8YcpmTIpVeJMe4WgYuDongVzixl5hlYLT2G8afhcdADeDeqCaAmZcSgLTLtqkjPQF7x+w==} + /@vitest/runner@0.34.5: + resolution: {integrity: sha512-RDEE3ViVvl7jFSCbnBRyYuu23XxmvRTSZWW6W4M7eC5dOsK75d5LIf6uhE5Fqf809DQ1+9ICZZNxhIolWHU4og==} dependencies: - '@vitest/utils': 0.34.4 + '@vitest/utils': 0.34.5 p-limit: 4.0.0 pathe: 1.1.1 dev: true - /@vitest/snapshot@0.34.4: - resolution: {integrity: sha512-GCsh4coc3YUSL/o+BPUo7lHQbzpdttTxL6f4q0jRx2qVGoYz/cyTRDJHbnwks6TILi6560bVWoBpYC10PuTLHw==} + /@vitest/snapshot@0.34.5: + resolution: {integrity: sha512-+ikwSbhu6z2yOdtKmk/aeoDZ9QPm2g/ZO5rXT58RR9Vmu/kB2MamyDSx77dctqdZfP3Diqv4mbc/yw2kPT8rmA==} dependencies: magic-string: 0.30.3 pathe: 1.1.1 pretty-format: 29.7.0 dev: true - /@vitest/spy@0.34.4: - resolution: {integrity: sha512-PNU+fd7DUPgA3Ya924b1qKuQkonAW6hL7YUjkON3wmBwSTIlhOSpy04SJ0NrRsEbrXgMMj6Morh04BMf8k+w0g==} + /@vitest/spy@0.34.5: + resolution: {integrity: sha512-epsicsfhvBjRjCMOC/3k00mP/TBGQy8/P0DxOFiWyLt55gnZ99dqCfCiAsKO17BWVjn4eZRIjKvcqNmSz8gvmg==} dependencies: tinyspy: 2.1.1 dev: true - /@vitest/ui@0.34.4(vitest@0.34.4): - resolution: {integrity: sha512-gz0m0r9ErFG32r+DRdwuLJpUDpbi+jrMcw9nJZAau48Fs4LDIBg561PvczvGqyYxzbyFU7vgkSnSlSDfK0d53w==} + /@vitest/ui@0.34.5(vitest@0.34.5): + resolution: {integrity: sha512-nK3Ny7fQgoTJMCGXLzYL0oo1ePtruRM9eYT1Y8esQx8fHj05davqVgqWv4Kd+Yy8PfzyrduTx1EYBdSMIbQh8A==} peerDependencies: vitest: '>=0.30.1 <1' dependencies: - '@vitest/utils': 0.34.4 + '@vitest/utils': 0.34.5 fast-glob: 3.3.1 fflate: 0.8.1 flatted: 3.2.9 pathe: 1.1.1 picocolors: 1.0.0 sirv: 2.0.3 - vitest: 0.34.4(@vitest/ui@0.34.4) + vitest: 0.34.5(@vitest/ui@0.34.5) dev: true - /@vitest/utils@0.34.4: - resolution: {integrity: sha512-yR2+5CHhp/K4ySY0Qtd+CAL9f5Yh1aXrKfAT42bq6CtlGPh92jIDDDSg7ydlRow1CP+dys4TrOrbELOyNInHSg==} + /@vitest/utils@0.34.5: + resolution: {integrity: sha512-ur6CmmYQoeHMwmGb0v+qwkwN3yopZuZyf4xt1DBBSGBed8Hf9Gmbm/5dEWqgpLPdRx6Av6jcWXrjcKfkTzg/pw==} dependencies: diff-sequences: 29.6.3 loupe: 2.3.6 @@ -2028,6 +2031,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'} @@ -2471,7 +2481,7 @@ packages: dependencies: '@cypress/request': 3.0.1 '@cypress/xvfb': 1.2.4(supports-color@8.1.1) - '@types/node': 18.17.17 + '@types/node': 18.17.19 '@types/sinonjs__fake-timers': 8.1.1 '@types/sizzle': 2.3.3 arch: 2.2.0 @@ -2945,8 +2955,8 @@ packages: - supports-color dev: true - /eslint-plugin-jsdoc@46.8.1(eslint@8.49.0): - resolution: {integrity: sha512-uTce7IBluPKXIQMWJkIwFsI1gv7sZRmLjctca2K5DIxPi8fSBj9f4iru42XmGwuiMyH2f3nfc60sFmnSGv4Z/A==} + /eslint-plugin-jsdoc@46.8.2(eslint@8.49.0): + resolution: {integrity: sha512-5TSnD018f3tUJNne4s4gDWQflbsgOycIKEUBoCLn6XtBMgNHxQFmV8vVxUtiPxAQq8lrX85OaSG/2gnctxw9uQ==} engines: {node: '>=16'} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -2986,7 +2996,31 @@ packages: synckit: 0.8.5 dev: true - /eslint-plugin-vitest@0.3.1(@typescript-eslint/eslint-plugin@6.7.2)(eslint@8.49.0)(vitest@0.34.4): + /eslint-plugin-unicorn@48.0.1(eslint@8.49.0): + resolution: {integrity: sha512-FW+4r20myG/DqFcCSzoumaddKBicIPeFnTrifon2mWIzlfyvzwyqZjqVP7m4Cqr/ZYisS2aiLghkUWaPg6vtCw==} + engines: {node: '>=16'} + peerDependencies: + eslint: '>=8.44.0' + dependencies: + '@babel/helper-validator-identifier': 7.22.20 + '@eslint-community/eslint-utils': 4.4.0(eslint@8.49.0) + ci-info: 3.8.0 + clean-regexp: 1.0.0 + eslint: 8.49.0 + esquery: 1.5.0 + indent-string: 4.0.0 + is-builtin-module: 3.2.1 + jsesc: 3.0.2 + lodash: 4.17.21 + pluralize: 8.0.0 + read-pkg-up: 7.0.1 + regexp-tree: 0.1.27 + regjsparser: 0.10.0 + semver: 7.5.4 + strip-indent: 3.0.0 + dev: true + + /eslint-plugin-vitest@0.3.1(@typescript-eslint/eslint-plugin@6.7.2)(eslint@8.49.0)(vitest@0.34.5): resolution: {integrity: sha512-GeR3zISHmqUGWK2sfW+eyCZivMqiQYzPf9UttHXBiEyMveS/jkKLHCrHUllwr3Hz1+i0zoseANd2xL0cFha8Eg==} engines: {node: 14.x || >= 16} peerDependencies: @@ -3001,7 +3035,7 @@ packages: '@typescript-eslint/utils': 6.7.2(eslint@8.49.0)(typescript@5.2.2) eslint: 8.49.0 typescript: 5.2.2 - vitest: 0.34.4(@vitest/ui@0.34.4) + vitest: 0.34.5(@vitest/ui@0.34.5) transitivePeerDependencies: - supports-color dev: true @@ -3046,7 +3080,7 @@ packages: file-entry-cache: 6.0.1 find-up: 5.0.0 glob-parent: 6.0.2 - globals: 13.21.0 + globals: 13.22.0 graphemer: 1.4.0 ignore: 5.2.4 imurmurhash: 0.1.4 @@ -3418,8 +3452,8 @@ packages: get-intrinsic: 1.2.1 dev: true - /get-tsconfig@4.7.0: - resolution: {integrity: sha512-pmjiZ7xtB8URYm74PlGJozDNyhvsVLUcpBa8DZBG3bWHwaHa9bPiRpiSfovw+fjhwONSCWKRyk+JQHEGZmMrzw==} + /get-tsconfig@4.7.2: + resolution: {integrity: sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==} dependencies: resolve-pkg-maps: 1.0.0 dev: true @@ -3504,8 +3538,8 @@ packages: is-glob: 4.0.3 dev: true - /glob@10.3.4: - resolution: {integrity: sha512-6LFElP3A+i/Q8XQKEvZjkEWEOTgAIALR9AO2rwT8bgPhDd1anmqDJDZ6lLddI4ehxxxR1S5RIqKe1uapMQfYaQ==} + /glob@10.3.6: + resolution: {integrity: sha512-mEfImdc/fiYHEcF6pHFfD2b/KrdFB1qH9mRe5vI5HROF8G51SWxQJ2V56Ezl6ZL9y86gsxQ1Lgo2S746KGUPSQ==} engines: {node: '>=16 || 14 >=14.17'} hasBin: true dependencies: @@ -3534,8 +3568,8 @@ packages: ini: 2.0.0 dev: true - /globals@13.21.0: - resolution: {integrity: sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==} + /globals@13.22.0: + resolution: {integrity: sha512-H1Ddc/PbZHTDVJSnj8kWptIRSD6AM3pK+mKytuIVF4uoBV7rshFlhhvA58ceJ5wp3Er58w6zj7bykMpYXt3ETw==} engines: {node: '>=8'} dependencies: type-fest: 0.20.2 @@ -4046,6 +4080,17 @@ packages: engines: {node: '>=12.0.0'} dev: true + /jsesc@0.5.0: + resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==} + hasBin: true + dev: true + + /jsesc@3.0.2: + resolution: {integrity: sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==} + engines: {node: '>=6'} + hasBin: true + dev: true + /json-buffer@3.0.1: resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} dev: true @@ -4816,6 +4861,11 @@ packages: pathe: 1.1.1 dev: true + /pluralize@8.0.0: + resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} + engines: {node: '>=4'} + dev: true + /postcss@8.4.30: resolution: {integrity: sha512-7ZEao1g4kd68l97aWG/etQKPKq07us0ieSZ2TnFDk11i0ZfDW2AwKHYU8qv4MZKqN2fdBfg+7q0ES06UA73C1g==} engines: {node: ^10 || ^12 || >=14} @@ -5020,6 +5070,11 @@ packages: strip-indent: 3.0.0 dev: true + /regexp-tree@0.1.27: + resolution: {integrity: sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==} + hasBin: true + dev: true + /regexp.prototype.flags@1.5.1: resolution: {integrity: sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==} engines: {node: '>= 0.4'} @@ -5029,6 +5084,13 @@ packages: set-function-name: 2.0.1 dev: true + /regjsparser@0.10.0: + resolution: {integrity: sha512-qx+xQGZVsy55CH0a1hiVwHmqjLryfh7wQyF5HO07XJ9f7dQMY/gPQHhlyDkIzJKC+x2fUCpCcUODUUUFrm7SHA==} + hasBin: true + dependencies: + jsesc: 0.5.0 + dev: true + /request-progress@3.0.0: resolution: {integrity: sha512-MnWzEHHaxHO2iWiQuHrUPBi/1WeBf5PkxQqNyNvLl9VAYSdXkP8tQ3pBSeCPD+yw0v0Aq1zosWLz0BdeXpWwZg==} dependencies: @@ -5091,7 +5153,7 @@ packages: engines: {node: '>=14'} hasBin: true dependencies: - glob: 10.3.4 + glob: 10.3.6 dev: true /rollup@3.29.2: @@ -5925,8 +5987,8 @@ packages: extsprintf: 1.3.0 dev: true - /vite-node@0.34.4(@types/node@20.6.2): - resolution: {integrity: sha512-ho8HtiLc+nsmbwZMw8SlghESEE3KxJNp04F/jPUCLVvaURwt0d+r9LxEqCX5hvrrOQ0GSyxbYr5ZfRYhQ0yVKQ==} + /vite-node@0.34.5(@types/node@20.6.4): + resolution: {integrity: sha512-RNZ+DwbCvDoI5CbCSQSyRyzDTfFvFauvMs6Yq4ObJROKlIKuat1KgSX/Ako5rlDMfVCyMcpMRMTkJBxd6z8YRA==} engines: {node: '>=v14.18.0'} hasBin: true dependencies: @@ -5935,7 +5997,7 @@ packages: mlly: 1.4.2 pathe: 1.1.1 picocolors: 1.0.0 - vite: 4.4.9(@types/node@20.6.2) + vite: 4.4.9(@types/node@20.6.4) transitivePeerDependencies: - '@types/node' - less @@ -5947,7 +6009,7 @@ packages: - terser dev: true - /vite@4.4.9(@types/node@20.6.2): + /vite@4.4.9(@types/node@20.6.4): resolution: {integrity: sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -5975,7 +6037,7 @@ packages: terser: optional: true dependencies: - '@types/node': 20.6.2 + '@types/node': 20.6.4 esbuild: 0.18.20 postcss: 8.4.30 rollup: 3.29.2 @@ -5983,7 +6045,7 @@ packages: fsevents: 2.3.3 dev: true - /vitepress@1.0.0-beta.7(@algolia/client-search@4.19.1)(@types/node@20.6.2)(search-insights@2.8.2): + /vitepress@1.0.0-beta.7(@algolia/client-search@4.19.1)(@types/node@20.6.4)(search-insights@2.8.2): resolution: {integrity: sha512-P9Rw+FXatKIU4fVdtKxqwHl6fby8E/8zE3FIfep6meNgN4BxbWqoKJ6yfuuQQR9IrpQqwnyaBh4LSabyll6tWg==} hasBin: true dependencies: @@ -5998,7 +6060,7 @@ packages: mark.js: 8.11.1 minisearch: 6.1.0 shiki: 0.14.4 - vite: 4.4.9(@types/node@20.6.2) + vite: 4.4.9(@types/node@20.6.4) vue: 3.3.4 transitivePeerDependencies: - '@algolia/client-search' @@ -6027,8 +6089,8 @@ packages: - universal-cookie dev: true - /vitest@0.34.4(@vitest/ui@0.34.4): - resolution: {integrity: sha512-SE/laOsB6995QlbSE6BtkpXDeVNLJc1u2LHRG/OpnN4RsRzM3GQm4nm3PQCK5OBtrsUqnhzLdnT7se3aeNGdlw==} + /vitest@0.34.5(@vitest/ui@0.34.5): + resolution: {integrity: sha512-CPI68mmnr2DThSB3frSuE5RLm9wo5wU4fbDrDwWQQB1CWgq9jQVoQwnQSzYAjdoBOPoH2UtXpOgHVge/uScfZg==} engines: {node: '>=v14.18.0'} hasBin: true peerDependencies: @@ -6060,13 +6122,13 @@ packages: dependencies: '@types/chai': 4.3.6 '@types/chai-subset': 1.3.3 - '@types/node': 20.6.2 - '@vitest/expect': 0.34.4 - '@vitest/runner': 0.34.4 - '@vitest/snapshot': 0.34.4 - '@vitest/spy': 0.34.4 - '@vitest/ui': 0.34.4(vitest@0.34.4) - '@vitest/utils': 0.34.4 + '@types/node': 20.6.4 + '@vitest/expect': 0.34.5 + '@vitest/runner': 0.34.5 + '@vitest/snapshot': 0.34.5 + '@vitest/spy': 0.34.5 + '@vitest/ui': 0.34.5(vitest@0.34.5) + '@vitest/utils': 0.34.5 acorn: 8.10.0 acorn-walk: 8.2.0 cac: 6.7.14 @@ -6080,8 +6142,8 @@ packages: strip-literal: 1.3.0 tinybench: 2.5.1 tinypool: 0.7.0 - vite: 4.4.9(@types/node@20.6.2) - vite-node: 0.34.4(@types/node@20.6.2) + vite: 4.4.9(@types/node@20.6.4) + vite-node: 0.34.5(@types/node@20.6.4) why-is-node-running: 2.2.2 transitivePeerDependencies: - less From fb44f8785466cb857eafbd503cd707e51d3b0040 Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Sat, 23 Sep 2023 23:34:28 +0200 Subject: [PATCH 2/2] infra(unicorn): prefer-date-now --- .eslintrc.js | 1 - src/modules/helpers/index.ts | 2 +- src/modules/helpers/unique.ts | 4 ++-- test/modules/helpers.spec.ts | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 2e9045ae093..77488ba8bfc 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -75,7 +75,6 @@ module.exports = defineConfig({ 'unicorn/prefer-array-flat-map': 'off', 'unicorn/prefer-array-some': 'off', 'unicorn/prefer-code-point': 'off', - 'unicorn/prefer-date-now': 'off', 'unicorn/prefer-export-from': 'off', 'unicorn/prefer-includes': 'off', 'unicorn/prefer-module': 'off', diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts index 3889c572a22..09a7b36b3ac 100644 --- a/src/modules/helpers/index.ts +++ b/src/modules/helpers/index.ts @@ -1178,7 +1178,7 @@ export class SimpleHelpersModule { } = options; return uniqueExec.exec(method, args, { ...options, - startTime: new Date().getTime(), + startTime: Date.now(), maxTime, maxRetries, currentIterations: 0, diff --git a/src/modules/helpers/unique.ts b/src/modules/helpers/unique.ts index c096854a6eb..860404455f5 100644 --- a/src/modules/helpers/unique.ts +++ b/src/modules/helpers/unique.ts @@ -89,10 +89,10 @@ export function exec< store?: Record; } = {} ): ReturnType { - const now = new Date().getTime(); + const now = Date.now(); const { - startTime = new Date().getTime(), + startTime = Date.now(), maxTime = 50, maxRetries = 50, compare = defaultCompare, diff --git a/test/modules/helpers.spec.ts b/test/modules/helpers.spec.ts index 7b709373f24..df8f00e7c09 100644 --- a/test/modules/helpers.spec.ts +++ b/test/modules/helpers.spec.ts @@ -1292,7 +1292,7 @@ Try adjusting maxTime or maxRetries parameters for faker.helpers.unique().`) it('should not mutate most of the input option properties', () => { const method = () => 'options-mutate-test'; - const startTime = new Date().getTime(); + const startTime = Date.now(); const maxTime = 49; const maxRetries = 49; const currentIterations = 0;