1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-02 22:49:09 +02:00

Tools: Implement "prefer-object-spread" eslint rule

This commit is contained in:
Laurent Cozic
2023-06-01 12:02:36 +01:00
parent 804d674d37
commit c89edd7b22
126 changed files with 588 additions and 909 deletions

View File

@@ -157,7 +157,7 @@ export default class Resource extends BaseItem {
public static async decrypt(item: ResourceEntity) {
// The item might already be decrypted but not the blob (for instance if it crashes while
// decrypting the blob or was otherwise interrupted).
const decryptedItem = item.encryption_cipher_text ? await super.decrypt(item) : Object.assign({}, item);
const decryptedItem = item.encryption_cipher_text ? await super.decrypt(item) : { ...item };
if (!decryptedItem.encryption_blob_encrypted) return decryptedItem;
const localState = await this.localState(item);
@@ -225,7 +225,7 @@ export default class Resource extends BaseItem {
throw error;
}
const resourceCopy = Object.assign({}, resource);
const resourceCopy = { ...resource };
resourceCopy.encryption_blob_encrypted = 1;
return { path: encryptedPath, resource: resourceCopy };
}
@@ -273,7 +273,7 @@ export default class Resource extends BaseItem {
public static async setLocalState(resourceOrId: any, state: ResourceLocalStateEntity) {
const id = typeof resourceOrId === 'object' ? resourceOrId.id : resourceOrId;
await ResourceLocalState.save(Object.assign({}, state, { resource_id: id }));
await ResourceLocalState.save({ ...state, resource_id: id });
}
public static async needFileSizeSet() {