commit d1b98c9b2e8816dbed6b5bd652bdcbec7deeeb9c
parent b8bb6367b7b24c9e79ee893a5eccce3734b6641f
Author: Konstantin Tarkus <hello@tarkus.me>
Date: Sun, 20 Sep 2015 16:04:45 +0300
Use AirBnb preset in JSCS settings
Diffstat:
7 files changed, 45 insertions(+), 36 deletions(-)
diff --git a/.jscsrc b/.jscsrc
@@ -1,8 +1,5 @@
{
- "preset": "google",
- "disallowSpacesInAnonymousFunctionExpression": null,
- "validateLineBreaks": "LF",
- "validateIndentation": 2,
+ "preset": "airbnb",
"excludeFiles": ["build/**", "node_modules/**"],
- "esprima": "esprima-fb"
+ "validateQuoteMarks": null
}
diff --git a/package.json b/package.json
@@ -40,6 +40,7 @@
"git-repository": "^0.1.1",
"glob": "^5.0.14",
"jest-cli": "^0.5.7",
+ "jscs": "^2.1.1",
"mkdirp": "^0.5.1",
"ncp": "^2.0.0",
"postcss": "^5.0.5",
@@ -54,7 +55,7 @@
"url-loader": "^0.5.6",
"webpack": "^1.12.2",
"webpack-dev-middleware": "^1.2.0",
- "webpack-hot-middleware": "^2.1.0"
+ "webpack-hot-middleware": "^2.2.0"
},
"jest": {
"rootDir": "./src",
@@ -65,7 +66,7 @@
]
},
"scripts": {
- "lint": "eslint src tools",
+ "lint": "eslint src tools && jscs src tools",
"csslint": "csscomb src/components --lint --verbose",
"csscomb": "csscomb src/components --verbose",
"test": "eslint src && jest",
diff --git a/src/app.js b/src/app.js
@@ -36,6 +36,7 @@ function render(state) {
} else {
window.scrollTo(0, 0);
}
+
// Remove the pre-rendered CSS because it's no longer used
// after the React app is launched
if (cssContainer) {
diff --git a/src/core/HttpClient.js b/src/core/HttpClient.js
@@ -7,6 +7,7 @@ function getUrl(path) {
if (path.startsWith('http') || canUseDOM) {
return path;
}
+
return process.env.WEBSITE_HOSTNAME ?
`http://${process.env.WEBSITE_HOSTNAME}${path}` :
`http://127.0.0.1:${global.server.get('port')}${path}`;
diff --git a/src/decorators/withViewport.js b/src/decorators/withViewport.js
@@ -32,6 +32,7 @@ function withViewport(ComposedComponent) {
window.addEventListener('resize', handleWindowResize);
window.addEventListener('orientationchange', handleWindowResize);
}
+
EE.on(RESIZE_EVENT, this.handleResize, this);
}
diff --git a/tools/config.js b/tools/config.js
@@ -26,7 +26,7 @@ const AUTOPREFIXER_BROWSERS = [
];
const GLOBALS = {
'process.env.NODE_ENV': DEBUG ? '"development"' : '"production"',
- '__DEV__': DEBUG,
+ __DEV__: DEBUG,
};
//
@@ -64,26 +64,28 @@ const config = {
},
module: {
- loaders: [{
- test: /\.jsx?$/,
- include: [
- path.resolve(__dirname, '../node_modules/react-routing/src'),
- path.resolve(__dirname, '../src'),
- ],
- loaders: [...(WATCH && ['react-hot']), 'babel-loader'],
- }, {
- test: /\.json$/,
- loader: 'json-loader',
- }, {
- test: /\.txt$/,
- loader: 'raw-loader',
- }, {
- test: /\.(png|jpg|jpeg|gif|svg|woff|woff2)$/,
- loader: 'url-loader?limit=10000',
- }, {
- test: /\.(eot|ttf|wav|mp3)$/,
- loader: 'file-loader',
- }],
+ loaders: [
+ {
+ test: /\.jsx?$/,
+ include: [
+ path.resolve(__dirname, '../node_modules/react-routing/src'),
+ path.resolve(__dirname, '../src'),
+ ],
+ loaders: [...(WATCH && ['react-hot']), 'babel-loader'],
+ }, {
+ test: /\.json$/,
+ loader: 'json-loader',
+ }, {
+ test: /\.txt$/,
+ loader: 'raw-loader',
+ }, {
+ test: /\.(png|jpg|jpeg|gif|svg|woff|woff2)$/,
+ loader: 'url-loader?limit=10000',
+ }, {
+ test: /\.(eot|ttf|wav|mp3)$/,
+ loader: 'file-loader',
+ },
+ ],
},
postcss: function plugins() {
@@ -124,10 +126,12 @@ const appConfig = merge({}, config, {
]),
],
module: {
- loaders: [...config.module.loaders, {
- test: /\.css$/,
- loader: 'style-loader/useable!css-loader!postcss-loader',
- }],
+ loaders: [
+ ...config.module.loaders, {
+ test: /\.css$/,
+ loader: 'style-loader/useable!css-loader!postcss-loader',
+ },
+ ],
},
});
@@ -168,10 +172,12 @@ const serverConfig = merge({}, config, {
{ raw: true, entryOnly: false }),
],
module: {
- loaders: [...config.module.loaders, {
- test: /\.css$/,
- loader: 'css-loader!postcss-loader',
- }],
+ loaders: [
+ ...config.module.loaders, {
+ test: /\.css$/,
+ loader: 'css-loader!postcss-loader',
+ },
+ ],
},
});
diff --git a/tools/copy.js b/tools/copy.js
@@ -19,6 +19,7 @@ import watch from './lib/watch';
export default async () => {
console.log('copy');
await Promise.all([
+
// Static files
copy('src/public', 'build/public'),
@@ -29,6 +30,7 @@ export default async () => {
copy('src/templates', 'build/templates'),
copy('package.json', 'build/package.json'),
+
]);
replace({