Skip to content

Commit

Permalink
Perform type checks during build and fix all errors (#7469)
Browse files Browse the repository at this point in the history
* Fail build if typescript errors present

* error fixes part 1

* fixes part 2

* fix merge conflict

* fixes part 3

* fixes part 4

* fixes facility select using -1 for id

* fixes type errors in daily rounds

* fixes #7482

* some minor fixes..

* fixes #7473

* update lockfile

* ignore generated files

* fix node 20 code present in codebase

* remove more errors

* run `lint-fix`

* Switch off classnames order in eslint

* fix lint from linux

* fix lint

---------

Co-authored-by: Mohammed Nihal <[email protected]>
  • Loading branch information
rithviknishad and nihal467 authored Apr 2, 2024
1 parent 8dfa65d commit fe6e616
Show file tree
Hide file tree
Showing 57 changed files with 416 additions and 245 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
],
"tailwindcss/no-custom-classname": "off",
"tailwindcss/migration-from-tailwind-2": "error",
"tailwindcss/classnames-order": "error",
"tailwindcss/classnames-order": "off",
"tailwindcss/enforces-shorthand": "off",
"tailwindcss/no-contradicting-classname": "error"
},
Expand Down
9 changes: 7 additions & 2 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"semi": true,
"jsxSingleQuote": false,
"arrowParens": "always",
"tailwindFunctions": ["classNames"]
}
"tailwindFunctions": [
"classNames"
],
"plugins": [
"prettier-plugin-tailwindcss"
]
}
209 changes: 209 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"@tailwindcss/typography": "^0.5.9",
"@types/cypress": "^1.1.3",
"@types/echarts": "^4.9.18",
"@types/google.maps": "^3.55.5",
"@types/lodash-es": "^4.17.9",
"@types/qrcode.react": "^1.0.2",
"@types/react": "18.2.14",
Expand Down Expand Up @@ -159,6 +160,7 @@
"tailwindcss": "^3.3.3",
"typescript": "^5.1.6",
"vite": "^5.1.3",
"vite-plugin-checker": "^0.6.4",
"vite-plugin-pwa": "^0.18.2"
},
"browserslist": {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export const DISCHARGE_REASONS = [
{ id: 2, text: "Referred" },
{ id: 3, text: "Expired" },
{ id: 4, text: "LAMA" },
];
] as const;

export const CONSCIOUSNESS_LEVEL = [
{ id: "UNRESPONSIVE", text: "Unresponsive" },
Expand Down
2 changes: 1 addition & 1 deletion src/Common/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const useAbortableEffect = (
};

export const parseOptionId: (
options: OptionsType[],
options: readonly OptionsType[],
id: string | string[]
) => string = (options, id) => {
const textArray = options
Expand Down
6 changes: 3 additions & 3 deletions src/Components/Assets/AssetConfigure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const AssetConfigure = ({ assetId, facilityId }: AssetConfigureProps) => {
<Page
title={`Configure HL7 Monitor: ${asset.name}`}
crumbsReplacements={{
[facilityId]: { name: asset.location_object.facility.name },
[facilityId]: { name: asset.location_object.facility?.name },
assets: { uri: `/assets?facility=${facilityId}` },
[assetId]: { name: asset?.name },
}}
Expand All @@ -42,7 +42,7 @@ const AssetConfigure = ({ assetId, facilityId }: AssetConfigureProps) => {
<Page
title={`Configure Ventilator: ${asset?.name}`}
crumbsReplacements={{
[facilityId]: { name: asset?.location_object.facility.name },
[facilityId]: { name: asset?.location_object.facility?.name },
assets: { uri: `/assets?facility=${facilityId}` },
[assetId]: { name: asset?.name },
}}
Expand All @@ -57,7 +57,7 @@ const AssetConfigure = ({ assetId, facilityId }: AssetConfigureProps) => {
<Page
title={`Configure ONVIF Camera: ${asset?.name}`}
crumbsReplacements={{
[facilityId]: { name: asset?.location_object.facility.name },
[facilityId]: { name: asset?.location_object.facility?.name },
assets: { uri: `/assets?facility=${facilityId}` },
[assetId]: { name: asset?.name },
}}
Expand Down
8 changes: 4 additions & 4 deletions src/Components/Assets/AssetManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ const AssetManage = (props: AssetManageProps) => {
<Page
title="Asset Details"
crumbsReplacements={{
[facilityId]: { name: asset?.location_object.facility.name },
[facilityId]: { name: asset?.location_object.facility?.name },
assets: { uri: `/assets?facility=${facilityId}` },
[assetId]: {
name: asset?.name,
Expand Down Expand Up @@ -404,7 +404,7 @@ const AssetManage = (props: AssetManageProps) => {
<div className="flex flex-col gap-6">
{[
{
label: asset?.location_object.facility.name,
label: asset?.location_object.facility?.name,
icon: "l-location-pin-alt",
content: asset?.location_object.name,
},
Expand All @@ -426,7 +426,7 @@ const AssetManage = (props: AssetManageProps) => {
className="flex gap-2"
onClick={() =>
navigate(
`/facility/${asset?.location_object.facility.id}/assets/${asset?.id}/update`
`/facility/${asset?.location_object.facility?.id}/assets/${asset?.id}/update`
)
}
id="update-asset"
Expand All @@ -444,7 +444,7 @@ const AssetManage = (props: AssetManageProps) => {
<ButtonV2
onClick={() =>
navigate(
`/facility/${asset?.location_object.facility.id}/assets/${asset?.id}/configure`
`/facility/${asset?.location_object.facility?.id}/assets/${asset?.id}/configure`
)
}
id="configure-asset"
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Assets/AssetWarrantyCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function AssetWarrantyCard(props: { asset: AssetData }) {
</div>
))}
</div>
<div className="mb-2 hidden h-[1px] w-full bg-white/40 xl:block" />
<div className="mb-2 hidden h-px w-full bg-white/40 xl:block" />
<div className="shrink-0">
<div>
<div className="mb-1 text-xs uppercase italic tracking-widest text-gray-200">
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Assets/AssetsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const AssetsList = () => {
try {
if (assetData) {
navigate(
`/facility/${assetData.location_object.facility.id}/assets/${assetId}`
`/facility/${assetData.location_object.facility?.id}/assets/${assetId}`
);
}
} catch (err) {
Expand Down Expand Up @@ -188,7 +188,7 @@ const AssetsList = () => {
{assets.map((asset: AssetData) => (
<Link
key={asset.id}
href={`/facility/${asset?.location_object.facility.id}/assets/${asset.id}`}
href={`/facility/${asset?.location_object.facility?.id}/assets/${asset.id}`}
className="h-full text-inherit"
data-testid="created-asset-list"
>
Expand Down
Loading

0 comments on commit fe6e616

Please sign in to comment.