From c27225611704b27eca915ba2cde000af983452be Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Tue, 12 May 2026 11:07:41 +0000 Subject: [PATCH] fmt: format files with prettier --- scripts/build-docs.js | 12 ++++++------ scripts/fix-sourcemap-sources.js | 6 +++--- src/index.js | 20 ++++++++++---------- src/utils.js | 8 ++++---- src/utils.spec.js | 12 ++++++------ test/integration/index.js | 10 +++++----- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/scripts/build-docs.js b/scripts/build-docs.js index afab908..151f68c 100644 --- a/scripts/build-docs.js +++ b/scripts/build-docs.js @@ -29,9 +29,9 @@ const toMarkdownTable = (tbl) => .toString() .replace(/([\\]+)\|/gu, "$1$1|") .replace(/\|/gu, "\\|") - .trim() + .trim(), ) - .join(" | ")} |` + .join(" | ")} |`, ) .join("\n"); @@ -47,7 +47,7 @@ ${usageFile process.env.npm_package_version || error("unable to get package version from env var $npm_package_version") ).match(/^.*?[1-9]/u)[0] - }` + }`, ) .replace(/^\n+|\n+$/gu, "")} ~~~`, @@ -55,7 +55,7 @@ ${usageFile inputsTable: () => { const table = [ ["Key", "Description", "Required", "Default"].map( - (title) => `**${title}**` + (title) => `**${title}**`, ), ]; @@ -85,7 +85,7 @@ ${usageFile const readme = (await readFile("README_TEMPLATE.md", "utf8")).replace( //gmu, - (m, p1) => snippets[p1]?.() || error("unrecognized @include directive: " + m) + (m, p1) => snippets[p1]?.() || error("unrecognized @include directive: " + m), ); await writeFile( @@ -95,5 +95,5 @@ await writeFile( ...(await prettier.resolveConfig(readmeFilePath, { useCache: false, })), - }) + }), ); diff --git a/scripts/fix-sourcemap-sources.js b/scripts/fix-sourcemap-sources.js index 7b79c87..8edb394 100644 --- a/scripts/fix-sourcemap-sources.js +++ b/scripts/fix-sourcemap-sources.js @@ -7,10 +7,10 @@ json.sources = json.sources.map((path) => path.replace( new RegExp( `^(?:\\.\\.?[\\\\/])*webpack:[\\\\/]*(?:breaking-change[\\\\/])?`, - "u" + "u", ), - "" - ) + "", + ), ); await writeFile(file, JSON.stringify(json)); diff --git a/src/index.js b/src/index.js index ff5825f..2f0292d 100644 --- a/src/index.js +++ b/src/index.js @@ -32,8 +32,8 @@ try { assert( Array.isArray(ret), `"commits" field of event payload is the wrong type: expected "Array", found "${humanReadableTypeOf( - ret - )}"` + ret, + )}"`, ); return ret.filter((cm) => filterFn(cm.message)); @@ -58,13 +58,13 @@ try { assert( inputWasProvided(issueNumber) || inputWasProvided(discussionNumber), - 'missing input: one or both of "discussionNumber" or "issueNumber" must be provided' + 'missing input: one or both of "discussionNumber" or "issueNumber" must be provided', ); if (inputWasProvided(issueNumber)) { assert( /^\d+$/.test(issueNumber), - 'invalid input provided for "issueNumber": not a valid integer' + 'invalid input provided for "issueNumber": not a valid integer', ); issueNumber = parseInt(issueNumber, 10); @@ -74,8 +74,8 @@ try { assert( /^\d+$/.test( discussionNumber, - 'invalid input provided for "discussionNumber": not a valid integer' - ) + 'invalid input provided for "discussionNumber": not a valid integer', + ), ); discussionNumber = parseInt(discussionNumber, 10); @@ -90,7 +90,7 @@ try { } else { assert( /^[123456]$/.test(headerLevel), - `invalid input provided for "headerLevel": expected an integer between 1 and 6 inclusive, or "false"` + `invalid input provided for "headerLevel": expected an integer between 1 and 6 inclusive, or "false"`, ); commitTitlePrefix = "#".repeat(parseInt(headerLevel, 10)) + " "; @@ -109,7 +109,7 @@ try { if (typeof issueNumber == "number") await octokit.addIssueComment( await octokit.getIssueOrDiscussionId(owner, name, issueNumber, "issue"), - body + body, ); if (typeof discussionNumber == "number") @@ -118,9 +118,9 @@ try { owner, name, discussionNumber, - "discussion" + "discussion", ), - body + body, ); } } catch (e) { diff --git a/src/utils.js b/src/utils.js index a3f5f0d..81deafc 100644 --- a/src/utils.js +++ b/src/utils.js @@ -21,7 +21,7 @@ export function getOctokit( auth = core.getInput("token", { required: false, trimWhitespace: true, - }) + }), ) { const methods = { getIssueOrDiscussionId: (() => { @@ -44,7 +44,7 @@ export function getOctokit( } } `, - { owner: repoOwner, name: repoName, number } + { owner: repoOwner, name: repoName, number }, ) ).repository[which].id); }; @@ -67,7 +67,7 @@ export function getOctokit( } } `, - { input: { subjectId: issueId, body: comment } } + { input: { subjectId: issueId, body: comment } }, ) ).addComment.commentEdge.node.url; }, @@ -89,7 +89,7 @@ export function getOctokit( body: comment, discussionId, }, - } + }, ) ).addDiscussionComment.comment.url; }, diff --git a/src/utils.spec.js b/src/utils.spec.js index c5a3529..4769a18 100644 --- a/src/utils.spec.js +++ b/src/utils.spec.js @@ -22,14 +22,14 @@ test.serial( repoOwner, repoName, issueNum, - "issue" + "issue", ); t.log("id:", id); t.is(typeof id, "string"); t.true(id.length > 0, "id length is 0!"); issueId = id; - } + }, ); test.serial( @@ -39,19 +39,19 @@ test.serial( repoOwner, repoName, discussionNum, - "discussion" + "discussion", ); t.log("id:", id); t.is(typeof id, "string"); t.true(id.length > 0, "id length is 0!"); discussionId = id; - } + }, ); test.serial("addIssueComment()", async (t) => { const expectedUrl = new URL( - `https://github.com/${repoOwner}/${repoName}/issues/${issueNum}#issuecomment-` + `https://github.com/${repoOwner}/${repoName}/issues/${issueNum}#issuecomment-`, ); let url = await octokit.addIssueComment(issueId, "test comment"); @@ -64,7 +64,7 @@ test.serial("addIssueComment()", async (t) => { test.serial("addDiscussionComment()", async (t) => { const expectedUrl = new URL( - `https://github.com/${repoOwner}/${repoName}/discussions/${discussionNum}#discussioncomment-` + `https://github.com/${repoOwner}/${repoName}/discussions/${discussionNum}#discussioncomment-`, ); let url = await octokit.addDiscussionComment(discussionId, "test comment"); diff --git a/test/integration/index.js b/test/integration/index.js index 554b83a..c1efe73 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -67,7 +67,7 @@ test.before(async (t) => { GITHUB_EVENT_NAME: ctx.event, ...this.resolveInputs(ctx.inputs), }, - } + }, ); } } @@ -75,7 +75,7 @@ test.before(async (t) => { Harness.actionYAML = yaml.load(await readFile("action.yml", "utf8")); tmpDir = await mkdtemp( - os.tmpdir().replace(new RegExp(`${path.sep}+$`, "u"), "") + path.sep + "bc" + os.tmpdir().replace(new RegExp(`${path.sep}+$`, "u"), "") + path.sep + "bc", ); t.context.defaultHarness = new Harness({ @@ -94,7 +94,7 @@ test.after.always("cleanup: remove temp dir", async (t) => { test("smoke test: encounters no errors and exits zero/cleanly", async (t) => { await t.notThrowsAsync( - t.context.defaultHarness.run({ inputs: { issueNumber: testIssue } }) + t.context.defaultHarness.run({ inputs: { issueNumber: testIssue } }), ); }); @@ -108,13 +108,13 @@ test(`if event != "push": don't error but quickly bail/exit 0 and print warning` t.context.defaultHarness.run({ event: "release", payload: { action: "created" }, - }) + }), ); const result = await promise; t.regex( result.stdout, - /^\s*::\s*warning.*(?:title=|::)\s*unsupported\s*event/iu + /^\s*::\s*warning.*(?:title=|::)\s*unsupported\s*event/iu, ); });