Skip to content

Commit

Permalink
feat: Lint imports problems as errors and fix them
Browse files Browse the repository at this point in the history
  • Loading branch information
Loxeris committed Apr 12, 2024
1 parent c46999a commit 547c7d1
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
},
"plugins": ["import"],
"rules": {
"import/order": ["warn"],
"import/no-unused-modules": ["warn"],
"import/no-useless-path-segments": ["warn"]
"import/order": ["error"],
"import/no-unused-modules": ["error"],
"import/no-useless-path-segments": ["error"]
}
}
2 changes: 1 addition & 1 deletion src/components/applications/JobMonitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import * as React from "react";
import CssBaseline from "@mui/material/CssBaseline";
import { Box } from "@mui/material";
import { useMUITheme } from "@/hooks/theme";
import { ThemeProvider as MUIThemeProvider } from "@mui/material/styles";
import { JobDataTable } from "../ui/JobDataTable";
import Dashboard from "../layout/Dashboard";
import { useMUITheme } from "@/hooks/theme";

/**
* Build the Job Monitor application
Expand Down
6 changes: 3 additions & 3 deletions src/components/applications/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import MenuItem from "@mui/material/MenuItem";
import Button from "@mui/material/Button";
import Autocomplete from "@mui/material/Autocomplete";
import TextField from "@mui/material/TextField";
import { useMetadata, Metadata } from "@/hooks/metadata";
import Image from "next/image";
import { CssBaseline, Stack } from "@mui/material";
import { useMUITheme } from "@/hooks/theme";
import { ThemeProvider as MUIThemeProvider } from "@mui/material/styles";
import { useRouter } from "next/navigation";
import { useOIDCContext } from "@/hooks/oidcConfiguration";
import * as React from "react";
import { useOidc } from "@axa-fr/react-oidc";
import { useOIDCContext } from "@/hooks/oidcConfiguration";
import { useMUITheme } from "@/hooks/theme";
import { useMetadata, Metadata } from "@/hooks/metadata";

/**
* Login form
Expand Down
4 changes: 2 additions & 2 deletions src/components/applications/UserDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import * as React from "react";
import CssBaseline from "@mui/material/CssBaseline";
import { Box } from "@mui/material";
import { useMUITheme } from "@/hooks/theme";
import { ThemeProvider as MUIThemeProvider } from "@mui/material/styles";
import { useOidcAccessToken } from "@axa-fr/react-oidc";
import { useOIDCContext } from "@/hooks/oidcConfiguration";
import Dashboard from "../layout/Dashboard";
import { useOIDCContext } from "@/hooks/oidcConfiguration";
import { useMUITheme } from "@/hooks/theme";

/**
* Build the User Dashboard page
Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import IconButton from "@mui/material/IconButton";
import MenuIcon from "@mui/icons-material/Menu";
import Toolbar from "@mui/material/Toolbar";
import Stack from "@mui/material/Stack";
import { ThemeProvider as MUIThemeProvider } from "@mui/material/styles";
import { ProfileButton } from "../ui/ProfileButton";
import DashboardDrawer from "../ui/DashboardDrawer";
import { useMUITheme } from "@/hooks/theme";
import { ThemeProvider as MUIThemeProvider } from "@mui/material/styles";
import { ThemeToggleButton } from "../ui/ThemeToggleButton";
import { useMUITheme } from "@/hooks/theme";

interface DashboardProps {
children: React.ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/DashboardDrawer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { DiracLogo } from "./DiracLogo";
import { usePathname } from "next/navigation";
import NextLink from "next/link";
import {
Expand All @@ -15,6 +14,7 @@ import { Dashboard, FolderCopy } from "@mui/icons-material";
import MonitorIcon from "@mui/icons-material/Monitor";
import MenuBookIcon from "@mui/icons-material/MenuBook";
import { ReactEventHandler } from "react";
import { DiracLogo } from "./DiracLogo";

// Define the sections that are accessible to users.
// Each section has an associated icon and path.
Expand Down
13 changes: 7 additions & 6 deletions src/components/ui/JobDataTable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from "react";
import { DataTable, MenuItem } from "./DataTable";
import Box from "@mui/material/Box";
import {
blue,
Expand All @@ -21,17 +20,19 @@ import {
Tooltip,
useMediaQuery,
useTheme,
Backdrop,
CircularProgress,
Snackbar,
} from "@mui/material";
import { useOidcAccessToken } from "@axa-fr/react-oidc";
import { useOIDCContext } from "../../hooks/oidcConfiguration";
import DeleteIcon from "@mui/icons-material/Delete";
import ClearIcon from "@mui/icons-material/Clear";
import ReplayIcon from "@mui/icons-material/Replay";
import { Backdrop, CircularProgress, Snackbar } from "@mui/material";
import { mutate } from "swr";
import useSWR from "swr";
import { fetcher } from "@/hooks/utils";
import useSWR, { mutate } from "swr";
import { useOIDCContext } from "../../hooks/oidcConfiguration";
import { DataTable, MenuItem } from "./DataTable";
import { JobHistoryDialog } from "./JobHistoryDialog";
import { fetcher } from "@/hooks/utils";
import { Filter } from "@/types/Filter";
import { Column } from "@/types/Column";

Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/ProfileButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"use client";
import { useOIDCContext } from "@/hooks/oidcConfiguration";
import { useOidc, useOidcAccessToken } from "@axa-fr/react-oidc";
import { Logout } from "@mui/icons-material";
import {
Expand All @@ -15,6 +14,7 @@ import {
} from "@mui/material";
import { deepOrange } from "@mui/material/colors";
import React from "react";
import { useOIDCContext } from "@/hooks/oidcConfiguration";

/**
* Profile button, expected to vary whether the user is connected
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/theme.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ThemeContext } from "@/contexts/ThemeProvider";
import { PaletteMode } from "@mui/material";
import { deepOrange, grey, lightGreen } from "@mui/material/colors";
import { createTheme, darken, lighten } from "@mui/material/styles";
import { useContext } from "react";
import { ThemeContext } from "@/contexts/ThemeProvider";

/**
* Custom hook to access the theme context
Expand Down
2 changes: 1 addition & 1 deletion test/unit-tests/Dashboard.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";
import { render, fireEvent } from "@testing-library/react";
import { useOidc, useOidcAccessToken } from "@axa-fr/react-oidc";
import Dashboard from "@/components/layout/Dashboard";
import { ThemeProvider } from "@/contexts/ThemeProvider";
import { useOidc, useOidcAccessToken } from "@axa-fr/react-oidc";

// Mock the module
jest.mock("@axa-fr/react-oidc", () => ({
Expand Down
2 changes: 1 addition & 1 deletion test/unit-tests/JobDataTable.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";
import { render } from "@testing-library/react";
import { JobDataTable } from "@/components/ui/JobDataTable";
import useSWR from "swr";
import { useOidcAccessToken } from "@axa-fr/react-oidc";
import { JobDataTable } from "@/components/ui/JobDataTable";

// Mock modules
jest.mock("@axa-fr/react-oidc", () => ({
Expand Down
2 changes: 1 addition & 1 deletion test/unit-tests/ProfileButton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { render, fireEvent } from "@testing-library/react";
import { ProfileButton } from "@/components/ui/ProfileButton";
import { useOidcAccessToken, useOidc } from "@axa-fr/react-oidc";
import { ProfileButton } from "@/components/ui/ProfileButton";
import { OIDCConfigurationContext } from "@/contexts/OIDCConfigurationProvider";

// Mocking the hooks
Expand Down
4 changes: 2 additions & 2 deletions test/unit-tests/UserDashboard.test.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from "react";
import { render } from "@testing-library/react";
import UserDashboard from "@/components/applications/UserDashboard";
import { ThemeProvider } from "@/contexts/ThemeProvider";
import {
useOIDCContext,
useOidcAccessToken,
useOidc,
} from "@axa-fr/react-oidc";
import UserDashboard from "@/components/applications/UserDashboard";
import { ThemeProvider } from "@/contexts/ThemeProvider";

// Mock the modules
jest.mock("@axa-fr/react-oidc", () => ({
Expand Down

0 comments on commit 547c7d1

Please sign in to comment.