Skip to content

Commit

Permalink
fix eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
khavinshankar committed Nov 7, 2023
1 parent bbd9268 commit 025965c
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 30 deletions.
8 changes: 0 additions & 8 deletions src/Components/Assets/AssetTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ export const assetClassProps = {
},
};

export interface AssetService {
id: string;
created_date: string;
modified_date: string;
serviced_on: string;
note: string;
}

export interface AssetData {
id: string;
name: string;
Expand Down
4 changes: 2 additions & 2 deletions src/Components/ExternalResult/ExternalResultUpload.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from "lodash-es";
import { startCase, camelCase } from "lodash-es";
import { navigate } from "raviger";
import { lazy, useState } from "react";
import CSVReader from "react-csv-reader";
Expand Down Expand Up @@ -131,7 +131,7 @@ export default function ExternalResultUpload() {
? errors.map((error: any) => {
return (
<div key={error[0][0]}>
{_.startCase(_.camelCase(error[0][0]))} -{" "}
{startCase(camelCase(error[0][0]))} -{" "}
{error[0][1]}
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Facility/Investigations/Reports/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Notification from "../../../../Utils/Notifications";
import _ from "lodash-es";
import { chain } from "lodash-es";
import { Group, InvestigationType } from "..";
import {
getPatient,
Expand Down Expand Up @@ -174,7 +174,7 @@ const InvestigationReports = ({ id }: any) => {
})
);

const investigationList = _.chain(data)
const investigationList = chain(data)
.compact()
.flatten()
.map((i) => ({
Expand Down
12 changes: 6 additions & 6 deletions src/Components/Facility/Investigations/Reports/utils.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import _ from "lodash-es";
import { memoize, chain, findIndex } from "lodash-es";
import { InvestigationResponse } from "./types";

export const transformData = _.memoize((data: InvestigationResponse) => {
const sessions = _.chain(data)
export const transformData = memoize((data: InvestigationResponse) => {
const sessions = chain(data)
.map((value) => value.session_object)
.uniqBy("session_external_id")
.orderBy("session_created_date", "desc")
.value();
const groupByInvestigation = _.chain(data)
const groupByInvestigation = chain(data)
.groupBy("investigation_object.external_id")
.values()
.value();
const reqData = groupByInvestigation.map((value) => {
const sessionValues = Array.from({ length: sessions.length });
value.forEach((val) => {
const sessionIndex = _.findIndex(sessions, [
const sessionIndex = findIndex(sessions, [
"session_external_id",
val.session_object.session_external_id,
]);
Expand Down Expand Up @@ -55,7 +55,7 @@ export const transformData = _.memoize((data: InvestigationResponse) => {
return { sessions, data: reqData };
});

export const getColorIndex = _.memoize(
export const getColorIndex = memoize(
({ max, min, value }: { min?: number; max?: number; value?: number }) => {
if (!max && min && value) {
// 1 => yellow color
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Facility/Investigations/ShowInvestigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "../../../Redux/actions";
import PageTitle from "../../Common/PageTitle";
import InvestigationTable from "./InvestigationTable";
import _ from "lodash-es";
import { chain } from "lodash-es";
import { set } from "lodash-es";
import { navigate } from "raviger";
import * as Notification from "../../../Utils/Notifications.js";
Expand Down Expand Up @@ -147,7 +147,7 @@ export default function ShowInvestigation(props: any) {
};

const handleUpdateCancel = useCallback(() => {
const changedValues = _.chain(state.initialValues)
const changedValues = chain(state.initialValues)
.map((val: any, _key: string) => ({
id: val?.id,
initialValue: val?.notes || val?.value || null,
Expand Down
10 changes: 5 additions & 5 deletions src/Components/Patient/SampleDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ButtonV2 from "../Common/components/ButtonV2";
import Card from "../../CAREUI/display/Card";
import { FileUpload } from "./FileUpload";
import Page from "../Common/components/Page";
import _ from "lodash-es";
import { startCase, camelCase, capitalize } from "lodash-es";
import { formatAge, formatDateTime } from "../../Utils/utils";
import { getTestSample } from "../../Redux/actions";

Expand Down Expand Up @@ -259,11 +259,11 @@ export const SampleDetails = ({ id }: DetailRoute) => {
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
<div>
<span className="font-semibold leading-relaxed">Status: </span>{" "}
{_.startCase(_.camelCase(flow.status))}
{startCase(camelCase(flow.status))}
</div>
<div>
<span className="font-semibold leading-relaxed">Label:</span>{" "}
{_.capitalize(flow.notes)}
{capitalize(flow.notes)}
</div>
<div>
<span className="font-semibold leading-relaxed">Created On :</span>{" "}
Expand Down Expand Up @@ -347,7 +347,7 @@ export const SampleDetails = ({ id }: DetailRoute) => {
<span className="font-semibold leading-relaxed">
Doctor&apos;s Name:{" "}
</span>
{_.startCase(_.camelCase(sampleDetails.doctor_name))}
{startCase(camelCase(sampleDetails.doctor_name))}
</div>
)}
{sampleDetails.diagnosis && (
Expand Down Expand Up @@ -430,7 +430,7 @@ export const SampleDetails = ({ id }: DetailRoute) => {
<span className="font-semibold capitalize leading-relaxed">
Sample Type:{" "}
</span>
{_.startCase(_.camelCase(sampleDetails.sample_type))}
{startCase(camelCase(sampleDetails.sample_type))}
</div>
)}
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/Components/Patient/SampleTestCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { SAMPLE_TEST_STATUS } from "../../Common/constants";
import { patchSample } from "../../Redux/actions";
import * as Notification from "../../Utils/Notifications";
import UpdateStatusDialog from "./UpdateStatusDialog";
import _ from "lodash-es";
import { startCase, camelCase } from "lodash-es";
import { formatDateTime } from "../../Utils/utils";
import ButtonV2 from "../Common/components/ButtonV2";
import { NonReadOnlyUsers } from "../../Utils/AuthorizeFor";
Expand Down Expand Up @@ -92,7 +92,7 @@ export const SampleTestCard = (props: SampleDetailsProps) => {
Status{" "}
</div>
<div className="mt-1 overflow-x-scroll whitespace-normal break-words text-sm font-medium leading-5">
{_.startCase(_.camelCase(itemData.status))}
{startCase(camelCase(itemData.status))}
</div>
</div>
</div>
Expand Down Expand Up @@ -127,7 +127,7 @@ export const SampleTestCard = (props: SampleDetailsProps) => {
Result{" "}
</div>
<div className="mt-1 overflow-x-scroll whitespace-normal break-words text-sm font-medium leading-5">
{_.startCase(_.camelCase(itemData.result))}
{startCase(camelCase(itemData.result))}
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/Utils/Notifications.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { alert, Stack, defaultModules } from "@pnotify/core";
import * as PNotifyMobile from "@pnotify/mobile";
import _ from "lodash-es";
import { startCase, camelCase } from "lodash-es";

defaultModules.set(PNotifyMobile, {});

Expand Down Expand Up @@ -43,7 +43,7 @@ const notifyError = (error) => {
errorMsg = error.detail;
} else {
for (let [key, value] of Object.entries(error)) {
let keyName = _.startCase(_.camelCase(key));
let keyName = startCase(camelCase(key));
if (Array.isArray(value)) {
const uniques = [...new Set(value)];
errorMsg += `${keyName} - ${uniques.splice(0, 5).join(", ")}`;
Expand Down
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import thunk from "redux-thunk";
import { Provider } from "react-redux";
import * as Sentry from "@sentry/browser";
import "./style/index.css";
// eslint-disable-next-line import/no-unresolved
import { registerSW } from "virtual:pwa-register";

if ("serviceWorker" in navigator) {
Expand Down
1 change: 1 addition & 0 deletions src/types/react-virtualized/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-unresolved */
// Type definitions for react-virtualized 9.21
// Project: https://github.com/bvaughn/react-virtualized
// Definitions by: Kalle Ott <https://github.com/kaoDev>
Expand Down

0 comments on commit 025965c

Please sign in to comment.