Skip to content

Commit 77c45cb

Browse files
committed
Add NestJS plugin for ESLint to start catching issues before upgrade
fix What about these? Revert "What about these?" This reverts commit 8338daa.
1 parent 2a98d16 commit 77c45cb

File tree

8 files changed

+265
-3
lines changed

8 files changed

+265
-3
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ module.exports = {
44
project: 'tsconfig.json',
55
sourceType: 'module',
66
},
7-
plugins: ['@typescript-eslint/eslint-plugin'],
7+
plugins: ['@typescript-eslint/eslint-plugin', '@darraghor/nestjs-typed'],
88
extends: [
99
'plugin:@typescript-eslint/eslint-recommended',
1010
'plugin:@typescript-eslint/recommended',
11+
'plugin:@darraghor/nestjs-typed/recommended',
1112
'prettier',
1213
],
1314
root: true,

package-lock.json

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

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@
5353
"pixelmatch": "^5.3.0",
5454
"pngjs": "^7.0.0",
5555
"reflect-metadata": "^0.1.13",
56-
"swagger-ui-express": "^4.6.3",
5756
"rimraf": "^5.0.1",
5857
"rxjs": "^7.8.1",
58+
"swagger-ui-express": "^4.6.3",
5959
"uuid-apikey": "^1.5.3"
6060
},
6161
"devDependencies": {
62+
"@darraghor/eslint-plugin-nestjs-typed": "^4.0.12",
6263
"@nestjs/cli": "^8.2.8",
6364
"@nestjs/schematics": "^8.0.11",
6465
"@nestjs/testing": "^8.4.7",

src/shared/api-file.decorator.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const ApiFile =
66
if (options?.isArray) {
77
ApiProperty({
88
type: 'array',
9+
isArray: true,
910
items: {
1011
type: 'file',
1112
properties: {

src/test-runs/dto/create-test-request-multipart.dto.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export class CreateTestRequestMultipartDto extends OmitType(CreateTestRequestDto
1010
'merge',
1111
'diffTollerancePercent',
1212
]) {
13+
14+
/* eslint-disable @darraghor/nestjs-typed/all-properties-are-whitelisted, @darraghor/nestjs-typed/all-properties-have-explicit-defined */
1315
@ApiFile()
1416
image: Express.Multer.File;
1517

@@ -25,6 +27,7 @@ export class CreateTestRequestMultipartDto extends OmitType(CreateTestRequestDto
2527
@Transform(({ value }) => value == 'true')
2628
merge?: boolean;
2729

30+
/* eslint-disable @darraghor/nestjs-typed/api-property-returning-array-should-set-array */
2831
@ApiPropertyOptional({ type: String })
2932
@IsOptional()
3033
@Type(() => String)

src/test-runs/dto/update-ignore-area.dto.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { Type } from 'class-transformer';
44
import { ValidateNested } from 'class-validator';
55

66
export class UpdateIgnoreAreasDto {
7-
@ApiProperty({ isArray: true })
7+
@ApiProperty({type: String, isArray: true })
8+
@Type(() => String)
9+
@ValidateNested({ each: true })
810
readonly ids: string[];
911

1012
@ApiProperty({ type: IgnoreAreaDto, isArray: true })

src/test-runs/test-runs.controller.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { CurrentUser } from '../shared/current-user.decorator';
4040
import { RoleGuard } from '../auth/guards/role.guard';
4141
import { Roles } from '../shared/roles.decorator';
4242

43+
/* eslint-disable @darraghor/nestjs-typed/injectable-should-be-provided */
4344
@ApiTags('test-runs')
4445
@Controller('test-runs')
4546
export class TestRunsController {

src/test-variations/test-variations.controller.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { MergeParams } from './types';
1111
import { BaseTestVariationDto } from './dto/base-test-variation.dto';
1212
import { TestVariationDto } from './dto/test-variation.dto';
1313

14+
/* eslint-disable @darraghor/nestjs-typed/injectable-should-be-provided */
1415
@ApiTags('test-variations')
1516
@Controller('test-variations')
1617
export class TestVariationsController {

0 commit comments

Comments
 (0)