Skip to content

Commit

Permalink
fix remaining eslint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ntraut committed May 25, 2024
1 parent bade1c3 commit 9e5e774
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 102 deletions.
28 changes: 13 additions & 15 deletions src/front/component/App.jsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
import React from 'react';
import { useLocation, useNavigate } from "react-router-dom";
import Parse from 'parse';

import ArrowBack from '@mui/icons-material/ArrowBack';
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
import AppBar from '@mui/material/AppBar';
import Toolbar from '@mui/material/Toolbar';
import Typography from '@mui/material/Typography';
import Button from '@mui/material/Button';

import ButtonGroup from '@mui/material/ButtonGroup';
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
import ClickAwayListener from '@mui/material/ClickAwayListener';
import Grow from '@mui/material/Grow';
import Paper from '@mui/material/Paper';
import Popper from '@mui/material/Popper';
import IconButton from '@mui/material/IconButton';
import MenuItem from '@mui/material/MenuItem';
import MenuList from '@mui/material/MenuList';
import Paper from '@mui/material/Paper';
import Popper from '@mui/material/Popper';
import Toolbar from '@mui/material/Toolbar';
import Typography from '@mui/material/Typography';
import Parse from 'parse';
import React from 'react';
import { useLocation, useNavigate } from "react-router-dom";

import IconButton from '@mui/material/IconButton';
import ArrowBack from '@mui/icons-material/ArrowBack';
import UserService from '../services/user-service';
import PubSub from '../utils/pub-sub';

import Router from './Router';
import PubSub from '../utils/pub-sub';
import UserService from '../services/user-service';

const options = ['Home', 'Documentation', 'My Profile'];

