Skip to content

Commit 241b631

Browse files
Run prettier (#488)
1 parent 1329ee7 commit 241b631

68 files changed

Lines changed: 557 additions & 523 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"typescript.tsdk": "node_modules/typescript/lib"
3-
}
2+
"typescript.tsdk": "node_modules/typescript/lib"
3+
}

cdk/jest.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module.exports = {
2-
testEnvironment: 'node',
3-
roots: ['<rootDir>/test'],
4-
testMatch: ['**/*.test.ts'],
2+
testEnvironment: "node",
3+
roots: ["<rootDir>/test"],
4+
testMatch: ["**/*.test.ts"],
55
transform: {
6-
'^.+\\.tsx?$': 'ts-jest'
7-
}
6+
"^.+\\.tsx?$": "ts-jest",
7+
},
88
};

cdk/lambdas/imageResize.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ exports.handler = async (event) => {
3737
Bucket: bucket,
3838
Key: targetKey,
3939
Body: resizedImage,
40-
})
40+
}),
4141
);
4242

4343
return {

cdk/lib/app-stack.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class AppStack extends cdk.Stack {
2828
const domainName = ssm.StringParameter.valueForStringParameter(
2929
this,
3030
`/env/domainName`,
31-
1
31+
1,
3232
);
3333

3434
const wwwDomainName = `www.${domainName}`;
@@ -49,7 +49,7 @@ export class AppStack extends cdk.Stack {
4949
effect: iam.Effect.ALLOW,
5050
actions: ["s3:*Object", "SES:*"],
5151
resources: ["*"],
52-
})
52+
}),
5353
);
5454

5555
taskDef
@@ -65,36 +65,36 @@ export class AppStack extends cdk.Stack {
6565
ssm.StringParameter.fromSecureStringParameterAttributes(
6666
this,
6767
"dbUrl",
68-
{ parameterName: "/env/db/dbUrl", version: 1 }
69-
)
68+
{ parameterName: "/env/db/dbUrl", version: 1 },
69+
),
7070
),
7171
GITHUB_SECRET: ecs.Secret.fromSsmParameter(
7272
ssm.StringParameter.fromStringParameterName(
7373
this,
7474
"githubSecret",
75-
"/env/githubSecret"
76-
)
75+
"/env/githubSecret",
76+
),
7777
),
7878
GITHUB_ID: ecs.Secret.fromSsmParameter(
7979
ssm.StringParameter.fromStringParameterName(
8080
this,
8181
"githubId",
82-
"/env/githubId"
83-
)
82+
"/env/githubId",
83+
),
8484
),
8585
NEXTAUTH_SECRET: ecs.Secret.fromSsmParameter(
8686
ssm.StringParameter.fromStringParameterName(
8787
this,
8888
"nextauthSecret",
89-
"/env/nextauthSecret"
90-
)
89+
"/env/nextauthSecret",
90+
),
9191
),
9292
DISCORD_INVITE_URL: ecs.Secret.fromSsmParameter(
9393
ssm.StringParameter.fromStringParameterName(
9494
this,
9595
"discordInviteUrl",
96-
"/env/discordInviteUrl"
97-
)
96+
"/env/discordInviteUrl",
97+
),
9898
),
9999
},
100100
logging: ecs.LogDrivers.awsLogs({
@@ -115,7 +115,7 @@ export class AppStack extends cdk.Stack {
115115
cpu: production ? 256 : 256, // Can alter if need more
116116
publicLoadBalancer: true,
117117
protocol: elbv2.ApplicationProtocol.HTTP,
118-
}
118+
},
119119
);
120120

