Skip to content

Commit

Permalink
Removing eslint issue (#40)
Browse files Browse the repository at this point in the history
* Diff method eslint refactoring done

* unknown is safer alternative of any and it don't throws any warning
  • Loading branch information
HeeManSu authored Mar 13, 2024
1 parent efc7f40 commit f1c1c48
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,7 @@ export interface childProcessResponse {
type: keyof typeof protocol;
data: unknown;
}

export interface InspectObject {
[key: string]: Array<{ name: string }>;
}
20 changes: 9 additions & 11 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { NextFunction, Request, RequestHandler, Response } from 'express';
import {
createInstallDependenciesScript,
currentFile,
IAllApps
IAllApps,
InspectObject
} from '../constants';

export const dirName = (gitUrl: string): string =>
Expand Down Expand Up @@ -119,23 +120,20 @@ export const getLangId = (input: string): LanguageId => {
return extension as LanguageId;
};

//eslint-disable-next-line
export const diff = (object1: any, object2: any): any => {
export const diff = (
object1: InspectObject,
object2: InspectObject
): InspectObject => {
for (const key in object2) {
//eslint-disable-next-line
if (Array.isArray(object2[key])) {
//eslint-disable-next-line
object1[key] = object1[key].filter(
(
item: any // eslint-disable-line
) => !object2[key].find((i: any) => i.name === item.name) // eslint-disable-line
item => !object2[key].find(i => i.name === item.name)
);
}
}

return object1; // eslint-disable-line
return object1;
};

export function isIAllApps(data: any): data is IAllApps {
export function isIAllApps(data: unknown): data is IAllApps {
return typeof data === 'object' && data !== null;
}

0 comments on commit f1c1c48

Please sign in to comment.