Skip to content

Commit

Permalink
(chore) Flag duplicate imports (#2106)
Browse files Browse the repository at this point in the history
This PR adds the [ESLint import plugin](https://github.com/import-js/eslint-plugin-import) and configures it to flag duplicate imports.
  • Loading branch information
denniskigen authored Nov 13, 2024
1 parent 219e370 commit 3f42ce5
Show file tree
Hide file tree
Showing 8 changed files with 643 additions and 33 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"plugin:testing-library/react"
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "jest-dom", "react-hooks", "testing-library"],
"plugins": ["@typescript-eslint", "import", "jest-dom", "react-hooks", "testing-library"],
"rules": {
"react-hooks/exhaustive-deps": "warn",
"react-hooks/rules-of-hooks": "error",
Expand All @@ -26,6 +26,7 @@
"fixStyle": "inline-type-imports"
}
],
"import/no-duplicates": "error",
"prefer-const": "off",
"no-console": ["error", { "allow": ["warn", "error"] }],
"no-unsafe-optional-chaining": "off",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"dayjs": "^1.11.10",
"dotenv": "^16.3.1",
"eslint": "^8.50.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest-dom": "^5.4.0",
"eslint-plugin-playwright": "^0.16.0",
"eslint-plugin-react-hooks": "^4.6.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import userEvent from '@testing-library/user-event';
import { screen, render, within } from '@testing-library/react';
import { type FetchResponse, getDefaultsFromConfigSchema, showSnackbar, useConfig } from '@openmrs/esm-framework';
import { mockAllergens, mockAllergicReactions } from '__mocks__';
import { getDefaultsFromConfigSchema, showSnackbar, useConfig } from '@openmrs/esm-framework';
import { mockAllergens, mockAllergicReactions, mockAllergy } from '__mocks__';
import { mockPatient } from 'tools';
import {
type NewAllergy,
Expand All @@ -11,7 +11,6 @@ import {
useAllergicReactions,
updatePatientAllergy,
} from './allergy-form.resource';
import { mockAllergy } from '__mocks__';
import { type AllergiesConfigObject, configSchema } from '../../config-schema';
import { AllergenType } from '../../types';
import AllergyForm from './allergy-form.workspace';
Expand Down
6 changes: 2 additions & 4 deletions packages/esm-patient-chart-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ import {
import * as PatientCommonLib from '@openmrs/esm-patient-common-lib';
import { createDashboardLink } from '@openmrs/esm-patient-common-lib';
import { esmPatientChartSchema } from './config-schema';
import { genericDashboardConfigSchema } from './side-nav/generic-dashboard.component';
import { genericNavGroupConfigSchema } from './side-nav/generic-nav-group.component';
import genericDashboardComponent, { genericDashboardConfigSchema } from './side-nav/generic-dashboard.component';
import genericNavGroupComponent, { genericNavGroupConfigSchema } from './side-nav/generic-nav-group.component';
import { moduleName } from './constants';
import { setupOfflineVisitsSync, setupCacheableRoutes } from './offline';
import { summaryDashboardMeta, encountersDashboardMeta } from './dashboard.meta';
import addPastVisitActionButtonComponent from './actions-buttons/add-past-visit.component';
import cancelVisitActionButtonComponent from './actions-buttons/cancel-visit.component';
import currentVisitSummaryComponent from './visit/visits-widget/current-visit-summary.component';
import genericDashboardComponent from './side-nav/generic-dashboard.component';
import genericNavGroupComponent from './side-nav/generic-nav-group.component';
import markPatientAliveActionButtonComponent from './actions-buttons/mark-patient-alive.component';
import markPatientDeceasedActionButtonComponent from './actions-buttons/mark-patient-deceased.component';
import pastVisitsDetailOverviewComponent from './visit/past-visit-overview.component';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import React, { useCallback } from 'react';
import { HeaderGlobalAction } from '@carbon/react';
import { getHistory, goBackInHistory, navigate, CloseFilledIcon } from '@openmrs/esm-framework';
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { getHistory, goBackInHistory, navigate, CloseFilledIcon } from '@openmrs/esm-framework';
import styles from './close-button.scss';

export function CloseButton({ patientUuid }: { patientUuid: string }) {
Expand All @@ -29,8 +28,8 @@ export function CloseButton({ patientUuid }: { patientUuid: string }) {

return (
<HeaderGlobalAction
className={styles.headerGlobalBarCloseButton}
aria-label={t('close', 'Close')}
className={styles.headerGlobalBarCloseButton}
onClick={onClosePatientChart}
>
<CloseFilledIcon size={20} />
Expand Down
14 changes: 4 additions & 10 deletions packages/esm-patient-common-lib/src/workspaces.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import {
type DefaultWorkspaceProps,
launchWorkspace,
navigateAndLaunchWorkspace,
usePatient,
} from '@openmrs/esm-framework';
import { getPatientUuidFromStore } from './store/patient-chart-store';
import { useSystemVisitSetting } from './useSystemVisitSetting';
import { useVisitOrOfflineVisit } from './offline/visit';
import { useCallback } from 'react';
import { type DefaultWorkspaceProps, launchWorkspace, navigateAndLaunchWorkspace } from '@openmrs/esm-framework';
import { getPatientUuidFromStore, usePatientChartStore } from './store/patient-chart-store';
import { launchStartVisitPrompt } from './launchStartVisitPrompt';
import { usePatientChartStore } from './store/patient-chart-store';
import { useSystemVisitSetting } from './useSystemVisitSetting';
import { useVisitOrOfflineVisit } from './offline/visit';

export interface DefaultPatientWorkspaceProps extends DefaultWorkspaceProps {
patientUuid: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import classNames from 'classnames';
import { useTranslation } from 'react-i18next';
import { Button, ButtonSkeleton, SkeletonText, Tile } from '@carbon/react';
import { ShoppingCartArrowUp } from '@carbon/react/icons';
import { launchPatientWorkspace, useOrderBasket } from '@openmrs/esm-patient-common-lib';
import { launchPatientWorkspace, useOrderBasket, usePatientChartStore } from '@openmrs/esm-patient-common-lib';
import {
ArrowRightIcon,
closeWorkspace,
Expand All @@ -24,7 +24,6 @@ import {
} from './drug-search.resource';
import type { DrugOrderBasketItem } from '../../types';
import styles from './order-basket-search-results.scss';
import { usePatientChartStore } from '@openmrs/esm-patient-common-lib';

export interface OrderBasketSearchResultsProps {
searchTerm: string;
Expand Down
Loading

0 comments on commit 3f42ce5

Please sign in to comment.