Commit 9b05c759 authored by Florent Chehab's avatar Florent Chehab Committed by Florent Chehab
Browse files

refacto(frontend): finish compliance with new eslint config

parent 754ee880
......@@ -26,10 +26,7 @@ module.exports = {
location: "anywhere"
}
],
// The warn should be turned to error at some point
"react/require-default-props": "warn",
"react/no-did-update-set-state": "warn",
"import/prefer-default-export": "warn",
"no-console": "error",
// Styling choices bellow...
"react/destructuring-assignment": "off", // might be less readable (and is a pain in the ass to refactor)
"react/no-unescaped-entities": "off", // that one doesn't improve code readability
......
......@@ -20,7 +20,7 @@ import PageSettings from "../pages/PageThemeSettings";
import PageUser from "../pages/PageUser";
import PageLists from "../pages/PageLists";
import MainAppFrame from "./MainAppFrame";
import { APP_ROUTES } from "../../config/appRoutes";
import APP_ROUTES from "../../config/appRoutes";
import PageAboutProject from "../pages/PageAboutProject";
import { PageCgu, PageRgpd } from "../pages/PagesRgpdCgu";
import PageNotFound from "../pages/PageNotFound";
......
......@@ -3,7 +3,7 @@ import AppBar from "@material-ui/core/AppBar";
import Toolbar from "@material-ui/core/Toolbar";
import PropTypes from "prop-types";
import { makeStyles } from "@material-ui/styles";
import { classNames } from "../../utils/classNames";
import classNames from "../../utils/classNames";
import { appBarHeight, siteMaxWidth } from "../../config/sharedStyles";
const useStyle = makeStyles(theme => ({
......
......@@ -7,7 +7,7 @@ import List from "@material-ui/core/List";
import ListItem from "@material-ui/core/ListItem";
import ListItemText from "@material-ui/core/ListItemText";
import Typography from "@material-ui/core/Typography";
import { toDateFr } from "../../utils/dateToFr";
import toDateFr from "../../utils/dateToFr";
import getActions from "../../redux/api/getActions";
import CustomComponentForAPI from "../common/CustomComponentForAPI";
......
......@@ -4,7 +4,7 @@ import { makeStyles } from "@material-ui/styles";
import PropTypes from "prop-types";
import { withRouter } from "react-router-dom";
import InformationList from "./InformationList";
import { APP_ROUTES } from "../../config/appRoutes";
import APP_ROUTES from "../../config/appRoutes";
const useStyles = makeStyles(theme => ({
divider: {
......
......@@ -13,11 +13,11 @@ import ListItem from "@material-ui/core/ListItem";
import ListItemIcon from "@material-ui/core/ListItemIcon";
import ListItemText from "@material-ui/core/ListItemText";
import PropTypes from "prop-types";
import { RequestParams } from "../../redux/api/RequestParams";
import RequestParams from "../../redux/api/RequestParams";
import getActions from "../../redux/api/getActions";
import { withErrorBoundary } from "../common/ErrorBoundary";
import CustomComponentForAPI from "../common/CustomComponentForAPI";
import { toDateFr } from "../../utils/dateToFr";
import toDateFr from "../../utils/dateToFr";
const INFORMATION_ICONS = {
success: <StartIcon />,
......
......@@ -6,7 +6,7 @@ import React from "react";
import { makeStyles } from "@material-ui/styles";
import PropTypes from "prop-types";
import CustomNavLink from "../common/CustomNavLink";
import { classNames } from "../../utils/classNames";
import classNames from "../../utils/classNames";
const useStyle = makeStyles(theme => ({
siteName: {
......
......@@ -15,9 +15,9 @@ import {
} from "./menuItems";
import IconWithMenu from "../common/IconWithMenu";
import DrawerMenu from "./DrawerMenu";
import { APP_ROUTES } from "../../config/appRoutes";
import APP_ROUTES from "../../config/appRoutes";
import CustomNavLink from "../common/CustomNavLink";
import { classNames } from "../../utils/classNames";
import classNames from "../../utils/classNames";
import Logo from "./Logo";
import BaseTemplate from "./BaseTemplate";
......
......@@ -8,7 +8,7 @@ import { withErrorBoundary } from "../common/ErrorBoundary";
import getActions from "../../redux/api/getActions";
import Notifier from "../common/Notifier";
import { RequestParams } from "../../redux/api/RequestParams";
import RequestParams from "../../redux/api/RequestParams";
/**
* Class to create notifications for important stuff on start up
......
......@@ -8,7 +8,7 @@ import Typography from "@material-ui/core/Typography";
import List from "@material-ui/core/List";
import ListItem from "@material-ui/core/ListItem";
import ListItemText from "@material-ui/core/ListItemText";
import { APP_ROUTES } from "../../config/appRoutes";
import APP_ROUTES from "../../config/appRoutes";
import CustomLink from "../common/CustomLink";
import getActions from "../../redux/api/getActions";
import CustomComponentForAPI from "../common/CustomComponentForAPI";
......
......@@ -3,7 +3,7 @@ import LocationCityIcon from "@material-ui/icons/LocationCity";
import HomeIcon from "@material-ui/icons/Home";
import SearchIcon from "@material-ui/icons/Search";
import AssignmentIcon from "@material-ui/icons/Assignment";
import { APP_ROUTES } from "../../config/appRoutes";
import APP_ROUTES from "../../config/appRoutes";
function item(label, route, Icon, hardRedirect = false) {
return {
......
......@@ -118,12 +118,12 @@ Alert.defaultProps = {
disagreeText: "Annuler",
infoText: "J'ai compris",
multilineButtons: false,
// eslint-disable-next-line no-console
handleClose: () => {
// eslint-disable-next-line no-console
console.error("Missing function for closing alert.");
},
// eslint-disable-next-line no-console
handleResponse: () => {
// eslint-disable-next-line no-console
console.error("Missing function for handling post performClose.");
}
};
......
......@@ -56,8 +56,8 @@ CoverGallery.propTypes = {
CoverGallery.defaultProps = {
picturesSrc: [],
// eslint-disable-next-line no-console
onEditButtonClick: () =>
// eslint-disable-next-line no-console
console.log("No function provided to edit cover gallery")
};
......
......@@ -4,7 +4,7 @@ import PropTypes from "prop-types";
import Loading from "./Loading";
import { getLatestRead, successActionsWithReads } from "../../redux/api/utils";
import Notifier from "./Notifier";
import { RequestParams } from "../../redux/api/RequestParams";
import RequestParams from "../../redux/api/RequestParams";
/**
* Custom react component to be used when called to the api are required to display data of the component.
......
......@@ -24,7 +24,7 @@ function CustomNavLink(props) {
CustomNavLink.propTypes = {
to: PropTypes.string.isRequired,
children: PropTypes.node
children: PropTypes.node.isRequired
};
export default CustomNavLink;
......@@ -4,7 +4,7 @@ import { compose } from "recompose";
import { connect } from "react-redux";
import Alert from "./Alert";
import getActions from "../../redux/api/getActions";
import { RequestParams } from "../../redux/api/RequestParams";
import RequestParams from "../../redux/api/RequestParams";
class DeleteHandler extends React.Component {
handleDelete() {
......
......@@ -53,10 +53,10 @@ function renderSuggestion({
}
renderSuggestion.propTypes = {
highlightedIndex: PropTypes.number,
index: PropTypes.number,
itemProps: PropTypes.object,
selectedItem: PropTypes.string,
highlightedIndex: PropTypes.number.isRequired,
index: PropTypes.number.isRequired,
itemProps: PropTypes.object.isRequired,
selectedItem: PropTypes.string.isRequired,
suggestion: PropTypes.shape({
label: PropTypes.string,
value: PropTypes.number
......
......@@ -4,10 +4,10 @@ import { setDisplayName } from "recompose";
import compose from "recompose/compose";
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";
import { RequestParams } from "../../redux/api/RequestParams";
import RequestParams from "../../redux/api/RequestParams";
import getActions from "../../redux/api/getActions";
import Alert from "./Alert";
import { APP_ROUTES } from "../../config/appRoutes";
import APP_ROUTES from "../../config/appRoutes";
function clear() {
return {
......@@ -93,6 +93,7 @@ const ConnectedErrorBoundary = compose(
*
* @returns {function(*): function(*): *}
*/
// eslint-disable-next-line import/prefer-default-export
export function withErrorBoundary() {
return Component =>
setDisplayName("error-boundary")(
......
......@@ -2,7 +2,7 @@ import React from "react";
import PropTypes from "prop-types";
import Typography from "@material-ui/core/Typography";
import TextLink from "./TextLink";
import { APP_ROUTES } from "../../config/appRoutes";
import APP_ROUTES from "../../config/appRoutes";
import getWindowBase from "../../utils/getWindowBase";
/**
......
import React from "react";
import PropTypes from "prop-types";
import CustomLink from "./CustomLink";
import { APP_ROUTES } from "../../config/appRoutes";
import APP_ROUTES from "../../config/appRoutes";
export default function LinkToUser(props) {
if (props.userId) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment