From 9d46e2fabb9bc97969544388efd2a92421c49c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?So=CC=9Bn=20Nguye=CC=82=CC=83n?= Date: Tue, 28 Nov 2023 09:17:01 +0000 Subject: [PATCH 01/11] chore: create pull-request github action --- .github/workflows/pull-request.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 00000000..3d762116 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,17 @@ +name: Check the pull request + +on: + pull_request: + types: [opened, edited] + +jobs: + check-style: + name: Make sure the code follows styling conventions + runs-on: ubuntu-latest + steps: + - name: Checkout source code + uses: actions/checkout@v4 + - name: Install dependencies + run: npm ci + - name: Run ESLint + run: npm run lint From e6b9259a7240f6a9f9e3355d07c81bc5243d80a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?So=CC=9Bn=20Nguye=CC=82=CC=83n?= Date: Tue, 28 Nov 2023 09:29:09 +0000 Subject: [PATCH 02/11] chore: only fix with prettier:fix command --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 0c2d995f..a1b19f47 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "test:jest": "jest --collectCoverage", "studio": "prisma studio", "migrate": "npx prisma migrate", - "prettier": "prettier --write -c '**/*.{ts,tsx,js,jsx,json,json5,scss,css,html,mdx}'", + "prettier": "prettier --check -c '**/*.{ts,tsx,js,jsx,json,json5,scss,css,html,mdx}'", + "prettier:fix": "prettier --write -c '**/*.{ts,tsx,js,jsx,json,json5,scss,css,html,mdx}'", "prepare": "husky install" }, "prisma": { From eb2da5ee061af35167d36685aebbab676666385e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?So=CC=9Bn=20Nguye=CC=82=CC=83n?= Date: Tue, 28 Nov 2023 09:28:12 +0000 Subject: [PATCH 03/11] chore: add prettier check to github action --- .github/workflows/pull-request.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 3d762116..77ec09a9 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -15,3 +15,5 @@ jobs: run: npm ci - name: Run ESLint run: npm run lint + - name: Run Prettier + run: npm run prettier From c93945a6a9622600bdc5760f7eab619c3aa6b0cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?So=CC=9Bn=20Nguye=CC=82=CC=83n?= Date: Tue, 28 Nov 2023 09:31:18 +0000 Subject: [PATCH 04/11] style: fix prettier errors --- app/sitemap.ts | 2 +- cdk/lib/app-stack.ts | 40 +++++++++++++------------- components/ArticleMenu/ArticleMenu.tsx | 6 ++-- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/app/sitemap.ts b/app/sitemap.ts index 8a30571e..20696aaa 100644 --- a/app/sitemap.ts +++ b/app/sitemap.ts @@ -9,4 +9,4 @@ export default async function sitemap() { } catch (error) { Sentry.captureException(error); } -} \ No newline at end of file +} diff --git a/cdk/lib/app-stack.ts b/cdk/lib/app-stack.ts index 34c1e49b..d614e70d 100644 --- a/cdk/lib/app-stack.ts +++ b/cdk/lib/app-stack.ts @@ -28,7 +28,7 @@ export class AppStack extends cdk.Stack { const domainName = ssm.StringParameter.valueForStringParameter( this, `/env/domainName`, - 1 + 1, ); const wwwDomainName = `www.${domainName}`; @@ -55,7 +55,7 @@ export class AppStack extends cdk.Stack { effect: iam.Effect.ALLOW, actions: ["s3:*Object", "SES:*"], resources: ["*"], - }) + }), ); taskDef @@ -72,57 +72,57 @@ export class AppStack extends cdk.Stack { ssm.StringParameter.fromSecureStringParameterAttributes( this, "sentryEnvironment", - { parameterName: "/env/sentry/environment", version: 1 } - ) + { parameterName: "/env/sentry/environment", version: 1 }, + ), ), SENTRY_DSN: ecs.Secret.fromSsmParameter( ssm.StringParameter.fromSecureStringParameterAttributes( this, "sentryDsn", - { parameterName: "/env/sentry/dsn", version: 1 } - ) + { parameterName: "/env/sentry/dsn", version: 1 }, + ), ), DATABASE_URL: ecs.Secret.fromSsmParameter( ssm.StringParameter.fromSecureStringParameterAttributes( this, "dbUrl", - { parameterName: "/env/db/dbUrl", version: 1 } - ) + { parameterName: "/env/db/dbUrl", version: 1 }, + ), ), GITHUB_SECRET: ecs.Secret.fromSsmParameter( ssm.StringParameter.fromStringParameterName( this, "githubSecret", - "/env/githubSecret" - ) + "/env/githubSecret", + ), ), GITHUB_ID: ecs.Secret.fromSsmParameter( ssm.StringParameter.fromStringParameterName( this, "githubId", - "/env/githubId" - ) + "/env/githubId", + ), ), NEXTAUTH_SECRET: ecs.Secret.fromSsmParameter( ssm.StringParameter.fromStringParameterName( this, "nextauthSecret", - "/env/nextauthSecret" - ) + "/env/nextauthSecret", + ), ), DISCORD_INVITE_URL: ecs.Secret.fromSsmParameter( ssm.StringParameter.fromStringParameterName( this, "discordInviteUrl", - "/env/discordInviteUrl" - ) + "/env/discordInviteUrl", + ), ), ADMIN_EMAIL: ecs.Secret.fromSsmParameter( ssm.StringParameter.fromStringParameterName( this, "adminEmail", - "/env/adminEmail" - ) + "/env/adminEmail", + ), ), }, logging: ecs.LogDrivers.awsLogs({ @@ -143,7 +143,7 @@ export class AppStack extends cdk.Stack { cpu: production ? 256 : 256, // Can alter if need more publicLoadBalancer: true, protocol: elbv2.ApplicationProtocol.HTTP, - } + }, ); fargateService.listener.addAction("DefaultListenerRule", { @@ -197,7 +197,7 @@ export class AppStack extends cdk.Stack { fargateService.service.connections.allowFromAnyIpv4( ec2.Port.tcp(this.appPort), - "app-inbound" + "app-inbound", ); this.loadbalancer = fargateService.loadBalancer; diff --git a/components/ArticleMenu/ArticleMenu.tsx b/components/ArticleMenu/ArticleMenu.tsx index f22aac86..0847115f 100644 --- a/components/ArticleMenu/ArticleMenu.tsx +++ b/components/ArticleMenu/ArticleMenu.tsx @@ -159,7 +159,7 @@ const ArticleMenu = ({ /> - +
@@ -205,7 +205,7 @@ const ArticleMenu = ({ {label} -
  • +