121121
fargateService.listener.addAction("DefaultListenerRule", {
@@ -158,7 +158,7 @@ export class AppStack extends cdk.Stack {
158158

159159
fargateService.service.connections.allowFromAnyIpv4(
160160
ec2.Port.tcp(this.appPort),
161-
"app-inbound"
161+
"app-inbound",
162162
);
163163

164164
this.loadbalancer = fargateService.loadBalancer;

cdk/lib/cdn-stack.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ export class CdnStack extends cdk.Stack {
2020
const domainName = ssm.StringParameter.valueForStringParameter(
2121
this,
2222
`/env/domainName`,
23-
1
23+
1,
2424
);
2525

2626
const hostedZoneId = ssm.StringParameter.valueForStringParameter(
2727
this,
2828
`/env/hostedZoneId`,
29-
1
29+
1,
3030
);
3131

3232
const wwwDomainName = `www.${domainName}`;
@@ -70,12 +70,12 @@ export class CdnStack extends cdk.Stack {
7070
certificate,
7171
{
7272
aliases: [domainName],
73-
}
73+
},
7474
),
7575
comment: `Redirect to ${wwwDomainName} from ${domainName}`,
7676
priceClass: cloudfront.PriceClass.PRICE_CLASS_ALL,
7777
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
78-
}
78+
},
7979
);
8080

8181
const webDistribution = new cloudfront.CloudFrontWebDistribution(
@@ -120,34 +120,34 @@ export class CdnStack extends cdk.Stack {
120120
certificate,
121121
{
122122
aliases: [wwwDomainName],
123-
}
123+
},
124124
),
125125
comment: `Web distribution for ${wwwDomainName}`,
126126
priceClass: cloudfront.PriceClass.PRICE_CLASS_ALL,
127127
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
128-
}
128+
},
129129
);
130130

131131
const redirectRecordProps = {
132132
zone,
133133
recordName: domainName,
134134
target: route53.RecordTarget.fromAlias(
135-
new targets.CloudFrontTarget(redirectDist)
135+
new targets.CloudFrontTarget(redirectDist),
136136
),
137137
};
138138

139139
new route53.ARecord(this, "ARedirectAliasRecord", redirectRecordProps);
140140
new route53.AaaaRecord(
141141
this,
142142
"AaaaRedirectAliasRecord",
143-
redirectRecordProps
143+
redirectRecordProps,
144144
);
145145

146146
const recordProps = {
147147
zone,
148148
recordName: wwwDomainName,
149149
target: route53.RecordTarget.fromAlias(
150-
new targets.CloudFrontTarget(webDistribution)
150+
new targets.CloudFrontTarget(webDistribution),
151151
),
152152
};
153153

cdk/lib/pipeline-stack.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ export class PipelineStack extends cdk.Stack {
2828

2929
const devAccountId = ssm.StringParameter.valueFromLookup(
3030
this,
31-
`/env/dev/accountId`
31+
`/env/dev/accountId`,
3232
);
3333

3434
const prodAccountId = ssm.StringParameter.valueFromLookup(
3535
this,
36-
`/env/prod/accountId`
36+
`/env/prod/accountId`,
3737
);
3838

3939
const defaultRegion = "eu-west-1";

cdk/lib/storage-stack.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class StorageStack extends cdk.Stack {
3333
const bucketName = ssm.StringParameter.valueForStringParameter(
3434
this,
3535
"/env/bucketname",
36-
1
36+
1,
3737
);
3838

3939
this.originAccessIdentity = new OriginAccessIdentity(this, "OAI", {
@@ -77,19 +77,19 @@ export class StorageStack extends cdk.Stack {
7777
new S3EventSource(this.bucket, {
7878
events: [s3.EventType.OBJECT_CREATED],
7979
filters: [{ prefix: "u/" }],
80-
})
80+
}),
8181
);
8282

8383
const dbUsername = ssm.StringParameter.valueForStringParameter(
8484
this,
8585
"/env/db/username",
86-
1
86+
1,
8787
);
8888

8989
const dbName = ssm.StringParameter.valueForStringParameter(
9090
this,
9191
"/env/db/name",
92-
1
92+
1,
9393
);
9494

9595
// RDS
@@ -101,15 +101,15 @@ export class StorageStack extends cdk.Stack {
101101
}),
102102
credentials: rds.Credentials.fromPassword(
103103
dbUsername,
104-
cdk.SecretValue.ssmSecure("/env/db/password", "1")
104+
cdk.SecretValue.ssmSecure("/env/db/password", "1"),
105105
),
106106
vpc: vpc,
107107
vpcSubnets: vpc.selectSubnets({
108108
subnetType: ec2.SubnetType.PUBLIC,
109109
}),
110110
instanceType: ec2.InstanceType.of(
111111
ec2.InstanceClass.T4G,
112-
ec2.InstanceSize.MICRO
112+
ec2.InstanceSize.MICRO,
113113
),
114114
allocatedStorage: 20,
115115
maxAllocatedStorage: 100,

cdk/tsconfig.json

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
"jsx": "react",
44
"target": "ES2020",
55
"module": "commonjs",
6-
"lib": [
7-
"es2020", "dom"
8-
],
6+
"lib": ["es2020", "dom"],
97
"esModuleInterop": true,
108
"declaration": true,
119
"strict": true,
@@ -21,13 +19,7 @@
2119
"inlineSources": true,
2220
"experimentalDecorators": true,
2321
"strictPropertyInitialization": false,
24-
"typeRoots": [
25-
"./node_modules/@types"
26-
]
22+
"typeRoots": ["./node_modules/@types"]
2723
},
28-
"exclude": [
29-
"lambdas",
30-
"node_modules",
31-
"cdk.out"
32-
]
24+
"exclude": ["lambdas", "node_modules", "cdk.out"]
3325
}

