Skip to content

Commit

Permalink
M2-5381: Lint files using new rules
Browse files Browse the repository at this point in the history
  • Loading branch information
sultanofcardio committed Feb 22, 2024
1 parent 4d0b9f6 commit 10ef66a
Show file tree
Hide file tree
Showing 64 changed files with 269 additions and 270 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import 'react-native-gesture-handler';

import { AppRegistry } from 'react-native';

import { jobRunner } from './src/shared/lib';
import { name as appName } from './app.json';
import App from './src/app';
import displayRemoteNotifications from './src/jobs/display-remote-notifications';
import localization from './src/jobs/localization';
import requestInterception from './src/jobs/request-interception';
import responseInterception from './src/jobs/response-interception';
import setBackgroundTask from './src/jobs/set-background-task';
import displayRemoteNotifications from './src/jobs/display-remote-notifications';
import localization from './src/jobs/localization';
import App from './src/app';
import { name as appName } from './app.json';
import { jobRunner } from './src/shared/lib';

jobRunner.runAll([
requestInterception,
Expand Down
3 changes: 2 additions & 1 deletion jest.components.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { jest } from '@jest/globals';
import React from 'react';

import { jest } from '@jest/globals';

jest.mock('@georstat/react-native-image-cache', () => {
return {
CachedImage: () => <></>,
Expand Down
6 changes: 3 additions & 3 deletions src/abstract/lib/utils/progressConvert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ import {
export const convertProgress = (storeProgress: StoreProgress): Progress => {
const result: Progress = {};

for (let appletId in storeProgress) {
for (const appletId in storeProgress) {
if (!result[appletId]) {
result[appletId] = {};
}
const entitiesProgress: StoreEntitiesProgress = storeProgress[appletId];

for (let entityId in entitiesProgress) {
for (const entityId in entitiesProgress) {
if (!result[appletId][entityId]) {
result[appletId][entityId] = {};
}

const eventsProgress: StoreEventsProgress = entitiesProgress[entityId];

for (let eventId in eventsProgress) {
for (const eventId in eventsProgress) {
const storePayload: StoreProgressPayload = eventsProgress[eventId];

const payload: ProgressPayload = {
Expand Down
2 changes: 1 addition & 1 deletion src/entities/abTrail/ui/AbShapes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const AbShapes: FC<Props> = props => {

const endOffset = getEndOffset();

let errorMiddlePoint: Point | null = errorPath
const errorMiddlePoint: Point | null = errorPath
? getEquidistantPoint(errorPath)
: null;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { AnswerService } from '@shared/api';
import { FileSystem } from 'react-native-file-access';

import { AnswerService } from '@shared/api';

import AnswersUploadService from './AnswersUploadService';
import { UserPrivateKeyRecord } from '../../../identity';
import MediaFilesCleaner from './MediaFilesCleaner';
import { UserPrivateKeyRecord } from '../../../identity';

const MOCK_CREATED_AT = +new Date();

Expand Down
14 changes: 7 additions & 7 deletions src/entities/activity/lib/services/AnswersUploadService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class AnswersUploadService implements IAnswersUploadService {
} catch (error) {
throw new Error(
`[UploadAnswersService.processFileUpload]: Error occurred while file ${logFileInfo} uploading\n\n` +

Check warning on line 172 in src/entities/activity/lib/services/AnswersUploadService.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/entities/activity/lib/services/AnswersUploadService.ts#L172

Operands of '+' operation with any is possible only with string, number, bigint or any (@typescript-eslint/restrict-plus-operands)
error!.toString(),
error.toString(),

Check warning on line 173 in src/entities/activity/lib/services/AnswersUploadService.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/entities/activity/lib/services/AnswersUploadService.ts#L173

Unsafe call of an `any` typed value (@typescript-eslint/no-unsafe-call)
);
}
}
Expand Down Expand Up @@ -201,7 +201,7 @@ class AnswersUploadService implements IAnswersUploadService {
} catch (error) {
throw new Error(
'[UploadAnswersService.uploadAllMediaFiles]: Error occurred on 1st files upload check\n\n' +

Check warning on line 203 in src/entities/activity/lib/services/AnswersUploadService.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/entities/activity/lib/services/AnswersUploadService.ts#L203

Operands of '+' operation with any is possible only with string, number, bigint or any (@typescript-eslint/restrict-plus-operands)
error!.toString(),
error.toString(),

Check warning on line 204 in src/entities/activity/lib/services/AnswersUploadService.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/entities/activity/lib/services/AnswersUploadService.ts#L204

Unsafe call of an `any` typed value (@typescript-eslint/no-unsafe-call)
);
}

Expand Down Expand Up @@ -256,7 +256,7 @@ class AnswersUploadService implements IAnswersUploadService {
} catch (error) {
throw new Error(
'[uploadAnswerMediaFiles.uploadAllMediaFiles]: Error occurred while 2nd files upload check\n\n' +

Check warning on line 258 in src/entities/activity/lib/services/AnswersUploadService.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/entities/activity/lib/services/AnswersUploadService.ts#L258

Operands of '+' operation with any is possible only with string, number, bigint or any (@typescript-eslint/restrict-plus-operands)
error!.toString(),
error.toString(),

Check warning on line 259 in src/entities/activity/lib/services/AnswersUploadService.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/entities/activity/lib/services/AnswersUploadService.ts#L259

Unsafe call of an `any` typed value (@typescript-eslint/no-unsafe-call)
);
}

Expand Down Expand Up @@ -288,7 +288,7 @@ class AnswersUploadService implements IAnswersUploadService {
} catch (error) {
throw new Error(
'[UploadAnswersService.uploadAnswers]: Error occurred while 1st check if answers uploaded\n\n' +

Check warning on line 290 in src/entities/activity/lib/services/AnswersUploadService.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/entities/activity/lib/services/AnswersUploadService.ts#L290

Operands of '+' operation with any is possible only with string, number, bigint or any (@typescript-eslint/restrict-plus-operands)
error!.toString(),
error.toString(),

Check warning on line 291 in src/entities/activity/lib/services/AnswersUploadService.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/entities/activity/lib/services/AnswersUploadService.ts#L291

Unsafe call of an `any` typed value (@typescript-eslint/no-unsafe-call)
);
}

Expand All @@ -308,7 +308,7 @@ class AnswersUploadService implements IAnswersUploadService {
} catch (error) {
throw new Error(
'[UploadAnswersService.uploadAnswers]: Error occurred while sending answers\n\n' +
error!.toString(),
error.toString(),
);
}

Expand All @@ -322,7 +322,7 @@ class AnswersUploadService implements IAnswersUploadService {
} catch (error) {
throw new Error(
'[UploadAnswersService.uploadAnswers]: Error occurred while 2nd check if answers uploaded\n\n' +
error!.toString(),
error.toString(),
);
}

Expand Down Expand Up @@ -442,7 +442,7 @@ class AnswersUploadService implements IAnswersUploadService {
} catch (error) {
throw new Error(
'[UploadAnswersService.assignRemoteUrlsToUserActions]: Error occurred while mapping user actions with media files\n\n' +
error!.toString(),
error.toString(),
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/entities/activity/lib/services/MediaFilesCleaner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ const createMediaFilesCleaner = (): Result => {

const urlsToProcess: string[] = [];

for (let recordId in entityRecord.answers) {
for (const recordId in entityRecord.answers) {
const record = entityRecord.answers[recordId]?.answer;

if (record?.uri) {
urlsToProcess.push(record.uri);
}
}

for (let fileUrl of urlsToProcess) {
for (const fileUrl of urlsToProcess) {
try {
const fileExists = await FileSystem.exists(fileUrl);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class QueueProcessingService {
} catch (error) {
this.logger.warn(
'[QueueProcessingService.process]: Error in processInternal occurred\n\n' +
error!.toString(),
error.toString(),
);
this.uploadStatusObservable.isError = true;
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const createEntityActivitiesCollector = (): EntityActivitiesCollector => {

const activityIds: string[] = flowDto!.activityIds;

for (let activityId of activityIds) {
for (const activityId of activityIds) {
addActivity(activityId);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/entities/activity/ui/ActivityFlowStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const ActivityFlowStep: FC<Props> = props => {
accessibilityLabel="activity-card-flow"
opacity={hasOpacity ? 0.5 : 1}
>
{`(${activityPositionInFlow!} of ${numberOfActivitiesInFlow!}) ${activityFlowName}`}
{`(${activityPositionInFlow} of ${numberOfActivitiesInFlow}) ${activityFlowName}`}
</Text>
</XStack>
);
Expand Down
2 changes: 1 addition & 1 deletion src/entities/applet/model/hooks/useStartEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ function useStartEntity({

const activityFlowDtos: ActivityFlowRecordDto[] =
detailsResponse.result.activityFlows;
const flow = activityFlowDtos!.find(x => x.id === flowId)!;
const flow = activityFlowDtos.find(x => x.id === flowId)!;

return flow.activityIds;
};
Expand Down
4 changes: 2 additions & 2 deletions src/entities/applet/model/services/RefreshAppletService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class RefreshAppletService implements IRefreshAppletService {
};

private cacheImages(urls: ImageUrl[]) {
for (let url of urls) {
for (const url of urls) {
try {
if (!this.isUrlValid(url)) {
continue;
Expand Down Expand Up @@ -102,7 +102,7 @@ class RefreshAppletService implements IRefreshAppletService {
) {
this.resetAppletDetailsQuery(appletInternalDtos.appletId);

for (let activityDto of appletInternalDtos.activities) {
for (const activityDto of appletInternalDtos.activities) {
this.resetActivityDetailsQuery(activityDto.id);

const activityKey = getActivityDetailsKey(activityDto.id);
Expand Down
4 changes: 2 additions & 2 deletions src/entities/applet/model/services/RefreshService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class RefreshService implements IRefreshService {

const unsuccessfulApplets: UnsuccessfulApplet[] = [];

for (let appletDto of appletDtos) {
for (const appletDto of appletDtos) {
try {
await this.refreshAppletService.refreshApplet(
appletDto,
Expand Down Expand Up @@ -223,7 +223,7 @@ class RefreshService implements IRefreshService {
} catch (error) {
this.logger.warn(
'[RefreshService.process]: Error occurred:\nInternal error:\n\n' +
error!.toString(),
error.toString(),
);
} finally {
RefreshService.mutex.release();
Expand Down
8 changes: 4 additions & 4 deletions src/entities/drawer/lib/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const convertToSkPaths = (
): SkPath[] => {
const skPaths: SkPath[] = [];

for (let line of lines.slice(startFrom)) {
for (const line of lines.slice(startFrom)) {
if (!line.points.length) {
continue;
}
Expand All @@ -20,7 +20,7 @@ export const convertToSkPaths = (

const path = Skia.Path.Make().moveTo(x, y);

for (let point of curvePoints.slice(1)) {
for (const point of curvePoints.slice(1)) {
path.lineTo(point.x, point.y);
}
skPaths.push(path);
Expand All @@ -33,9 +33,9 @@ export const getChunkedPointsAsStrings = (lines: DrawLine[]) => {
const results: string[] = [];
const chunkSize: number = 50;

for (let line of lines) {
for (const line of lines) {
const { points } = line;
let { length } = points;
const { length } = points;

for (let index = 0; index < length; index += chunkSize) {
const myChunk = line.points.slice(index, index + chunkSize + 1);
Expand Down
2 changes: 1 addition & 1 deletion src/entities/drawer/ui/DrawingBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const DrawingBoard: FC<Props> = props => {
startTime: Date.now(),
points: [drawPoint],
};
const logPoint = drawPoint.scale(vector) as DrawPoint;
const logPoint = drawPoint.scale(vector);

onLog({ ...logPoint, lineNumber: value?.length, type: 'DrawingTest' });
};
Expand Down
2 changes: 1 addition & 1 deletion src/entities/drawer/ui/DrawingTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const DrawingTest: FC<Props> = props => {
const { value, backgroundImageUrl, imageUrl, onLog } = props;

const onResult = async (result: DrawResult) => {
let fileName = value.fileName;
const fileName = value.fileName;

const fileMeta = SvgFileManager.getFileMeta(fileName);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { addDays, startOfDay, subDays } from 'date-fns';

import ScheduledDateCalculator from './ScheduledDateCalculator';

const now = new Date(2024, 0, 25);
Expand Down Expand Up @@ -564,7 +565,7 @@ describe('ScheduledDateCalculator', () => {
event.availability.startDate = new Date(wednesday);
event.availability.endDate = addDays(wednesday, 30);

let getNowMock = jest.fn(() => {
const getNowMock = jest.fn(() => {
return new Date(wednesday);
});

Expand Down Expand Up @@ -592,7 +593,7 @@ describe('ScheduledDateCalculator', () => {
event.availability.startDate = new subDays(new Date(wednesday), 30);
event.availability.endDate = new Date(wednesday);

let getNowMock = jest.fn(() => {
const getNowMock = jest.fn(() => {
return new Date(wednesday);
});

Expand Down Expand Up @@ -620,7 +621,7 @@ describe('ScheduledDateCalculator', () => {
event.availability.startDate = new addDays(new Date(wednesday), 10);
event.availability.endDate = addDays(wednesday, 30);

let getNowMock = jest.fn(() => {
const getNowMock = jest.fn(() => {
return new Date(wednesday);
});

Expand Down Expand Up @@ -649,7 +650,7 @@ describe('ScheduledDateCalculator', () => {
event.availability.startDate = new subDays(new Date(wednesday), 30);
event.availability.endDate = subDays(wednesday, 10);

let getNowMock = jest.fn(() => {
const getNowMock = jest.fn(() => {
return new Date(wednesday);
});

Expand Down
10 changes: 5 additions & 5 deletions src/entities/event/model/operations/ScheduledDateCalculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class ScheduledDateCalculator {
): Date | null {
const today = startOfDay(this.getNow());

let date = new Date(selectedDate!);
let date = new Date(selectedDate);

if (selectedDate > today) {
let months = 0;
Expand Down Expand Up @@ -82,13 +82,13 @@ export class ScheduledDateCalculator {
const selectedMonth = specificDay.getMonth();
const selectedDay = specificDay.getDate();

const result = new Date(selectedYear!, selectedMonth!, selectedDay!);
const result = new Date(selectedYear, selectedMonth, selectedDay);
this.setTime(result, availability);
return result;
}

private calculateScheduledAt(event: ScheduleEvent): Date | null {
let { availability, selectedDate } = event;
const { availability, selectedDate } = event;

const now = this.getNow();

Expand Down Expand Up @@ -116,7 +116,7 @@ export class ScheduledDateCalculator {
return this.calculateForMonthly(selectedDate!, availability);
}

let parseInput: EventParseInput = {};
const parseInput: EventParseInput = {};

if (availability.periodicityType === PeriodicityType.Weekly) {
const dayOfWeek = selectedDate!.getDay();
Expand All @@ -134,7 +134,7 @@ export class ScheduledDateCalculator {
parseInput.end = endOfDay.getTime();
}

const parsedSchedule = Parse.schedule(parseInput!);
const parsedSchedule = Parse.schedule(parseInput);

const fromDate = Day.fromDate(now);

Expand Down
4 changes: 2 additions & 2 deletions src/entities/flanker/lib/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const parseResponse = (data: {
responseTouchTimestamp: !isWebView
? record.response_touch_timestamp
: record.rt
? record.start_timestamp + record.rt
: null,
? record.start_timestamp + record.rt
: null,
};

return parseResponseResult;
Expand Down
8 changes: 4 additions & 4 deletions src/entities/notification/lib/services/filterNotifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import {
export const filterNotifications = (
appletNotifications: AppletNotificationDescribers,
): Array<NotificationDescriber> => {
let result: Array<NotificationDescriber> = [];
const result: Array<NotificationDescriber> = [];

for (let eventNotifications of appletNotifications.events) {
for (let notification of eventNotifications.notifications) {
for (const eventNotifications of appletNotifications.events) {
for (const notification of eventNotifications.notifications) {
if (notification.isActive) {
result.push(notification);
}
Expand Down Expand Up @@ -39,7 +39,7 @@ export const filterAppletNotifications = (
events: [],
};

for (let eventNotifications of appletNotifications.events) {
for (const eventNotifications of appletNotifications.events) {
const eventsClone: EventNotificationDescribers = {
...eventNotifications,
notifications: [],
Expand Down
Loading

0 comments on commit 10ef66a

Please sign in to comment.