const App = function () {
const App = function App () {
const [canBack, setCanBack] = React.useState(false);
const [userConnected, setUserConnected] = React.useState(false);
const [anchorEl, setAnchorEl] = React.useState(null);
Expand Down
18 changes: 10 additions & 8 deletions src/front/component/LoginActions.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React, { useState } from 'react';
/* eslint-disable no-console */
import { CardActions, Button, TextField, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material';
import PropTypes from 'prop-types';
import { withStyles } from '@mui/styles';
import PropTypes from 'prop-types';
import React, { useState } from 'react';

import UserService from '../services/user-service';

const styles = {
Expand All @@ -10,21 +12,21 @@ const styles = {
},
};

const LoginActions = function ({ classes, redirectPath, onUserLoggedIn }) {
const LoginActions = function LoginActions ({ classes, redirectPath, onUserLoggedIn }) {

const [isDialogSignupOpened, setIsDialogSignupOpened] = useState(false);
const [isDialogLoginOpened, setIsDialogLoginOpened] = useState(false);
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [textMessage, setTextMessage] = useState(null);

const handleDialogClose = function () {
const handleDialogClose = function handleDialogClose () {
setIsDialogSignupOpened(false);
setIsDialogLoginOpened(false);
setTextMessage(null);
};

const onSubmitForm = async function () {
const onSubmitForm = async function onSubmitForm () {
let user;
try {
if (isDialogLoginOpened) {
Expand All @@ -45,7 +47,7 @@ const LoginActions = function ({ classes, redirectPath, onUserLoggedIn }) {
}
};

const passwordReset = async function () {
const passwordReset = async function passwordReset () {
try {
if (!document.forms[0].email.reportValidity()) {
return;
Expand All @@ -66,10 +68,10 @@ const LoginActions = function ({ classes, redirectPath, onUserLoggedIn }) {
};


let githubRedirectUri = process.env.PUBLIC_URL + '/login/github';
let githubRedirectUri = `${process.env.PUBLIC_URL }/login/github`;
if (redirectPath) {
githubRedirectUri =
githubRedirectUri + '?redirectPath=' + encodeURIComponent(redirectPath);
`${githubRedirectUri }?redirectPath=${ encodeURIComponent(redirectPath)}`;
}
githubRedirectUri = encodeURIComponent(githubRedirectUri);

Expand Down
10 changes: 5 additions & 5 deletions src/front/component/Router.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from 'react';
import { Route, Routes } from 'react-router-dom';

import LoginPage from '../pages/login/login';
import DetailsPage from '../pages/details/details';
import HomePage from '../pages/home/home';
import Github from '../pages/login/github';
import LoginPage from '../pages/login/login';
import NoFound404Page from '../pages/notfound/notfound';
import OAuthAuthorizePage from '../pages/oauth/authorize';
import DetailsPage from '../pages/details/details';
import ProfilePage from '../pages/profile/profile';
import NoFound404Page from '../pages/notfound/notfound';
import Github from '../pages/login/github';

const Router = function () {
const Router = function Router () {
return (
<Routes>
<Route path="/login/github" element={<Github />} />
Expand Down
2 changes: 1 addition & 1 deletion src/front/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Parse from 'parse';
import React from 'react';
import { createRoot } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import Parse from 'parse';

import App from './component/App';
import './index.css';
Expand Down
34 changes: 17 additions & 17 deletions src/front/pages/details/details.jsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/* eslint-disable complexity */
/* eslint-disable max-lines */
import React, { useEffect, useState } from 'react';
import { useParams } from "react-router-dom";
import withStyles from '@mui/styles/withStyles';
import TextField from '@mui/material/TextField';
import CircularProgress from '@mui/material/CircularProgress';
import FileCopy from '@mui/icons-material/FileCopy';
import Button from '@mui/material/Button';
import CircularProgress from '@mui/material/CircularProgress';
import { green } from '@mui/material/colors';
import InputAdornment from '@mui/material/InputAdornment';
import IconButton from '@mui/material/IconButton';
import Switch from '@mui/material/Switch';
import FormControlLabel from '@mui/material/FormControlLabel';
import FileCopy from '@mui/icons-material/FileCopy';
import PropTypes from 'prop-types'; // ES6
import IconButton from '@mui/material/IconButton';
import InputAdornment from '@mui/material/InputAdornment';
import Snackbar from '@mui/material/Snackbar';
import Switch from '@mui/material/Switch';
import TextField from '@mui/material/TextField';
import Tooltip from '@mui/material/Tooltip';
import withStyles from '@mui/styles/withStyles';
import PropTypes from 'prop-types'; // ES6
import React, { useEffect, useState } from 'react';
import { useParams } from "react-router-dom";

import { validateFormField, checkValid } from '../../services/formValidator';
import ApplicationsService from '../../services/applications-service';
import { validateFormField, checkValid } from '../../services/formValidator';

const styles = {
root: {
Expand Down Expand Up @@ -64,7 +64,7 @@ const styles = {
}
};

const DetailsPage = function ({ classes }) {
const DetailsPage = function DetailsPage ({ classes }) {
const { appId } = useParams();
const [loading, setLoading] = useState(true);
const [updateLoading, setUpdateLoading] = useState(false);
Expand All @@ -85,7 +85,7 @@ const DetailsPage = function ({ classes }) {
});
}, [appId]);

const handleChange = function (name, event) {
const handleChange = function handleChange (name, event) {
const { value } = event.target;

const validated = validateFormField(value, name);
Expand All @@ -100,7 +100,7 @@ const DetailsPage = function ({ classes }) {
};


const handleToggle = function (name, event) {
const handleToggle = function handleToggle (name, event) {
const { checked } = event.target;

setApplicationUpdate((prevUpdate) => ({
Expand All @@ -109,15 +109,15 @@ const DetailsPage = function ({ classes }) {
}));
};

const handleClose = function (event, reason) {
const handleClose = function handleClose (event, reason) {
if (reason === 'clickaway') {
return;
}

setSnackBarText('');
};

const clickUpdateApplication = async function () {
const clickUpdateApplication = async function clickUpdateApplication () {
setUpdateLoading(true);

Object.entries(applicationUpdate).forEach(([key, value]) => {
Expand All @@ -130,7 +130,7 @@ const DetailsPage = function ({ classes }) {
setSnackBarText("Application successfully updated");
};

const copyToClipboard = function (key) {
const copyToClipboard = function copyToClipboard (key) {
navigator.permissions.query({ name: 'clipboard-write' }).then((result) => {
if (result.state === 'granted' || result.state === 'prompt') {
navigator.clipboard.writeText(
Expand Down
43 changes: 21 additions & 22 deletions src/front/pages/home/home.jsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
/* eslint-disable no-console */
/* eslint-disable max-lines */
import React, { useEffect, useState } from 'react';
import { useNavigate } from "react-router-dom";
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import Divider from '@mui/material/Divider';
import ListItemText from '@mui/material/ListItemText';
import Typography from '@mui/material/Typography';
import CircularProgress from '@mui/material/CircularProgress';
import Fab from '@mui/material/Fab';
import AddIcon from '@mui/icons-material/Add';
import DeveloperModeIcon from '@mui/icons-material/DeveloperMode';

import Button from '@mui/material/Button';
import TextField from '@mui/material/TextField';
import Card from '@mui/material/Card';
import CardActions from '@mui/material/CardActions';
import CardContent from '@mui/material/CardContent';
import CircularProgress from '@mui/material/CircularProgress';
import Dialog from '@mui/material/Dialog';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogContentText from '@mui/material/DialogContentText';
import DialogTitle from '@mui/material/DialogTitle';
import Card from '@mui/material/Card';
import CardActions from '@mui/material/CardActions';
import CardContent from '@mui/material/CardContent';

import Divider from '@mui/material/Divider';
import Fab from '@mui/material/Fab';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import ListItemText from '@mui/material/ListItemText';
import TextField from '@mui/material/TextField';
import Typography from '@mui/material/Typography';
import React, { useEffect, useState } from 'react';
import Moment from 'react-moment';
import { useNavigate } from "react-router-dom";

import { validateFormField, checkValid } from '../../services/formValidator';
import ApplicationsService from '../../services/applications-service';
import { validateFormField, checkValid } from '../../services/formValidator';


const HomePage = function () {
const HomePage = function HomePage () {
const [loading, setLoading] = useState(true);
const [dialogNewApplicationOpen, setDialogNewApplicationOpen] = useState(false);
const [developerApplications, setDeveloperApplications] = useState([]);
Expand Down Expand Up @@ -61,11 +60,11 @@ const HomePage = function () {
});
}, []);

const handleClickOpen = function () {
const handleClickOpen = function handleClickOpen () {
setDialogNewApplicationOpen(true);
};

const handleClose = function () {
const handleClose = function handleClose () {
setDialogNewApplicationOpen(false);
setNewApplication({
name: '',
Expand All @@ -82,7 +81,7 @@ const HomePage = function () {
setErrorMessage(null);
};

const handleChange = function (name, event) {
const handleChange = function handleChange (name, event) {
const { value } = event.target;
const validated = validateFormField(value, name);
setNewApplication(prevState => ({
Expand All @@ -95,11 +94,11 @@ const HomePage = function () {
}));
};

const rowClick = function (application) {
const rowClick = function rowClick (application) {
navigate(`/application/${application.id}`);
};

const clickCreateApplication = async function () {
const clickCreateApplication = async function clickCreateApplication () {
try {
const app = await ApplicationsService.create(newApplication);
navigate(`/application/${app.id}`);
Expand Down
4 changes: 3 additions & 1 deletion src/front/pages/login/github.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/* eslint-disable no-console */
/* eslint-disable react/forbid-prop-types */
import React, { useEffect } from 'react';
import { useNavigate, useLocation } from "react-router-dom";

import UserService from '../../services/user-service';

const Github = function () {
const Github = function Github () {
const location = useLocation();
const navigate = useNavigate();
const params = new URLSearchParams(location.search);
Expand Down
10 changes: 5 additions & 5 deletions src/front/pages/login/login.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import withStyles from '@mui/styles/withStyles';
import Card from '@mui/material/Card';
import CardContent from '@mui/material/CardContent';
import CardMedia from '@mui/material/CardMedia';
import Typography from '@mui/material/Typography';
import withStyles from '@mui/styles/withStyles';
import PropTypes from 'prop-types'; // ES6

import React, { useEffect } from 'react';
import { useNavigate } from "react-router-dom";
import UserService from '../../services/user-service';

import LoginActions from '../../component/LoginActions';
import UserService from '../../services/user-service';

const styles = {
card: {
Expand All @@ -22,7 +22,7 @@ const styles = {
},
};

const LoginPage = function ({ classes }) {
const LoginPage = function LoginPage ({ classes }) {
const navigate = useNavigate();

useEffect(() => {
Expand All @@ -32,7 +32,7 @@ const LoginPage = function ({ classes }) {
}
});

const onUserLoggedIn = function (user) {
const onUserLoggedIn = function onUserLoggedIn (user) {
if (user) {
navigate('/home');
}
Expand Down
14 changes: 6 additions & 8 deletions src/front/pages/notfound/notfound.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import React from 'react';
import { useNavigate } from "react-router-dom";
import withStyles from '@mui/styles/withStyles';
import Typography from '@mui/material/Typography';
import DeveloperModeIcon from '@mui/icons-material/DeveloperMode';

import Button from '@mui/material/Button';
import Card from '@mui/material/Card';
import CardActions from '@mui/material/CardActions';
import CardContent from '@mui/material/CardContent';

import Typography from '@mui/material/Typography';
import withStyles from '@mui/styles/withStyles';
import PropTypes from 'prop-types'; // ES6
import React from 'react';
import { useNavigate } from "react-router-dom";

const styles = {
card: {
Expand All @@ -19,8 +17,8 @@ const styles = {
},
};

const NoFound404Page = function ({ classes }) {
const goToHome = function () {
const NoFound404Page = function NoFound404Page ({ classes }) {
const goToHome = function goToHome () {
const navigate = useNavigate();
setTimeout(navigate(`/home`), 1000);
};
Expand Down
Loading

0 comments on commit 9e5e774

Please sign in to comment.