Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
dozoisch committed Apr 22, 2015
1 parent b9775bc commit 712899c
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
"react/self-closing-comp": 1,
"react/wrap-multilines": 1,
"space-after-keywords": 2,
"strict": [1, "global"]
"strict": 0,
}
}
17 changes: 8 additions & 9 deletions config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,39 @@ var base = {
app: {
root: path.normalize(path.join(__dirname, "/..")),
env: env,
keys: ["super-secret-hurr-durr"],
}
},
};

var specific = {
development: {
app: {
port: 3000,
name: "Koa React Gulp Mongoose Mocha - Dev",
keys: ["super-secret-hurr-durr"]
keys: ["super-secret-hurr-durr"],
},
mongo: {
url: "mongodb://localhost/koareactfullexample_dev",
}
},
},
test: {
app: {
port: 3001,
name: "Koa React Gulp Mongoose Mocha - Test realm",
keys: ["super-secret-hurr-durr"]
keys: ["super-secret-hurr-durr"],
},
mongo: {
url: "mongodb://localhost/koareactfullexample_test",
}
},
},
production: {
app: {
port: process.env.PORT || 3000,
name: "Koa React Gulp Mongoose Mocha"
name: "Koa React Gulp Mongoose Mocha",
},
mongo: {
url: "mongodb://localhost/koareactfullexample",
}
}
},
},
};

module.exports = _.merge(base, specific[env]);
2 changes: 1 addition & 1 deletion config/koa.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = function (app, config, passport) {
app.use(function *(next) {
this.render = views(config.app.root + "/src/views", {
map: { html: "swig" },
cache : config.app.env === "development" ? "memory" : false
cache : config.app.env === "development" ? "memory" : false,
});
yield next;
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"hot-dev-server": "webpack-dev-server --content-base public -ds --config webpack.config.js --hot --progress --colors --port 2992 --inline",
"dev-server": "npm run hot-dev-server",
"test": "NODE_ENV=test ./node_modules/.bin/mocha --harmony --reporter spec ./test/test-*.js",
"lint": "eslint src test server.js make-webpack-config.js webpack-*.js app config lib"
"lint": "eslint src app test webpack config lib server.js webpack.config.js"
},
"author": "Hugo Dozois <hugo@dozoisch.com>",
"license": "MIT",
Expand Down
4 changes: 1 addition & 3 deletions src/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ var stats = require("../../build/stats.json");
var publicPath = stats.publicPath;

var STYLE_URL;
var SCRIPT_URL_COMMON;
var SCRIPT_URL_APP = publicPath + [].concat(stats.assetsByChunkName.app)[0]
var SCRIPT_URL_APP = publicPath + [].concat(stats.assetsByChunkName.app)[0];
if (process.env.NODE_ENV === "production") {
var COMMON_CHUNK = stats.assetsByChunkName.commons;
STYLE_URL = (publicPath + [].concat(stats.assetsByChunkName.app)[1] +"?" + stats.hash);
SCRIPT_URL_APP += "?" + stats.hash;
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/count.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var Schema = mongoose.Schema;
*/
var CountSchema = new Schema({
value: { type: Number, default: 0 },
updated: { type: Date, default: Date.now }
updated: { type: Date, default: Date.now },
});

CountSchema.pre("save", function (next) {
Expand Down
4 changes: 2 additions & 2 deletions src/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ var UserSchema = new Schema({
toJSON : {
transform: function (doc, ret, options) {
delete ret.password;
}
}
},
},
});

/**
Expand Down
2 changes: 1 addition & 1 deletion test/middlewares/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var co = require("co");

var Models = [
mongoose.model("Count"),
mongoose.model("User")
mongoose.model("User"),
];

function dropCollection(Model) {
Expand Down
2 changes: 1 addition & 1 deletion test/test-count.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe("Count", function () {
var c = new CountModel({value: gCount});
yield [
c.save(),
authHelper.createUser()
authHelper.createUser(),
];
}));

Expand Down
1 change: 0 additions & 1 deletion webpack/strategies/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
"use strict";
import development from "./development";
import version from "./version";
import optimize from "./optimize";
Expand Down
4 changes: 2 additions & 2 deletions webpack/strategies/optimize.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export default (config, options) => {
if (options.optimize) {
config = _.extend({}, config, {
output: _.extend({}, config.output, {
filename: "[name].min.js"
})
filename: "[name].min.js",
}),
});
config.plugins = config.plugins.concat([
new optimize.UglifyJsPlugin(),
Expand Down
1 change: 0 additions & 1 deletion webpack/strategies/style.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import _ from "lodash";
import ExtractTextPlugin, { extract } from "extract-text-webpack-plugin";

export default (config, options) => {
Expand Down
7 changes: 3 additions & 4 deletions webpack/strategies/version.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import _ from "lodash";
import fs from "fs";
import { execSync } from "child_process";
import { join } from "path";

import { version } from "../../package.json"
import { version } from "../../package.json";

export default (config, options) => {
if (!options.prerender) {
let plugin = function() {
this.plugin("done", function(stats) {
let jsonStats = stats.toJson({
chunkModules: true,
exclude: options.excludeFromStats
exclude: options.excludeFromStats,
});
jsonStats.publicPath = options.publicPath;
jsonStats.appVersion = version;
Expand All @@ -23,7 +22,7 @@ export default (config, options) => {
}
fs.writeFileSync(join(folderPath, "stats.json"), JSON.stringify(jsonStats));
});
}
};
config.plugins.push(plugin);
}
return config;
Expand Down
20 changes: 10 additions & 10 deletions webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default (options) => {

options.publicPath = options.devServer ? "//localhost:2992/_assets/" : "";
const environment = options.test || options.development ? "development" : "production";
const babelLoader = "babel?optional[]=es7.objectRestSpread&optional[]=runtime"
const babelLoader = "babel?optional[]=es7.objectRestSpread&optional[]=runtime";
const reactLoader = options.development ? `react-hot!${babelLoader}` : babelLoader;
const chunkFilename = (options.devServer ? "[id].js" : "[name].js") +
(options.longTermCaching && !options.prerender ? "?[chunkhash]" : "");
Expand All @@ -35,7 +35,7 @@ export default (options) => {

const config = {
entry: {
"app": "./app/app.jsx",
app: "./app/app.jsx",
},

output: {
Expand All @@ -50,7 +50,7 @@ export default (options) => {
],

resolve: {
extensions: ["",".js",".jsx"],
extensions: ["", ".js", ".jsx"],
},

module: {
Expand All @@ -60,7 +60,7 @@ export default (options) => {
{ test: /\.(woff|woff2)/, loader: "url?limit=100000" },
{ test: /\.(png|jpg|jpeg|gif|svg)/, loader: "url?limit=100000" },
{ test: /\.(ttf|eot)/, loader: "file" },
]
],
},

plugins: [
Expand All @@ -70,19 +70,19 @@ export default (options) => {
new webpack.PrefetchPlugin("react/lib/ReactComponentBrowserEnvironment"),
new webpack.DefinePlugin({
"process.env": {
"NODE_ENV": JSON.stringify(environment)
}
NODE_ENV: JSON.stringify(environment),
},
}),
],

devServer: {
stats: {
exclude: options.excludeFromStats
}
}
exclude: options.excludeFromStats,
},
},
};

return strategies.reduce((conf, strategy) => {
return strategy(conf, options);
}, config);
}
};

0 comments on commit 712899c

Please sign in to comment.