Skip to content

Commit

Permalink
chore(deps): update dependency eslint-config-love to v97 (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] authored Nov 9, 2024
1 parent 31412f1 commit 83ba0d0
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 100 deletions.
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ typings/

# next.js build output
.next

# pnpm
pnpm-lock.yaml
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@vercel/ncc": "0.38.2",
"all-contributors-cli": "6.26.1",
"eslint": "9.14.0",
"eslint-config-love": "96.0.0",
"eslint-config-love": "97.0.0",
"eslint-plugin-regexp": "2.6.0",
"husky": "9.1.6",
"jest": "29.7.0",
Expand Down
27 changes: 20 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 18 additions & 20 deletions src/main.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,24 @@ const pullRequestEvents = (webhooks.find((v) => v.name === "pull_request")

describe("main", () => {
beforeEach(() => {
mocked(getConfigs).mockImplementation(() => {
return {
projectKey: "projectKey",
apiHost: "apiHost",
apiKey: "apiKey",
githubEventPath: "githubEventPath",
fixKeywords: ["fixKeyword"],
closeKeywords: ["closeKeyword"],
pushCommentTemplate: "pushCommentTemplate",
prOpenedCommentTemplate: "prOpenedCommentTemplate",
prReopenedCommentTemplate: "prReopenedCommentTemplate",
prReadyForReviewCommentTemplate: "prReadyForReviewCommentTemplate",
prClosedCommentTemplate: "prClosedCommentTemplate",
prMergedCommentTemplate: "prMergedCommentTemplate",
commitMessageRegTemplate: "commitMessageRegTemplate",
prTitleRegTemplate: "prTitleRegTemplate",
fixStatusId: "fixStatusId",
closeStatusId: "closeStatusId",
};
});
mocked(getConfigs).mockImplementation(() => ({
projectKey: "projectKey",
apiHost: "apiHost",
apiKey: "apiKey",
githubEventPath: "githubEventPath",
fixKeywords: ["fixKeyword"],
closeKeywords: ["closeKeyword"],
pushCommentTemplate: "pushCommentTemplate",
prOpenedCommentTemplate: "prOpenedCommentTemplate",
prReopenedCommentTemplate: "prReopenedCommentTemplate",
prReadyForReviewCommentTemplate: "prReadyForReviewCommentTemplate",
prClosedCommentTemplate: "prClosedCommentTemplate",
prMergedCommentTemplate: "prMergedCommentTemplate",
commitMessageRegTemplate: "commitMessageRegTemplate",
prTitleRegTemplate: "prTitleRegTemplate",
fixStatusId: "fixStatusId",
closeStatusId: "closeStatusId",
}));
mocked(info).mockImplementation((m) => m);
mocked(setFailed).mockImplementation((m) => m);
});
Expand Down
74 changes: 36 additions & 38 deletions src/main/getConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,44 +75,42 @@ export const defaultConfigs: Omit<Configs, RequiredConfigKeys> = {
* @throws {Error} Will throw an error if missing required input
*/

export const getConfigs = (): Configs => {
return {
projectKey: getConfig("project_key", { required: true }),
apiHost: getConfig("api_host", { required: true }),
apiKey: getConfig("api_key", { required: true }),
githubEventPath: getConfig("github_event_path", { required: true }),
fixKeywords: getConfig("fix_keywords")
? getMultilineInput("fix_keywords")
: defaultConfigs.fixKeywords,
closeKeywords: getConfig("close_keywords")
? getMultilineInput("close_keywords")
: defaultConfigs.closeKeywords,
pushCommentTemplate:
getConfig("push_comment_template") || defaultConfigs.pushCommentTemplate,
prOpenedCommentTemplate:
getConfig("pr_opened_comment_template") ||
defaultConfigs.prOpenedCommentTemplate,
prReopenedCommentTemplate:
getConfig("pr_reopened_comment_template") ||
defaultConfigs.prReopenedCommentTemplate,
prReadyForReviewCommentTemplate:
getConfig("pr_ready_for_review_comment_template") ||
defaultConfigs.prReadyForReviewCommentTemplate,
prClosedCommentTemplate:
getConfig("pr_closed_comment_template") ||
defaultConfigs.prClosedCommentTemplate,
prMergedCommentTemplate:
getConfig("pr_merged_comment_template") ||
defaultConfigs.prMergedCommentTemplate,
commitMessageRegTemplate:
getConfig("commit_message_reg_template") ||
defaultConfigs.commitMessageRegTemplate,
prTitleRegTemplate:
getConfig("pr_title_reg_template") || defaultConfigs.prTitleRegTemplate,
fixStatusId: getConfig("fix_status_id") || defaultConfigs.fixStatusId,
closeStatusId: getConfig("close_status_id") || defaultConfigs.closeStatusId,
};
};
export const getConfigs = (): Configs => ({
projectKey: getConfig("project_key", { required: true }),
apiHost: getConfig("api_host", { required: true }),
apiKey: getConfig("api_key", { required: true }),
githubEventPath: getConfig("github_event_path", { required: true }),
fixKeywords: getConfig("fix_keywords")
? getMultilineInput("fix_keywords")
: defaultConfigs.fixKeywords,
closeKeywords: getConfig("close_keywords")
? getMultilineInput("close_keywords")
: defaultConfigs.closeKeywords,
pushCommentTemplate:
getConfig("push_comment_template") || defaultConfigs.pushCommentTemplate,
prOpenedCommentTemplate:
getConfig("pr_opened_comment_template") ||
defaultConfigs.prOpenedCommentTemplate,
prReopenedCommentTemplate:
getConfig("pr_reopened_comment_template") ||
defaultConfigs.prReopenedCommentTemplate,
prReadyForReviewCommentTemplate:
getConfig("pr_ready_for_review_comment_template") ||
defaultConfigs.prReadyForReviewCommentTemplate,
prClosedCommentTemplate:
getConfig("pr_closed_comment_template") ||
defaultConfigs.prClosedCommentTemplate,
prMergedCommentTemplate:
getConfig("pr_merged_comment_template") ||
defaultConfigs.prMergedCommentTemplate,
commitMessageRegTemplate:
getConfig("commit_message_reg_template") ||
defaultConfigs.commitMessageRegTemplate,
prTitleRegTemplate:
getConfig("pr_title_reg_template") || defaultConfigs.prTitleRegTemplate,
fixStatusId: getConfig("fix_status_id") || defaultConfigs.fixStatusId,
closeStatusId: getConfig("close_status_id") || defaultConfigs.closeStatusId,
});

interface InputOptions {
required?: boolean;
Expand Down
24 changes: 11 additions & 13 deletions src/pr/parsePullRequest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,17 @@ const getConfigs = (
const getParsedPullRequest = (
event: PullRequestEvent,
parsedPullRequest?: Partial<ParsedPullRequest>,
): ParsedPullRequest => {
return {
pr: event.pull_request,
action: event.action,
sender: event.sender,
issueKey,
title,
keywords: "",
isFix: false,
isClose: false,
...parsedPullRequest,
};
};
): ParsedPullRequest => ({
pr: event.pull_request,
action: event.action,
sender: event.sender,
issueKey,
title,
keywords: "",
isFix: false,
isClose: false,
...parsedPullRequest,
});

describe.each(events)("parsePullRequest", (_event) => {
test("return parsed pull request", () => {
Expand Down
35 changes: 16 additions & 19 deletions src/pr/postComments.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { postComments, type PostCommentsProps } from "./postComments";
import type { ParsedPullRequest } from "./parsePullRequest";
import type { PullRequestEvent } from "@octokit/webhooks-types";
import webhooks from "@octokit/webhooks-examples";

const login = "login";
const html_url = "html_url";
const htmlUrl = "html_url";
const fixStatusId = "fixStatusId";
const closeStatusId = "closeStatusId";
const apiHost = "apiHost";
Expand Down Expand Up @@ -53,7 +52,7 @@ const getEvent = <T extends PullRequestEvent>(event: T): T => ({
pull_request: {
...event.pull_request,
title,
html_url,
html_url: htmlUrl,
},
sender: {
...event.sender,
Expand All @@ -64,19 +63,17 @@ const getEvent = <T extends PullRequestEvent>(event: T): T => ({
const getParsedPullRequest = (
event: PullRequestEvent,
parsedPullRequest?: Partial<ParsedPullRequest>,
): ParsedPullRequest => {
return {
pr: event.pull_request,
action: event.action,
sender: event.sender,
issueKey,
title,
keywords: "",
isFix: false,
isClose: false,
...parsedPullRequest,
};
};
): ParsedPullRequest => ({
pr: event.pull_request,
action: event.action,
sender: event.sender,
issueKey,
title,
keywords: "",
isFix: false,
isClose: false,
...parsedPullRequest,
});

const getConfigs = (
parsedPullRequest: ParsedPullRequest,
Expand Down Expand Up @@ -124,7 +121,7 @@ describe("postComments", () => {
"opened, reopened, ready_for_review",
(_event) => {
const event = getEvent(_event);
const comment = `${event.action},${login},${title},${html_url}`;
const comment = `${event.action},${login},${title},${htmlUrl}`;

it("post a comment to Backlog API", async () => {
const parsedPullRequest = getParsedPullRequest(event);
Expand Down Expand Up @@ -208,7 +205,7 @@ describe("postComments", () => {
..._event,
pull_request: { ..._event.pull_request, merged: true },
} as PullRequestEvent);
const comment = `merged,${login},${title},${html_url}`;
const comment = `merged,${login},${title},${htmlUrl}`;

it("post a comment to Backlog API", async () => {
const parsedPullRequest = getParsedPullRequest(event);
Expand Down Expand Up @@ -283,7 +280,7 @@ describe("postComments", () => {

describe.each(closedEvents)("closed", (_event) => {
const event = getEvent(_event);
const comment = `closed,${login},${title},${html_url}`;
const comment = `closed,${login},${title},${htmlUrl}`;

it("post a comment to Backlog API", async () => {
const parsedPullRequest = getParsedPullRequest(event);
Expand Down

0 comments on commit 83ba0d0

Please sign in to comment.