Skip to content

Commit acdfb43

Browse files
committed
Upgrade eslint config and grunt-eslint to latest
- disable ES6 because PhantomJS does not support it yet - fix linter errors reported after the upgrade.
1 parent fab5bd4 commit acdfb43

File tree

9 files changed

+57
-53
lines changed

9 files changed

+57
-53
lines changed

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"extends": "loopback",
3+
"parserOptions": {
4+
"ecmaVersion": 5
5+
},
36
"rules": {
47
"max-len": ["error", 100, 4, {
58
"ignoreComments": true,

common/models/acl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ module.exports = function(ACL) {
347347

348348
var self = this;
349349
this.find({where: {principalType: principalType, principalId: principalId,
350-
model: model, property: propertyQuery, accessType: accessTypeQuery}},
350+
model: model, property: propertyQuery, accessType: accessTypeQuery}},
351351
function(err, dynACLs) {
352352
if (err) {
353353
if (callback) callback(err);

common/models/role.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ module.exports = function(Role) {
343343

344344
if (principalType && principalId) {
345345
roleMappingModel.findOne({where: {roleId: roleId,
346-
principalType: principalType, principalId: principalId}},
346+
principalType: principalType, principalId: principalId}},
347347
function(err, result) {
348348
debug('Role mapping found: %j', result);
349349
done(!err && result); // The only arg is the result

example/mobile-models/app.js

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,26 @@ var Application = models.Application(dataSource);
1717

1818
app.model(Application);
1919

20-
var data = {pushSettings: [
21-
{'platform': 'apns',
22-
'apns': {
23-
'pushOptions': {
24-
'gateway': 'gateway.sandbox.push.apple.com',
25-
'cert': 'credentials/apns_cert_dev.pem',
26-
'key': 'credentials/apns_key_dev.pem',
27-
},
28-
29-
'feedbackOptions': {
30-
'gateway': 'feedback.sandbox.push.apple.com',
31-
'cert': 'credentials/apns_cert_dev.pem',
32-
'key': 'credentials/apns_key_dev.pem',
33-
'batchFeedback': true,
34-
'interval': 300,
35-
},
36-
}},
37-
]};
20+
var data = {
21+
pushSettings: [{
22+
'platform': 'apns',
23+
'apns': {
24+
'pushOptions': {
25+
'gateway': 'gateway.sandbox.push.apple.com',
26+
'cert': 'credentials/apns_cert_dev.pem',
27+
'key': 'credentials/apns_key_dev.pem',
28+
},
29+
30+
'feedbackOptions': {
31+
'gateway': 'feedback.sandbox.push.apple.com',
32+
'cert': 'credentials/apns_cert_dev.pem',
33+
'key': 'credentials/apns_key_dev.pem',
34+
'batchFeedback': true,
35+
'interval': 300,
36+
},
37+
},
38+
}],
39+
};
3840

3941
Application.create(data, function(err, data) {
4042
g.log('Created: %s', data.toObject());

lib/model.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,8 @@ module.exports = function(registry) {
614614
isStatic: false,
615615
http: {verb: 'head', path: '/' + pathName + '/rel/:fk'},
616616
accepts: {arg: 'fk', type: 'any',
617-
description: format('Foreign key for %s', relationName),
618-
required: true,
617+
description: format('Foreign key for %s', relationName),
618+
required: true,
619619
http: {source: 'path'}},
620620
description: format('Check the existence of %s relation to an item by id.', relationName),
621621
accessType: 'READ',
@@ -691,7 +691,7 @@ module.exports = function(registry) {
691691
isStatic: isStatic,
692692
http: {verb: 'get', path: '/' + pathName + '/count'},
693693
accepts: {arg: 'where', type: 'object',
694-
description: 'Criteria to match model instances'},
694+
description: 'Criteria to match model instances'},
695695
description: format('Counts %s of %s.', scopeName, this.modelName),
696696
accessType: 'READ',
697697
returns: {arg: 'count', type: 'number'},

lib/persisted-model.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ module.exports = function(registry) {
750750
accepts: [
751751
{arg: 'id', type: 'any', description: 'Model id', required: true,
752752
http: {source: 'path'}},
753-
{arg: 'data', type: 'object', model: typeName, http: {source: 'body'}, description:
753+
{arg: 'data', type: 'object', model: typeName, http: {source: 'body'}, description:
754754
'Model instance data'},
755755
],
756756
returns: {arg: 'data', type: typeName, root: true},
@@ -825,7 +825,7 @@ module.exports = function(registry) {
825825
description: 'Delete a model instance by {{id}} from the data source.',
826826
accessType: 'WRITE',
827827
accepts: {arg: 'id', type: 'any', description: 'Model id', required: true,
828-
http: {source: 'path'}},
828+
http: {source: 'path'}},
829829
http: {verb: 'del', path: '/:id'},
830830
returns: {arg: 'count', type: 'object', root: true},
831831
});
@@ -865,7 +865,7 @@ module.exports = function(registry) {
865865
accepts: [
866866
{arg: 'since', type: 'number', description: 'Find deltas since this checkpoint'},
867867
{arg: 'remoteChanges', type: 'array', description: 'an array of change objects',
868-
http: {source: 'body'}},
868+
http: {source: 'body'}},
869869
],
870870
returns: {arg: 'result', type: 'object', root: true},
871871
http: {verb: 'post', path: '/diff'},

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@
6868
"cookie-parser": "^1.3.4",
6969
"dirty-chai": "^1.2.2",
7070
"es5-shim": "^4.1.0",
71-
"eslint-config-loopback": "^5.0.0",
71+
"eslint-config-loopback": "^6.0.0",
7272
"express-session": "^1.14.0",
7373
"grunt": "^1.0.1",
7474
"grunt-browserify": "^5.0.0",
7575
"grunt-cli": "^1.2.0",
7676
"grunt-contrib-uglify": "^2.0.0",
7777
"grunt-contrib-watch": "^1.0.0",
78-
"grunt-eslint": "^18.1.0",
78+
"grunt-eslint": "^19.0.0",
7979
"grunt-karma": "^2.0.0",
8080
"grunt-mocha-test": "^0.12.7",
8181
"karma": "^1.1.2",

test/model.application.test.js

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,29 +65,30 @@ describe('Application', function() {
6565
});
6666

6767
it('Create a new application with push settings', function(done) {
68-
Application.create({owner: 'rfeng',
69-
name: 'MyAppWithPush',
70-
description: 'My push mobile application',
71-
pushSettings: {
72-
apns: {
73-
production: false,
74-
certData: 'cert',
75-
keyData: 'key',
76-
pushOptions: {
77-
gateway: 'gateway.sandbox.push.apple.com',
78-
port: 2195,
79-
},
80-
feedbackOptions: {
81-
gateway: 'feedback.sandbox.push.apple.com',
82-
port: 2196,
83-
interval: 300,
84-
batchFeedback: true,
85-
},
68+
Application.create({
69+
owner: 'rfeng',
70+
name: 'MyAppWithPush',
71+
description: 'My push mobile application',
72+
pushSettings: {
73+
apns: {
74+
production: false,
75+
certData: 'cert',
76+
keyData: 'key',
77+
pushOptions: {
78+
gateway: 'gateway.sandbox.push.apple.com',
79+
port: 2195,
8680
},
87-
gcm: {
88-
serverApiKey: 'serverKey',
81+
feedbackOptions: {
82+
gateway: 'feedback.sandbox.push.apple.com',
83+
port: 2196,
84+
interval: 300,
85+
batchFeedback: true,
8986
},
90-
}},
87+
},
88+
gcm: {
89+
serverApiKey: 'serverKey',
90+
},
91+
}},
9192
function(err, result) {
9293
var app = result;
9394
assert.deepEqual(app.pushSettings.toObject(), {

test/rest.middleware.test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ describe('loopback.rest', function() {
139139
it('allows models to provide a custom HTTP path', function(done) {
140140
var CustomModel = app.registry.createModel('CustomModel',
141141
{name: String},
142-
{http: {'path': 'domain1/CustomModelPath'},
143-
});
142+
{http: {'path': 'domain1/CustomModelPath'}});
144143

145144
app.model(CustomModel, {dataSource: 'db'});
146145
app.use(loopback.rest());
@@ -151,8 +150,7 @@ describe('loopback.rest', function() {
151150
it('should report 200 for url-encoded HTTP path', function(done) {
152151
var CustomModel = app.registry.createModel('CustomModel',
153152
{name: String},
154-
{http: {path: 'domain%20one/CustomModelPath'},
155-
});
153+
{http: {path: 'domain%20one/CustomModelPath'}});
156154

157155
app.model(CustomModel, {dataSource: 'db'});
158156
app.use(loopback.rest());

0 commit comments

Comments
 (0)