From e20dd82928ef9315b8b5b9ffe19d6f2d6a934c61 Mon Sep 17 00:00:00 2001 From: Carlos Date: Wed, 20 Sep 2017 13:15:12 +0200 Subject: [PATCH] repaired ESLint to work everywhere, plus refactor on all package.json's that included ESLint dependencies. --- .eslintrc.yml | 2 +- package.json | 3 ++- services/auth/package.json | 2 -- .../client/common/methods/client/create.js | 22 +++++++++---------- services/client/package.json | 3 --- services/production/package.json | 2 -- services/salix/package.json | 2 -- 7 files changed, 14 insertions(+), 22 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index 8ea0fe0fe..101c70b1e 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,4 +1,4 @@ -extends: google +extends: [eslint:recommended, google] installedESLint: true rules: indent: [error, 4] diff --git a/package.json b/package.json index 1dda2dfa3..c6bef2107 100644 --- a/package.json +++ b/package.json @@ -30,9 +30,10 @@ "cors": "^2.8.1", "css-loader": "^0.25.0", "del": "^2.2.2", - "eslint": "^3.16.1", + "eslint": "^3.19.0", "eslint-config-angular": "^0.5.0", "eslint-config-google": "^0.6.0", + "eslint-config-loopback": "^4.0.0", "eslint-config-xo": "^0.17.0", "eslint-plugin-angular": "^1.4.1", "file-loader": "^0.9.0", diff --git a/services/auth/package.json b/services/auth/package.json index bc6233e61..a245ca653 100644 --- a/services/auth/package.json +++ b/services/auth/package.json @@ -21,8 +21,6 @@ "strong-error-handler": "^2.1.0" }, "devDependencies": { - "eslint": "^2.13.1", - "eslint-config-loopback": "^4.0.0", "nsp": "^2.1.0" }, "repository": { diff --git a/services/client/common/methods/client/create.js b/services/client/common/methods/client/create.js index fbc730845..84ff937d2 100644 --- a/services/client/common/methods/client/create.js +++ b/services/client/common/methods/client/create.js @@ -1,12 +1,12 @@ var app = require('../../../server/server'); -module.exports = function(Client){ +module.exports = function(Client) { Client.remoteMethod('createUserProfile', { description: 'Creates both client and its web account', accepts: { arg: 'data', type: 'object', - http: { source: 'body' } + http: {source: 'body'} }, returns: { root: true, @@ -17,7 +17,7 @@ module.exports = function(Client){ path: '/createUserProfile' } }); - + Client.createUserProfile = (data, callback) => { let firstEmail = data.email.split(',')[0]; let user = { @@ -26,11 +26,11 @@ module.exports = function(Client){ password: parseInt(Math.random() * 100000000000000) }; - app.models.Account.beginTransaction('READ COMMITTED', (err, transaction) => { - app.models.Account.create(user, {transaction}, (err, account) => { - if (err) { + app.models.Account.beginTransaction('READ COMMITTED', (error, transaction) => { + app.models.Account.create(user, {transaction}, (error, account) => { + if (error) { transaction.rollback(); - return callback(err); + return callback(error); } let client = { @@ -41,10 +41,10 @@ module.exports = function(Client){ email: data.email }; - Client.create(client, {transaction}, (err, client) => { - if (err) { + Client.create(client, {transaction}, (error, client) => { + if (error) { transaction.rollback(); - return callback(err); + return callback(error); } transaction.commit(); @@ -53,4 +53,4 @@ module.exports = function(Client){ }); }); }; -}; \ No newline at end of file +}; diff --git a/services/client/package.json b/services/client/package.json index bb21bcb06..8c088d4c9 100644 --- a/services/client/package.json +++ b/services/client/package.json @@ -3,7 +3,6 @@ "version": "1.0.0", "main": "server/server.js", "scripts": { - "lint": "eslint .", "start": "node .", "posttest": "npm run lint && nsp check" }, @@ -21,8 +20,6 @@ "strong-error-handler": "^2.1.0" }, "devDependencies": { - "eslint": "^2.13.1", - "eslint-config-loopback": "^4.0.0", "nsp": "^2.1.0" }, "repository": { diff --git a/services/production/package.json b/services/production/package.json index efe774be9..1d2d51296 100644 --- a/services/production/package.json +++ b/services/production/package.json @@ -22,8 +22,6 @@ "strong-error-handler": "^2.1.0" }, "devDependencies": { - "eslint": "^2.13.1", - "eslint-config-loopback": "^4.0.0", "nsp": "^2.1.0" }, "repository": { diff --git a/services/salix/package.json b/services/salix/package.json index d4c0099c4..a70bba256 100644 --- a/services/salix/package.json +++ b/services/salix/package.json @@ -21,8 +21,6 @@ "strong-error-handler": "^2.1.0" }, "devDependencies": { - "eslint": "^2.13.1", - "eslint-config-loopback": "^4.0.0", "nsp": "^2.1.0" }, "repository": {