Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskigen committed Dec 6, 2024
1 parent 4f66f57 commit e02080f
Show file tree
Hide file tree
Showing 20 changed files with 18 additions and 45 deletions.
3 changes: 1 addition & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"project": true,
"tsconfigRootDir": "__dirname"
},
"plugins": ["@typescript-eslint", "import", "react-hooks", "unused-imports"],
"plugins": ["@typescript-eslint", "import", "react-hooks"],
"root": true,
"rules": {
// The following rules need `noImplicitAny` to be set to `true` in our tsconfig. They are too restrictive for now, but should be reconsidered in future
Expand Down Expand Up @@ -63,7 +63,6 @@
]
}
],
"unused-imports/no-unused-imports-ts": "error",
"react-hooks/exhaustive-deps": "warn",
"react-hooks/rules-of-hooks": "error"
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
"eslint": "^8.50.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"husky": "^8.0.3",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.4.2",
Expand Down
2 changes: 1 addition & 1 deletion src/cohort-builder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { showToast, useLayoutType } from '@openmrs/esm-framework';
import { useTranslation } from 'react-i18next';
import { getCohortMembers, getDataSet, search } from './cohort-builder.resources';
import { addToHistory } from './cohort-builder.utils';
import { type Patient, type SearchParams } from './types';
import type { Patient, SearchParams } from './types';
import Composition from './components/composition/composition.component';
import SavedCohorts from './components/saved-cohorts/saved-cohorts.component';
import SavedQueries from './components/saved-queries/saved-queries.component';
Expand Down
2 changes: 1 addition & 1 deletion src/cohort-builder.utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Column, type Patient, type Query } from './types';
import type { Column, Patient, Query } from './types';

export const composeJson = (searchParameters) => {
const query: Query = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/composition/composition.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState } from 'react';
import { TextInput } from '@carbon/react';
import { useTranslation } from 'react-i18next';
import { showNotification } from '@openmrs/esm-framework';
import { type SearchByProps } from '../../types';
import type { SearchByProps } from '../../types';
import { createCompositionQuery, isCompositionValid } from './composition.utils';
import SearchButtonSet from '../search-button-set/search-button-set';
import styles from './composition.style.css';
Expand Down
2 changes: 1 addition & 1 deletion src/components/composition/composition.utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { addColumnsToDisplay } from '../../cohort-builder.utils';
import { type Query } from '../../types';
import type { Query } from '../../types';

export const isCompositionValid = (search: string) => {
const matches = search.match(/and|or|not|\d+|\)|\(|union|intersection|!|\+/gi);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState } from 'react';
import { ComposedModal, ModalFooter, ModalHeader, OverflowMenu, OverflowMenuItem } from '@carbon/react';
import { useTranslation } from 'react-i18next';
import { showToast } from '@openmrs/esm-framework';
import { type DefinitionDataRow } from '../../../types';
import type { DefinitionDataRow } from '../../../types';

