Skip to content

Commit fd99648

Browse files
committed
Add .eslint configuration
1 parent 417d6e4 commit fd99648

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

.eslintrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "airbnb",
3+
"rules": {
4+
"no-var": "off",
5+
"prefer-arrow-callback": "off",
6+
"comma-dangle": "off"
7+
}
8+
}

lib/postMethod.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ module.exports = function(Model, options) {
1515
return cb(err);
1616
}
1717
if (!previousInstance) {
18-
return cb({code: 'INSTANCE_NOT_FOUND'});
18+
return cb({ code: 'INSTANCE_NOT_FOUND' });
1919
}
2020

2121
if (defaultOptions.assignProperties) {
2222
_.assign(previousInstance, instance);
2323

24-
previousInstance.save(function (err, updatedInstance) {
25-
cb(err, updatedInstance);
24+
previousInstance.save(function (errSaving, updatedInstance) {
25+
cb(errSaving, updatedInstance);
2626
});
2727
} else {
2828
previousInstance.updateAttributes(instance, function (errUpdating, updatedInstance) {
@@ -37,10 +37,10 @@ module.exports = function(Model, options) {
3737
description: 'Update attributes for a model instance and persist it into data source (loopback-post-mixin)',
3838
accepts: [
3939
{ arg: 'id', type: 'string' },
40-
{ arg: 'instance', type: 'object', http: { source: 'body'}}
40+
{ arg: 'instance', type: 'object', http: { source: 'body'} }
4141
],
4242
http: { path: '/:id', verb: 'post', errorStatus: 400 },
43-
returns: [ { arg: 'instance', root: true, type: 'object' } ]
43+
returns: [{ arg: 'instance', root: true, type: 'object' }]
4444
}
4545
);
4646

lib/spamControl.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,11 @@ module.exports = function(Model, opts) {
101101
_getKey(ctx.instance, spamOptions, accessToken, function (err, key) {
102102
debug('Before key: %s', key);
103103

104-
cache.ttl(key, function(err, cacheResult) {
104+
cache.ttl(key, function (err, cacheResult) {
105105
if (cacheResult) {
106106
return _resolveOrError(1, next);
107-
} else {
108-
next();
109107
}
108+
next();
110109
});
111110
});
112111
} else {

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "loopback-ibmresearch-mixin",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"description": "A Loopback mixin using in some IBM research apps",
55
"main": "lib/index.js",
66
"scripts": {
@@ -37,6 +37,11 @@
3737
"lodash": "^4.16.6",
3838
"loopback": "^2.36.0",
3939
"loopback-boot": "^2.23.0",
40-
"mocha": "^3.1.2"
40+
"mocha": "^3.1.2",
41+
"eslint": "^3.13.1",
42+
"eslint-config-airbnb": "^14.0.0",
43+
"eslint-plugin-import": "^2.2.0",
44+
"eslint-plugin-jsx-a11y": "^3.0.2",
45+
"eslint-plugin-react": "^6.9.0"
4146
}
4247
}

0 commit comments

Comments
 (0)