Skip to content

Commit

Permalink
[core] Upgrade eslint (#8583)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari authored Oct 7, 2017
1 parent 366857b commit e66d4c4
Show file tree
Hide file tree
Showing 107 changed files with 326 additions and 347 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ module.exports = {
'linebreak-style': 'off', // Don't play nicely with Windows.
'arrow-body-style': 'off', // Not our taste?
'arrow-parens': 'off', // Incompatible with prettier
'object-curly-newline': 'off', // Incompatible with prettier
'function-paren-newline': 'off', // Incompatible with prettier
indent: 'off', // Incompatible with prettier
'space-before-function-paren': 'off', // Incompatible with prettier
'no-mixed-operators': 'off', // Incompatible with prettier
Expand All @@ -46,6 +48,7 @@ module.exports = {
'no-prototype-builtins': 'off', // airbnb use error
'object-curly-spacing': 'off', // use babel plugin rule
'no-restricted-properties': 'off', // To remove once react-docgen support ** operator.
'prefer-destructuring': 'off', // To remove once react-docgen support ** operator.

'babel/object-curly-spacing': ['error', 'always'],

Expand Down Expand Up @@ -88,6 +91,8 @@ module.exports = {
],
},
],
'react/default-props-match-prop-types': 'off', // Buggy
'react/jsx-curly-brace-presence': 'off', // Buggy

'material-ui/docgen-ignore-before-comment': 'error',

Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/components/AppWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class AppWrapper extends React.Component<any, any> {
// Wait for the title to be updated.
this.googleTimer = setTimeout(() => {
window.gtag('config', config.google.id, {
page_path: location.pathname,
page_path: window.location.pathname,
});
});
}
Expand Down
5 changes: 5 additions & 0 deletions docs/src/pages/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
rules: {
'prefer-destructuring': 'error',
},
};
2 changes: 1 addition & 1 deletion docs/src/pages/customization/CssInJs.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const MyLinkStyled = withStyles(styles)(MyLink);
export default function CssInJs() {
return (
<Typography type="subheading">
<MyLinkStyled href="#">{'MyLink'}</MyLinkStyled>
<MyLinkStyled href="#">MyLink</MyLinkStyled>
{' - '}
<MyLinkStyled href="#" variant="primary">
{'primary'}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/customization/OverridesComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import OverridesClassNames from 'docs/src/pages/customization/OverridesClassName

// We can use OverridesClassNames over and over.
function OverridesComponent() {
return <OverridesClassNames>{'Component'}</OverridesClassNames>;
return <OverridesClassNames>Component</OverridesClassNames>;
}

export default OverridesComponent;
2 changes: 1 addition & 1 deletion docs/src/pages/customization/OverridesInlineStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const style = {
};

function OverridesInlineStyle() {
return <Button style={style}>{'inline-style'}</Button>;
return <Button style={style}>inline-style</Button>;
}

export default OverridesInlineStyle;
2 changes: 1 addition & 1 deletion docs/src/pages/customization/OverridesTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const theme = createMuiTheme({
function OverridesTheme() {
return (
<MuiThemeProvider theme={theme}>
<Button>{'Overrides'}</Button>
<Button>Overrides</Button>
</MuiThemeProvider>
);
}
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/customization/Palette.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function Palette() {
return (
<MuiThemeProvider theme={theme}>
<div>
<Button color="primary">{'Primary'}</Button>
<Button color="accent">{'Accent'}</Button>
<Button color="primary">Primary</Button>
<Button color="accent">Accent</Button>
</div>
</MuiThemeProvider>
);
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/customization/TypographyTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ function TypographyTheme() {
return (
<MuiThemeProvider theme={theme}>
<div>
<Typography type="body1">{'body1'}</Typography>
<Button>{'Button'}</Button>
<Typography type="body1">body1</Typography>
<Button>Button</Button>
</div>
</MuiThemeProvider>
);
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/app-bar/ButtonAppBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const styles = theme => ({
});

function ButtonAppBar(props) {
const classes = props.classes;
const { classes } = props;
return (
<div className={classes.root}>
<AppBar position="static">
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/app-bar/SimpleAppBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const styles = theme => ({
});

function SimpleAppBar(props) {
const classes = props.classes;
const { classes } = props;
return (
<div className={classes.root}>
<AppBar position="static" color="default">
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/avatars/IconAvatars.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const styles = {
};

function IconAvatars(props) {
const classes = props.classes;
const { classes } = props;
return (
<div className={classes.row}>
<Avatar className={classes.avatar}>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/avatars/ImageAvatars.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const styles = {
};

function ImageAvatars(props) {
const classes = props.classes;
const { classes } = props;
return (
<div className={classes.row}>
<Avatar alt="Remy Sharp" src="/static/images/remy.jpg" className={classes.avatar} />
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/avatars/LetterAvatars.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const styles = {
};

function LetterAvatars(props) {
const classes = props.classes;
const { classes } = props;
return (
<div className={classes.row}>
<Avatar className={classes.avatar}>H</Avatar>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/badges/SimpleBadge.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const styles = theme => ({
});

function SimpleBadge(props) {
const classes = props.classes;
const { classes } = props;
return (
<div>
<Badge className={classes.badge} badgeContent={4} color="primary">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LabelBottomNavigation extends React.Component {
};

render() {
const classes = this.props.classes;
const { classes } = this.props;
const { value } = this.state;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SimpleBottomNavigation extends React.Component {
};

render() {
const classes = this.props.classes;
const { classes } = this.props;
const { value } = this.state;

return (
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/buttons/FlatButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function doSomething(event) {
}

function FlatButtons(props) {
const classes = props.classes;
const { classes } = props;
return (
<div>
<Button className={classes.button}>Default</Button>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/buttons/FloatingActionButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const styles = theme => ({
});

function FloatingActionButtons(props) {
const classes = props.classes;
const { classes } = props;
return (
<div>
<Button fab color="primary" aria-label="add" className={classes.button}>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/buttons/IconButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const styles = theme => ({
});

function IconButtons(props) {
const classes = props.classes;
const { classes } = props;
return (
<div>
<IconButton className={classes.button} aria-label="Delete">
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/buttons/RaisedButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const styles = theme => ({
});

function RaisedButtons(props) {
const classes = props.classes;
const { classes } = props;
return (
<div>
<Button raised className={classes.button}>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/cards/MediaControlCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const styles = theme => ({
});

function MediaControlCard(props) {
const classes = props.classes;
const { classes } = props;

return (
<div>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/cards/RecipeReviewCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class RecipeReviewCard extends React.Component {
};

render() {
const classes = this.props.classes;
const { classes } = this.props;

return (
<div>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/cards/SimpleCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const styles = theme => ({
});

function SimpleCard(props) {
const classes = props.classes;
const { classes } = props;
const bull = <span className={classes.bullet}></span>;

return (
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/cards/SimpleMediaCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const styles = {
};

function SimpleMediaCard(props) {
const classes = props.classes;
const { classes } = props;
return (
<div>
<Card className={classes.card}>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/chips/Chips.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function handleClick() {
}

function Chips(props) {
const classes = props.classes;
const { classes } = props;
return (
<div className={classes.row}>
<Chip label="Basic Chip" className={classes.chip} />
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/chips/ChipsArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ChipsArray extends React.Component {
};

render() {
const classes = this.props.classes;
const { classes } = this.props;

return (
<div className={classes.row}>
Expand Down
7 changes: 3 additions & 4 deletions docs/src/pages/demos/dialogs/ConfirmationDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,22 @@ const styles = theme => ({

class ConfirmationDialogDemo extends React.Component {
state = {
anchorEl: null,
open: false,
value: 'Dione',
};

button = undefined;

handleClickListItem = event => {
this.setState({ open: true, anchorEl: event.currentTarget });
handleClickListItem = () => {
this.setState({ open: true });
};

handleRequestClose = value => {
this.setState({ value, open: false });
};

render() {
const classes = this.props.classes;
const { classes } = this.props;
return (
<div className={classes.root}>
<List>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/dialogs/FormDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class FormDialog extends React.Component {
<div>
<Button onClick={this.handleClickOpen}>Open form dialog</Button>
<Dialog open={this.state.open} onRequestClose={this.handleRequestClose}>
<DialogTitle>{'Subscribe'}</DialogTitle>
<DialogTitle>Subscribe</DialogTitle>
<DialogContent>
<DialogContentText>
To subscribe to this website, please enter your email address here. We will send
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/dividers/InsetDividers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const styles = theme => ({
});

function InsetDividers(props) {
const classes = props.classes;
const { classes } = props;
return (
<List className={classes.root}>
<ListItem button>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/dividers/ListDividers.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const styles = theme => ({
});

function ListDividers(props) {
const classes = props.classes;
const { classes } = props;
return (
<List className={classes.root}>
<ListItem button>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/drawers/MiniDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class MiniDrawer extends React.Component {
};

render() {
const classes = this.props.classes;
const { classes } = this.props;

return (
<div className={classes.root}>
Expand Down
30 changes: 25 additions & 5 deletions docs/src/pages/demos/drawers/TemporaryDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class TemporaryDrawer extends React.Component {
};

render() {
const classes = this.props.classes;
const { classes } = this.props;

const sideList = (
<div className={classes.list}>
Expand All @@ -58,12 +58,22 @@ class TemporaryDrawer extends React.Component {
<Button onClick={this.toggleDrawer('top', true)}>Open Top</Button>
<Button onClick={this.toggleDrawer('bottom', true)}>Open Bottom</Button>
<Drawer open={this.state.left} onRequestClose={this.toggleDrawer('left', false)}>
<div tabIndex={0} role="button" onClick={this.toggleDrawer('left', false)}>
<div
tabIndex={0}
role="button"
onClick={this.toggleDrawer('left', false)}
onKeyDown={this.toggleDrawer('left', false)}
>
{sideList}
</div>
</Drawer>
<Drawer anchor="top" open={this.state.top} onRequestClose={this.toggleDrawer('top', false)}>
<div tabIndex={0} role="button" onClick={this.toggleDrawer('top', false)}>
<div
tabIndex={0}
role="button"
onClick={this.toggleDrawer('top', false)}
onKeyDown={this.toggleDrawer('top', false)}
>
{fullList}
</div>
</Drawer>
Expand All @@ -72,7 +82,12 @@ class TemporaryDrawer extends React.Component {
open={this.state.bottom}
onRequestClose={this.toggleDrawer('bottom', false)}
>
<div tabIndex={0} role="button" onClick={this.toggleDrawer('bottom', false)}>
<div
tabIndex={0}
role="button"
onClick={this.toggleDrawer('bottom', false)}
onKeyDown={this.toggleDrawer('bottom', false)}
>
{fullList}
</div>
</Drawer>
Expand All @@ -81,7 +96,12 @@ class TemporaryDrawer extends React.Component {
open={this.state.right}
onRequestClose={this.toggleDrawer('right', false)}
>
<div tabIndex={0} role="button" onClick={this.toggleDrawer('right', false)}>
<div
tabIndex={0}
role="button"
onClick={this.toggleDrawer('right', false)}
onKeyDown={this.toggleDrawer('right', false)}
>
{sideList}
</div>
</Drawer>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/grid-list/AdvancedGridList.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const styles = theme => ({
* ];
*/
function AdvancedGridList(props) {
const classes = props.classes;
const { classes } = props;

return (
<div className={classes.root}>
Expand Down
Loading

0 comments on commit e66d4c4

Please sign in to comment.