Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Disallow Relative import #10009

Merged
merged 30 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
18af78d
package added
AdityaJ2305 Jan 16, 2025
4deec78
update the address
AdityaJ2305 Jan 16, 2025
95f433d
Merge branch 'develop' into eslint_no_relative_path
AdityaJ2305 Jan 16, 2025
af35804
Empty-Commit
AdityaJ2305 Jan 16, 2025
943a999
fixed import in codebase
AdityaJ2305 Jan 16, 2025
b5a1a4d
Merge branch 'develop' into eslint_no_relative_path
AdityaJ2305 Jan 16, 2025
0feaa4c
Merge branch 'develop' into eslint_no_relative_path
AdityaJ2305 Jan 17, 2025
c615781
fix import lint fail
AdityaJ2305 Jan 17, 2025
09a38c8
Merge branch 'develop' into eslint_no_relative_path
AdityaJ2305 Jan 17, 2025
785a4ab
Merge branch 'develop' into eslint_no_relative_path
AdityaJ2305 Jan 17, 2025
b52df97
resolved conflicts
AdityaJ2305 Jan 17, 2025
e6da4e3
rm samefileimport
AdityaJ2305 Jan 17, 2025
437c732
file fix after rm samefileimport
AdityaJ2305 Jan 17, 2025
8b38470
file fix after rm samefileimport 2.0
AdityaJ2305 Jan 17, 2025
1c6c718
file fix after rm samefileimport 2.0
AdityaJ2305 Jan 17, 2025
021ba4c
Merge branch 'develop' into eslint_no_relative_path
rithviknishad Jan 18, 2025
293b09f
fix unused errors on some file
AdityaJ2305 Jan 18, 2025
fa041bb
Merge branch 'develop' into eslint_no_relative_path
AdityaJ2305 Jan 18, 2025
e712618
eslint ignore specific lines
AdityaJ2305 Jan 19, 2025
18572d9
eslint ignore specific lines
AdityaJ2305 Jan 19, 2025
553623e
Merge branch 'develop' into eslint_no_relative_path
AdityaJ2305 Jan 20, 2025
412197c
Revert "file fix after rm samefileimport 2.0"
AdityaJ2305 Jan 20, 2025
8502325
reset to allowsamedir
AdityaJ2305 Jan 20, 2025
426aa2b
Revert "file fix after rm samefileimport 2.0"
AdityaJ2305 Jan 20, 2025
0ecea01
reset to allowsamedir
AdityaJ2305 Jan 20, 2025
bb18675
Merge branch 'develop' into eslint_no_relative_path
AdityaJ2305 Jan 20, 2025
a53aa91
resolved conflicts
AdityaJ2305 Jan 20, 2025
56bafb2
replace unused to _
AdityaJ2305 Jan 20, 2025
7eae09e
Merge branch 'develop' into eslint_no_relative_path
AdityaJ2305 Jan 20, 2025
086b795
resolved conflicts
AdityaJ2305 Jan 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 12 additions & 23 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@
],
"overrides": [
{
"files": [
"**/*.mdx"
],
"extends": [
"plugin:react/recommended",
"plugin:mdx/recommended"
],
"files": ["**/*.mdx"],
"extends": ["plugin:react/recommended", "plugin:mdx/recommended"],
"rules": {
"react/jsx-no-target-blank": "off",
"i18next/no-literal-string": "off"
Expand All @@ -40,10 +35,7 @@
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"i18next"
],
"plugins": ["@typescript-eslint", "i18next", "no-relative-import-paths"],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
Expand All @@ -61,22 +53,19 @@
{
"mode": "jsx-only",
"jsx-attributes": {
"include": [
"label",
"placeholder",
"error",
"title"
],
"exclude": [
".*"
]
"include": ["label", "placeholder", "error", "title"],
"exclude": [".*"]
},
"callees": {
"exclude": [
".*"
]
"exclude": [".*"]
}
}
],
"no-relative-import-paths/no-relative-import-paths": [
"error",
{
"prefix": "@"
}
]
},
"ignorePatterns": [
Expand Down
8 changes: 8 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-i18next": "^6.1.0",
"eslint-plugin-mdx": "^3.1.5",
"eslint-plugin-no-relative-import-paths": "^1.6.1",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
Expand Down
3 changes: 1 addition & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ import PluginEngine from "@/PluginEngine";
import AuthUserProvider from "@/Providers/AuthUserProvider";
import HistoryAPIProvider from "@/Providers/HistoryAPIProvider";
import Routers from "@/Routers";
import { PubSubProvider } from "@/Utils/pubsubContext";
import { handleHttpError } from "@/Utils/request/errorHandler";

import { PubSubProvider } from "./Utils/pubsubContext";

const queryClient = new QueryClient({
defaultOptions: {
queries: {
Expand Down
5 changes: 2 additions & 3 deletions src/Routers/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@ import { usePluginRoutes } from "@/hooks/useCareApps";

import ConsultationRoutes from "@/Routers/routes/ConsultationRoutes";
import FacilityRoutes from "@/Routers/routes/FacilityRoutes";
import OrganizationRoutes from "@/Routers/routes/OrganizationRoutes";
import PatientRoutes from "@/Routers/routes/PatientRoutes";
import ResourceRoutes from "@/Routers/routes/ResourceRoutes";
import ScheduleRoutes from "@/Routers/routes/ScheduleRoutes";
import UserRoutes from "@/Routers/routes/UserRoutes";
import QuestionnaireRoutes from "@/Routers/routes/questionnaireRoutes";
import { PermissionProvider } from "@/context/PermissionContext";
import { PlugConfigEdit } from "@/pages/Apps/PlugConfigEdit";
import { PlugConfigList } from "@/pages/Apps/PlugConfigList";
import UserDashboard from "@/pages/UserDashboard";

import OrganizationRoutes from "./routes/OrganizationRoutes";
import QuestionnaireRoutes from "./routes/questionnaireRoutes";

// List of paths where the sidebar should be hidden
const PATHS_WITHOUT_SIDEBAR = ["/", "/session-expired"];

Expand Down
3 changes: 1 addition & 2 deletions src/Routers/PatientRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ import { patientTabs } from "@/components/Patient/PatientDetailsTab";
import { PatientHome } from "@/components/Patient/PatientHome";

import PatientUserProvider from "@/Providers/PatientUserProvider";
import PublicRouter from "@/Routers/PublicRouter";
import { FacilitiesPage } from "@/pages/Facility/FacilitiesPage";
import PatientIndex from "@/pages/Patient/index";
import { PatientRegistration } from "@/pages/PublicAppointments/PatientRegistration";
import PatientSelect from "@/pages/PublicAppointments/PatientSelect";
import { ScheduleAppointment } from "@/pages/PublicAppointments/Schedule";
import { AppointmentSuccess } from "@/pages/PublicAppointments/Success";

import PublicRouter from "./PublicRouter";

const DashboardRoutes = {
"/nearby_facilities": () => <FacilitiesPage />,
"/facility/:facilityId/appointments/:appointmentId/success": ({
Expand Down
2 changes: 1 addition & 1 deletion src/Routers/routes/questionnaireRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { QuestionnaireList } from "@/components/Questionnaire";
import QuestionnaireEditor from "@/components/Questionnaire/QuestionnaireEditor";
import { QuestionnaireShow } from "@/components/Questionnaire/show";

import { AppRoutes } from "../AppRouter";
import { AppRoutes } from "@/Routers/AppRouter";

const QuestionnaireRoutes: AppRoutes = {
"/questionnaire": () => <QuestionnaireList />,
Expand Down
3 changes: 1 addition & 2 deletions src/Utils/request/useQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { useMemo, useRef } from "react";

import request from "@/Utils/request/request";
import { ApiRoute, RequestOptions } from "@/Utils/request/types";

import { mergeRequestOptions } from "./utils";
import { mergeRequestOptions } from "@/Utils/request/utils";

export interface QueryOptions<TData> extends RequestOptions<TData> {
prefetch?: boolean;
Expand Down
6 changes: 3 additions & 3 deletions src/components/Common/Charts/ObservationChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import {
} from "@/components/ui/table";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";

import { Avatar } from "@/components/Common/Avatar";
import { ObservationHistoryTable } from "@/components/Common/Charts/ObservationHistoryTable";

import routes from "@/Utils/request/api";
import query from "@/Utils/request/query";
import { ObservationAnalyzeResponse } from "@/types/emr/observation";
import { Code } from "@/types/questionnaire/code";

import { Avatar } from "../Avatar";
import { ObservationHistoryTable } from "./ObservationHistoryTable";

export type ObservationPlotConfig = {
id: string;
name: string;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Common/Charts/ObservationHistoryTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import {
TableRow,
} from "@/components/ui/table";

import { Avatar } from "@/components/Common/Avatar";

import routes from "@/Utils/request/api";
import query from "@/Utils/request/query";
import { ObservationWithUser } from "@/types/emr/observation";
import { Code } from "@/types/questionnaire/code";

import { Avatar } from "../Avatar";

interface PaginatedResponse<T> {
count: number;
next: string | null;
Expand Down
3 changes: 1 addition & 2 deletions src/components/Common/UserAutocompleteFormField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useState } from "react";

import { Avatar } from "@/components/Common/Avatar";
import { Autocomplete } from "@/components/Form/FormFields/Autocomplete";
import FormField from "@/components/Form/FormFields/FormField";
import {
Expand All @@ -18,8 +19,6 @@ import {
mergeQueryOptions,
} from "@/Utils/utils";

import { Avatar } from "./Avatar";

type BaseProps = FormFieldBaseProps<UserBareMinimum> & {
placeholder?: string;
userType?: UserType;
Expand Down
4 changes: 2 additions & 2 deletions src/components/ErrorPages/DefaultErrorPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { useEffect } from "react";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";

import useAppHistory from "@/hooks/useAppHistory";
import { Button } from "@/components/ui/button";

import { Button } from "../ui/button";
import useAppHistory from "@/hooks/useAppHistory";

type ErrorType = "PAGE_NOT_FOUND" | "PAGE_LOAD_ERROR" | "CUSTOM_ERROR";

Expand Down
12 changes: 6 additions & 6 deletions src/components/Facility/DuplicatePatientDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ import { useTranslation } from "react-i18next";

import CareIcon from "@/CAREUI/icons/CareIcon";

import DialogModal from "@/components/Common/Dialog";

import { PartialPatientModel } from "@/types/emr/newPatient";

import { Button } from "../ui/button";
import { Button } from "@/components/ui/button";
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "../ui/table";
} from "@/components/ui/table";

import DialogModal from "@/components/Common/Dialog";

import { PartialPatientModel } from "@/types/emr/newPatient";

interface Props {
patientList: Array<PartialPatientModel>;
Expand Down
3 changes: 1 addition & 2 deletions src/components/Facility/EncounterCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import { cn } from "@/lib/utils";
import CareIcon from "@/CAREUI/icons/CareIcon";

import { Badge } from "@/components/ui/badge";
import { buttonVariants } from "@/components/ui/button";

import { formatDateTime } from "@/Utils/utils";
import { Encounter, completedEncounterStatus } from "@/types/emr/encounter";

import { buttonVariants } from "../ui/button";

interface EncounterCardProps {
encounter: Encounter;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Files/AudioCaptureDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import CareIcon from "@/CAREUI/icons/CareIcon";

import { useTimer } from "@/hooks/useTimer";

import useVoiceRecorder from "../../Utils/useVoiceRecorder";
import useVoiceRecorder from "@/Utils/useVoiceRecorder";

export interface AudioCaptureDialogProps {
show: boolean;
Expand Down
7 changes: 5 additions & 2 deletions src/components/Patient/MedicationStatementList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table";
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";

import routes from "@/Utils/request/api";
import query from "@/Utils/request/query";
import { formatDateTime } from "@/Utils/utils";

import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip";

interface MedicationStatementListProps {
patientId: string;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { MedicationStatementList } from "@/components/Patient/MedicationStatementList";
import { AllergyList } from "@/components/Patient/allergy/list";
import { DiagnosisList } from "@/components/Patient/diagnosis/list";
import { SymptomsList } from "@/components/Patient/symptoms/list";

import { PatientProps } from ".";
import { MedicationStatementList } from "../MedicationStatementList";
import { AllergyList } from "../allergy/list";

export const HealthProfileSummary = (props: PatientProps) => {
const { id } = props;
Expand Down
13 changes: 6 additions & 7 deletions src/components/Patient/PatientDetailsTab/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import EncounterHistory from "@/components/Patient/PatientDetailsTab//EncounterHistory";
import { HealthProfileSummary } from "@/components/Patient/PatientDetailsTab//HealthProfileSummary";
import { Appointments } from "@/components/Patient/PatientDetailsTab/Appointments";
import { Demography } from "@/components/Patient/PatientDetailsTab/Demography";
import EncounterHistory from "@/components/Patient/PatientDetailsTab/EncounterHistory";
import { HealthProfileSummary } from "@/components/Patient/PatientDetailsTab/HealthProfileSummary";
import { PatientFilesTab } from "@/components/Patient/PatientDetailsTab/PatientFiles";
import { PatientUsers } from "@/components/Patient/PatientDetailsTab/PatientUsers";
import { ResourceRequests } from "@/components/Patient/PatientDetailsTab/ResourceRequests";
import { Updates } from "@/components/Patient/PatientDetailsTab/patientUpdates";

import { Patient } from "@/types/emr/newPatient";

import { Appointments } from "./Appointments";
import { PatientFilesTab } from "./PatientFiles";
import { PatientUsers } from "./PatientUsers";
import { ResourceRequests } from "./ResourceRequests";

export interface PatientProps {
facilityId: string;
id: string;
Expand Down
3 changes: 1 addition & 2 deletions src/components/Patient/PatientInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
} from "@/components/ui/popover";

import { Avatar } from "@/components/Common/Avatar";
import ManageEncounterOrganizations from "@/components/Patient/ManageEncounterOrganizations";

import useQuestionnaireOptions from "@/hooks/useQuestionnaireOptions";

Expand All @@ -39,8 +40,6 @@ import { formatDateTime, formatPatientAge } from "@/Utils/utils";
import { Encounter, completedEncounterStatus } from "@/types/emr/encounter";
import { Patient } from "@/types/emr/newPatient";

import ManageEncounterOrganizations from "./ManageEncounterOrganizations";

export interface PatientInfoCardProps {
patient: Patient;
encounter: Encounter;
Expand Down
3 changes: 1 addition & 2 deletions src/components/Patient/PatientRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { z } from "zod";
import CareIcon from "@/CAREUI/icons/CareIcon";
import SectionNavigator from "@/CAREUI/misc/SectionNavigator";

import Autocomplete from "@/components/ui/autocomplete";
import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox";
import {
Expand Down Expand Up @@ -56,8 +57,6 @@ import OrganizationSelector from "@/pages/Organization/components/OrganizationSe
import { PatientModel } from "@/types/emr/patient";
import { Organization } from "@/types/organization/organization";

import Autocomplete from "../ui/autocomplete";

interface PatientRegistrationPageProps {
facilityId: string;
patientId?: string;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Patient/diagnosis/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { useQuery } from "@tanstack/react-query";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Skeleton } from "@/components/ui/skeleton";

import { DiagnosisTable } from "@/components/Patient/diagnosis/DiagnosisTable";

import query from "@/Utils/request/query";
import diagnosisApi from "@/types/emr/diagnosis/diagnosisApi";

import { DiagnosisTable } from "./DiagnosisTable";

interface DiagnosisListProps {
patientId: string;
encounterId?: string;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Patient/symptoms/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { useQuery } from "@tanstack/react-query";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Skeleton } from "@/components/ui/skeleton";

import { SymptomTable } from "@/components/Patient/symptoms/SymptomTable";

import query from "@/Utils/request/query";
import symptomApi from "@/types/emr/symptom/symptomApi";

import { SymptomTable } from "./SymptomTable";

interface SymptomsListProps {
patientId: string;
encounterId?: string;
Expand Down
Loading
Loading