Skip to content

Commit 467c949

Browse files
committed
Run linter as part of CI, remove non used variables and fix from default command line
1 parent 3e019ae commit 467c949

File tree

12 files changed

+10
-23
lines changed

12 files changed

+10
-23
lines changed

.github/workflows/workflow.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ jobs:
1818
- name: Install npm dependencies
1919
run: npm ci
2020

21+
- name: Static analysis
22+
run: npm run lint
23+
2124
- name: Unit tests
2225
run: npm run test:cov
2326

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"start:dev": "nest start --watch",
1414
"start:debug": "nest start --debug --watch",
1515
"start:prod": "node dist/main",
16-
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
16+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
1717
"test": "jest --projects src",
1818
"test:watch": "jest --projects src --watch",
1919
"test:cov": "jest --projects src --coverage",

src/auth/auth.service.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Test, TestingModule } from '@nestjs/testing';
22
import { AuthService } from './auth.service';
3-
import { UsersModule } from '../users/users.module';
43
import { UsersService } from '../users/users.service';
54
import { JwtService } from '@nestjs/jwt';
65

src/compare/libs/odiff/odiff.service.spec.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { TestingModule, Test } from '@nestjs/testing';
22
import { TestStatus } from '@prisma/client';
3-
import { PNG } from 'pngjs';
43
import { IgnoreAreaDto } from 'src/test-runs/dto/ignore-area.dto';
54
import { StaticService } from '../../../shared/static/static.service';
6-
import { DIFF_DIMENSION_RESULT, EQUAL_RESULT, NO_BASELINE_RESULT } from '../consts';
5+
import { DIFF_DIMENSION_RESULT, NO_BASELINE_RESULT } from '../consts';
76
import { OdiffService, DEFAULT_CONFIG, ignoreAreaToRegionMapper } from './odiff.service';
87
import { OdiffConfig, OdiffIgnoreRegions } from './odiff.types';
98
import { compare } from 'odiff-bin';
@@ -61,15 +60,6 @@ describe('parseConfig', () => {
6160
});
6261

6362
describe('getDiff', () => {
64-
const image = new PNG({
65-
width: 20,
66-
height: 20,
67-
});
68-
const anotherImage = new PNG({
69-
width: 20,
70-
height: 20,
71-
});
72-
anotherImage.data[0] = 1; // alterate pixel to have it different from 0
7363

7464
it('no baseline', async () => {
7565
service = await initService({});

src/main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { NestFactory } from '@nestjs/core';
22
import { AppModule } from './app.module';
33
import { setupSwagger } from './swagger';
44
import { Logger, ValidationPipe } from '@nestjs/common';
5-
import * as express from 'express';
65
import { join } from 'path';
76
import * as bodyParser from 'body-parser';
87
import { readFileSync, existsSync } from 'fs';

src/shared/api-file.decorator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ApiPropertyOptions, ApiProperty } from '@nestjs/swagger';
22

33
export const ApiFile =
44
(options?: ApiPropertyOptions): PropertyDecorator =>
5-
(target: Object, propertyKey: string | symbol) => {
5+
(target: any, propertyKey: string | symbol) => {
66
if (options?.isArray) {
77
ApiProperty({
88
type: 'array',

src/shared/static/static.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class StaticService {
4545

4646
async deleteImage(imageName: string): Promise<boolean> {
4747
if (!imageName) return;
48-
return new Promise((resolvePromise, reject) => {
48+
return new Promise((resolvePromise) => {
4949
unlink(this.getImagePath(imageName), (err) => {
5050
if (err) {
5151
this.logger.error(err);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ApiProperty } from '@nestjs/swagger';
2-
import { IsNotEmpty } from 'class-validator';
32
import { IgnoreAreaDto } from './ignore-area.dto';
43

54
export class UpdateIgnoreAreasDto {

src/test-runs/test-runs.service.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ describe('TestRunsService', () => {
117117
let service: TestRunsService;
118118
const imageBuffer = Buffer.from('Image');
119119
const ignoreAreas = [{ x: 1, y: 2, width: 10, height: 20 }];
120-
const tempIgnoreAreas = [{ x: 3, y: 4, width: 30, height: 40 }];
121120

122121
it('findOne', async () => {
123122
const id = 'some id';
@@ -298,8 +297,6 @@ describe('TestRunsService', () => {
298297
it('calculateDiff', async () => {
299298
const testRun: TestRun = generateTestRun();
300299
const testRunUpdateMock = jest.fn();
301-
const baselineMock = 'baseline image';
302-
const imageeMock = 'image';
303300
const deleteImageMock = jest.fn();
304301
const diffResult = {
305302
id: 'test',

src/test-variations/test-variations.service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ describe('TestVariationsService', () => {
562562
id: 'baseline id 1',
563563
baselineName: 'image name 1',
564564
testVariationId: testVariationId,
565-
testRunId: 'test run id 1',
565+
testRunId: testRunId,
566566
userId: 'userId',
567567
createdAt: new Date(),
568568
updatedAt: new Date(),

0 commit comments

Comments
 (0)