Skip to content

Commit

Permalink
"Restore" ESLint support
Browse files Browse the repository at this point in the history
I removed our leftover config in opencast#700 with a promise to bring ESLint back.
Well this is it, for now!

This introduces an ESLint config file in the new flat file format,
which will be required for ESLint `>= 9`. It is already supported in version 8, though,
which we are still stuck on because of the (unmaintained) config we are/were using.
I briefly tried to port this project over to `@opencast/eslint-config-ts-react`,
but the code said "no," basically. ;P

This has a few unfortunate consequences. See opencast#713. I plan to address these in due time, though.

Note that this does **not** introduce automatic/live checking of the code
during development. I only added a call to the linter to the build command,
in turn making CI fail when there are warnings.
I created opencast#712 to track the live thing if we want that.
  • Loading branch information
JulianKniephoff committed Jun 25, 2024
1 parent a81803e commit 9fbe75d
Show file tree
Hide file tree
Showing 12 changed files with 8,430 additions and 2,240 deletions.
9 changes: 9 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { FlatCompat } from "@eslint/eslintrc";

const config = [
{ ignores: ["build"] },
...new FlatCompat({ baseDirectory: import.meta.dirname })
.extends("eslint-config-react-app"),
];

export default config;
10,640 changes: 8,413 additions & 2,227 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"scripts": {
"start": "vite",
"build": "tsc && vite build",
"build": "tsc && eslint . --max-warnings=0 && vite build",
"serve": "vite preview",
"test": "vitest"
},
Expand All @@ -62,12 +62,18 @@
]
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.5.0",
"@redux-devtools/extension": "^3.3.0",
"@types/lodash": "^4.17.4",
"@types/node": "^20.14.1",
"@types/react-dom": "^18.3.0",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@vitejs/plugin-react-swc": "^3.7.0",
"eslint": "^8.57.0",
"eslint-config-react-app": "^7.0.1",
"prop-types": "^15.8.1",
"rollup-preserve-directives": "^1.1.1",
"sass": "^1.77.4",
Expand Down
5 changes: 1 addition & 4 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from "../selectors/userInfoSelectors";
import { availableHotkeys } from "../configs/hotkeysConfig";
import { studioURL } from "../configs/generalConfig";
import { getCurrentLanguageInformation, hasAccess } from "../utils/utils";
import { hasAccess } from "../utils/utils";
import { overflowStyle } from "../utils/componentStyles";
import RegistrationModal from "./shared/RegistrationModal";
import HotKeyCheatSheet from "./shared/HotKeyCheatSheet";
Expand All @@ -26,9 +26,6 @@ import { Tooltip } from "./shared/Tooltip";
import { HiTranslate } from "react-icons/hi";
import { IconContext } from "react-icons";

// Get code, flag and name of the current language
const currentLanguage = getCurrentLanguageInformation();

// References for detecting a click outside of the container of the dropdown menus
const containerLang = React.createRef<HTMLDivElement>();
const containerHelp = React.createRef<HTMLDivElement>();
Expand Down
1 change: 0 additions & 1 deletion src/components/events/partials/EventActionCell.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import ConfirmModal from "../../shared/ConfirmModal";
import { connect } from "react-redux";
import EventDetailsModal from "./modals/EventDetailsModal";
import EmbeddingCodeModal from "./modals/EmbeddingCodeModal";
import { getUserInformation } from "../../../selectors/userInfoSelectors";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useTranslation } from "react-i18next";
import { Formik } from "formik";
import _ from "lodash";
import cn from "classnames";
import { connect } from "react-redux";
import Notifications from "../../../shared/Notifications";
import { getUserInformation } from "../../../../selectors/userInfoSelectors";
import { hasAccess } from "../../../../utils/utils";
Expand Down
1 change: 0 additions & 1 deletion src/components/events/partials/SeriesActionsCell.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import ConfirmModal from "../../shared/ConfirmModal";
import { connect } from "react-redux";
import SeriesDetailsModal from "./modals/SeriesDetailsModal";
import {
fetchSeriesDetailsThemeNames,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import ConfirmModal from "../../shared/ConfirmModal";
import RecordingDetailsModal from "./modal/RecordingDetailsModal";
import { getUserInformation } from "../../../selectors/userInfoSelectors";
Expand Down
1 change: 0 additions & 1 deletion src/components/shared/Notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
getNotifications,
getGlobalPositions,
} from "../../selectors/notificationSelector";
import { connect } from "react-redux";
import { useTranslation } from "react-i18next";
import cn from "classnames";
import {
Expand Down
1 change: 0 additions & 1 deletion src/components/statistics/Statistics.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useEffect, useState } from "react";
import { connect } from "react-redux";
import { Link } from "react-router-dom";
import { useTranslation } from "react-i18next";
import cn from "classnames";
Expand Down
1 change: 0 additions & 1 deletion src/components/users/partials/GroupsActionsCell.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState } from "react";
import { connect } from "react-redux";
import { useTranslation } from "react-i18next";
import ConfirmModal from "../../shared/ConfirmModal";
import GroupDetailsModal from "./modal/GroupDetailsModal";
Expand Down
1 change: 0 additions & 1 deletion src/components/users/partials/UsersActionsCell.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import ConfirmModal from "../../shared/ConfirmModal";
import UserDetailsModal from "./modal/UserDetailsModal";
import { getUserInformation } from "../../../selectors/userInfoSelectors";
Expand Down

0 comments on commit 9fbe75d

Please sign in to comment.