Skip to content

Commit

Permalink
infra(unicorn): prefer-date-now (#2419)
Browse files Browse the repository at this point in the history
Co-authored-by: ST-DDT <[email protected]>
  • Loading branch information
Shinigami92 and ST-DDT authored Oct 7, 2023
1 parent 93bb134 commit 57bcd97
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/modules/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/modules/helpers/unique.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test/modules/helpers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 57bcd97

Please sign in to comment.