fix: add prefer-date-now rule (#5113)

This commit is contained in:
LongYinan 2023-11-29 04:43:54 +00:00
parent 4dddbbdaee
commit bd488262fa
No known key found for this signature in database
GPG Key ID: 30B1140CE1C07C99
4 changed files with 4 additions and 3 deletions

View File

@ -211,6 +211,7 @@ const config = {
'unicorn/prefer-dom-node-append': 'error',
'unicorn/prefer-dom-node-remove': 'error',
'unicorn/prefer-array-some': 'error',
'unicorn/prefer-date-now': 'error',
'unicorn/no-useless-promise-resolve-reject': 'error',
'sonarjs/no-all-duplicated-branches': 'error',
'sonarjs/no-element-overwrite': 'error',

View File

@ -23,7 +23,7 @@ export type UserClaim = Pick<
hasPassword?: boolean;
};
export const getUtcTimestamp = () => Math.floor(new Date().getTime() / 1000);
export const getUtcTimestamp = () => Math.floor(Date.now() / 1000);
@Injectable()
export class AuthService {

View File

@ -85,7 +85,7 @@ export function useBlockSuiteMetaHelper(
setPageMeta(pageId, {
trash: true,
trashDate: +new Date(),
trashDate: Date.now(),
trashRelate: isRoot ? parentMeta?.id : undefined,
});
setPageReadonly(pageId, true);

View File

@ -1,7 +1,7 @@
import type { EventBasedChannel } from 'async-call-rpc';
export function getTime() {
return new Date().getTime();
return Date.now();
}
export const isMacOS = () => {