components/ArticleSearch/SearchBar.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
interface Props {
32
searchTerm: string;
43
setSearchTerm: React.Dispatch<React.SetStateAction<string>>;
@@ -10,7 +9,7 @@ const SearchBar = (props: Props) => {
109
console.log(searchTerm);
1110

1211
return (
13-
<div className='flex grow justify-end'>
12+
<div className="flex grow justify-end">
1413
<label htmlFor="searchInput" aria-label="Enter search term"></label>
1514
<input
1615
onChange={(e) => setSearchTerm(e.target.value)}

components/Comments/CommentsArea.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ const CommentsArea = ({ postId, postOwnerId }: Props) => {
116116
const onSubmit = async (
117117
body: string,
118118
parentId: number | undefined,
119-
fieldName: FieldName
119+
fieldName: FieldName,
120120
) => {
121121
// vaidate markdoc syntax
122122
const ast = Markdoc.parse(body);
123123
const errors = Markdoc.validate(ast, config).filter(
124-
(e) => e.error.level === "critical"
124+
(e) => e.error.level === "critical",
125125
);
126126

127127
if (errors.length > 0) {
@@ -164,7 +164,7 @@ const CommentsArea = ({ postId, postOwnerId }: Props) => {
164164

165165
const generateComments = (
166166
commentsArr: Comments | Children | undefined,
167-
depth = 0
167+
depth = 0,
168168
) => {
169169
if (!commentsArr) return null;
170170
return commentsArr.map(
@@ -196,7 +196,7 @@ const CommentsArea = ({ postId, postOwnerId }: Props) => {
196196
year: "numeric",
197197
month: "long",
198198
day: "numeric",
199-
}
199+
},
200200
);
201201

202202
const commentUpdated =
@@ -321,7 +321,7 @@ const CommentsArea = ({ postId, postOwnerId }: Props) => {
321321
// TODO: Add alert to confirm reset if there is already content being written
322322
resetField("reply");
323323
setShowCommentBoxId((currentId) =>
324-
currentId === id ? null : id
324+
currentId === id ? null : id,
325325
);
326326
}
327327
}}
@@ -362,7 +362,7 @@ const CommentsArea = ({ postId, postOwnerId }: Props) => {
362362
)}
363363
</section>
364364
);
365-
}
365+
},
366366
);
367367
};
368368

@@ -415,7 +415,7 @@ const CommentsArea = ({ postId, postOwnerId }: Props) => {
415415
React,
416416
{
417417
components: markdocComponents,
418-
}
418+
},
419419
)}
420420
</article>
421421
) : (

0 commit comments

Comments
 (0)