Skip to content

Commit

Permalink
fix eslint error
Browse files Browse the repository at this point in the history
  • Loading branch information
ihahoo committed Nov 15, 2017
1 parent 43794dd commit 79def20
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 55 deletions.
59 changes: 35 additions & 24 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,36 +1,47 @@
{
"extends": "airbnb",
"extends": "airbnb",
"env": {
"es6": true,
"node": true,
"browser": true
"es6": true,
"node": true,
"browser": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 6,
"sourceType": "module"
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"react",
"import"
"react",
"import"
],
"rules": {
"comma-dangle": ["warn", "only-multiline"],
"indent": [2, 2, {"SwitchCase": 1}],
"no-console": 0,
"no-alert": 0,
"global-require": 0,
"react/wrap-multilines": 0,
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"react/forbid-prop-types": 0,
"object-shorthand": [2, "always", { "avoidQuotes": false }],
"jsx-a11y/no-static-element-interactions": 0,
"import/no-extraneous-dependencies": 0,
"react/no-array-index-key": 0,
"react/no-children-prop": 0
"comma-dangle": ["warn", "only-multiline"],
"indent": [2, 2, {"SwitchCase": 1}],
"no-console": 0,
"no-alert": 0,
"global-require": 0,
"react/wrap-multilines": 0,
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"react/forbid-prop-types": 0,
"object-shorthand": [2, "always", { "avoidQuotes": false }],
"import/no-extraneous-dependencies": 0,
"react/no-array-index-key": 0,
"jsx-a11y/no-static-element-interactions": 0,
"jsx-a11y/no-noninteractive-element-interactions": 0,
"max-len": [2, 200],
"class-methods-use-this": 0,
"object-curly-newline": 0,
"prefer-destructuring": 0,
"prefer-promise-reject-errors": 0,
"jsx-a11y/anchor-is-valid": [ "error", {
"components": [],
"specialLink": [ "hrefLeft", "hrefRight" ],
"aspects": [ "invalidHref", "preferButton" ]
}],
"react/no-children-prop": 0
},
"globals": {
"window": true
Expand Down
2 changes: 1 addition & 1 deletion src/server/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const WebpackIsomorphicTools = require('webpack-isomorphic-tools');
const WebpackIsomorphicToolsConfig = require('../../webpack/webpack.isomorphic.tools');

const rootDir = path.resolve(__dirname, '../../');
/* eslint no-underscore-dangle: 0*/
/* eslint no-underscore-dangle: 0 */
global.__DEVELOPMENT__ = process.env.NODE_ENV !== 'production';
global.webpackIsomorphicTools = new WebpackIsomorphicTools(WebpackIsomorphicToolsConfig)
.server(rootDir, () => {
Expand Down
56 changes: 28 additions & 28 deletions src/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,37 +42,37 @@ app.use((req, res) => {
const match = matchData[matchData.length - 1].match;
const store = configureStore({});
fetchData({ store, match })
.then(() => {
const context = {};
const body = renderToString(
<Provider store={store}>
<StaticRouter location={req.url} context={context}>
{renderRoutes(routes)}
</StaticRouter>
</Provider>
);
.then(() => {
const context = {};
const body = renderToString((
<Provider store={store}>
<StaticRouter location={req.url} context={context}>
{renderRoutes(routes)}
</StaticRouter>
</Provider>
));

if (context.url) {
res.redirect(302, context.url);
return;
}
if (context.url) {
res.redirect(302, context.url);
return;
}

const head = Helmet.rewind();
const state = store.getState();
const data = {
title: head.title.toString(),
meta: head.meta.toString(),
link: head.link.toString(),
script: head.script.toString(),
body,
state: JSON.stringify(state),
assets: webpackIsomorphicTools.assets(),
layout: false
};
const head = Helmet.rewind();
const state = store.getState();
const data = {
title: head.title.toString(),
meta: head.meta.toString(),
link: head.link.toString(),
script: head.script.toString(),
body,
state: JSON.stringify(state),
assets: webpackIsomorphicTools.assets(),
layout: false
};

res.render('index', data);
})
.catch(e => console.log(e));
res.render('index', data);
})
.catch(e => console.log(e));
});

if (port) {
Expand Down
2 changes: 1 addition & 1 deletion webpack/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const webpackConfig = {
}),
new webpack.DefinePlugin({
'process.env':{
'NODE_ENV': JSON.stringify('production')
NODE_ENV: JSON.stringify('production')
}
}),
new UglifyJsPlugin()
Expand Down
2 changes: 1 addition & 1 deletion webpack/webpack.config.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ const webpackConfig = {
}),
new webpack.DefinePlugin({
'process.env':{
'NODE_ENV': JSON.stringify('production')
NODE_ENV: JSON.stringify('production')
}
}),
new UglifyJsPlugin(),
Expand Down

0 comments on commit 79def20

Please sign in to comment.