Skip to content

Commit ec3ff9c

Browse files
committed
Merge pull request strongloop#12 from strongloop/feature/eslint
Feature/eslint
2 parents 35ac797 + 86261bb commit ec3ff9c

File tree

7 files changed

+35
-24
lines changed

7 files changed

+35
-24
lines changed

.eslintignore

Whitespace-only changes.

.eslintrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "loopback",
3+
"rules": {
4+
"max-len": ["error", 80, 4, {
5+
"ignoreComments": true,
6+
"ignoreUrls": true,
7+
"ignorePattern": "^\\s*var\\s.+=\\s*(require\\s*\\()|(/)"
8+
}]
9+
}
10+
}

.jshintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"main": "server/server.js",
55
"license": "MIT",
66
"scripts": {
7-
"pretest": "jshint ."
7+
"lint": "eslint .",
8+
"posttest": "npm run lint"
89
},
910
"dependencies": {
1011
"async": "~0.9.0",
@@ -17,6 +18,7 @@
1718
"serve-favicon": "^2.0.1"
1819
},
1920
"devDependencies": {
20-
"jshint": "^2.8.0"
21+
"eslint": "^2.7.0",
22+
"eslint-config-loopback": "^1.0.0"
2123
}
2224
}

server/server.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ var app = module.exports = loopback();
1111
boot(app, __dirname);
1212

1313
app.start = function(httpOnly) {
14-
if(httpOnly === undefined) {
14+
if (httpOnly === undefined) {
1515
httpOnly = process.env.HTTP;
1616
}
1717
var server = null;
18-
if(!httpOnly) {
18+
if (!httpOnly) {
1919
var options = {
2020
key: sslConfig.privateKey,
21-
cert: sslConfig.certificate
21+
cert: sslConfig.certificate,
2222
};
2323
server = https.createServer(options, app);
2424
} else {
2525
server = http.createServer(app);
2626
}
2727
server.listen(app.get('port'), function() {
28-
var baseUrl = (httpOnly? 'http://' : 'https://') + app.get('host') + ':' + app.get('port');
28+
var baseUrl = (httpOnly ? 'http://' : 'https://') + app.get('host') + ':' + app.get('port');
2929
app.emit('started', baseUrl);
3030
console.log('LoopBack server listening @ %s%s', baseUrl, '/');
3131
if (app.get('loopback-component-explorer')) {

server/ssl-config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
var path = require('path'),
2-
fs = require("fs");
1+
var path = require('path');
2+
var fs = require('fs');
33

44
exports.privateKey = fs.readFileSync(path.join(__dirname, './private/privatekey.pem')).toString();
55
exports.certificate = fs.readFileSync(path.join(__dirname, './private/certificate.pem')).toString();

server/test-server.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,37 @@ var db = app.dataSources.db;
88
var notes = [
99
];
1010

11-
for(var i=0; i<500; i++) {
12-
notes.push({author: 'Author' + i, title: 'Blog ' + i, content: 'Nice content ' + i, created: new Date(), modified: new Date()});
11+
for (var i = 0; i < 500; i++) {
12+
notes.push({ author: 'Author' + i, title: 'Blog ' + i,
13+
content: 'Nice content ' + i, created: new Date(), modified: new Date() });
1314
}
1415

1516
function importData(Model, data, cb) {
16-
1717
// console.log('Importing data for ' + Model.modelName);
18-
Model.destroyAll(function (err) {
19-
if(err) {
18+
Model.destroyAll(function(err) {
19+
if (err) {
2020
cb(err);
2121
return;
2222
}
23-
async.each(data, function (d, callback) {
23+
async.each(data, function(d, callback) {
2424
Model.create(d, callback);
2525
}, cb);
2626
});
2727
}
2828

2929
async.series(
3030
[
31-
function (cb) {
31+
function(cb) {
3232
db.autoupdate(cb);
3333
},
34-
importData.bind(null, app.models.note, notes)
35-
], function (err, results) {
36-
if(err) {
37-
console.error(err);
38-
} else {
39-
console.log('Done');
40-
}
41-
});
34+
importData.bind(null, app.models.note, notes),
35+
], function(err, results) {
36+
if (err) {
37+
console.error(err);
38+
} else {
39+
console.log('Done');
40+
}
41+
});
4242

4343
app.start();
4444

0 commit comments

Comments
 (0)