Merge pull request #3002 from strongloop/eslint-es6

Upgrade eslint config and grunt-eslint to latest
This commit is contained in:
Miroslav Bajtoš 2016-12-07 10:52:52 +01:00 committed by GitHub
commit 7f2cdc106c
9 changed files with 56 additions and 52 deletions

View File

@ -1,5 +1,8 @@
{
"extends": "loopback",
"parserOptions": {
"ecmaVersion": 5
},
"rules": {
"max-len": ["error", 100, 4, {
"ignoreComments": true,

View File

@ -347,7 +347,7 @@ module.exports = function(ACL) {
var self = this;
this.find({where: {principalType: principalType, principalId: principalId,
model: model, property: propertyQuery, accessType: accessTypeQuery}},
model: model, property: propertyQuery, accessType: accessTypeQuery}},
function(err, dynACLs) {
if (err) {
if (callback) callback(err);

View File

@ -343,7 +343,7 @@ module.exports = function(Role) {
if (principalType && principalId) {
roleMappingModel.findOne({where: {roleId: roleId,
principalType: principalType, principalId: principalId}},
principalType: principalType, principalId: principalId}},
function(err, result) {
debug('Role mapping found: %j', result);
done(!err && result); // The only arg is the result

View File

@ -17,24 +17,26 @@ var Application = models.Application(dataSource);
app.model(Application);
var data = {pushSettings: [
{'platform': 'apns',
'apns': {
'pushOptions': {
'gateway': 'gateway.sandbox.push.apple.com',
'cert': 'credentials/apns_cert_dev.pem',
'key': 'credentials/apns_key_dev.pem',
},
var data = {
pushSettings: [{
'platform': 'apns',
'apns': {
'pushOptions': {
'gateway': 'gateway.sandbox.push.apple.com',
'cert': 'credentials/apns_cert_dev.pem',
'key': 'credentials/apns_key_dev.pem',
},
'feedbackOptions': {
'gateway': 'feedback.sandbox.push.apple.com',
'cert': 'credentials/apns_cert_dev.pem',
'key': 'credentials/apns_key_dev.pem',
'batchFeedback': true,
'interval': 300,
},
}},
]};
'feedbackOptions': {
'gateway': 'feedback.sandbox.push.apple.com',
'cert': 'credentials/apns_cert_dev.pem',
'key': 'credentials/apns_key_dev.pem',
'batchFeedback': true,
'interval': 300,
},
},
}],
};
Application.create(data, function(err, data) {
g.log('Created: %s', data.toObject());

View File

@ -614,8 +614,8 @@ module.exports = function(registry) {
isStatic: false,
http: {verb: 'head', path: '/' + pathName + '/rel/:fk'},
accepts: {arg: 'fk', type: 'any',
description: format('Foreign key for %s', relationName),
required: true,
description: format('Foreign key for %s', relationName),
required: true,
http: {source: 'path'}},
description: format('Check the existence of %s relation to an item by id.', relationName),
accessType: 'READ',
@ -691,7 +691,7 @@ module.exports = function(registry) {
isStatic: isStatic,
http: {verb: 'get', path: '/' + pathName + '/count'},
accepts: {arg: 'where', type: 'object',
description: 'Criteria to match model instances'},
description: 'Criteria to match model instances'},
description: format('Counts %s of %s.', scopeName, this.modelName),
accessType: 'READ',
returns: {arg: 'count', type: 'number'},

View File

@ -750,7 +750,7 @@ module.exports = function(registry) {
accepts: [
{arg: 'id', type: 'any', description: 'Model id', required: true,
http: {source: 'path'}},
{arg: 'data', type: 'object', model: typeName, http: {source: 'body'}, description:
{arg: 'data', type: 'object', model: typeName, http: {source: 'body'}, description:
'Model instance data'},
],
returns: {arg: 'data', type: typeName, root: true},
@ -825,7 +825,7 @@ module.exports = function(registry) {
description: 'Delete a model instance by {{id}} from the data source.',
accessType: 'WRITE',
accepts: {arg: 'id', type: 'any', description: 'Model id', required: true,
http: {source: 'path'}},
http: {source: 'path'}},
http: {verb: 'del', path: '/:id'},
returns: {arg: 'count', type: 'object', root: true},
});
@ -865,7 +865,7 @@ module.exports = function(registry) {
accepts: [
{arg: 'since', type: 'number', description: 'Find deltas since this checkpoint'},
{arg: 'remoteChanges', type: 'array', description: 'an array of change objects',
http: {source: 'body'}},
http: {source: 'body'}},
],
returns: {arg: 'result', type: 'object', root: true},
http: {verb: 'post', path: '/diff'},

View File

@ -68,14 +68,14 @@
"cookie-parser": "^1.3.4",
"dirty-chai": "^1.2.2",
"es5-shim": "^4.1.0",
"eslint-config-loopback": "^5.0.0",
"eslint-config-loopback": "^6.0.0",
"express-session": "^1.14.0",
"grunt": "^1.0.1",
"grunt-browserify": "^5.0.0",
"grunt-cli": "^1.2.0",
"grunt-contrib-uglify": "^2.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-eslint": "^18.1.0",
"grunt-eslint": "^19.0.0",
"grunt-karma": "^2.0.0",
"grunt-mocha-test": "^0.12.7",
"karma": "^1.1.2",

View File

@ -65,29 +65,30 @@ describe('Application', function() {
});
it('Create a new application with push settings', function(done) {
Application.create({owner: 'rfeng',
name: 'MyAppWithPush',
description: 'My push mobile application',
pushSettings: {
apns: {
production: false,
certData: 'cert',
keyData: 'key',
pushOptions: {
gateway: 'gateway.sandbox.push.apple.com',
port: 2195,
},
feedbackOptions: {
gateway: 'feedback.sandbox.push.apple.com',
port: 2196,
interval: 300,
batchFeedback: true,
},
Application.create({
owner: 'rfeng',
name: 'MyAppWithPush',
description: 'My push mobile application',
pushSettings: {
apns: {
production: false,
certData: 'cert',
keyData: 'key',
pushOptions: {
gateway: 'gateway.sandbox.push.apple.com',
port: 2195,
},
gcm: {
serverApiKey: 'serverKey',
feedbackOptions: {
gateway: 'feedback.sandbox.push.apple.com',
port: 2196,
interval: 300,
batchFeedback: true,
},
}},
},
gcm: {
serverApiKey: 'serverKey',
},
}},
function(err, result) {
var app = result;
assert.deepEqual(app.pushSettings.toObject(), {

View File

@ -139,8 +139,7 @@ describe('loopback.rest', function() {
it('allows models to provide a custom HTTP path', function(done) {
var CustomModel = app.registry.createModel('CustomModel',
{name: String},
{http: {'path': 'domain1/CustomModelPath'},
});
{http: {'path': 'domain1/CustomModelPath'}});
app.model(CustomModel, {dataSource: 'db'});
app.use(loopback.rest());
@ -151,8 +150,7 @@ describe('loopback.rest', function() {
it('should report 200 for url-encoded HTTP path', function(done) {
var CustomModel = app.registry.createModel('CustomModel',
{name: String},
{http: {path: 'domain%20one/CustomModelPath'},
});
{http: {path: 'domain%20one/CustomModelPath'}});
app.model(CustomModel, {dataSource: 'db'});
app.use(loopback.rest());