@darraghor/eslint-plugin-nestjs-typed 3.20.5 → 3.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,7 +18,9 @@ This plugin only supports typescript up to the version typescript eslint parser
18
18
 
19
19
  ## Index of available rules
20
20
 
21
- (more details for each specific rule are available in sections below)
21
+ Please check the recommended list (https://github.com/darraghoriordan/eslint-plugin-nestjs-typed/blob/main/src/configs/recommended.ts) to check which rules are turned on when using that config.
22
+
23
+ Some rules are opinionated and have to be turned on explicitly.
22
24
 
23
25
  Nest Modules and Dependency Injection
24
26
 
@@ -46,15 +48,17 @@ Security
46
48
  - should-specify-forbid-unknown-values
47
49
  - api-methods-should-be-guarded
48
50
 
49
- ## Why use this package?
51
+ Detailed docs are available here: https://github.com/darraghoriordan/eslint-plugin-nestjs-typed/tree/main/src/docs/rules
50
52
 
51
- If you use NestJs (https://nestjs.com/) then these rules will help you to prevent common bugs and issues. They mostly check that you are using decorators correctly.
53
+ ## Who is this package for?
52
54
 
53
- See the following summaries
55
+ If you use NestJs (https://nestjs.com/) these ESLint rules will help you to prevent common bugs and issues in NestJs applications.
54
56
 
55
- ### 1. Detect Nest Dependency Injection issues
57
+ They mostly check that you are using decorators correctly.
56
58
 
57
- There are some things you don't want to forget when working with Nest dependency injection...
59
+ The three primary groupings of rules in this plugin are...
60
+
61
+ ### 1. Detect Nest Dependency Injection issues
58
62
 
59
63
  The Nest DI is declarative and if you forget to provide an injectable you wont see an error until run time. Nest is good at telling you where these are but sometimes it's not.
60
64
 
@@ -64,11 +68,11 @@ These are described in the "Common Errors" section of the nest js docs.
64
68
 
65
69
  ### 2. Using Open Api / Swagger decorators and automatically generating a clients
66
70
 
67
- When working with NestJS I generate my front end client and models using the swagger generated from the nest controllers and models.
71
+ When working with NestJS I generate my front end client and models using the swagger/Open API specification generated directly from the nest controllers and models.
68
72
 
69
- I have a bunch of rules here that are mostly for strict typing with decorators for those controllers and models.
73
+ I have a bunch of rules here that enforce strict Open API typing with decorators for NestJs controllers and models.
70
74
 
71
- These rules are somewhat opinionated, but necessary for clean model generation if using an Open Api model generator.
75
+ These rules are opinionated, but necessary for clean model generation if using an Open Api client generator later in your build.
72
76
 
73
77
  ### 3. Helping prevent bugs
74
78
 
@@ -99,6 +103,8 @@ npm install class-validator
99
103
  yarn add class-validator
100
104
  ```
101
105
 
106
+ ## To configure
107
+
102
108
  Then update your eslint with the plugin import and add the recommended rule set
103
109
 
104
110
  ```ts
@@ -137,674 +143,3 @@ Disable a single rule with the full name e.g. in your eslint configuration...
137
143
  "off",
138
144
  }
139
145
  ```
140
-
141
- ## Rule Details
142
-
143
- ### Rule: all-properties-have-explicit-defined
144
-
145
- This rule checks that all properties of a class have an appropriate `@IsDefined()` or `@IsOptional()` decorator.
146
-
147
- This rule also checks that both `@IsDefined()` and `@IsOptional()` are not used on the same property because this doesn't make sense.
148
-
149
- The rule will ignore any classes that have 0 class-validator decorators. This is to avoid errors for classes that are not used for validation.
150
-
151
- This PASSES - all properties are decorated correctly
152
-
153
- ```ts
154
- export class CreateOrganisationDto {
155
- @IsDefined()
156
- otherProperty!: MyClass;
157
-
158
- @IsOptional()
159
- someStringProperty?: string;
160
- }
161
- ```
162
-
163
- This PASSES - no class validator decorators are used
164
-
165
- ```ts
166
- export class CreateOrganisationDto {
167
- otherProperty!: MyClass;
168
-
169
- someStringProperty?: string;
170
- }
171
- ```
172
-
173
- This FAILS - missing `@IsOptional()` on `someStringProperty`
174
-
175
- ```ts
176
- export class CreateOrganisationDto {
177
- @IsDefined()
178
- otherProperty!: MyClass;
179
- @IsString()
180
- someStringProperty?: string;
181
- }
182
- ```
183
-
184
- ### Rule: all-properties-are-whitelisted
185
-
186
- You should forbid non-whitelisted properties in your DTOs.
187
-
188
- If you have a DTO that has one property with a class-validator decorator, it's very unlikely that the same DTO will have any properties without a decorator - i.e. ALL DTO properties should be validated or explicitly whitelisted with `@Allow()`.
189
-
190
- This rule will flag any properties that are not whitelisted as expected because it's probably a mistake.
191
-
192
- This PASSES - all properties are decorated
193
-
194
- ```ts
195
- export class CreateOrganisationDto {
196
- @ApiProperty({type: Person, isArray: true})
197
- @ValidateNested({each: true})
198
- members!: MyClass[];
199
-
200
- @ApiProperty()
201
- @Allow()
202
- otherProperty!: MyClass;
203
-
204
- @ApiProperty()
205
- @IsString()
206
- someStringProperty!: string;
207
- }
208
- ```
209
-
210
- This FAILS - one property here is missing a validation decorator. This is likely a mistake.
211
-
212
- ```ts
213
- export class CreateOrganisationDto {
214
- @ApiProperty({type: Person, isArray: true})
215
- @ValidateNested({each: true})
216
- members!: MyClass[];
217
-
218
- @ApiProperty()
219
- otherProperty!: MyClass;
220
- }
221
- ```
222
-
223
- ### Rule: validate-nested-of-array-should-set-each
224
-
225
- If you use the `@ValidateNested` decorator you should specify the `{each: true}` option if the property is an array.
226
-
227
- This PASSES because it's an array and each is set
228
-
229
- ```ts
230
- export class CreateOrganisationDto {
231
- @ApiProperty({type: Person, isArray: true})
232
- @ValidateNested({each: true})
233
- members!: MyClass[];
234
- }
235
- ```
236
-
237
- This PASSES because it's an array and each is set
238
-
239
- ```ts
240
- export class CreateOrganisationDto {
241
- @ApiProperty({type: Person, isArray: true})
242
- @ValidateNested({each: true})
243
- members!: Array<MyClass>;
244
- }
245
- ```
246
-
247
- This PASSES because it's not an array and each is not set
248
-
249
- ```ts
250
- export class CreateOrganisationDto {
251
- @ApiProperty({type: Person, isArray: true})
252
- @ValidateNested()
253
- members!: MyClass;
254
- }
255
- ```
256
-
257
- This FAILS because it's not an array and each is set
258
-
259
- ```ts
260
- export class CreateOrganisationDto {
261
- @ApiProperty({type: Person, isArray: true})
262
- @ValidateNested({each: true})
263
- members!: MyClass;
264
- }
265
- ```
266
-
267
- ### Rule: validated-non-primitive-property-needs-type-decorator
268
-
269
- If you use any of the class validator decorators on a property that is not a primitive, you should tell class-transformer how to transform it into a class first.
270
-
271
- This rule accepts 2 options:
272
-
273
- - `additionalTypeDecorators`: string list of custom type decorators that will be counted as valid for the rule test e.g.
274
-
275
- ```ts
276
- "@darraghor/nestjs-typed/validated-non-primitive-property-needs-type-decorator": [
277
- "error",
278
- {additionalTypeDecorators: ["TransformDate"]},
279
- ],
280
- ```
281
-
282
- - `additionalCustomValidatorDecorators`: string list of custom class-validator decorators which will get recognized as a validator by the plugin. This is especially useful if you have created your own validator outside of the standard ones provided by the library. The example below prevents errors from being raised by the linter if we use the `@IsDateRange` validator on a class property.
283
-
284
- ```ts
285
- "@darraghor/nestjs-typed/validated-non-primitive-property-needs-type-decorator": [
286
- "error",
287
- {additionalCustomValidatorDecorators: ["IsDateRange"]},
288
- ],
289
- ```
290
-
291
- This PASSES because we're validating a Person class and we have added the @Type decorator.
292
-
293
- ```ts
294
- export class CreateOrganisationDto {
295
- @ApiProperty({type: Person, isArray: true})
296
- @IsDefined()
297
- @Type(() => Person)
298
- members!: Person;
299
- }
300
- ```
301
-
302
- This PASSES because it is a primitive type (boolean, string, number). We don't need to tell class-transformer how to transform those.
303
-
304
- ```ts
305
- export class CreateOrganisationDto {
306
- @ApiProperty({type: Person, isArray: true})
307
- @ValidateNested({each: true})
308
- @IsBoolean()
309
- members!: boolean;
310
- }
311
- ```
312
-
313
- This PASSES because we only check properties that have a class-validator decorator (e.g. `@IsDefined()`)
314
-
315
- ```ts
316
- export class CreateOrganisationDto {
317
- @ApiProperty({type: Person, isArray: true})
318
- members!: Person | Date;
319
- }
320
- ```
321
-
322
- This PASSES because it is a primitive array. These don't need `@Type()` decorators.
323
-
324
- ````ts
325
- class ExampleDto {
326
- @ApiProperty({
327
- isArray: true,
328
- })
329
- @Allow()
330
- exampleProperty!: string[];
331
- }
332
- ```
333
-
334
- This FAILS because you should always tell class-transformer the type for an array
335
-
336
- ```ts
337
- export class CreateOrganisationDto {
338
- @ApiProperty({type: Person, isArray: true})
339
- @ValidateNested({each: true})
340
- @IsArray()
341
- members!: (Person | Date)[];
342
- }
343
- ````
344
-
345
- This FAILS because Date is not a primitive type (string, number, boolean)
346
-
347
- ```ts
348
- export class CreateOrganisationDto {
349
- @ApiProperty({type: Person, isArray: true})
350
- @ValidateNested({each: true})
351
- @IsDate()
352
- members!: Date;
353
- }
354
- ```
355
-
356
- ### Rule: param-decorator-name-matches-route-param
357
-
358
- This rule will verify you have entered a `Param("name")` that has a matching url parameter in a controller or method decorator
359
-
360
- NOTE: nestjs allows for fuzzy matching params in paths with `_+?()*` as regex params. This rule doesn't support parsing paths with regex so we will ignore any routes with these characters in them.
361
-
362
- this PASSES because the uuid param is in the `Get()` decorator
363
-
364
- ```ts
365
- @Controller("custom-bot")
366
- export class CustomBotController {
367
- constructor() {}
368
-
369
- @Get(":uuid")
370
- @ApiOkResponse({type: CustomBot})
371
- findOne(
372
- @Param("uuid") uuid: string,
373
- @Request() request: RequestWithUser
374
- ): Promise<CustomBot> {
375
- return this.customBotService.findOne(uuid, request.user.uuid);
376
- }
377
- }
378
- ```
379
-
380
- this PASSES because the uuid param is in the `Controller()` decorator
381
-
382
- ```ts
383
- @Controller("custom-bot/:uuid")
384
- export class CustomBotController {
385
- constructor() {}
386
-
387
- @Get()
388
- @ApiOkResponse({type: CustomBot})
389
- findOne(
390
- @Param("uuid") uuid: string,
391
- @Request() request: RequestWithUser
392
- ): Promise<CustomBot> {
393
- return this.customBotService.findOne(uuid, request.user.uuid);
394
- }
395
- }
396
- ```
397
-
398
- This FAILS because there is a typo in the param decorator
399
-
400
- ```ts
401
- @Controller("custom-bot")
402
- export class CustomBotController {
403
- constructor() {}
404
-
405
- @Get(":uuid")
406
- @ApiOkResponse({type: CustomBot})
407
- findOne(
408
- @Param("uui") uuid: string,
409
- @Request() request: RequestWithUser
410
- ): Promise<CustomBot> {
411
- return this.customBotService.findOne(uuid, request.user.uuid);
412
- }
413
- }
414
- ```
415
-
416
- this FAILS because you shouldn't put the `:` in the param decorator
417
-
418
- ```ts
419
- @Controller("custom-bot")
420
- export class CustomBotController {
421
- constructor() {}
422
-
423
- @Get(":uuid")
424
- @ApiOkResponse({type: CustomBot})
425
- findOne(
426
- @Param(":uuid") uuid: string,
427
- @Request() request: RequestWithUser
428
- ): Promise<CustomBot> {
429
- return this.customBotService.findOne(uuid, request.user.uuid);
430
- }
431
- }
432
- ```
433
-
434
- ### Rule: should-specify-forbid-unknown-values
435
-
436
- This checks when if you are setting ValidationPipe parameters you set forbidUnknownValues to true.
437
-
438
- There is a CVE for class-transformer when using random javascript objects. You need to be careful about configuring the ValidationPipe in NestJs. See
439
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-18413
440
- https://github.com/typestack/class-validator/issues/438
441
-
442
- e.g. this PASSES because the property is set
443
-
444
- ```ts
445
- const validationPipeB = new ValidationPipe({
446
- forbidNonWhitelisted: true,
447
- forbidUnknownValues: true,
448
- });
449
- ```
450
-
451
- this FAILS because property is not set
452
-
453
- ```ts
454
- const validationPipeB = new ValidationPipe({
455
- forbidNonWhitelisted: true,
456
- });
457
- ```
458
-
459
- this FAILS because property is set to false
460
-
461
- ```ts
462
- const validationPipeB = new ValidationPipe({
463
- forbidNonWhitelisted: false,
464
- });
465
- ```
466
-
467
- this PASSES because the default values seem to work ok
468
-
469
- ```ts
470
- const validationPipeB = new ValidationPipe();
471
- ```
472
-
473
- ### Rule: provided-injected-should-match-factory-parameters
474
-
475
- Checks that there are the same number of injected items in a Provider that are passed to the factory method
476
-
477
- PASSES because `Myservice` injected and `myservice` used in factory params
478
-
479
- ```ts
480
- export const MyOtherInjectableProvider: NotAProvider = {
481
- provide: MyOtherInjectable,
482
- useFactory: async (config: MyService): Promise<MyOtherInjectable> => {
483
- return new MyOtherInjectable();
484
- },
485
- inject: [MyService],
486
- };
487
- ```
488
-
489
- FAILS because SecondService is not used in the factory - this is probably a developer error where they meant to inject the second service.
490
-
491
- ```ts
492
- export const MyOtherInjectableProvider: Provider = {
493
- provide: MyOtherInjectable,
494
- useFactory: async (config: MyService): Promise<MyOtherInjectable> => {
495
- return new MyOtherInjectable();
496
- },
497
- inject: [MyService, SecondService],
498
- };
499
- ```
500
-
501
- FAILS because SecondService isn't injected in the factory - this is probably a developer error where they meant to inject the second service.
502
-
503
- Of course you can ignore this warning if SecondService is `@Global()`
504
-
505
- ```ts
506
- export const MyOtherInjectableProvider: Provider = {
507
- provide: MyOtherInjectable,
508
- useFactory: async (
509
- config: MyService,
510
- secondService: SecondService
511
- ): Promise<MyOtherInjectable> => {
512
- return new MyOtherInjectable();
513
- },
514
- inject: [MyService],
515
- };
516
- ```
517
-
518
- ### Rule: injectable-should-be-provided
519
-
520
- Checks that a class marked with `@Injectable` is injected somewhere in a module or used in a provider.
521
-
522
- NestJS will catch these at runtime but I prefer to get a nudge during development in my IDE. This will only check if the service is injected once. It won't check that the correct things are injected to the correct modules. So you might still get occasional runtime issues if you forget to import a module.
523
-
524
- Fails if a thing marked as `@Injectable` is not in the `providers` of a module or `provides` in a provider.
525
-
526
- This rule only works with ArrayExpression assignment for the lists of providers. e.g.
527
-
528
- ```
529
- // This works ok. We assign an array directly to the providers
530
-
531
- @Module({
532
- imports: [],
533
- providers: [MyProvider],
534
- })
535
- export class ProviderArrayModule {}
536
- ```
537
-
538
- ```
539
- // the rule will not follow this type of assignment with a variable or import to check which providers are in the variable reference.
540
-
541
- const providers = [ExampleProviderIncludedInModule];
542
-
543
- @Module({
544
- imports: [],
545
- providers: providers,
546
- })
547
- export class ProviderArrayModule {}
548
- ```
549
-
550
- There is some additional configuration you can (and should!) provide for this rule. This is the default setting. You should over ride this with your src directory and any strings to filter out from paths (note that the `filterFromPaths` are NOT globs - just matched strings).
551
-
552
- ```ts
553
- "@darraghor/nestjs-typed/injectable-should-be-provided": [
554
- "error",
555
- {
556
- src: ["src/**/*.ts"],
557
- filterFromPaths: ["node_modules", ".test.", ".spec."],
558
- },
559
- ],
560
- ```
561
-
562
- ### Rule: api-property-matches-property-optionality
563
-
564
- This checks that you have added the correct api property decorator for your swagger documents.
565
-
566
- There are specific, distinct decorators for optional properties and mandatory properties.
567
-
568
- Using the correct one affects Open Api doc generation.
569
-
570
- The following FAILS because this is an optional property and should have `@ApiPropertyOptional`
571
-
572
- ```ts
573
- class TestClass {
574
- @Expose()
575
- @ApiProperty()
576
- thisIsAStringProp?: string;
577
- }
578
- ```
579
-
580
- The following FAILS because this is an optional property and should have `@ApiPropertyOptional`
581
-
582
- ```ts
583
- class TestClass {
584
- @Expose()
585
- @ApiProperty()
586
- thisIsAStringProp: string | undefined;
587
- }
588
- ```
589
-
590
- The following FAILS because this is a required property and should have `@ApiProperty`. It's not really an optional property but it is from an api DTO transformation perspective.
591
-
592
- ```ts
593
- class TestClass {
594
- @Expose()
595
- @ApiPropertyOptional()
596
- thisIsAStringProp!: string;
597
- }
598
- ```
599
-
600
- ### Rule: controllers-should-supply-api-tags
601
-
602
- If you have more than a handful of api methods the swagger UI is difficult to navigate. It's easier to group api methods by using tags.
603
-
604
- This enforces api tags on controllers.
605
-
606
- This PASSES because it has api tags
607
-
608
- ```ts
609
- @ApiTags("my-group-of-methods")
610
- @Controller("my-controller")
611
- class TestClass {}
612
- ```
613
-
614
- The following FAILS because it's missing api tags
615
-
616
- ```ts
617
- @Controller("my-controller")
618
- class TestClass {}
619
- ```
620
-
621
- ### Rule: api-method-should-specify-api-response
622
-
623
- If you have an api method like @Get() you should specify the return status code (and type!) by using @ApiResponse and the other expected responses.
624
-
625
- Note: I often leave out 400s and 500s because it's kind of assumed, but these decorators should be used if the return type changes in your api for 400/500 etc!
626
-
627
- This PASSES
628
-
629
- ```ts
630
- class TestClass {
631
- @Get()
632
- @ApiResponse({status: 200, type: String})
633
- @ApiBadRequestResponse({description: "Bad Request"})
634
- public getAll(): Promise<string[]> {
635
- return [];
636
- }
637
- }
638
- ```
639
-
640
- The following FAILS because it's missing api response decorators
641
-
642
- ```ts
643
- class TestClass {
644
- @Get()
645
- public getAll(): Promise<string[]> {
646
- return [];
647
- }
648
- }
649
- ```
650
-
651
- ### Rule: api-enum-property-best-practices
652
-
653
- If you use enums on properties you should set the correct open api properties in the ApiProperty decorator.
654
-
655
- If you don't use `enum` open api won't use the enum correctly.
656
-
657
- If you don't use `enumName` then Open api will create a new enum for each api method. e.g. `ControllerNameEnumName`, This is awful to use as a consumer of a generated client.
658
-
659
- You don't need to use `type:` any more. This used to be necessary in old versions to get enum strings correctly output.
660
-
661
- The enumName should match the enum type you specify. It's easier to match them up when working on BE and FE. And it reduces chance for typos resulting in duplicate enums.
662
-
663
- PASSES - This is a perfect enum description
664
-
665
- ```ts
666
- class TestClass {
667
- @ApiPropertyOptional({enum: MyEnum, enumName: "MyEnum"})
668
- thisIsAnEnumProp?: MyEnum;
669
- }
670
- ```
671
-
672
- FAILS - you don't need type
673
-
674
- ```ts
675
- class TestClass {
676
- @ApiPropertyOptional({type: MyEnum, enum: MyEnum, enumName: "MyEnum"})
677
- thisIsAnEnumProp?: MyEnum;
678
- }
679
- ```
680
-
681
- FAILS - you need to add a name
682
-
683
- ```ts
684
- class TestClass {
685
- @ApiPropertyOptional({enum: MyEnum})
686
- thisIsAnEnumProp?: MyEnum;
687
- }
688
- ```
689
-
690
- FAILS - the enumName doesn't match the enumType
691
-
692
- ```ts
693
- class MyClass {
694
- @ApiProperty({enumName: "MyEnumTYPO", enum: MyEnum})
695
- public myProperty!: MyEnum;
696
- }
697
- ```
698
-
699
- ### Rule: api-property-returning-array-should-set-array
700
-
701
- If you return an array you should indicate this in the api property. There are two ways to do this
702
-
703
- `ApiProperty({type:[String]}) OR ApiProperty({type:String, isArray:true})`
704
-
705
- I enforce the second long way! You can turn this rule off if you prefer the shorthand way, but you won't get warned if you missed the array specification.
706
-
707
- This PASSES - property is array and specifies isArray
708
-
709
- ```ts
710
- class TestClass {
711
- @ApiPropertyOptional({enumName: "MyEnum" isArray:true})
712
- thisIsAProp!: MyEnum[];
713
- }
714
- ```
715
-
716
- This PASSES - property is array and specifies isArray
717
-
718
- ```ts
719
- class TestClass {
720
- @ApiPropertyOptional({type: String, isArray: true})
721
- thisIsAProp!: Array<string>;
722
- }
723
- ```
724
-
725
- This FAILS - missing isArray
726
-
727
- ```ts
728
- class TestClass {
729
- @ApiPropertyOptional({type: String})
730
- thisIsAProp!: Array<string>;
731
- }
732
- ```
733
-
734
- This FAILS - doesn't need isArray
735
-
736
- ```ts
737
- class TestClass {
738
- @ApiPropertyOptional({type: String, isArray: true})
739
- thisIsAProp!: string;
740
- }
741
- ```
742
-
743
- ### Rule: api-methods-should-be-guarded
744
-
745
- If you require authentication, and don't use a global guard, you should be explicit about how each controller or endpoint is protected, and a UseGuards annotation should cover each.
746
-
747
- NOTE: This rule is context-dependent (i.e. it'll generate useless noise if you've got a global guard) and so is OFF by default. It will need manually enabling in the rules section of your eslint config with `"@darraghor/nestjs-typed/api-methods-should-be-guarded": "error"`.
748
-
749
- This PASSES - endpoint is protected by an AuthGuard
750
-
751
- ```ts
752
- class TestClass {
753
- @Get()
754
- @UseGuards(AuthGuard('jwt'))
755
- public getAll(): Promise<string[]> {
756
- return [];
757
- }
758
- }`
759
- ```
760
-
761
- This PASSES - entire controller is protected by an AuthGuard
762
-
763
- ```ts
764
- @UseGuards(AuthGuard('jwt'))
765
- class TestClass {
766
-
767
- @Get()
768
- public getAll(): Promise<string[]> {
769
- return [];
770
- }
771
-
772
- @Get()
773
- public getOne(): Promise<string> {
774
- return "1";
775
- }
776
- }
777
- ```
778
-
779
- This PASSES - endpoint is protected by a custom Guard
780
-
781
- ```ts
782
- class TestClass {
783
- @Post()
784
- @UseGuards(MyCustomGuard('hand-gestures'))
785
- public getAll(): Promise<string[]> {
786
- return [];
787
- }
788
- }
789
- ```
790
-
791
- This PASSES - it isn't a controller or an endpoint
792
-
793
- ```ts
794
- class TestClass {
795
- public getAll(): Promise<string[]> {
796
- return [];
797
- }
798
- }
799
- ```
800
-
801
- This FAILS - neither the controller nor the endpoint is protected with a guard
802
-
803
- ```ts
804
- class TestClass {
805
- @Get()
806
- public getAll(): Promise<string[]> {
807
- return [];
808
- }
809
- }
810
- ```
@@ -22,6 +22,7 @@ declare const allConfigs: {
22
22
  "@darraghor/nestjs-typed/all-properties-are-whitelisted": string;
23
23
  "@darraghor/nestjs-typed/all-properties-have-explicit-defined": string;
24
24
  "@darraghor/nestjs-typed/api-methods-should-be-guarded": string;
25
+ "@darraghor/nestjs-typed/api-method-should-specify-api-operation": string;
25
26
  };
26
27
  };
27
28
  "no-swagger": {
@@ -32,6 +33,7 @@ declare const allConfigs: {
32
33
  rules: {
33
34
  "@darraghor/nestjs-typed/api-property-matches-property-optionality": string;
34
35
  "@darraghor/nestjs-typed/api-method-should-specify-api-response": string;
36
+ "@darraghor/nestjs-typed/api-method-should-specify-api-operation": string;
35
37
  "@darraghor/nestjs-typed/controllers-should-supply-api-tags": string;
36
38
  "@darraghor/nestjs-typed/api-enum-property-best-practices": string;
37
39
  "@darraghor/nestjs-typed/api-property-returning-array-should-set-array": string;
@@ -6,6 +6,7 @@ declare const _default: {
6
6
  rules: {
7
7
  "@darraghor/nestjs-typed/api-property-matches-property-optionality": string;
8
8
  "@darraghor/nestjs-typed/api-method-should-specify-api-response": string;
9
+ "@darraghor/nestjs-typed/api-method-should-specify-api-operation": string;
9
10
  "@darraghor/nestjs-typed/controllers-should-supply-api-tags": string;
10
11
  "@darraghor/nestjs-typed/api-enum-property-best-practices": string;
11
12
  "@darraghor/nestjs-typed/api-property-returning-array-should-set-array": string;
@@ -5,9 +5,10 @@ module.exports = {
5
5
  rules: {
6
6
  "@darraghor/nestjs-typed/api-property-matches-property-optionality": "off",
7
7
  "@darraghor/nestjs-typed/api-method-should-specify-api-response": "off",
8
+ "@darraghor/nestjs-typed/api-method-should-specify-api-operation": "off",
8
9
  "@darraghor/nestjs-typed/controllers-should-supply-api-tags": "off",
9
10
  "@darraghor/nestjs-typed/api-enum-property-best-practices": "off",
10
11
  "@darraghor/nestjs-typed/api-property-returning-array-should-set-array": "off",
11
12
  },
12
13
  };
13
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9Td2FnZ2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbmZpZ3Mvbm9Td2FnZ2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxpQkFBUztJQUNMLE1BQU0sRUFBRSwyQkFBMkI7SUFDbkMsYUFBYSxFQUFFLEVBQUMsVUFBVSxFQUFFLFFBQVEsRUFBQztJQUNyQyxLQUFLLEVBQUU7UUFDSCxtRUFBbUUsRUFDL0QsS0FBSztRQUNULGdFQUFnRSxFQUM1RCxLQUFLO1FBQ1QsNERBQTRELEVBQUUsS0FBSztRQUNuRSwwREFBMEQsRUFBRSxLQUFLO1FBQ2pFLHVFQUF1RSxFQUNuRSxLQUFLO0tBQ1o7Q0FDSixDQUFDIn0=
14
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9Td2FnZ2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbmZpZ3Mvbm9Td2FnZ2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxpQkFBUztJQUNMLE1BQU0sRUFBRSwyQkFBMkI7SUFDbkMsYUFBYSxFQUFFLEVBQUMsVUFBVSxFQUFFLFFBQVEsRUFBQztJQUNyQyxLQUFLLEVBQUU7UUFDSCxtRUFBbUUsRUFDL0QsS0FBSztRQUNULGdFQUFnRSxFQUFFLEtBQUs7UUFDdkUsaUVBQWlFLEVBQzdELEtBQUs7UUFDVCw0REFBNEQsRUFBRSxLQUFLO1FBQ25FLDBEQUEwRCxFQUFFLEtBQUs7UUFDakUsdUVBQXVFLEVBQ25FLEtBQUs7S0FDWjtDQUNKLENBQUMifQ==
@@ -21,6 +21,7 @@ declare const _default: {
21
21
  "@darraghor/nestjs-typed/all-properties-are-whitelisted": string;
22
22
  "@darraghor/nestjs-typed/all-properties-have-explicit-defined": string;
23
23
  "@darraghor/nestjs-typed/api-methods-should-be-guarded": string;
24
+ "@darraghor/nestjs-typed/api-method-should-specify-api-operation": string;
24
25
  };
25
26
  };
26
27
  export = _default;
@@ -23,6 +23,7 @@ module.exports = {
23
23
  "@darraghor/nestjs-typed/all-properties-are-whitelisted": "error",
24
24
  "@darraghor/nestjs-typed/all-properties-have-explicit-defined": "error",
25
25
  "@darraghor/nestjs-typed/api-methods-should-be-guarded": "off",
26
+ "@darraghor/nestjs-typed/api-method-should-specify-api-operation": "off",
26
27
  },
27
28
  };
28
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVjb21tZW5kZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uZmlncy9yZWNvbW1lbmRlZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsaUJBQVM7SUFDTCxNQUFNLEVBQUUsMkJBQTJCO0lBQ25DLGFBQWEsRUFBRSxFQUFDLFVBQVUsRUFBRSxRQUFRLEVBQUM7SUFDckMsS0FBSyxFQUFFO1FBQ0gsMkVBQTJFLEVBQ3ZFLE9BQU87UUFDWCx1REFBdUQsRUFBRTtZQUNyRCxPQUFPO1lBQ1A7Z0JBQ0ksR0FBRyxFQUFFLENBQUMsYUFBYSxDQUFDO2dCQUNwQixlQUFlLEVBQUUsQ0FBQyxjQUFjLEVBQUUsUUFBUSxFQUFFLFFBQVEsQ0FBQzthQUN4RDtTQUNKO1FBQ0QsbUVBQW1FLEVBQy9ELE9BQU87UUFDWCxnRUFBZ0UsRUFDNUQsT0FBTztRQUNYLDREQUE0RCxFQUFFLE9BQU87UUFDckUsMERBQTBELEVBQUUsT0FBTztRQUNuRSx1RUFBdUUsRUFDbkUsT0FBTztRQUNYLDhEQUE4RCxFQUFFLE9BQU87UUFDdkUsa0VBQWtFLEVBQzlELE9BQU87UUFDWCwrRUFBK0UsRUFDM0UsT0FBTztRQUNYLGtFQUFrRSxFQUM5RCxP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MifQ==
package/dist/index.d.ts CHANGED
@@ -22,6 +22,9 @@ declare const configuration: {
22
22
  "api-method-should-specify-api-response": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"shouldSpecifyApiResponse", never[], {
23
23
  MethodDefinition(node: import("@typescript-eslint/types/dist/generated/ast-spec").MethodDefinition): void;
24
24
  }>;
25
+ "api-method-should-specify-api-operation": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"shouldSpecifyApiOperation", never[], {
26
+ MethodDefinition(node: import("@typescript-eslint/types/dist/generated/ast-spec").MethodDefinition): void;
27
+ }>;
25
28
  "api-enum-property-best-practices": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"needsEnumNameAdded" | "needsTypeRemoved" | "enumNameShouldMatchType", never[], {
26
29
  PropertyDefinition(node: import("@typescript-eslint/types/dist/generated/ast-spec").Node): void;
27
30
  }>;
@@ -72,6 +75,7 @@ declare const configuration: {
72
75
  "@darraghor/nestjs-typed/all-properties-are-whitelisted": string;
73
76
  "@darraghor/nestjs-typed/all-properties-have-explicit-defined": string;
74
77
  "@darraghor/nestjs-typed/api-methods-should-be-guarded": string;
78
+ "@darraghor/nestjs-typed/api-method-should-specify-api-operation": string;
75
79
  };
76
80
  };
77
81
  "no-swagger": {
@@ -82,6 +86,7 @@ declare const configuration: {
82
86
  rules: {
83
87
  "@darraghor/nestjs-typed/api-property-matches-property-optionality": string;
84
88
  "@darraghor/nestjs-typed/api-method-should-specify-api-response": string;
89
+ "@darraghor/nestjs-typed/api-method-should-specify-api-operation": string;
85
90
  "@darraghor/nestjs-typed/controllers-should-supply-api-tags": string;
86
91
  "@darraghor/nestjs-typed/api-enum-property-best-practices": string;
87
92
  "@darraghor/nestjs-typed/api-property-returning-array-should-set-array": string;
@@ -0,0 +1,6 @@
1
+ import { TSESTree, TSESLint } from "@typescript-eslint/utils";
2
+ export declare const shouldUseApiResponseDecorator: (node: TSESTree.MethodDefinition) => boolean;
3
+ declare const rule: TSESLint.RuleModule<"shouldSpecifyApiOperation", never[], {
4
+ MethodDefinition(node: TSESTree.MethodDefinition): void;
5
+ }>;
6
+ export default rule;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shouldUseApiResponseDecorator = void 0;
4
+ const createRule_1 = require("../../utils/createRule");
5
+ const typedTokenHelpers_1 = require("../../utils/typedTokenHelpers");
6
+ const shouldUseApiResponseDecorator = (node) => {
7
+ const hasApiMethodDecorator = typedTokenHelpers_1.typedTokenHelpers.nodeHasDecoratorsNamed(node, ["Get", "Post", "Put", "Delete", "Patch", "Options", "Head", "All"]);
8
+ const hasApiOperationDecorator = typedTokenHelpers_1.typedTokenHelpers.nodeHasDecoratorsNamed(node, ["ApiOperation"]);
9
+ return hasApiMethodDecorator && !hasApiOperationDecorator;
10
+ };
11
+ exports.shouldUseApiResponseDecorator = shouldUseApiResponseDecorator;
12
+ const rule = (0, createRule_1.createRule)({
13
+ name: "api-method-should-specify-api-operation",
14
+ meta: {
15
+ docs: {
16
+ description: "Api methods should at least specify the expected ApiOperation.",
17
+ recommended: false,
18
+ requiresTypeChecking: false,
19
+ },
20
+ messages: {
21
+ shouldSpecifyApiOperation: `A method decorated with @Get, @Post etc. should specify the expected ApiOperation e.g. @ApiOperation({description: ""}). These decorators are in the @nestjs/swagger npm package.`,
22
+ },
23
+ schema: [],
24
+ hasSuggestions: false,
25
+ type: "suggestion",
26
+ },
27
+ defaultOptions: [],
28
+ create(context) {
29
+ return {
30
+ // eslint-disable-next-line @typescript-eslint/naming-convention
31
+ MethodDefinition(node) {
32
+ if ((0, exports.shouldUseApiResponseDecorator)(node)) {
33
+ context.report({
34
+ node: node,
35
+ messageId: "shouldSpecifyApiOperation",
36
+ });
37
+ }
38
+ },
39
+ };
40
+ },
41
+ });
42
+ exports.default = rule;
43
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBpTWV0aG9kc1Nob3V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UNWLGNBQWMsRUFBRSxLQUFLO1FBQ3JCLElBQUksRUFBRSxZQUFZO0tBQ3JCO0lBQ0QsY0FBYyxFQUFFLEVBQUU7SUFFbEIsTUFBTSxDQUNGLE9BRUM7UUFFRCxPQUFPO1lBQ0gsZ0VBQWdFO1lBQ2hFLGdCQUFnQixDQUFDLElBQStCO2dCQUM1QyxJQUFJLElBQUEscUNBQTZCLEVBQUMsSUFBSSxDQUFDLEVBQUU7b0JBQ3JDLE9BQU8sQ0FBQyxNQUFNLENBQUM7d0JBQ1gsSUFBSSxFQUFFLElBQUk7d0JBQ1YsU0FBUyxFQUFFLDJCQUEyQjtxQkFDekMsQ0FBQyxDQUFDO2lCQUNOO1lBQ0wsQ0FBQztTQUNKLENBQUM7SUFDTixDQUFDO0NBQ0osQ0FBQyxDQUFDO0FBRUgsa0JBQWUsSUFBSSxDQUFDIn0=
@@ -21,6 +21,9 @@ declare const allRules: {
21
21
  "api-method-should-specify-api-response": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"shouldSpecifyApiResponse", never[], {
22
22
  MethodDefinition(node: import("@typescript-eslint/types/dist/generated/ast-spec").MethodDefinition): void;
23
23
  }>;
24
+ "api-method-should-specify-api-operation": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"shouldSpecifyApiOperation", never[], {
25
+ MethodDefinition(node: import("@typescript-eslint/types/dist/generated/ast-spec").MethodDefinition): void;
26
+ }>;
24
27
  "api-enum-property-best-practices": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"needsEnumNameAdded" | "needsTypeRemoved" | "enumNameShouldMatchType", never[], {
25
28
  PropertyDefinition(node: import("@typescript-eslint/types/dist/generated/ast-spec").Node): void;
26
29
  }>;
@@ -17,6 +17,7 @@ const validateNestedOfArrayShouldSetEach_1 = __importDefault(require("./validate
17
17
  const allPropertiesAreWhitelisted_1 = __importDefault(require("./allPropertiesAreWhitelisted/allPropertiesAreWhitelisted"));
18
18
  const allPropertiesHaveExplicitDefined_1 = __importDefault(require("./allPropertiesHaveExplicitDefined/allPropertiesHaveExplicitDefined"));
19
19
  const apiMethodsShouldBeGuarded_1 = __importDefault(require("./apiMethodsShouldBeGuarded/apiMethodsShouldBeGuarded"));
20
+ const apiMethodsShouldSpecifyApiOperation_1 = __importDefault(require("./apiMethodsShouldSpecifyApiOperation/apiMethodsShouldSpecifyApiOperation"));
20
21
  const allRules = {
21
22
  "all-properties-have-explicit-defined": allPropertiesHaveExplicitDefined_1.default,
22
23
  "api-property-matches-property-optionality": apiPropertyMatchesPropertyOptionality_1.default,
@@ -24,6 +25,7 @@ const allRules = {
24
25
  "provided-injected-should-match-factory-parameters": ProviderInjectedShouldMatchFactory_1.default,
25
26
  "controllers-should-supply-api-tags": controllerDecoratedHasApiTags_1.default,
26
27
  "api-method-should-specify-api-response": apiMethodsShouldSpecifyApiResponse_1.default,
28
+ "api-method-should-specify-api-operation": apiMethodsShouldSpecifyApiOperation_1.default,
27
29
  "api-enum-property-best-practices": apiEnumPropertyBestPractices_1.default,
28
30
  "api-property-returning-array-should-set-array": apiPropertyReturningArrayShouldSetArray_1.default,
29
31
  "should-specify-forbid-unknown-values": shouldSpecifyForbidUnknownValuesRule_1.default,
@@ -34,4 +36,4 @@ const allRules = {
34
36
  "api-methods-should-be-guarded": apiMethodsShouldBeGuarded_1.default,
35
37
  };
36
38
  exports.default = allRules;
37
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcnVsZXMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSwwSEFBa0c7QUFDbEcsaUpBQW1JO0FBQ25JLDBKQUFrSTtBQUNsSSxrSUFBMEc7QUFDMUcsaUpBQXlIO0FBQ3pILCtIQUF1RztBQUN2RyxnS0FBd0k7QUFDeEksbUpBQXVIO0FBQ3ZIL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UFBbUg7QUFDbkgsc0hBQThGO0FBQzlGLG9KQUE0SDtBQUU1SCxNQUFNLFFBQVEsR0FBRztJQUNiLHNDQUFzQyxFQUFFLDBDQUFnQztJQUN4RSwyQ0FBMkMsRUFDdkMsK0NBQXFDO0lBQ3pDLCtCQUErQixFQUFFLG9DQUEwQjtJQUMzRCxtREFBbUQsRUFDL0MsNENBQTRDO0lBQ2hELG9DQUFvQyxFQUFFLHVDQUE2QjtJQUNuRSx3Q0FBd0MsRUFDcEMsNENBQWtDO0lBQ3RDLHlDQUF5QyxFQUNyQyw2Q0FBbUM7SUFDdkMsa0NBQWtDLEVBQUUsc0NBQTRCO0lBQ2hFLCtDQUErQyxFQUMzQyxpREFBdUM7SUFDM0Msc0NBQXNDLEVBQUUsOENBQWdDO0lBQ3hFLDBDQUEwQyxFQUN0Qyw2Q0FBdUM7SUFDM0MsdURBQXVELEVBQ25ELDZDQUFtQztJQUN2QywwQ0FBMEMsRUFDdEMsNENBQWtDO0lBQ3RDLGdDQUFnQyxFQUFFLHFDQUEyQjtJQUM3RCwrQkFBK0IsRUFBRSxtQ0FBeUI7Q0FDN0QsQ0FBQztBQUVGLGtCQUFlLFFBQVEsQ0FBQyJ9
@@ -6,10 +6,5 @@ const utils_1 = require("@typescript-eslint/utils");
6
6
  // eslint-disable-next-line @typescript-eslint/no-var-requires, unicorn/prefer-module
7
7
  //const {version} = require("../../package.json");
8
8
  // eslint-disable-next-line new-cap
9
- exports.createRule = utils_1.ESLintUtils.RuleCreator(
10
- // (name) =>
11
- // `https://github.com/darraghoriordan/eslint-plugin-nestjs-typed/blob/v${
12
- // version as string
13
- // }/packages/eslint-plugin/docs/rules/${name}.md`
14
- () => `https://github.com/darraghoriordan/eslint-plugin-nestjs-typed/blob/main/README.md`);
15
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9jcmVhdGVSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLG9EQUFxRDtBQUVyRCxzSEFBc0g7QUFDdEgscUZBQXFGO0FBQ3JGLGtEQUFrRDtBQUNsRCxtQ0FBbUM7QUFDdEIsUUFBQSxVQUFVLEdBQUcsbUJBQVcsQ0FBQyxXQUFXO0FBQzdDLFlBQVk7QUFDWiw4RUFBOEU7QUFDOUUsNEJBQTRCO0FBQzVCLHNEQUFzRDtBQUN0RCxHQUFHLEVBQUUsQ0FDRCxtRkFBbUYsQ0FDMUYsQ0FBQyJ9
9
+ exports.createRule = utils_1.ESLintUtils.RuleCreator((name) => `https://github.com/darraghoriordan/eslint-plugin-nestjs-typed/main/src/docs/rules/${name}.md`);
10
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9jcmVhdGVSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLG9EQUFxRDtBQUVyRCxzSEFBc0g7QUFDdEgscUZBQXFGO0FBQ3JGLGtEQUFrRDtBQUNsRCxtQ0FBbUM7QUFDdEIsUUFBQSxVQUFVLEdBQUcsbUJBQVcsQ0FBQyxXQUFXLENBQzdDLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FDTCxxRkFBcUYsSUFBSSxLQUFLLENBQ3JHLENBQUMifQ==
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darraghor/eslint-plugin-nestjs-typed",
3
- "version": "3.20.5",
3
+ "version": "3.21.0",
4
4
  "description": "Eslint rules for nestjs projects",
5
5
  "scripts": {
6
6
  "clean": "rm -Rf ./dist/",
@@ -43,35 +43,35 @@
43
43
  "main": "dist/index.js",
44
44
  "types": "index.d.ts",
45
45
  "dependencies": {
46
- "@typescript-eslint/scope-manager": "^5.59.1",
47
- "@typescript-eslint/utils": "^5.59.1",
46
+ "@typescript-eslint/scope-manager": "^5.59.5",
47
+ "@typescript-eslint/utils": "^5.59.5",
48
48
  "eslint-module-utils": "2.8.0",
49
49
  "reflect-metadata": "0.1.13"
50
50
  },
51
51
  "devDependencies": {
52
- "@commitlint/cli": "17.6.1",
53
- "@commitlint/config-conventional": "17.6.1",
52
+ "@commitlint/cli": "17.6.3",
53
+ "@commitlint/config-conventional": "17.6.3",
54
54
  "@semantic-release/changelog": "6.0.3",
55
55
  "@semantic-release/exec": "6.0.3",
56
56
  "@types/eslint": "8.37.0",
57
57
  "@types/jest": "29.5.1",
58
58
  "@types/node": "18.16.0",
59
- "@typescript-eslint/eslint-plugin": "5.59.1",
60
- "@typescript-eslint/parser": "5.59.1",
59
+ "@typescript-eslint/eslint-plugin": "5.59.5",
60
+ "@typescript-eslint/parser": "5.59.5",
61
61
  "class-validator": "^0.14",
62
- "eslint": "8.39.0",
62
+ "eslint": "8.40.0",
63
63
  "eslint-config-prettier": "8.8.0",
64
64
  "eslint-plugin-import": "2.27.5",
65
- "eslint-plugin-jsdoc": "43.1.1",
65
+ "eslint-plugin-jsdoc": "44.2.3",
66
66
  "eslint-plugin-prefer-arrow": "1.2.3",
67
- "eslint-plugin-unicorn": "46.0.0",
67
+ "eslint-plugin-unicorn": "47.0.0",
68
68
  "husky": "8.0.3",
69
69
  "jest": "29.5.0",
70
70
  "jest-create-mock-instance": "2.0.0",
71
71
  "jest-junit": "16.0.0",
72
- "lint-staged": "13.2.1",
72
+ "lint-staged": "13.2.2",
73
73
  "prettier": "2.8.8",
74
- "semantic-release": "21.0.1",
74
+ "semantic-release": "21.0.2",
75
75
  "ts-jest": "29.1.0",
76
76
  "ts-node": "10.9.1",
77
77
  "typescript": "4.8.4"