Skip to content
Snippets Groups Projects
Commit c2aef20d authored by sixertoy's avatar sixertoy
Browse files

:ghost: fix rapide de règles eslint

parent 4d64af74
Branches
Tags
No related merge requests found
Showing
with 1031 additions and 987 deletions
......@@ -22,7 +22,7 @@
"rules": {
"array-bracket-newline": ["error", { "multiline": true }],
"array-element-newline": ["error", "consistent"],
"func-style": ["error", "declaration"],
"func-style": ["error", "declaration", { "allowArrowFunctions": true }],
"import/no-unresolved": "off",
"indent": ["error", 4],
"max-nested-callbacks": ["error", 2],
......
......@@ -28,7 +28,10 @@ function SimpleAppBar(props) {
return (
<div className={classes.root}>
<AppBar position="relative" style={{ background: "#FFFFFF", boxShadow: "none" }}>
<AppBar
position="relative"
style={{ background: "#FFFFFF", boxShadow: "none" }}
>
<Toolbar>
<Typography className={classes.typo1} variant="h4" color="inherit">
Tranches / décote
......@@ -43,7 +46,7 @@ function SimpleAppBar(props) {
}
SimpleAppBar.propTypes = {
classes: PropTypes.object.isRequired,
classes: PropTypes.shape().isRequired,
}
export default withStyles(styles)(SimpleAppBar)
// Adapted from https://github.com/eipex2/nivo-cra/tree/master/src/
import React from "react"
import { ResponsiveBar } from "@nivo/bar"
import Card from "@material-ui/core/Card"
import CardContent from "@material-ui/core/CardContent"
class BarChart extends React.Component {
constructor(props) {
......@@ -19,7 +17,9 @@ class BarChart extends React.Component {
result[keycols[index]] = Math.round(item / 10000000) / 100
return result
}, stavant)
const stapres = { refid: "" /* +Math.round(total.apres/10000000)/100+ "Md€" */ }
const stapres = {
refid: "" /* +Math.round(total.apres/10000000)/100+ "Md€" */,
}
const resapres = deciles
.map(element => element.apres)
.reduce((result, item, index, array) => {
......@@ -38,7 +38,10 @@ class BarChart extends React.Component {
// const iddecile=key.substring(0,key.indexOf(".")
<image
key={key}
xlinkHref={`../static/images/decile${key.substring(0, key.indexOf("."))}.png`}
xlinkHref={`../static/images/decile${key.substring(
0,
key.indexOf("."),
)}.png`}
x={x + width / 2 - size / 2}
y={y + height / 2 - size / 2}
height={width > 15 ? size : 0}
......@@ -52,7 +55,15 @@ class BarChart extends React.Component {
return (
<div className="chart">
<ResponsiveBar
layers={["grid", "axes", "bars", Image, "markers", "legends", "annotations"]}
layers={[
"grid",
"axes",
"bars",
Image,
"markers",
"legends",
"annotations",
]}
data={data}
keys={keycols}
/* */
......
......@@ -149,7 +149,11 @@ class MiniDrawer extends React.Component {
>
<div className={classes.toolbar}>
<IconButton onClick={this.handleDrawerClose}>
{theme.direction === "rtl" ? <ChevronRightIcon /> : <ChevronLeftIcon />}
{theme.direction === "rtl" ? (
<ChevronRightIcon />
) : (
<ChevronLeftIcon />
)}
</IconButton>
</div>
<Divider />
......
......@@ -2,7 +2,7 @@ import { Grid } from "@material-ui/core"
import SimpleCard from "./SimpleCard"
import RecettesCard from "./RecettesCard"
export default props => (
export default () => (
<Grid container sm={12} spacing={32}>
<Grid item sm={6}>
<RecettesCard />
......
import { Component } from "react"
import { Grid } from "@material-ui/core"
import fetch from "isomorphic-fetch"
import SimpleCard from "components/SimpleCard"
import CarteEtat from "components/CarteEtat"
......
......@@ -92,7 +92,11 @@ class RecettesCard extends React.Component {
</div>
<div>
<Button variant="contained" color="secondary" onClick={this.updateStateRes}>
<Button
variant="contained"
color="secondary"
onClick={this.updateStateRes}
>
Lancer la simulation
</Button>
</div>
......
......@@ -283,15 +283,13 @@ class Reformeur extends Component {
UpdateTaux = (i, value) => {
const ref = this.state.reforme
const list = this.state.reforme.impot_revenu.bareme.taux.map(
(item, j) => {
const list = this.state.reforme.impot_revenu.bareme.taux.map((item, j) => {
if (j === i) {
const valchiffre = parseInt(value, 10)
return isNaN(valchiffre) ? item : valchiffre
}
return item
},
)
})
ref.impot_revenu.bareme.taux = list
this.setState({ reforme: ref })
}
......@@ -502,17 +500,10 @@ class Reformeur extends Component {
<div>
{/* <div>You are sized like a tablet or mobile phone though</div> */}
<div className={classes.root}>
<AppBar
position="static"
color="default"
>
<AppBar position="static" color="default">
<Tabs
value={
this.state.indextab
}
onChange={
this.handleTabChange
}
value={this.state.indextab}
onChange={this.handleTabChange}
indicatorColor="primary"
textColor="primary"
variant="fullWidth"
......@@ -522,78 +513,32 @@ class Reformeur extends Component {
</Tabs>
</AppBar>
<SwipeableViews
axis={
theme.direction
=== "rtl"
? "x-reverse"
: "x"
}
axis={theme.direction === "rtl" ? "x-reverse" : "x"}
index={this.state.indextab}
onChangeIndex={
this.handleIndexChange
}
>
<TabContainer
dir={theme.direction}
onChangeIndex={this.handleIndexChange}
>
<TabContainer dir={theme.direction}>
<Paper>
<ArticleHeader />
<Divider />
<Article
reforme={
this.state
.reforme
}
reformebase={
this.state
.reformebase
}
onChange={
this
.handleChange
}
addTranche={
this
.addTranche
}
removeTranche={
this
.removeTranche
}
reforme={this.state.reforme}
reformebase={this.state.reformebase}
onChange={this.handleChange}
addTranche={this.addTranche}
removeTranche={this.removeTranche}
/>
</Paper>
</TabContainer>
<TabContainer
dir={theme.direction}
>
<TabContainer dir={theme.direction}>
<Impact
loading={
this.state
.loading
}
onRevenuChange={
this
.handleRevenuChange
}
onOutreMerChange={
this
.handleOutreMerChange
}
res_brut={
this.state
.res_brut
}
total_pop={
this.state
.total_pop
}
onClick={
this.simPop
}
cas_types={
this.state
.cas_types
}
loading={this.state.loading}
onRevenuChange={this.handleRevenuChange}
onOutreMerChange={this.handleOutreMerChange}
res_brut={this.state.res_brut}
total_pop={this.state.total_pop}
onClick={this.simPop}
cas_types={this.state.cas_types}
/>
</TabContainer>
</SwipeableViews>
......@@ -605,35 +550,23 @@ class Reformeur extends Component {
<div>
{/* <div>You also have a good screen</div> */}
<div className="moitie-gauche">
<Paper
className={
this.props.classes.paper
}
>
<Paper className={this.props.classes.paper}>
<ArticleHeader />
<Divider />
<Article
reforme={this.state.reforme}
reformebase={
this.state.reformebase
}
reformebase={this.state.reformebase}
onChange={this.handleChange}
addTranche={this.addTranche}
removeTranche={
this.removeTranche
}
removeTranche={this.removeTranche}
/>
</Paper>
</div>
<div className="moitie-droite">
<Impact
loading={this.state.loading}
onRevenuChange={
this.handleRevenuChange
}
onOutreMerChange={
this.handleOutreMerChange
}
onRevenuChange={this.handleRevenuChange}
onOutreMerChange={this.handleOutreMerChange}
res_brut={this.state.res_brut}
total_pop={this.state.total_pop}
onClick={this.simPop}
......@@ -665,11 +598,7 @@ class Reformeur extends Component {
</Tabs>
</AppBar>
<SwipeableViews
axis={
theme.direction === "rtl"
? "x-reverse"
: "x"
}
axis={theme.direction === "rtl" ? "x-reverse" : "x"}
index={this.state.indextab}
onChangeIndex={this.handleIndexChange}
>
......@@ -685,12 +614,8 @@ class Reformeur extends Component {
<TabContainer dir={theme.direction}>
<Impact
loading={this.state.loading}
onRevenuChange={
this.handleRevenuChange
}
onOutreMerChange={
this.handleOutreMerChange
}
onRevenuChange={this.handleRevenuChange}
onOutreMerChange={this.handleOutreMerChange}
res_brut={this.state.res_brut}
total_pop={this.state.total_pop}
onClick={this.simPop}
......
......@@ -20,7 +20,7 @@ import desertIsland from "@iconify/icons-twemoji/desert-island"
import CircularProgress from "@material-ui/core/CircularProgress"
const styles = theme => ({
const styles = () => ({
card: {
minWidth: 50,
paddingBottom: 0,
......@@ -79,12 +79,25 @@ class SimpleCard extends React.Component {
handleOutreMerChange = numcastype => (event) => {
// console.log("je suis dans l'outremer",numcastype,event,this.props.desc_cas_type.outre_mer)
this.props.onOutreMerChange(numcastype, 3 - this.props.desc_cas_type.outre_mer)
this.props.onOutreMerChange(
numcastype,
3 - this.props.desc_cas_type.outre_mer,
)
}
roundedRevenues(revenumensuel) {
const roundlevel = [100, 50, 100, 200, 500, 1000, 5000, 10000, 100000]
const paliers = [900, 2000, 3000, 4000, 10000, 15000, 20000, 100000, 1000000]
const paliers = [
900,
2000,
3000,
4000,
10000,
15000,
20000,
100000,
1000000,
]
// for now the rounded revenues do not depend on the current value
let currpal = 0
const res = []
......@@ -100,7 +113,12 @@ class SimpleCard extends React.Component {
render() {
const {
classes, index, desc_cas_type, impots_avant, impots_apres, loading,
classes,
index,
desc_cas_type,
impots_avant,
impots_apres,
loading,
} = this.props
const styleIcons = {
......
import Button from "@material-ui/core/Button"
/* eslint
indent: [2, 2],
semi: [2, "always"],
react/jsx-indent: [2, 2],
react/jsx-indent-props: [2, 2]
max-nested-callbacks: [2, { "max": 4 }]
*/
import Button from "@material-ui/core/Button";
function Contact() {
return (
<a href="mailto:leximpact@openfisca.org" style={{ color: "white", textDecoration: "none" }}>
<a
href="mailto:leximpact@openfisca.org"
style={{ color: "white", textDecoration: "none" }}
>
<Button color="inherit">
<p>Vos Retours !</p>
</Button>
</a>
)
);
}
export default Contact
export default Contact;
import { withStyles } from "@material-ui/core/styles"
import AppBar from "@material-ui/core/AppBar"
import Toolbar from "@material-ui/core/Toolbar"
import Home from "components/header/home"
import Links from "components/header/links"
import MenuContainer from "components/header/menu-container"
/* eslint
indent: [2, 2],
semi: [2, "always"],
react/jsx-indent: [2, 2],
react/jsx-indent-props: [2, 2]
max-nested-callbacks: [2, { "max": 4 }]
*/
import PropTypes from "prop-types";
import { withStyles } from "@material-ui/core/styles";
import AppBar from "@material-ui/core/AppBar";
import Toolbar from "@material-ui/core/Toolbar";
import Home from "components/header/home";
import Links from "components/header/links";
import MenuContainer from "components/header/menu-container";
const styles = {
header: {
......@@ -12,7 +20,7 @@ const styles = {
header__space: {
flexGrow: 1,
},
}
};
function HeaderContainer({ classes }) {
return (
......@@ -26,7 +34,11 @@ function HeaderContainer({ classes }) {
</Toolbar>
</AppBar>
</div>
)
);
}
export default withStyles(styles)(HeaderContainer)
HeaderContainer.propTypes = {
classes: PropTypes.shape().isRequired,
};
export default withStyles(styles)(HeaderContainer);
import Breakpoint, { BreakpointProvider } from "react-socks"
import Typography from "@material-ui/core/Typography"
/* eslint
indent: [2, 2],
semi: [2, "always"],
react/jsx-indent: [2, 2],
react/jsx-indent-props: [2, 2]
max-nested-callbacks: [2, { "max": 4 }]
*/
import Breakpoint, { BreakpointProvider } from "react-socks";
import Typography from "@material-ui/core/Typography";
function Home() {
return (
......@@ -10,7 +17,7 @@ function Home() {
</Typography>
</Breakpoint>
</BreakpointProvider>
)
);
}
export default Home
export default Home;
import { withStyles } from "@material-ui/core/styles"
import Button from "@material-ui/core/Button"
/* eslint
indent: [2, 2],
semi: [2, "always"],
react/jsx-indent: [2, 2],
react/jsx-indent-props: [2, 2]
max-nested-callbacks: [2, { "max": 4 }]
*/
import PropTypes from "prop-types";
import { withStyles } from "@material-ui/core/styles";
import Button from "@material-ui/core/Button";
const styles = {
links: {
......@@ -12,7 +20,7 @@ const styles = {
paddingRight: 30,
marginLeft: 30,
},
}
};
function Links({ classes }) {
return (
......@@ -21,7 +29,11 @@ function Links({ classes }) {
Impôt sur le revenu
</Button>
</div>
)
);
}
export default withStyles(styles)(Links)
Links.propTypes = {
classes: PropTypes.hape().isRequired,
};
export default withStyles(styles)(Links);
import Button from "@material-ui/core/Button"
/* eslint
indent: [2, 2],
semi: [2, "always"],
react/jsx-indent: [2, 2],
react/jsx-indent-props: [2, 2]
max-nested-callbacks: [2, { "max": 4 }]
*/
import Button from "@material-ui/core/Button";
function Login() {
return (
<Button color="inherit">
<p>Connexion</p>
</Button>
)
);
}
export default Login
export default Login;
import { useReducer } from "react"
import { flow } from "lodash/fp"
import Menu from "components/header/menu"
import Login from "components/header/login"
import Signup from "components/header/signup"
import Contact from "components/header/contact"
/* eslint
indent: [2, 2],
semi: [2, "always"],
react/jsx-indent: [2, 2],
react/jsx-indent-props: [2, 2]
max-nested-callbacks: [2, { "max": 4 }]
*/
import { useReducer } from "react";
import { flow } from "lodash/fp";
import Menu from "components/header/menu";
import Login from "components/header/login";
import Signup from "components/header/signup";
import Contact from "components/header/contact";
import {
open, close, reducer, initialState,
} from "components/header/menu-reducer"
open,
close,
reducer,
initialState,
} from "components/header/menu-reducer";
function MenuContainer() {
const [state, dispatch] = useReducer(reducer, initialState())
const [state, dispatch] = useReducer(reducer, initialState());
function openMenu({ currentTarget }) {
return flow([open, dispatch])(currentTarget)
return flow([open, dispatch])(currentTarget);
}
function closeMenu() {
return dispatch(close())
return dispatch(close());
}
return (
......@@ -25,7 +35,7 @@ function MenuContainer() {
<Login />
<Signup />
</Menu>
)
);
}
export default MenuContainer
export default MenuContainer;
/* eslint
indent: [2, 2],
semi: [2, "always"],
react/jsx-indent: [2, 2],
react/jsx-indent-props: [2, 2]
max-nested-callbacks: [2, { "max": 4 }]
*/
function initialState() {
return { isOpen: false }
return { isOpen: false };
}
function open(anchorEl = false) {
return {
type: "header/menu/open",
anchorEl,
}
};
}
function close() {
return { type: "header/menu/close" }
return { type: "header/menu/close" };
}
function reducer(state, { type, anchorEl }) {
......@@ -18,16 +25,16 @@ function reducer(state, { type, anchorEl }) {
return {
isOpen: true,
anchorEl,
}
};
}
if (type === close().type) {
return { isOpen: false }
return { isOpen: false };
}
return state
return state;
}
export {
open, close, reducer, initialState,
}
};
import { withStyles } from "@material-ui/core/styles"
import Breakpoint, { BreakpointProvider } from "react-socks"
import MaterialMenu from "@material-ui/core/Menu"
import MaterialMoreIcon from "@material-ui/icons/MoreVert"
import MaterialMenuItem from "@material-ui/core/MenuItem"
import MaterialIconButton from "@material-ui/core/IconButton"
/* eslint
indent: [2, 2],
semi: [2, "always"],
react/jsx-indent: [2, 2],
react/jsx-indent-props: [2, 2]
max-nested-callbacks: [2, { "max": 4 }]
*/
import PropTypes from "prop-types";
import { withStyles } from "@material-ui/core/styles";
import Breakpoint, { BreakpointProvider } from "react-socks";
import MaterialMenu from "@material-ui/core/Menu";
import MaterialMoreIcon from "@material-ui/icons/MoreVert";
import MaterialMenuItem from "@material-ui/core/MenuItem";
import MaterialIconButton from "@material-ui/core/IconButton";
const styles = {
menu: {
display: "flex",
},
}
};
function Menu({
classes, state, actions, children,
}) {
const { isOpen, anchorEl } = state
const { openMenu, closeMenu } = actions
const { isOpen, anchorEl } = state;
const { openMenu, closeMenu } = actions;
return (
<BreakpointProvider>
......@@ -42,7 +50,14 @@ function Menu({
</div>
</Breakpoint>
</BreakpointProvider>
)
);
}
export default withStyles(styles)(Menu)
Menu.propTypes = {
actions: PropTypes.shape().isRequired,
children: PropTypes.shape().isRequired,
classes: PropTypes.shape().isRequired,
state: PropTypes.shape().isRequired,
};
export default withStyles(styles)(Menu);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment