Skip to content

Commit 9f5b671

Browse files
committed
update
1 parent f871c13 commit 9f5b671

File tree

27 files changed

+139
-105
lines changed

27 files changed

+139
-105
lines changed

.eslintrc

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
11
{
2-
"extends": ["eslint-config-unjs"]
2+
"extends": ["eslint-config-unjs"],
3+
"rules": {
4+
"unicorn/no-null": "off",
5+
"require-await": "error",
6+
"unicorn/filename-case": "off",
7+
"unicorn/no-process-exit": "error",
8+
"unicorn/prefer-ternary": "error",
9+
"unicorn/prefer-top-level-await": "off",
10+
"no-useless-constructor": "error",
11+
"@typescript-eslint/no-unused-vars": [
12+
"warn",
13+
{
14+
"argsIgnorePattern": "^_",
15+
"varsIgnorePattern": "^_",
16+
},
17+
],
18+
"@typescript-eslint/no-namespace": "error",
19+
"camelcase": "off",
20+
"unicorn/prefer-code-point": "error",
21+
"unicorn/prefer-string-slice": "off",
22+
"unicorn/prefer-at": "off",
23+
"unicorn/explicit-length-check": "off",
24+
"no-empty": [
25+
"error",
26+
{
27+
"allowEmptyCatch": true,
28+
},
29+
],
30+
"prefer-const": "error",
31+
"unicorn/no-empty-file": "error",
32+
"@typescript-eslint/no-non-null-assertion": "off",
33+
},
334
}

e2e/publish.test.mts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { exec } from "child_process";
2-
import { platform } from "os";
3-
import wp from "wait-port";
1+
/* eslint-disable unicorn/no-process-exit */
2+
import { exec } from "node:child_process";
3+
import { platform } from "node:os";
44
import assert from "node:assert";
5+
import wp from "wait-port";
56
import ezSpawn from "@jsdevtools/ez-spawn";
67
import pushWorkflowRunInProgressFixture from "./fixtures/workflow_run.in_progress.json" with { type: "json" };
78
import prWorkflowRunRequestedFixture from "./fixtures/pr.workflow_run.requested.json" with { type: "json" };
@@ -246,8 +247,8 @@ async function killPort() {
246247
killSignal: "SIGINT",
247248
});
248249
}
249-
} catch (e) {
250-
console.error(e);
250+
} catch (error) {
251+
console.error(error);
251252
c.abort();
252253
process.exit(1);
253254
} finally {

packages/backend/objects.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
import { DurableObjectState } from "@cloudflare/workers-types";
2-
import type { Env } from "nitro-cloudflare-dev";
3-
41
export class Workflows {
5-
constructor(state: DurableObjectState, env: Env) {}
6-
7-
async fetch(request: Request) {
8-
return new Response("Hello World");
9-
}
2+
fetch() { return new Response("Hello World"); }
103
}

packages/backend/script/ci.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import fs from "fs/promises";
1+
import fs from "node:fs/promises";
22
if (process.env.CI) {
3-
const content = Object.entries(process.env)
3+
const content = [...Object.entries(process.env)
44
.filter(([k]) => k.startsWith("NITRO"))
5-
.map(([k, v]) => `${k}="${v}"`)
6-
.concat(["NITRO_TEST=true", "GITHUB_TOKEN=" + process.env.GITHUB_TOKEN!])
5+
.map(([k, v]) => `${k}="${v}"`), "NITRO_TEST=true", "GITHUB_TOKEN=" + process.env.GITHUB_TOKEN!]
76
.join("\n");
87
await fs.writeFile(".dev.vars", content);
98
}

packages/backend/script/octokit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import esbuild from "esbuild";
21
import { fileURLToPath } from "node:url";
2+
import esbuild from "esbuild";
33
import { polyfillNode } from "esbuild-plugin-polyfill-node";
44

55
await esbuild.build({

packages/backend/script/update-webhook-url.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const octokit = new Octokit({
2626
auth: jwtToken,
2727
});
2828

29-
let {
29+
const {
3030
data: { url },
3131
} = await octokit.request("GET /app/hook/config");
3232

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default defineEventHandler((event) => {
22
if (handleCors(event, {})) {
3-
return;
3+
console.log('CORS was successfully handled');
44
}
55
});

packages/backend/server/octokit.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ import { createAppAuth } from "@octokit/auth-app";
2727
import { OAuthApp } from "@octokit/oauth-app";
2828
import { Webhooks, type EmitterWebhookEvent } from "@octokit/webhooks";
2929

30+
import type { Octokit } from "@octokit/core";
31+
import { createUnauthenticatedAuth } from "@octokit/auth-unauthenticated";
32+
33+
// https://github.com/octokit/app.js/blob/main/src/types.ts
34+
import type { Endpoints } from "@octokit/types";
35+
3036
type Constructor<T> = new (...args: any[]) => T;
3137

3238
type OctokitType<TOptions extends Options> =
@@ -64,6 +70,7 @@ export class App<TOptions extends Options = Options> {
6470
clientType: "github-app";
6571
Octokit: OctokitClassType<TOptions>;
6672
}>;
73+
6774
log: {
6875
debug: (message: string, additionalInfo?: object) => void;
6976
info: (message: string, additionalInfo?: object) => void;
@@ -136,9 +143,6 @@ export class App<TOptions extends Options = Options> {
136143
}
137144
}
138145

139-
import type { Octokit } from "@octokit/core";
140-
import { createUnauthenticatedAuth } from "@octokit/auth-unauthenticated";
141-
142146
export function webhooks(
143147
appOctokit: Octokit,
144148
options: Required<Options>["webhooks"],
@@ -173,12 +177,12 @@ export function webhooks(
173177
return new auth.octokit.constructor({
174178
...auth.octokitOptions,
175179
authStrategy: createAppAuth,
176-
...{
180+
177181
auth: {
178182
...auth,
179183
installationId,
180-
},
181-
},
184+
}
185+
,
182186
});
183187
},
184188
})) as Octokit;
@@ -201,9 +205,6 @@ export function webhooks(
201205
});
202206
}
203207

204-
// https://github.com/octokit/app.js/blob/main/src/types.ts
205-
import type { Endpoints } from "@octokit/types";
206-
207208
export type Options = {
208209
appId?: number | string;
209210
privateKey?: string;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default defineNitroPlugin((nitro) => {
2-
nitro.hooks.hook("error", async (error, { event }) => {
2+
nitro.hooks.hook("error", (error, { event }) => {
33
console.error(`${event?.path} Application error:`, error);
44
});
55
});

packages/backend/server/routes/[owner]/[repo]/[npmOrg]/[packageAndRefOrSha].get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type Params = Omit<WorkflowData, "sha" | "isPullRequest" | "ref"> & {
55
packageAndRefOrSha: string;
66
};
77

8-
export default eventHandler(async (event) => {
8+
export default eventHandler((event) => {
99
const params = getRouterParams(event) as Params;
1010
const [noScopePackageName, refOrSha] = params.packageAndRefOrSha.split("@");
1111
const packageName = params.npmOrg + "/" + noScopePackageName;

0 commit comments

Comments
 (0)