Unverified Commit b8de0428 authored by Florent Chehab's avatar Florent Chehab
Browse files

style: new prettier on all the repo 🎉

parent 8d2a2eb7
......@@ -11,4 +11,4 @@
"tourism",
"shared_comment",
"specific_partnership"
]
\ No newline at end of file
]
......@@ -21,10 +21,7 @@
"maxLength": 500
}
},
"required": [
"url",
"description"
],
"required": ["url", "description"],
"additionalProperties": false
}
},
......@@ -54,10 +51,7 @@
"maxLength": 500
}
},
"required": [
"url",
"title"
],
"required": ["url", "title"],
"additionalProperties": false
}
},
......@@ -71,10 +65,7 @@
"$ref": "definitions.json#/definitions/hex-color"
}
},
"required": [
"primary",
"secondary"
],
"required": ["primary", "secondary"],
"additionalProperties": false
},
"hex-color": {
......
......@@ -10,10 +10,7 @@
{
"type": "object",
"additionalProperties": false,
"required": [
"type",
"content"
],
"required": ["type", "content"],
"properties": {
"type": {
"const": "univ-block"
......@@ -21,23 +18,14 @@
"content": {
"type": "object",
"additionalProperties": false,
"required": [
"university",
"appreciation"
],
"required": ["university", "appreciation"],
"properties": {
"university": {
"type": [
"integer",
"null"
],
"type": ["integer", "null"],
"description": "pk of the university"
},
"appreciation": {
"type": [
"integer",
"null"
],
"type": ["integer", "null"],
"minimum": 0,
"maximum": 10
}
......@@ -48,10 +36,7 @@
{
"type": "object",
"additionalProperties": false,
"required": [
"type",
"content"
],
"required": ["type", "content"],
"properties": {
"type": {
"const": "text-block"
......
......@@ -7,10 +7,7 @@
"mode": {
"description": "What is the selected mode of the theme",
"type": "string",
"enum": [
"light",
"dark"
]
"enum": ["light", "dark"]
},
"light": {
"description": "Settings in light mode",
......@@ -21,10 +18,6 @@
"$ref": "definitions.json#/definitions/palette"
}
},
"required": [
"mode",
"light",
"dark"
],
"required": ["mode", "light", "dark"],
"additionalProperties": false
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<head>
<meta charset="UTF-8" />
<title>Vous êtes banni du site</title>
</head>
<body>
</head>
<body>
Vous êtes banni du site, veuillez contacter le SIMDE.
</body>
</body>
</html>
......@@ -74,8 +74,8 @@ import withNetworkWrapper, { NetWrapParam } from ".../withNetworkWrapper";
export default withNetworkWrapper([
new NetWrapParam("userData", "one", {
addDataToProp: "userData",
params: RequestParams.Builder.withId(CURRENT_USER_ID).build()
})
params: RequestParams.Builder.withId(CURRENT_USER_ID).build(),
}),
])(ThemeProvider);
```
......@@ -93,7 +93,7 @@ You will see that those parameters can also depend on your component `props`.
```js
import withNetworkWrapper, { NetWrapParam } from ".../withNetworkWrapper";
const buildParams = univId =>
const buildParams = (univId) =>
RequestParams.Builder.withQueryParam("university", univId).build();
export default compose(
......@@ -101,11 +101,11 @@ export default compose(
withNetworkWrapper([
new NetWrapParam("sharedUnivFeedbacks", "all", {
addDataToProp: "feedback",
params: props => buildParams(props.univId),
params: (props) => buildParams(props.univId),
propTypes: {
univId: PropTypes.number.isRequired
}
})
univId: PropTypes.number.isRequired,
},
}),
])
)(SharedUnivFeedback);
```
......
......@@ -19,13 +19,13 @@
name: "Rex-DRI",
search: {
placeholder: "Search for...",
noData: "No result :("
noData: "No result :(",
// paths: ['/Application', '/GettingStarted', "Technologies", "/Other"]
},
alias: {
"/": "/GettingStarted/introduction.md",
"/.*/_sidebar.md": "/_sidebar.md"
}
"/.*/_sidebar.md": "/_sidebar.md",
},
};
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
......
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"react-hot-loader/babel",
"@babel/plugin-proposal-class-properties"
]
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": [
"react-hot-loader/babel",
"@babel/plugin-proposal-class-properties"
]
}
......@@ -2,20 +2,20 @@ module.exports = {
env: {
browser: true,
es6: true,
"jest/globals": true
"jest/globals": true,
},
extends: ["airbnb", "prettier"],
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly"
SharedArrayBuffer: "readonly",
},
parser: "babel-eslint",
parserOptions: {
ecmaFeatures: {
jsx: true
jsx: true,
},
ecmaVersion: 2018,
sourceType: "module"
sourceType: "module",
},
plugins: ["react", "jest", "import"],
rules: {
......@@ -23,8 +23,8 @@ module.exports = {
"warn",
{
terms: ["todo", "fixme"],
location: "anywhere"
}
location: "anywhere",
},
],
"no-console": "error",
// Styling choices bellow...
......@@ -44,6 +44,6 @@ module.exports = {
"one-var": "off",
camelcase: "off", // hard to do with python convention
"max-classes-per-file": "off",
"max-len": "off"
}
"max-len": "off",
},
};
......@@ -17,14 +17,13 @@ var webpack = require("webpack");
var WebpackDevServer = require("webpack-dev-server");
var config = require("./webpack.config.dev");
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
inline: true,
//progress: true,
historyApiFallback: true,
headers: { "Access-Control-Allow-Origin": "*" }
headers: { "Access-Control-Allow-Origin": "*" },
}).listen(3000, "0.0.0.0", (err) => {
if (err) {
// eslint-disable-next-line no-console
......
......@@ -36,7 +36,7 @@ const SERVICES_TO_INITIALIZE = [
CountryService,
CurrencyService,
LanguageService,
FilterService
FilterService,
];
/**
......@@ -44,7 +44,7 @@ const SERVICES_TO_INITIALIZE = [
*/
function App() {
useOnBeforeComponentMount(() => {
SERVICES_TO_INITIALIZE.forEach(service => service.initialize());
SERVICES_TO_INITIALIZE.forEach((service) => service.initialize());
});
return (
......@@ -53,7 +53,7 @@ function App() {
display: "flex",
flexDirection: "column",
justifyItems: "flex-end",
minHeight: "100vh"
minHeight: "100vh",
}}
>
<MainAppFrame>
......@@ -103,7 +103,7 @@ export default compose(
new NetWrapParam("universities", "all"),
new NetWrapParam("currencies", "all"),
new NetWrapParam("languages", "all"),
new NetWrapParam("serverModerationStatus", "all") // not needed for server moderation status
new NetWrapParam("serverModerationStatus", "all"), // not needed for server moderation status
]),
withErrorBoundary()
)(App);
......@@ -6,28 +6,28 @@ import { makeStyles } from "@material-ui/styles";
import classNames from "../../utils/classNames";
import { appBarHeight, siteMaxWidth } from "../../config/sharedStyles";
const useStyle = makeStyles(theme => ({
const useStyle = makeStyles((theme) => ({
root: {
flexGrow: 1
flexGrow: 1,
},
appBar: {
width: "100%",
height: appBarHeight(theme)
height: appBarHeight(theme),
},
toolBar: {
width: "100%",
maxWidth: siteMaxWidth(),
display: "flex"
display: "flex",
},
content: {
maxWidth: siteMaxWidth()
maxWidth: siteMaxWidth(),
},
centered: {
margin: "0 auto"
margin: "0 auto",
},
middleBlock: {
flex: 1
}
flex: 1,
},
}));
export default function BaseTemplate({ inBetween, toolbarContent, children }) {
......@@ -52,9 +52,9 @@ export default function BaseTemplate({ inBetween, toolbarContent, children }) {
BaseTemplate.propTypes = {
toolbarContent: PropTypes.node.isRequired,
children: PropTypes.node.isRequired,
inBetween: PropTypes.node
inBetween: PropTypes.node,
};
BaseTemplate.defaultProps = {
inBetween: <></>
inBetween: <></>,
};
......@@ -14,7 +14,7 @@ import {
mainMenuHome,
mainMenuItems,
secondaryMenuItems,
settingsMenuItems
settingsMenuItems,
} from "./menuItems";
const ListItemHeading = ({ label, Icon }) => (
......@@ -28,7 +28,7 @@ const ListItemHeading = ({ label, Icon }) => (
ListItemHeading.propTypes = {
label: PropTypes.node.isRequired,
Icon: PropTypes.object.isRequired
Icon: PropTypes.object.isRequired,
};
const ListItemsTmp = ({ items, onClick, inset }) => (
......@@ -52,15 +52,17 @@ const ListItemsTmp = ({ items, onClick, inset }) => (
ListItemsTmp.propTypes = {
items: PropTypes.array.isRequired,
onClick: PropTypes.func.isRequired,
inset: PropTypes.bool
inset: PropTypes.bool,
};
ListItemsTmp.defaultProps = {
inset: false
inset: false,
};
function DrawerMenu({ open, closeDrawer }) {
const ListItems = props => <ListItemsTmp {...props} onClick={closeDrawer} />;
const ListItems = (props) => (
<ListItemsTmp {...props} onClick={closeDrawer} />
);
return (
<div style={{ zIndex: 200000 }}>
......@@ -95,7 +97,7 @@ function DrawerMenu({ open, closeDrawer }) {
DrawerMenu.propTypes = {
open: PropTypes.bool.isRequired,
closeDrawer: PropTypes.func.isRequired
closeDrawer: PropTypes.func.isRequired,
};
export default React.memo(DrawerMenu);
......@@ -23,7 +23,7 @@ function ExternalDataUpdateInfo({ updates }) {
if (updates.length > 0) {
return (
<List aria-label="List of updates">
{updates.map(el => (
{updates.map((el) => (
<ListItem key={el.source}>
<ListItemText
primary={getLabel(el.source)}
......@@ -43,13 +43,13 @@ function ExternalDataUpdateInfo({ updates }) {
}
ExternalDataUpdateInfo.propTypes = {
updates: PropTypes.array.isRequired
updates: PropTypes.array.isRequired,
};
ExternalDataUpdateInfo.defaultProps = {};
export default withNetworkWrapper([
new NetWrapParam("externalDataUpdateInfo", "all", {
addDataToProp: "updates"
})
addDataToProp: "updates",
}),
])(ExternalDataUpdateInfo);
......@@ -6,13 +6,13 @@ import { withRouter } from "react-router-dom";
import InformationList from "./InformationList";
import APP_ROUTES from "../../config/appRoutes";
const useStyles = makeStyles(theme => ({
const useStyles = makeStyles((theme) => ({
divider: {
marginTop: theme.spacing(4),
marginBottom: theme.spacing(0),
paddingBottom: theme.spacing(2),
color: theme.palette.text.secondary
}
color: theme.palette.text.secondary,
},
}));
function FooterImportantInformation({ location }) {
......@@ -33,8 +33,8 @@ function FooterImportantInformation({ location }) {
FooterImportantInformation.propTypes = {
location: PropTypes.shape({
pathname: PropTypes.string.isRequired
}).isRequired
pathname: PropTypes.string.isRequired,
}).isRequired,
};
export default withRouter(FooterImportantInformation);
......@@ -18,7 +18,7 @@ const INFORMATION_ICONS = {
success: <StartIcon />,
info: <InfoIcon />,
error: <ErrorIcon color="error" />,
warning: <WarningIcon color="error" />
warning: <WarningIcon color="error" />,
};
/**
......@@ -33,7 +33,7 @@ function InformationList({ includeVariants, informationList }) {
return (
<List aria-label="List of information">
{informationListFiltered.map(el => (
{informationListFiltered.map((el) => (
<ListItem key={el.id}>
<ListItemIcon>{INFORMATION_ICONS[el.variant]}</ListItemIcon>
<ListItemText primary={el.message} secondary={toDateFr(el.start)} />
......@@ -45,19 +45,19 @@ function InformationList({ includeVariants, informationList }) {
InformationList.propTypes = {
includeVariants: PropTypes.arrayOf(PropTypes.string.isRequired),
informationList: PropTypes.array.isRequired
informationList: PropTypes.array.isRequired,
};
InformationList.defaultProps = {
includeVariants: ["warning", "error", "info", "success"]
includeVariants: ["warning", "error", "info", "success"],
};
export default compose(
withNetworkWrapper([
new NetWrapParam("information", "all", {
addDataToProp: "informationList",
params: RequestParams.Builder.withQueryParam("now", "true").build()
})
params: RequestParams.Builder.withQueryParam("now", "true").build(),
}),
]),
withErrorBoundary()
)(InformationList);
......@@ -8,13 +8,13 @@ import PropTypes from "prop-types";
import CustomNavLink from "../common/CustomNavLink";
import classNames from "../../utils/classNames";
const useStyle = makeStyles(theme => ({
const useStyle = makeStyles((theme) => ({
siteName: {
fontWeight: 900
fontWeight: 900,
},
logoContainer: {
position: "relative",
width: "fit-content"
width: "fit-content",
},
iconChip: {
backgroundColor: "transparent",
......@@ -22,11 +22,11 @@ const useStyle = makeStyles(theme => ({
paddingLeft: 1,
paddingRight: 1,
"&:hover": {
cursor: "pointer"
}
cursor: "pointer",
},
},
centered: {
margin: "0 auto"
margin: "0 auto",
},
logoUnderline: {
position: "absolute",
......@@ -35,15 +35,15 @@ const useStyle = makeStyles(theme => ({
height: 9,
backgroundColor: theme.palette.secondary.main,
width: "100%",
zIndex: -1
zIndex: -1,
},
iconAvatar: {
width: "2.5em",
height: "2.5em",
overflow: "initial",
backgroundColor: "transparent",
right: -4
}
right: -4,
},
}));
function Core() {
......@@ -88,11 +88,11 @@ function Logo({ linkTo }) {
}
Logo.propTypes = {
linkTo: PropTypes.string
linkTo: PropTypes.string,
};
Logo.defaultProps = {
linkTo: ""
linkTo: "",
};
export default Logo;
......@@ -8,11 +8,11 @@ import NotificationService from "../../services/NotificationService";
function NotifierImportantInformation({ informationList }) {
informationList
.filter(el => el.should_notify)
.forEach(el =>
.filter((el) => el.should_notify)
.forEach((el) =>
NotificationService.notify(el.message, {
variant: el.variant,
autoHideDuration: null
autoHideDuration: null,
})
);
......@@ -20,7 +20,7 @@ function NotifierImportantInformation({ informationList }) {
}
NotifierImportantInformation.propTypes = {
informationList: PropTypes.array.isRequired
informationList: PropTypes.array.isRequired,
};
export default compose(
......@@ -28,8 +28,8 @@ export default compose(
[
new NetWrapParam("information", "all", {
addDataToProp: "informationList",
params: RequestParams.Builder.withQueryParam("now", "true").build()
})
params: RequestParams.Builder.withQueryParam("now", "true").build(),
}),
],
React.Fragment
),
......
......@@ -13,7 +13,7 @@ function SnackbarCloseButton({ notiKey }) {
}
SnackbarCloseButton.propTypes = {
notiKey: PropTypes.number.isRequired
notiKey: PropTypes.number.isRequired,
};
export default SnackbarCloseButton;
......@@ -71,11 +71,11 @@ function UnlinkedPartners({ unlinkedPartners, variant }) {