diff --git a/eslint.config.mjs b/eslint.config.mjs
index 3de883b5a2..0641ee6413 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -3,10 +3,14 @@ import pluginJs from "@eslint/js";
import pluginReactConfig from "eslint-plugin-react/configs/recommended.js";
import babelParser from "@babel/eslint-parser";
import reactHooks from "eslint-plugin-react-hooks";
+import jestPlugin from "eslint-plugin-jest";
export default [
pluginJs.configs.recommended,
pluginReactConfig,
+ {
+ ignores: ["**/frontend/build/**", "**/frontend/coverage/**"],
+ },
{
files: ["**/*.{js,mjs,cjs,jsx}"],
plugins: {
@@ -18,16 +22,15 @@ export default [
process: "readonly",
},
parser: babelParser,
-
},
settings: {
react: {
- version: "detect"
- }
+ version: "detect",
+ },
},
rules: {
- "semi": 2,
+ semi: 2,
"react/prop-types": 0,
"jsx-no-bind": 0,
"react/jsx-no-bind": 0,
@@ -36,35 +39,51 @@ export default [
"react/destructuring-assignment": 0,
"react/forbid-prop-types": 0,
"react/jsx-wrap-multilines": 0,
- "react/style-prop-object": [2, { "allow": ["FormattedNumber"] }],
+ "react/style-prop-object": [2, { allow: ["FormattedNumber"] }],
"import/prefer-default-export": 0,
"function-paren-newline": 0,
"react/function-component-definition": 0,
"func-names": 0,
"no-underscore-dangle": 0,
+ "no-unused-vars": [
+ "error",
+ {
+ vars: "all",
+ args: "after-used",
+ ignoreRestSiblings: false,
+ varsIgnorePattern: "^_",
+ argsIgnorePattern: "^_",
+ caughtErrors: "all",
+ caughtErrorsIgnorePattern: "^_",
+ },
+ ],
"no-console": 1,
"prefer-destructuring": 0,
"operator-linebreak": 0,
- "indent": 0,
- "camelcase": 0,
+ indent: 0,
+ camelcase: 0,
"space-before-function-paren": 0,
"implicit-arrow-linebreak": 0,
"nonblock-statement-body-position": 0,
"react/prefer-stateless-function": 0,
- "curly": 0,
+ curly: 0,
"object-curly-newline": 0,
"prefer-template": 0,
"arrow-parens": 0,
"no-param-reassign": 0,
"no-mixed-operators": 0,
"no-else-return": 0,
-
},
},
{
- files: ['frontend/babel.config.js', 'frontend/jest.config.js', 'babel.config.js'], // Specify the config files
+ files: [
+ "frontend/babel.config.js",
+ "frontend/jest.config.js",
+ "babel.config.js",
+ ], // Specify the config files
languageOptions: {
globals: {
+ ...globals.node,
require: "readonly",
module: "readonly",
__dirname: "readonly",
@@ -73,16 +92,23 @@ export default [
},
},
{
- files: ["**/__tests__/**/*.{js,jsx}", "**/*.test.{js,jsx}"],
+ files: ["**/*.{js,cjs}", "**/scripts/**/*.js"],
languageOptions: {
globals: {
- jest: "readonly", // Define Jest-specific globals
- test: "readonly",
- expect: "readonly",
+ ...globals.node,
},
},
+ },
+ {
+ files: ["**/__tests__/**/*.{js,jsx}", "**/*.test.{js,jsx}"],
+ plugins: {
+ jest: jestPlugin,
+ },
+ languageOptions: {
+ globals: jestPlugin.environments.globals.globals,
+ },
rules: {
- "react/react-in-jsx-scope": 0, // Disable React in scope for JSX cuz we are using React 17+
- }
- }
-];
\ No newline at end of file
+ ...jestPlugin.configs.recommended.rules,
+ },
+ },
+];
diff --git a/frontend/config-overrides.js b/frontend/config-overrides.js
index 98dddc1d9e..b569c30ab2 100644
--- a/frontend/config-overrides.js
+++ b/frontend/config-overrides.js
@@ -1,5 +1,4 @@
// config-overrides.js
-/* eslint-disable no-undef */
const webpack = require("webpack");
module.exports = function override(config, env) {
if (env === "production") {
diff --git a/frontend/config/webpack/webpack.dev.js b/frontend/config/webpack/webpack.dev.js
index edf48f4ab9..ffd6a54f84 100644
--- a/frontend/config/webpack/webpack.dev.js
+++ b/frontend/config/webpack/webpack.dev.js
@@ -1,5 +1,3 @@
-/* eslint-disable no-undef */
-
const path = require("path");
const webpack = require("webpack");
const UnusedWebpackPlugin = require("unused-webpack-plugin");
diff --git a/frontend/config/webpack/webpack.prod.js b/frontend/config/webpack/webpack.prod.js
index febd85c698..504ad1f9f2 100644
--- a/frontend/config/webpack/webpack.prod.js
+++ b/frontend/config/webpack/webpack.prod.js
@@ -1,6 +1,3 @@
-/* eslint-disable no-undef */
-
-// const webpack = require("webpack");
const { resolve } = require("path");
const path = require("path");
const TerserPlugin = require("terser-webpack-plugin");
diff --git a/frontend/src/AuthenticatedSwitch.jsx b/frontend/src/AuthenticatedSwitch.jsx
index 2d8823a385..027c7958c7 100644
--- a/frontend/src/AuthenticatedSwitch.jsx
+++ b/frontend/src/AuthenticatedSwitch.jsx
@@ -14,10 +14,13 @@ import AdminLogs from "./pages/AdminLogs";
import ReportEncounter from "./pages/ReportsAndManagamentPages/ReportEncounter";
import ReportConfirm from "./pages/ReportsAndManagamentPages/ReportConfirm";
-export default function AuthenticatedSwitch({ showAlert, setShowAlert, showclassicsubmit }) {
+export default function AuthenticatedSwitch({
+ showAlert,
+ setShowAlert,
+ showclassicsubmit,
+}) {
const { data } = useGetMe();
const username = data?.username;
- // eslint-disable-next-line no-undef
const avatar =
data?.imageURL || `${process.env.PUBLIC_URL}/images/Avatar.png`;
const [header, setHeader] = React.useState(true);
diff --git a/frontend/src/components/AuthenticatedAppHeader.jsx b/frontend/src/components/AuthenticatedAppHeader.jsx
index b700397f9e..70860a11fd 100644
--- a/frontend/src/components/AuthenticatedAppHeader.jsx
+++ b/frontend/src/components/AuthenticatedAppHeader.jsx
@@ -1,4 +1,3 @@
-/* eslint-disable no-undef */
import React, { useContext } from "react";
import { Navbar, Nav } from "react-bootstrap";
import "../css/dropdown.css";
@@ -10,7 +9,11 @@ import Menu from "./header/Menu";
import FooterVisibilityContext from "../FooterVisibilityContext";
import Logo from "./svg/Logo";
-export default function AuthenticatedAppHeader({ username, avatar, showclassicsubmit }) {
+export default function AuthenticatedAppHeader({
+ username,
+ avatar,
+ showclassicsubmit,
+}) {
const { visible } = useContext(FooterVisibilityContext);
const {
@@ -68,7 +71,10 @@ export default function AuthenticatedAppHeader({ username, avatar, showclassicsu
marginLeft: "auto",
}}
>
-