Skip to content

Commit 18b30d1

Browse files
fix: format code blocks
1 parent 6413220 commit 18b30d1

File tree

7 files changed

+37
-23
lines changed

7 files changed

+37
-23
lines changed

content/graphql/interfaces.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Field, ID, InterfaceType } from '@nestjs/graphql';
1111

1212
@InterfaceType()
1313
export abstract class Character {
14-
@Field(type => ID)
14+
@Field((type) => ID)
1515
id: string;
1616

1717
@Field()
@@ -58,7 +58,7 @@ To provide a customized `resolveType()` function, pass the `resolveType` propert
5858
},
5959
})
6060
export abstract class Book {
61-
@Field(type => ID)
61+
@Field((type) => ID)
6262
id: string;
6363

6464
@Field()

content/graphql/mapped-types.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ We can pick a set of properties from this class using the `PickType()` utility f
6464

6565
```typescript
6666
@InputType()
67-
export class UpdateEmailInput extends PickType(CreateUserInput, ['email'] as const) {}
67+
export class UpdateEmailInput extends PickType(CreateUserInput, [
68+
'email',
69+
] as const) {}
6870
```
6971

7072
> info **Hint** The `PickType()` function is imported from the `@nestjs/graphql` package.
@@ -91,7 +93,9 @@ We can generate a derived type that has every property **except** `email` as sho
9193

9294
```typescript
9395
@InputType()
94-
export class UpdateUserInput extends OmitType(CreateUserInput, ['email'] as const) {}
96+
export class UpdateUserInput extends OmitType(CreateUserInput, [
97+
'email',
98+
] as const) {}
9599
```
96100

97101
> info **Hint** The `OmitType()` function is imported from the `@nestjs/graphql` package.
@@ -124,7 +128,10 @@ We can generate a new type that combines all properties in both types.
124128

125129
```typescript
126130
@InputType()
127-
export class UpdateUserInput extends IntersectionType(CreateUserInput, AdditionalUserInfo) {}
131+
export class UpdateUserInput extends IntersectionType(
132+
CreateUserInput,
133+
AdditionalUserInfo,
134+
) {}
128135
```
129136

130137
> info **Hint** The `IntersectionType()` function is imported from the `@nestjs/graphql` package.

content/recipes/mikroorm.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,11 @@ export class Book {
196196

197197
@Property({ persist: false }) // Similar to class-transformer's `@Expose()`. Will only exist in memory, and will be serialized.
198198
count?: number;
199-
200-
@ManyToOne({ serializer: value => value.name, serializedName: 'authorName' }) // Equivalent of class-transformer's `@Transform()`
199+
200+
@ManyToOne({
201+
serializer: (value) => value.name,
202+
serializedName: 'authorName',
203+
}) // Equivalent of class-transformer's `@Transform()`
201204
author: Author;
202205
}
203206
```

content/recipes/prisma.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,7 @@ import { INestApplication, Injectable, OnModuleInit } from '@nestjs/common';
250250
import { PrismaClient } from '@prisma/client';
251251

252252
@Injectable()
253-
export class PrismaService extends PrismaClient
254-
implements OnModuleInit {
255-
253+
export class PrismaService extends PrismaClient implements OnModuleInit {
256254
async onModuleInit() {
257255
await this.$connect();
258256
}
@@ -274,16 +272,15 @@ Still inside the `src` directory, create a new file called `user.service.ts` and
274272
```typescript
275273
import { Injectable } from '@nestjs/common';
276274
import { PrismaService } from './prisma.service';
277-
import {
278-
User,
279-
Prisma
280-
} from '@prisma/client';
275+
import { User, Prisma } from '@prisma/client';
281276

282277
@Injectable()
283278
export class UserService {
284279
constructor(private prisma: PrismaService) {}
285280

286-
async user(userWhereUniqueInput: Prisma.UserWhereUniqueInput): Promise<User | null> {
281+
async user(
282+
userWhereUniqueInput: Prisma.UserWhereUniqueInput,
283+
): Promise<User | null> {
287284
return this.prisma.user.findUnique({
288285
where: userWhereUniqueInput,
289286
});
@@ -340,16 +337,15 @@ Still inside the `src` directory, create a new file called `post.service.ts` and
340337
```typescript
341338
import { Injectable } from '@nestjs/common';
342339
import { PrismaService } from './prisma.service';
343-
import {
344-
Post,
345-
Prisma,
346-
} from '@prisma/client';
340+
import { Post, Prisma } from '@prisma/client';
347341

348342
@Injectable()
349343
export class PostService {
350344
constructor(private prisma: PrismaService) {}
351345

352-
async post(postWhereUniqueInput: Prisma.PostWhereUniqueInput): Promise<Post | null> {
346+
async post(
347+
postWhereUniqueInput: Prisma.PostWhereUniqueInput,
348+
): Promise<Post | null> {
353349
return this.prisma.post.findUnique({
354350
where: postWhereUniqueInput,
355351
});

content/security/authorization.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ export class CaslAbilityFactory {
252252

253253
return build({
254254
// Read https://casl.js.org/v5/en/guide/subject-type-detection#use-classes-as-subject-types for details
255-
detectSubjectType: item => item.constructor as ExtractSubjectType<Subjects>
255+
detectSubjectType: (item) =>
256+
item.constructor as ExtractSubjectType<Subjects>,
256257
});
257258
}
258259
}

content/security/helmet.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ await app.register(fastifyHelmet);
4545
> contentSecurityPolicy: {
4646
> directives: {
4747
> defaultSrc: [`'self'`],
48-
> styleSrc: [`'self'`, `'unsafe-inline'`, 'cdn.jsdelivr.net', 'fonts.googleapis.com'],
48+
> styleSrc: [
49+
> `'self'`,
50+
> `'unsafe-inline'`,
51+
> 'cdn.jsdelivr.net',
52+
> 'fonts.googleapis.com',
53+
> ],
4954
> fontSrc: [`'self'`, 'fonts.gstatic.com'],
5055
> imgSrc: [`'self'`, 'data:', 'cdn.jsdelivr.net'],
5156
> scriptSrc: [`'self'`, `https: 'unsafe-inline'`, `cdn.jsdelivr.net`],

content/techniques/mongo.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,9 @@ Middleware (also called pre and post hooks) are functions which are passed contr
265265
name: Cat.name,
266266
useFactory: () => {
267267
const schema = CatsSchema;
268-
schema.pre('save', function() { console.log('Hello from pre save') });
268+
schema.pre('save', function () {
269+
console.log('Hello from pre save');
270+
});
269271
return schema;
270272
},
271273
},

0 commit comments

Comments
 (0)