Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infra(unicorn): prefer-date-now #2419

Merged
merged 4 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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