Skip to content
This repository has been archived by the owner on Oct 26, 2021. It is now read-only.

Commit

Permalink
Update eslint to 3.5.0. Update related eslint deps
Browse files Browse the repository at this point in the history
universal-redux was still relying on eslint 1.x.x where eslint is now
at 3.x.x.  Having this old dependency was causing shrinkwraps to fail
for projects that are using latest eslint.

This change updates eslint to 3.5.0 and also updates related eslint
dependencies:

```
    "eslint-config-airbnb": "11.1.0",
    "eslint-loader": "1.4.0",
    "eslint-plugin-import": "1.15.0",
    "eslint-plugin-jsx-a11y": "2.2.2",
    "eslint-plugin-react": "6.2.1",
```

I also didn't want to cause too much churn in the code, so I disabled
rules that had non-trivial changes to fix. For trivial fixes, I went
ahead and fixed those.
  • Loading branch information
Brian Geihsler committed Sep 14, 2016
1 parent 54f6ab3 commit 57f437f
Show file tree
Hide file tree
Showing 18 changed files with 59 additions and 37 deletions.
15 changes: 14 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,41 @@
"mocha": true
},
"rules": {
"react/forbid-prop-types": 0,
"react/jsx-filename-extension": 0,
"react/no-danger": 0,
"react/no-multi-comp": 2,
"react/prefer-stateless-function": 0,
"react/require-extension": 0,
"import/default": 0,
"import/imports-first": 0,
"import/named": 2,
"import/namespace": 2,
"import/newline-after-import": 0,
"import/no-duplicates": 0,
"import/no-extraneous-dependencies": 0,
"import/no-unresolved": 0,
"import/no-named-as-default": 2,
"arrow-body-style": 0,
"comma-dangle": 0,
"global-require": 0,
"indent": [2, 2, {"SwitchCase": 1}],
"no-console": 0,
"no-alert": 0,
"no-nested-ternary": 0,
"no-path-concat": 0,
"no-underscore-dangle": 0,
"max-len": 0,
"object-curly-spacing": [2, "always"],
"prefer-template": 0,
"array-bracket-spacing": [2, "always"]
},
"plugins": [
"react",
"import"
],
"parser": "babel-eslint",
"settings": {
"import/parser": "babel-eslint",
"import/resolve": {
moduleDirectory: ["node_modules", "src"]
}
Expand Down
3 changes: 2 additions & 1 deletion bin/build_es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ webpack(webpackConfig, (err, stats) => {
if (buildStats) {
fs.writeFile(outputStatsPath, JSON.stringify(stats.toJson()), (writeError) => {
if (writeError) {
return console.log(writeError);
console.log(writeError);
return;
}

console.log('Webpack output stats were saved to', outputStatsPath);
Expand Down
2 changes: 1 addition & 1 deletion bin/webpack-dev-server_es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const app = new Express();
app.use(require('webpack-dev-middleware')(compiler, serverOptions));
app.use(require('webpack-hot-middleware')(compiler));

app.listen(port, function onAppListening(err) {
app.listen(port, (err) => {
if (err) {
console.error(err);
} else {
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@
"babel-runtime": "6.9.2",
"compression": "1.6.2",
"css-loader": "0.23.1",
"eslint": "1.10.3",
"eslint-config-airbnb": "0.1.1",
"eslint-loader": "1.0.0",
"eslint-plugin-import": "0.12.1",
"eslint-plugin-react": "3.7.1",
"eslint": "3.5.0",
"eslint-config-airbnb": "11.1.0",
"eslint-loader": "1.4.0",
"eslint-plugin-import": "1.15.0",
"eslint-plugin-jsx-a11y": "2.2.2",
"eslint-plugin-react": "6.2.1",
"express": "4.14.0",
"extract-text-webpack-plugin": "1.0.1",
"file-loader": "0.9.0",
"fmp-redux-async-connect": "0.1.15",
"json-loader": "0.5.4",
"less": "2.7.1",
"less-loader": "2.2.3",
Expand All @@ -74,7 +76,6 @@
"react-transform-hmr": "1.0.4",
"redbox-react": "1.2.10",
"redux": "3.5.2",
"fmp-redux-async-connect": "0.1.15",
"redux-devtools": "3.3.1",
"redux-devtools-dock-monitor": "1.1.1",
"redux-devtools-log-monitor": "1.0.11",
Expand Down
2 changes: 2 additions & 0 deletions src/client/devtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ export function render() {
const Tools = __DEVTOOLS_IS_VISIBLE__ ? DevTools : InvisibleDevTools;
return <Tools />;
}

return null;
}
4 changes: 2 additions & 2 deletions src/client/providers/async-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { Router } from 'react-router';
import getRoutes from 'universal-redux/routes';
import AsyncProps from '../../vendor/async-props';

export default function(store, devComponent) {
export default function (store, devComponent) {
const root = (
<Provider store={store} key="provider">
<div>
<Router render={(props) => <AsyncProps {...props} />} history={history}>
<Router render={props => <AsyncProps {...props} />} history={history}>
{getRoutes(store)}
</Router>
{devComponent}
Expand Down
7 changes: 3 additions & 4 deletions src/client/providers/react-router.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React from 'react';
import { Router } from 'react-router';
import { browserHistory } from 'react-router';
import { browserHistory, Router } from 'react-router';
import { ReduxAsyncConnect } from 'fmp-redux-async-connect';
import getRoutes from 'universal-redux/routes';

export default function(store) {
export default function (store) {
const component = (
<Router render={(props) => <ReduxAsyncConnect {...props} />} history={browserHistory}>
<Router render={props => <ReduxAsyncConnect {...props} />} history={browserHistory}>
{getRoutes(store)}
</Router>
);
Expand Down
2 changes: 1 addition & 1 deletion src/client/providers/redux-async-connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Provider } from 'react-redux';
import createRouter from './react-router';

export default function(store, devComponent) {
export default function (store, devComponent) {
const root = (
<Provider store={store} key="provider">
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/client/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { includes } from 'lodash';
import reduxAsyncConnectClient from './providers/redux-async-connect';
import asyncPropsClient from './providers/async-props';

export default function(store, providers, devComponent) {
export default function (store, providers, devComponent) {
let client = reduxAsyncConnectClient;
if (includes(providers, 'async-props')) {
client = asyncPropsClient;
Expand Down
2 changes: 1 addition & 1 deletion src/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function validateConfig(config) {

export default (projectConfig) => {
// since typically the dev server is logging this out too
projectConfig.verbose = false;
projectConfig.verbose = false; // eslint-disable-line no-param-reassign

const config = mergeConfigs(projectConfig);

Expand Down
12 changes: 6 additions & 6 deletions src/helpers/fetchAllData.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
function fetchAllData(components, getState, dispatch, location, params, deferred) {
const methodName = deferred ? 'fetchDataDeferred' : 'fetchData';
return components
.filter((component) => !!component) // Weed out 'undefined' routes
.filter((component) => component[methodName]) // only look at ones with a static fetchData()
.map((component) => component[methodName]) // pull out fetch data methods
.filter(component => !!component) // Weed out 'undefined' routes
.filter(component => component[methodName]) // only look at ones with a static fetchData()
.map(component => component[methodName]) // pull out fetch data methods
.map(fetchData => fetchData(getState, dispatch, location, params)); // call fetch data methods and save promises
}

export default (components, getState, dispatch, location, params) => {
return new Promise(resolve => {
return new Promise((resolve) => {
const doTransition = () => {
Promise.all(fetchAllData(components, getState, dispatch, location, params, true))
.then(resolve)
.catch(error => {
.catch((error) => {
// TODO: You may want to handle errors for fetchDataDeferred here
console.warn('Warning: Error in fetchDataDeferred', error);
return resolve();
Expand All @@ -21,7 +21,7 @@ export default (components, getState, dispatch, location, params) => {

Promise.all(fetchAllData(components, getState, dispatch, location, params))
.then(doTransition)
.catch(error => {
.catch((error) => {
// TODO: You may want to handle errors for fetchData here
console.warn('Warning: Error in fetchData', error);
return doTransition();
Expand Down
8 changes: 3 additions & 5 deletions src/server/body.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import serialize from 'serialize-javascript';

export default class Body extends Component {
static propTypes = {
additions: PropTypes.string,
assets: PropTypes.object,
component: PropTypes.node,
headers: PropTypes.object,
store: PropTypes.object,
};

Expand All @@ -17,10 +15,10 @@ export default class Body extends Component {

return (
<body>
<div id="content" dangerouslySetInnerHTML={{ __html: content }}/>
<script dangerouslySetInnerHTML={{ __html: `window.__data=${serialize(store.getState())};` }} charSet="UTF-8"/>
<div id="content" dangerouslySetInnerHTML={{ __html: content }} />
<script dangerouslySetInnerHTML={{ __html: `window.__data=${serialize(store.getState())};` }} charSet="UTF-8" />
{ Object.keys(assets.javascript).map((jsAsset, key) =>
<script src={assets.javascript[jsAsset]} key={key} charSet="UTF-8"/>
<script src={assets.javascript[jsAsset]} key={key} charSet="UTF-8" />
)}
</body>
);
Expand Down
12 changes: 10 additions & 2 deletions src/server/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export default class Head extends Component {
const additionsNode = require(path.resolve(additions)).default;
return additionsNode(store, headers);
}

return null;
}

render() {
Expand All @@ -25,8 +27,14 @@ export default class Head extends Component {
<meta name="viewport" content="width=device-width, initial-scale=1" />
{/* styles (will be present only in production with webpack extract text plugin) */}
{Object.keys(assets.styles).map((style, key) =>
<link href={assets.styles[style]} key={key} media="screen, projection"
rel="stylesheet" type="text/css" charSet="UTF-8"/>
<link
href={assets.styles[style]}
key={key}
media="screen, projection"
rel="stylesheet"
type="text/css"
charSet="UTF-8"
/>
)}
{this.renderAdditions()}
</head>
Expand Down
2 changes: 1 addition & 1 deletion src/server/providers/async-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Provider } from 'react-redux';
import AsyncProps, { loadPropsOnServer } from '../../vendor/async-props';

export default function(store, renderProps) {
export default function (store, renderProps) {
return new Promise((resolve, reject) => {
loadPropsOnServer(renderProps, (err, asyncProps) => {
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion src/server/providers/react-router.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { match as reactRouterMatch } from 'react-router';
import createMemoryHistory from 'react-router/lib/createMemoryHistory';

export function match(routes, location, store, cb) {
export function match(routes, location, store, cb) { // eslint-disable-line import/prefer-default-export
reactRouterMatch({ history: createMemoryHistory(), routes, location }, cb);
}
2 changes: 1 addition & 1 deletion src/server/providers/redux-async-connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Provider } from 'react-redux';
import { ReduxAsyncConnect, loadOnServer } from 'fmp-redux-async-connect';

export default function(store, renderProps) {
export default function (store, renderProps) {
return new Promise((resolve, reject) => {
loadOnServer(renderProps, store)
.then(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/server/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default (projectConfig, projectToolsConfig) => {
});
};

function *koaMiddleware() {
function* koaMiddleware() {
yield dynamicMiddleware(this.request.originalUrl,
this.request.headers,
(status, body, resolve) => {
Expand All @@ -92,7 +92,7 @@ export default (projectConfig, projectToolsConfig) => {
dynamicMiddleware(req.originalUrl,
res._headers,
(status, body) => res.status(status).send(body),
(url) => res.redirect(url));
url => res.redirect(url));
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { includes } from 'lodash';
import reduxAsyncConnectServer from './providers/redux-async-connect';
import asyncPropsServer from './providers/async-props';

export default function(store, renderProps, providers) {
export default function (store, renderProps, providers) {
let server = reduxAsyncConnectServer;
if (includes(providers, 'async-props')) {
server = asyncPropsServer;
Expand Down

0 comments on commit 57f437f

Please sign in to comment.