Skip to content

Commit c221aeb

Browse files
committed
Working with ESLint in the UI
1 parent 9bc0357 commit c221aeb

File tree

46 files changed

+582
-593
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+582
-593
lines changed

ui/.eslintrc

Lines changed: 0 additions & 21 deletions
This file was deleted.

ui/.eslintrc.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const path = require('path');
2+
3+
module.exports =
4+
Object.assign({},{
5+
"parser": "babel-eslint",
6+
"extends": "airbnb-base",
7+
"plugins": [
8+
"flowtype",
9+
"react"
10+
],
11+
"rules": {
12+
"curly": "off", // Ugly for one-liners
13+
"no-underscore-dangle": "off", // I like this one actually, but the library we're using enforces it.
14+
"semi": "off", // Where's the "force no semi" rule?
15+
"comma-dangle": "off", // Ew. I get it, but ew.
16+
"prefer-const": "off", // Sometimes we don't mutate, but want the ability to later on
17+
"consistent-return": "off", // Often unnecessary
18+
"func-names": "off", // Often Cleaner
19+
"space-before-function-paren": "off", // Personal preference
20+
"space-before-blocks": "off", // Personal preference
21+
"no-else-return": "off", // Sometimes an if/else block looks cleaner, even if unnecessary
22+
"react/jsx-uses-vars": 1,
23+
"import/extensions": "off",
24+
"import/first": "off",
25+
"import/no-extraneous-dependencies": ["error", {"devDependencies": false, "optionalDependencies": false, "peerDependencies": false}]
26+
}
27+
},
28+
{settings: {
29+
'import/resolver': {
30+
node: {
31+
paths: [path.resolve(__dirname, 'src')],
32+
},
33+
},
34+
}})

ui/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"postcss-flexbugs-fixes": "3.0.0",
3030
"postcss-loader": "2.0.6",
3131
"promise": "7.1.1",
32+
"prop-types": "^15.5.10",
3233
"react": "^15.6.1",
3334
"react-apollo": "^1.4.8",
3435
"react-autosuggest": "^9.3.2",
@@ -50,8 +51,6 @@
5051
"devDependencies": {
5152
"eslint": "^3.19.0",
5253
"eslint-config-airbnb-base": "^11.2.0",
53-
"eslint-plugin-flowtype": "^2.35.0",
54-
"eslint-plugin-import": "^2.7.0",
5554
"eslint-config-react-app": "^1.0.5",
5655
"eslint-loader": "1.7.1",
5756
"eslint-plugin-flowtype": "2.34.0",

ui/src/App.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
/* eslint-disable */
12
.monaco-editor{
23
width:100% !important;
34
}
45

56
.overflow-guard{
67
width:100% !important;
7-
}
8+
}

ui/src/App.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @flow
22

3-
import React, { Component } from 'react';
3+
import { Component } from 'react';
44
import PropTypes from 'prop-types';
55
import { Switch, Route } from 'react-router-dom'
66
import { gql, graphql } from 'react-apollo';
@@ -17,7 +17,7 @@ import AddIcon from 'material-ui-icons/Add';
1717
import { MuiThemeProvider } from 'material-ui/styles';
1818
import { RobotTheme } from './Themes'
1919
import 'typeface-roboto'
20-
import css from './App.css'
20+
import css from './App.css' // eslint-disable-line no-unused-vars
2121

