diff options
| author | Shinigami <[email protected]> | 2023-10-07 10:14:57 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-07 10:14:57 +0200 |
| commit | 57bcd970883ebfa54952a0893bbaaa1c29c3c0d0 (patch) | |
| tree | 0303c635f4f543f54d6c6829f157bcebd4f9c513 | |
| parent | 93bb134a3d0663cd804679c54926f0042b02b289 (diff) | |
| download | faker-57bcd970883ebfa54952a0893bbaaa1c29c3c0d0.tar.xz faker-57bcd970883ebfa54952a0893bbaaa1c29c3c0d0.zip | |
infra(unicorn): prefer-date-now (#2419)
Co-authored-by: ST-DDT <[email protected]>
| -rw-r--r-- | .eslintrc.js | 1 | ||||
| -rw-r--r-- | src/modules/helpers/index.ts | 2 | ||||
| -rw-r--r-- | src/modules/helpers/unique.ts | 4 | ||||
| -rw-r--r-- | test/modules/helpers.spec.ts | 2 |
4 files changed, 4 insertions, 5 deletions
diff --git a/.eslintrc.js b/.eslintrc.js index 4e8dda50..1c8d5096 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -76,7 +76,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 f5e7e177..7ace1e91 100644 --- a/src/modules/helpers/index.ts +++ b/src/modules/helpers/index.ts @@ -1181,7 +1181,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 c096854a..86040445 100644 --- a/src/modules/helpers/unique.ts +++ b/src/modules/helpers/unique.ts @@ -89,10 +89,10 @@ export function exec< store?: Record<RecordKey, RecordKey>; } = {} ): ReturnType<TMethod> { - 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 7b709373..df8f00e7 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; |
