Skip to content

Commit 2e0c220

Browse files
committed
Upgrade CYF ESLint config and fix violations
1 parent ddb2a2a commit 2e0c220

File tree

8 files changed

+72
-19
lines changed

8 files changed

+72
-19
lines changed

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default [
1414
reportUnusedDisableDirectives: "error",
1515
},
1616
},
17-
cyfConfig,
17+
...cyfConfig.configs.standard,
1818
...tsEslint.configs.strict,
1919
...tsEslint.configs.stylistic,
2020
...typeScriptOnly(

package-lock.json

Lines changed: 58 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
"homepage": "https://github.com/CodeYourFuture/gitbot#readme",
3535
"devDependencies": {
36-
"@codeyourfuture/eslint-config-standard": "^5.1.0",
36+
"@codeyourfuture/eslint-config-standard": "^7.0.0",
3737
"@netlify/functions": "^3.0.4",
3838
"@octokit/webhooks-types": "^7.6.1",
3939
"@types/eslint": "^9.6.1",

src/netlify/repo_event.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ describe("repo event handler", () => {
4343
blocks: [
4444
{
4545
text: {
46-
"text": "A new repository <https://github.com/Foo/Bar|`Foo/Bar`> was just created by <https://github.com/octocat|Monalisa Octocat>.",
47-
"type": "mrkdwn",
46+
text: "A new repository <https://github.com/Foo/Bar|`Foo/Bar`> was just created by <https://github.com/octocat|Monalisa Octocat>.",
47+
type: "mrkdwn",
4848
},
4949
type: "section",
5050
},
@@ -191,7 +191,7 @@ describe("repo event handler", () => {
191191
});
192192
});
193193

194-
const createPayload = async (secret: string, event: PingEvent | RepositoryEvent): Promise<{ body: string, signature: string }> => {
194+
const createPayload = async (secret: string, event: PingEvent | RepositoryEvent): Promise<{ body: string; signature: string }> => {
195195
const body = JSON.stringify(event);
196196
const signature = await sign(secret, body);
197197
return { body, signature };

src/netlify/repo_event.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const enum HttpStatus {
99
BAD_REQUEST = 400,
1010
}
1111

12-
type Event = Pick<HandlerEvent, "body" | "headers">
12+
type Event = Pick<HandlerEvent, "body" | "headers">;
1313

1414
const handler = (async (event: Event): Promise<HandlerResponse> => {
1515
let payload: Maybe<Repository>;

src/netlify/slack_interaction.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ describe("slack interaction handler", () => {
8181
expect(getBody(await updateRequest!.text())).toEqual({
8282
blocks: [{
8383
text: {
84-
"text": "A new repository <repoUrl|`owner/repo`> was just created by <userUrl|userName>.",
85-
"type": "mrkdwn",
84+
text: "A new repository <repoUrl|`owner/repo`> was just created by <userUrl|userName>.",
85+
type: "mrkdwn",
8686
},
8787
type: "section",
8888
}],
@@ -154,8 +154,8 @@ describe("slack interaction handler", () => {
154154
expect(getBody(await updateRequest!.text())).toEqual({
155155
blocks: [{
156156
text: {
157-
"text": "A new repository <repoUrl|`owner/repo`> was just created by <userUrl|userName>.",
158-
"type": "mrkdwn",
157+
text: "A new repository <repoUrl|`owner/repo`> was just created by <userUrl|userName>.",
158+
type: "mrkdwn",
159159
},
160160
type: "section",
161161
}],
@@ -165,7 +165,7 @@ describe("slack interaction handler", () => {
165165
});
166166
});
167167

168-
const createPayload = (secret: string, payload: Record<string, string>): { body: string, signature: string, timestamp: number } => {
168+
const createPayload = (secret: string, payload: Record<string, string>): { body: string; signature: string; timestamp: number } => {
169169
const timestamp = Math.floor(Date.now() / 1_000);
170170
const body = new URLSearchParams(payload).toString();
171171
const hmac = createHmac("sha256", secret);

src/slack.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ describe("validatePayload", () => {
106106
body = "",
107107
signature = "",
108108
timestamp = 0,
109-
}: { body?: string, signature?: string, timestamp?: number } = {}): Maybe<MessageRef> => {
109+
}: { body?: string; signature?: string; timestamp?: number } = {}): Maybe<MessageRef> => {
110110
return validatePayload(body, signature, timestamp);
111111
};
112112
});
113113

114-
const sign = (payload: string, secret: string): { signature: string, timestamp: number } => {
114+
const sign = (payload: string, secret: string): { signature: string; timestamp: number } => {
115115
const timestamp = Math.floor(Date.now() / 1_000);
116116
const hmac = createHmac("sha256", secret);
117117
hmac.update(`v0:${timestamp.toFixed(0)}:${payload}`);

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { Maybe } from "./types.js";
22

33
export function getConfig(name: string, required?: true): string;
44
export function getConfig(name: string, required: false): Maybe<string>;
5-
export function getConfig (name: string, required = true): Maybe<string> {
5+
export function getConfig(name: string, required = true): Maybe<string> {
66
const value = process.env[name];
77
if (required && !value) {
88
throw new Error(`missing configuration ${name}`);

0 commit comments

Comments
 (0)