enum Options {
VIEW,
Expand Down
2 changes: 1 addition & 1 deletion src/components/saved-cohorts/saved-cohorts.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import { DataTable, Table, TableHead, TableRow, TableHeader, TableBody, TableCell, Pagination } from '@carbon/react';
import { showToast } from '@openmrs/esm-framework';
import { useTranslation } from 'react-i18next';
import { type DefinitionDataRow, type PaginationData } from '../../types';
import type { DefinitionDataRow, PaginationData } from '../../types';
import { onDeleteCohort, getCohorts } from './saved-cohorts.resources';
import EmptyData from '../empty-data/empty-data.component';
import SavedCohortsOptions from './saved-cohorts-options/saved-cohorts-options.component';
Expand Down
2 changes: 1 addition & 1 deletion src/components/saved-cohorts/saved-cohorts.resources.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type FetchResponse, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
import { type Cohort, type DefinitionDataRow } from '../../types';
import type { Cohort, DefinitionDataRow } from '../../types';

/**
* @returns Cohorts
Expand Down
2 changes: 1 addition & 1 deletion src/components/saved-cohorts/saved-cohorts.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { openmrsFetch } from '@openmrs/esm-framework';
import { render, screen, waitFor } from '@testing-library/react';
import { type DefinitionDataRow } from '../../types';
import type { DefinitionDataRow } from '../../types';
import { getCohorts } from './saved-cohorts.resources';
import SavedCohorts from './saved-cohorts.component';

Expand Down
2 changes: 1 addition & 1 deletion src/components/saved-queries/saved-queries.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import { DataTable, Table, TableHead, TableRow, TableHeader, TableBody, TableCell, Pagination } from '@carbon/react';
import { showToast } from '@openmrs/esm-framework';
import { useTranslation } from 'react-i18next';
import { type DefinitionDataRow, type PaginationData } from '../../types';
import type { DefinitionDataRow, PaginationData } from '../../types';
import { deleteDataSet, getQueries } from './saved-queries.resources';
import EmptyData from '../empty-data/empty-data.component';
import SavedQueriesOptions from './saved-queries-options/saved-queries-options.component';
Expand Down
2 changes: 1 addition & 1 deletion src/components/saved-queries/saved-queries.resources.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type FetchResponse, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
import { type Response, type DefinitionDataRow } from '../../types';
import type { DefinitionDataRow, Response } from '../../types';

/**
* @returns Queries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DatePicker, DatePickerInput, Column, Dropdown, NumberInput, Switch, Con
import { useTranslation } from 'react-i18next';
import dayjs from 'dayjs';
import { composeJson, queryDescriptionBuilder } from '../../cohort-builder.utils';
import { type Concept, type SearchByProps } from '../../types';
import type { Concept, SearchByProps } from '../../types';
import { SearchConcept } from './search-concept/search-concept.component';
import SearchButtonSet from '../search-button-set/search-button-set';
import styles from './search-by-concepts.style.scss';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type FetchResponse, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
import { type Concept, type DataType } from '../../../types';
import type { Concept, DataType } from '../../../types';

interface ConceptResponse {
uuid: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import dayjs from 'dayjs';
import { Column, DatePicker, DatePickerInput, Dropdown, MultiSelect } from '@carbon/react';
import { useTranslation } from 'react-i18next';
import { showToast } from '@openmrs/esm-framework';
import { type DropdownValue, type DrugOrderDetails, type SearchByProps } from '../../types';
import type { DropdownValue, DrugOrderDetails, SearchByProps } from '../../types';
import { getDescription, getQueryDetails } from './search-by-drug-orders.utils';
import { useCareSettings, useDrugs } from './search-by-drug-orders.resources';
import SearchButtonSet from '../search-button-set/search-button-set';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { useMemo } from 'react';
import useSWRImmutable from 'swr/immutable';
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';

import { type DropdownValue, type Response } from '../../types';
import type { DropdownValue, Response } from '../../types';

/**
* @returns Drugs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import React, { useState } from 'react';
import dayjs from 'dayjs';
import { DatePicker, DatePickerInput, Column, NumberInput, MultiSelect } from '@carbon/react';
import { useTranslation } from 'react-i18next';

import { showToast } from '@openmrs/esm-framework';
import { useLocations } from '../../cohort-builder.resources';
import { type SearchByProps, type DropdownValue } from '../../types';
import type { SearchByProps, DropdownValue } from '../../types';
import { getDescription, getQueryDetails } from './search-by-encounters.utils';
import { useEncounterTypes, useForms } from './search-by-encounters.resources';
import SearchButtonSet from '../search-button-set/search-button-set';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useSWRImmutable from 'swr/immutable';
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
import { type DropdownValue, type Response } from '../../types';
import type { DropdownValue, Response } from '../../types';

/**
* @returns Locations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '@carbon/react';
import { showToast } from '@openmrs/esm-framework';
import { downloadCSV } from '../../../cohort-builder.utils';
import { type Cohort, type Patient, type SearchHistoryItem } from '../../../types';
import type { Cohort, Patient, SearchHistoryItem } from '../../../types';
import { createCohort, createQuery } from './search-history-options.resources';

enum Option {
Expand Down
23 changes: 0 additions & 23 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3165,7 +3165,6 @@ __metadata:
eslint: "npm:^8.50.0"
eslint-plugin-import: "npm:^2.31.0"
eslint-plugin-react-hooks: "npm:^5.0.0"
eslint-plugin-unused-imports: "npm:^2.0.0"
husky: "npm:^8.0.3"
identity-obj-proxy: "npm:^3.0.0"
jest: "npm:^29.4.2"
Expand Down Expand Up @@ -8186,28 +8185,6 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin-unused-imports@npm:^2.0.0":
version: 2.0.0
resolution: "eslint-plugin-unused-imports@npm:2.0.0"
dependencies:
eslint-rule-composer: "npm:^0.3.0"
peerDependencies:
"@typescript-eslint/eslint-plugin": ^5.0.0
eslint: ^8.0.0
peerDependenciesMeta:
"@typescript-eslint/eslint-plugin":
optional: true
checksum: 10/ab2e829cf8f246431c9dd86c4f8a1e2b729111cb312791b2da9c46ac48e24b8772c5f56b46efa498f6954975c78e2f31dafbd1372a7c025dc6e10950d4f434ac
languageName: node
linkType: hard

"eslint-rule-composer@npm:^0.3.0":
version: 0.3.0
resolution: "eslint-rule-composer@npm:0.3.0"
checksum: 10/c751e71243c6750de553ca0f586a71c7e9d43864bcbd0536639f287332e3f1ed3337bb0db07020652fa90937ceb63b6cc14c0f71fb227e8fc20ca44ee67e837f
languageName: node
linkType: hard

"eslint-scope@npm:5.1.1":
version: 5.1.1
resolution: "eslint-scope@npm:5.1.1"
Expand Down

0 comments on commit e02080f

Please sign in to comment.