2222
@graphql(gql`query { me { displayName username imageUrl } }`)
2323
class App extends Component {
@@ -27,44 +27,44 @@ class App extends Component {
2727

2828
state = {
2929
hoveredTooltip: false,
30-
loginModalOpen:false,
30+
loginModalOpen: false,
3131
}
3232

33-
addNew = (event, index) => {
34-
if(!this.props.data.me)
35-
this.setState({loginModalOpen:true})
33+
addNew = () => {
34+
if (!this.props.data.me)
35+
this.setState({ loginModalOpen: true })
3636
else
3737
this.context.router.history.push('/lambdas/new')
3838
};
3939

4040
render() {
4141
const theme = RobotTheme;
42-
if(!this.props.data || this.props.data.loading){
42+
if (!this.props.data || this.props.data.loading){
4343
return <FullPageLoader theme={theme}/>
4444
}
4545
return (
4646
<MuiThemeProvider theme={theme}>
47-
47+
4848
<div className="App" >
49-
<AppToolbar
50-
onRef={ref => (this.child = ref)}
49+
<AppToolbar
50+
onRef={ref => (this.child = ref)} //eslint-disable-line
5151
loading={false}
5252
{...this.props} />
53-
<Grid container gutter={0} justify="center" style={{padding: '0 15px 0 15px', marginTop: '60px', backgroundColor:theme.canvasColor[900]}}>
53+
<Grid container gutter={0} justify="center" style={{ padding: '0 15px 0 15px', marginTop: '60px', backgroundColor: theme.canvasColor[900] }}>
5454
<Grid item xs={12} sm={10} lg={8}>
5555
<Grid item xs={12}>
5656
<Switch>
57-
<Route path='/lambdas/new' render={(props) => ( <NewLambdaPage appData={this.props.data}/> )}/>
57+
<Route path='/lambdas/new' render={<NewLambdaPage appData={this.props.data}/>}/>
5858
<Route path='/users/:user' component={User} appData={this.props.data}/>
5959
<Route path='/:slug' component={LambdaPage} appData={this.props.data}/>
6060
<Route path='/' component={Lambdas} appData={this.props.data}/>
6161
</Switch>
6262
</Grid>
6363

64-
{this.context.router.route.location.pathname.indexOf("/lambdas/new") === -1 && (<Button onClick={this.addNew} fab color="primary" style={{position: 'fixed',right: '15px', bottom: '15px'}}>
64+
{this.context.router.route.location.pathname.indexOf('/lambdas/new') === -1 && (<Button onClick={this.addNew} fab color="primary" style={{ position: 'fixed', right: '15px', bottom: '15px' }}>
6565
<AddIcon />
6666
</Button>)}
67-
<LoginModal onClose={()=>this.setState({loginModalOpen:false})}
67+
<LoginModal onClose={() => this.setState({ loginModalOpen: false })}
6868
isOpen={this.state.loginModalOpen}
6969
returnTo='/lambdas/new' />
7070
</Grid>
@@ -75,4 +75,4 @@ class App extends Component {
7575
}
7676
}
7777

78-
export default App;
78+
export default App;

ui/src/App.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React from 'react';
1+
/* eslint-disable */
2+
23
import ReactDOM from 'react-dom';
34
import App from './App';
45

ui/src/Themes.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const RobotThemeDark = createMuiTheme({
4747
export const MainTheme = createMuiTheme({
4848
palette: createPalette({
4949
type: 'light',
50-
primary: {
50+
primary: {
5151
50: '#757495',
5252
100: '#5E5D83',
5353
200: '#474671',
@@ -58,13 +58,13 @@ export const MainTheme = createMuiTheme({
5858
700: '#030132',
5959
800: '#03012D',
6060
900: '#020127',
61-
'A100': '#5E5C8F',
62-
'A200': '#47457F',
63-
'A400': '#19175F',
64-
'A700': '#020041',
65-
'contrastDefaultColor': '#88003C'
61+
A100: '#5E5C8F',
62+
A200: '#47457F',
63+
A400: '#19175F',
64+
A700: '#020041',
65+
contrastDefaultColor: '#88003C'
6666
},
6767
accent: blue,
6868
error: red,
6969
}),
70-
});
70+
});

ui/src/Util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export function getRandomInt(min, max) {
22
min = Math.ceil(min);
33
max = Math.floor(max);
4-
return Math.floor(Math.random() * (max - min)) + min; //The maximum is exclusive and the minimum is inclusive
5-
}
4+
return Math.floor(Math.random() * (max - min)) + min; // The maximum is exclusive and the minimum is inclusive
5+
}

ui/src/components/_lambdaPage/index.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
// @flow
22

3-
import React from 'react';
43
import PropTypes from 'prop-types';
54
import { withStyles } from 'material-ui/styles';
65
import Grid from 'material-ui/Grid';
76
import Paper from 'material-ui/Paper';
8-
import Typography from 'material-ui/Typography';
9-
//import Breadcrumbs from 'components/breadcrumbs'
107
import styles from './styles'
118
import ViewLambda from 'components/viewLambda'
129

@@ -16,7 +13,7 @@ function lambdaPage(props, context) {
1613
return (
1714
<Grid container gutter={0} justify="flex-start" className={classes.card}>
1815
<Grid item xs={3} >
19-
{/*<Breadcrumbs />*/}
16+
{/* <Breadcrumbs /> */}
2017
</Grid>
2118
<Grid item xs={12}>
2219
<Paper className={classes.root}>
@@ -37,5 +34,3 @@ lambdaPage.contextTypes = {
3734
};
3835

3936
export default withStyles(styles)(lambdaPage);
40-
41-
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createStyleSheet } from 'material-ui/styles';
22

33
export default createStyleSheet('lambdaPage', theme => ({
4-
root:{
5-
padding:'15px'
4+
root: {
5+
padding: '15px'
66
},
7-
}));
7+
}));

0 commit comments

Comments
 (0)