chore: Enable eslint to enforce curly (#3060)
This commit is contained in:
@@ -92,8 +92,12 @@ class Attachment extends BaseModel {
|
||||
query: FindOptions<Attachment>
|
||||
) => Promise<void>
|
||||
) {
|
||||
if (!query.offset) query.offset = 0;
|
||||
if (!query.limit) query.limit = 10;
|
||||
if (!query.offset) {
|
||||
query.offset = 0;
|
||||
}
|
||||
if (!query.limit) {
|
||||
query.limit = 10;
|
||||
}
|
||||
let results;
|
||||
|
||||
do {
|
||||
|
||||
@@ -186,7 +186,9 @@ class Collection extends ParanoidModel {
|
||||
// getters
|
||||
|
||||
get url(): string {
|
||||
if (!this.name) return `/collection/untitled-${this.urlId}`;
|
||||
if (!this.name) {
|
||||
return `/collection/untitled-${this.urlId}`;
|
||||
}
|
||||
return `/collection/${slugify(this.name)}-${this.urlId}`;
|
||||
}
|
||||
|
||||
@@ -354,7 +356,9 @@ class Collection extends ParanoidModel {
|
||||
}
|
||||
|
||||
getDocumentTree = (documentId: string): NavigationNode | null => {
|
||||
if (!this.documentStructure) return null;
|
||||
if (!this.documentStructure) {
|
||||
return null;
|
||||
}
|
||||
const sort: Sort = this.sort || {
|
||||
field: "title",
|
||||
direction: "asc",
|
||||
@@ -386,7 +390,9 @@ class Collection extends ParanoidModel {
|
||||
loopChildren(this.documentStructure);
|
||||
|
||||
// if the document is a draft loopChildren will not find it in the structure
|
||||
if (!result) return null;
|
||||
if (!result) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
...result,
|
||||
@@ -548,7 +554,9 @@ class Collection extends ParanoidModel {
|
||||
* Update document's title and url in the documentStructure
|
||||
*/
|
||||
updateDocument = async function (updatedDocument: Document) {
|
||||
if (!this.documentStructure) return;
|
||||
if (!this.documentStructure) {
|
||||
return;
|
||||
}
|
||||
let transaction;
|
||||
|
||||
try {
|
||||
|
||||
@@ -127,7 +127,9 @@ export const DOCUMENT_VERSION = 2;
|
||||
],
|
||||
},
|
||||
withViews: (userId: string) => {
|
||||
if (!userId) return {};
|
||||
if (!userId) {
|
||||
return {};
|
||||
}
|
||||
return {
|
||||
include: [
|
||||
{
|
||||
@@ -215,7 +217,9 @@ class Document extends ParanoidModel {
|
||||
// getters
|
||||
|
||||
get url() {
|
||||
if (!this.title) return `/doc/untitled-${this.urlId}`;
|
||||
if (!this.title) {
|
||||
return `/doc/untitled-${this.urlId}`;
|
||||
}
|
||||
const slugifiedTitle = slugify(this.title);
|
||||
return `/doc/${slugifiedTitle}-${this.urlId}`;
|
||||
}
|
||||
@@ -721,7 +725,9 @@ class Document extends ParanoidModel {
|
||||
};
|
||||
|
||||
publish = async (userId: string, options?: FindOptions<Document>) => {
|
||||
if (this.publishedAt) return this.save(options);
|
||||
if (this.publishedAt) {
|
||||
return this.save(options);
|
||||
}
|
||||
|
||||
if (!this.template) {
|
||||
const collection = await Collection.findByPk(this.collectionId);
|
||||
@@ -735,7 +741,9 @@ class Document extends ParanoidModel {
|
||||
};
|
||||
|
||||
unpublish = async (userId: string, options?: FindOptions<Document>) => {
|
||||
if (!this.publishedAt) return this;
|
||||
if (!this.publishedAt) {
|
||||
return this;
|
||||
}
|
||||
const collection = await this.$get("collection");
|
||||
await collection?.removeDocumentInStructure(this);
|
||||
|
||||
@@ -777,7 +785,9 @@ class Document extends ParanoidModel {
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!parent) this.parentDocumentId = null;
|
||||
if (!parent) {
|
||||
this.parentDocumentId = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.template && collection) {
|
||||
|
||||
@@ -58,7 +58,9 @@ class Group extends ParanoidModel {
|
||||
|
||||
@AfterDestroy
|
||||
static async deleteGroupUsers(model: Group) {
|
||||
if (!model.deletedAt) return;
|
||||
if (!model.deletedAt) {
|
||||
return;
|
||||
}
|
||||
await GroupUser.destroy({
|
||||
where: {
|
||||
groupId: model.id,
|
||||
|
||||
@@ -125,7 +125,9 @@ class Team extends ParanoidModel {
|
||||
requestedSubdomain: string,
|
||||
options = {}
|
||||
) {
|
||||
if (this.subdomain) return this.subdomain;
|
||||
if (this.subdomain) {
|
||||
return this.subdomain;
|
||||
}
|
||||
let subdomain = requestedSubdomain;
|
||||
let append = 0;
|
||||
|
||||
@@ -234,7 +236,9 @@ class Team extends ParanoidModel {
|
||||
`avatars/${model.id}/${uuidv4()}`,
|
||||
"public-read"
|
||||
);
|
||||
if (newUrl) model.avatarUrl = newUrl;
|
||||
if (newUrl) {
|
||||
model.avatarUrl = newUrl;
|
||||
}
|
||||
} catch (err) {
|
||||
Logger.error("Error uploading avatar to S3", err, {
|
||||
url: avatarUrl,
|
||||
|
||||
@@ -360,7 +360,9 @@ class User extends ParanoidModel {
|
||||
`avatars/${model.id}/${uuidv4()}`,
|
||||
"public-read"
|
||||
);
|
||||
if (newUrl) model.avatarUrl = newUrl;
|
||||
if (newUrl) {
|
||||
model.avatarUrl = newUrl;
|
||||
}
|
||||
} catch (err) {
|
||||
Logger.error("Couldn't upload user avatar image to S3", err, {
|
||||
url: avatarUrl,
|
||||
@@ -452,8 +454,12 @@ class User extends ParanoidModel {
|
||||
query: FindOptions<User>,
|
||||
callback: (users: Array<User>, query: FindOptions<User>) => Promise<void>
|
||||
) {
|
||||
if (!query.offset) query.offset = 0;
|
||||
if (!query.limit) query.limit = 10;
|
||||
if (!query.offset) {
|
||||
query.offset = 0;
|
||||
}
|
||||
if (!query.limit) {
|
||||
query.limit = 10;
|
||||
}
|
||||
let results;
|
||||
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user