diff --git a/.eslintrc.json b/.eslintrc.json index 8a9f115..8be52d4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -18,6 +18,7 @@ "@typescript-eslint" ], "rules": { + "arrow-parens": ["warn", "always"], "brace-style": ["warn", "1tbs"], "camelcase": ["warn", { "properties": "never", diff --git a/src/class/prsOpen.ts b/src/class/prsOpen.ts index e663b28..a64cbe2 100644 --- a/src/class/prsOpen.ts +++ b/src/class/prsOpen.ts @@ -61,7 +61,7 @@ export default class PullRequestOpen { repo: "github-AutoResponse", pull_number: this.context.payload.number }).then(async (res) => { - const listFiles = res.data.map(a => a.filename); + const listFiles = res.data.map((a) => a.filename); for (let i = 0; i < listFiles.length; i++) { if (/src\/index/i.test(listFiles[i])) { fileLabels.push("Core"); @@ -79,7 +79,7 @@ export default class PullRequestOpen { } if (fileLabels.length > 0) { - new Set(fileLabels).forEach(a => filteredlabels.push(a)); + new Set(fileLabels).forEach((a) => filteredlabels.push(a)); await this.context.octokit.issues.addLabels( this.context.issue({ labels: filteredlabels diff --git a/src/class/prsReview.ts b/src/class/prsReview.ts index 8b538db..da984fa 100644 --- a/src/class/prsReview.ts +++ b/src/class/prsReview.ts @@ -37,7 +37,7 @@ export default class PullRequestReview { body: `@${this.context.payload.pull_request.user.login} your pull request has been approved by @${this.context.payload.review.user.login}, please type \`Ready to merge\` for merging`, event: "COMMENT" }); - if (this.context.payload.pull_request.labels.find(a => a.name == "Requested Changes")) { + if (this.context.payload.pull_request.labels.find((a) => a.name == "Requested Changes")) { await this.context.octokit.issues.removeLabel( this.context.issue({ name: "Requested Changes" @@ -76,7 +76,7 @@ export default class PullRequestReview { body: `Pull request has requested changes by @${this.context.payload.review.user.login}. PING! @${this.context.payload.pull_request.user.login} Please address their comments before I'm merging this PR, thanks!`, event: "COMMENT" }); - if (this.context.payload.pull_request.labels.find(a => a.name == "Approved")) { + if (this.context.payload.pull_request.labels.find((a) => a.name == "Approved")) { await this.context.octokit.issues.removeLabel( this.context.issue({ name: "Approved" @@ -117,7 +117,7 @@ export default class PullRequestReview { body: `@${this.context.payload.pull_request.user.login} your pull request has been approved by \`[MAINTAINER]\`@${this.context.payload.review.user.login}, please type \`Ready to merge\` for merging`, event: "COMMENT" }); - if (this.context.payload.pull_request.labels.find(a => a.name == "Requested Changes")) { + if (this.context.payload.pull_request.labels.find((a) => a.name == "Requested Changes")) { await this.context.octokit.issues.removeLabel( this.context.issue({ name: "Requested Changes" @@ -156,7 +156,7 @@ export default class PullRequestReview { body: `Pull request has requested changes by @${this.context.payload.review.user.login}. PING! @${this.context.payload.pull_request.user.login} Please address their comments before I'm merging this PR, thanks!`, event: "COMMENT" }); - if (this.context.payload.pull_request.labels.find(a => a.name == "Approved")) { + if (this.context.payload.pull_request.labels.find((a) => a.name == "Approved")) { await this.context.octokit.issues.removeLabel( this.context.issue({ name: "Approved" @@ -198,7 +198,7 @@ export default class PullRequestReview { body: `@${this.context.payload.pull_request.user.login} your pull request has been approved by @${this.context.payload.review.user.login}, even though please wait for the \`MAINTAINERS\`/\`CODEOWNERS\` to review`, event: "COMMENT" }); - if (this.context.payload.pull_request.labels.find(a => a.name == "Requested Changes")) { + if (this.context.payload.pull_request.labels.find((a) => a.name == "Requested Changes")) { await this.context.octokit.issues.removeLabel( this.context.issue({ name: "Requested Changes" @@ -268,7 +268,7 @@ export default class PullRequestReview { body: `@${this.context.payload.pull_request.user.login} Pull request has been approved by \`[OWNER]\`@${this.context.payload.review.user.login}, please type \`Merge\` for merging @${this.context.payload.review.user.login}`, event: "COMMENT" }); - if (this.context.payload.pull_request.labels.find(a => a.name == "Requested Changes")) { + if (this.context.payload.pull_request.labels.find((a) => a.name == "Requested Changes")) { await this.context.octokit.issues.removeLabel( this.context.issue({ name: "Requested Changes" @@ -307,7 +307,7 @@ export default class PullRequestReview { body: `@${this.context.payload.pull_request.user.login} your pull request has requested changes by \`[OWNER]\`@${this.context.payload.review.user.login}. Please address their comments before I'm merging this PR, thanks!`, event: "COMMENT" }); - if (this.context.payload.pull_request.labels.find(a => a.name == "Approved")) { + if (this.context.payload.pull_request.labels.find((a) => a.name == "Approved")) { await this.context.octokit.issues.removeLabel( this.context.issue({ name: "Approved" @@ -348,7 +348,7 @@ export default class PullRequestReview { body: `@${this.context.payload.pull_request.user.login} Pull request has been approved by \`[MAINTAINER]\`@${this.context.payload.review.user.login}, please type \`Merge\` for merging @${this.context.payload.review.user.login}`, event: "COMMENT" }); - if (this.context.payload.pull_request.labels.find(a => a.name == "Requested Changes")) { + if (this.context.payload.pull_request.labels.find((a) => a.name == "Requested Changes")) { await this.context.octokit.issues.removeLabel( this.context.issue({ name: "Requested Changes" @@ -387,7 +387,7 @@ export default class PullRequestReview { body: `Pull request has requested changes by \`[MAINTAINER]\`@${this.context.payload.review.user.login}. PING! @${this.context.payload.pull_request.user.login} Please address their comments before I"m merging this PR, thanks!`, event: "COMMENT" }); - if (this.context.payload.pull_request.labels.find(a => a.name == "Approved")) { + if (this.context.payload.pull_request.labels.find((a) => a.name == "Approved")) { await this.context.octokit.issues.removeLabel( this.context.issue({ name: "Approved" @@ -429,7 +429,7 @@ export default class PullRequestReview { body: `@${this.context.payload.pull_request.user.login} your pull request has been approved by @${this.context.payload.review.user.login}, even though please wait for the \`MAINTAINERS\`/\`CODEOWNERS\` to review`, event: "COMMENT" }); - if (this.context.payload.pull_request.labels.find(a => a.name == "Requested Changes")) { + if (this.context.payload.pull_request.labels.find((a) => a.name == "Requested Changes")) { await this.context.octokit.issues.removeLabel( this.context.issue({ name: "Requested Changes" diff --git a/src/class/prsSynchronize.ts b/src/class/prsSynchronize.ts index 2e02ca0..814e06b 100644 --- a/src/class/prsSynchronize.ts +++ b/src/class/prsSynchronize.ts @@ -33,7 +33,7 @@ export default class PullRequestSynchronize { issue_number: this.context.payload.pull_request.number }).then(async (res) => { let i: number; - const prsLabels = res.data.find(a => a.name == "Requested Changes" || a.name == "Approved")?.name; + const prsLabels = res.data.find((a) => a.name == "Requested Changes" || a.name == "Approved")?.name; if (prsLabels) { await this.context.octokit.pulls.listReviews({ owner: this.context.payload.repository.owner.login, @@ -48,8 +48,8 @@ export default class PullRequestSynchronize { "CHANGES_REQUESTED", "APPROVED" ]; - if (res.data[i].state == datastate.find(a => a == res.data[i].state)) { - if (res.data[i].user?.login != reviewersArray.find(a => a == res.data[i].user?.login)) { + if (res.data[i].state == datastate.find((a) => a == res.data[i].state)) { + if (res.data[i].user?.login != reviewersArray.find((a) => a == res.data[i].user?.login)) { const username: string = res.data[i].user?.login || ""; reviewersArray.push(username); tagReviewers.push("@" + username); @@ -124,7 +124,7 @@ export default class PullRequestSynchronize { repo: this.context.payload.repository.name, issue_number: this.context.payload.pull_request.number }).then(async (res) => { - if (res.data.find(a => a.name == "Config Invalid")) { + if (res.data.find((a) => a.name == "Config Invalid")) { await this.context.octokit.issues.removeLabel( this.context.issue({ name: "Config Invalid" diff --git a/src/class/workflowCheck.ts b/src/class/workflowCheck.ts index edda649..b802681 100644 --- a/src/class/workflowCheck.ts +++ b/src/class/workflowCheck.ts @@ -68,7 +68,7 @@ export default class WorkflowCheck { repo: this.context.payload.repository.name, pull_number: prsNumber }).then(async (res) => { - if (res.data.labels.find(a => a.name == "CI Failed")) { + if (res.data.labels.find((a) => a.name == "CI Failed")) { await this.context.octokit.issues.removeLabel( this.context.issue({ owner: this.context.payload.repository.owner.login,