Merge pull request #3002 from strongloop/eslint-es6
Upgrade eslint config and grunt-eslint to latest
This commit is contained in:
commit
7f2cdc106c
|
@ -1,5 +1,8 @@
|
||||||
{
|
{
|
||||||
"extends": "loopback",
|
"extends": "loopback",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 5
|
||||||
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"max-len": ["error", 100, 4, {
|
"max-len": ["error", 100, 4, {
|
||||||
"ignoreComments": true,
|
"ignoreComments": true,
|
||||||
|
|
|
@ -347,7 +347,7 @@ module.exports = function(ACL) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this.find({where: {principalType: principalType, principalId: principalId,
|
this.find({where: {principalType: principalType, principalId: principalId,
|
||||||
model: model, property: propertyQuery, accessType: accessTypeQuery}},
|
model: model, property: propertyQuery, accessType: accessTypeQuery}},
|
||||||
function(err, dynACLs) {
|
function(err, dynACLs) {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (callback) callback(err);
|
if (callback) callback(err);
|
||||||
|
|
|
@ -343,7 +343,7 @@ module.exports = function(Role) {
|
||||||
|
|
||||||
if (principalType && principalId) {
|
if (principalType && principalId) {
|
||||||
roleMappingModel.findOne({where: {roleId: roleId,
|
roleMappingModel.findOne({where: {roleId: roleId,
|
||||||
principalType: principalType, principalId: principalId}},
|
principalType: principalType, principalId: principalId}},
|
||||||
function(err, result) {
|
function(err, result) {
|
||||||
debug('Role mapping found: %j', result);
|
debug('Role mapping found: %j', result);
|
||||||
done(!err && result); // The only arg is the result
|
done(!err && result); // The only arg is the result
|
||||||
|
|
|
@ -17,24 +17,26 @@ var Application = models.Application(dataSource);
|
||||||
|
|
||||||
app.model(Application);
|
app.model(Application);
|
||||||
|
|
||||||
var data = {pushSettings: [
|
var data = {
|
||||||
{'platform': 'apns',
|
pushSettings: [{
|
||||||
'apns': {
|
'platform': 'apns',
|
||||||
'pushOptions': {
|
'apns': {
|
||||||
'gateway': 'gateway.sandbox.push.apple.com',
|
'pushOptions': {
|
||||||
'cert': 'credentials/apns_cert_dev.pem',
|
'gateway': 'gateway.sandbox.push.apple.com',
|
||||||
'key': 'credentials/apns_key_dev.pem',
|
'cert': 'credentials/apns_cert_dev.pem',
|
||||||
},
|
'key': 'credentials/apns_key_dev.pem',
|
||||||
|
},
|
||||||
|
|
||||||
'feedbackOptions': {
|
'feedbackOptions': {
|
||||||
'gateway': 'feedback.sandbox.push.apple.com',
|
'gateway': 'feedback.sandbox.push.apple.com',
|
||||||
'cert': 'credentials/apns_cert_dev.pem',
|
'cert': 'credentials/apns_cert_dev.pem',
|
||||||
'key': 'credentials/apns_key_dev.pem',
|
'key': 'credentials/apns_key_dev.pem',
|
||||||
'batchFeedback': true,
|
'batchFeedback': true,
|
||||||
'interval': 300,
|
'interval': 300,
|
||||||
},
|
},
|
||||||
}},
|
},
|
||||||
]};
|
}],
|
||||||
|
};
|
||||||
|
|
||||||
Application.create(data, function(err, data) {
|
Application.create(data, function(err, data) {
|
||||||
g.log('Created: %s', data.toObject());
|
g.log('Created: %s', data.toObject());
|
||||||
|
|
|
@ -614,8 +614,8 @@ module.exports = function(registry) {
|
||||||
isStatic: false,
|
isStatic: false,
|
||||||
http: {verb: 'head', path: '/' + pathName + '/rel/:fk'},
|
http: {verb: 'head', path: '/' + pathName + '/rel/:fk'},
|
||||||
accepts: {arg: 'fk', type: 'any',
|
accepts: {arg: 'fk', type: 'any',
|
||||||
description: format('Foreign key for %s', relationName),
|
description: format('Foreign key for %s', relationName),
|
||||||
required: true,
|
required: true,
|
||||||
http: {source: 'path'}},
|
http: {source: 'path'}},
|
||||||
description: format('Check the existence of %s relation to an item by id.', relationName),
|
description: format('Check the existence of %s relation to an item by id.', relationName),
|
||||||
accessType: 'READ',
|
accessType: 'READ',
|
||||||
|
@ -691,7 +691,7 @@ module.exports = function(registry) {
|
||||||
isStatic: isStatic,
|
isStatic: isStatic,
|
||||||
http: {verb: 'get', path: '/' + pathName + '/count'},
|
http: {verb: 'get', path: '/' + pathName + '/count'},
|
||||||
accepts: {arg: 'where', type: 'object',
|
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),
|
description: format('Counts %s of %s.', scopeName, this.modelName),
|
||||||
accessType: 'READ',
|
accessType: 'READ',
|
||||||
returns: {arg: 'count', type: 'number'},
|
returns: {arg: 'count', type: 'number'},
|
||||||
|
|
|
@ -750,7 +750,7 @@ module.exports = function(registry) {
|
||||||
accepts: [
|
accepts: [
|
||||||
{arg: 'id', type: 'any', description: 'Model id', required: true,
|
{arg: 'id', type: 'any', description: 'Model id', required: true,
|
||||||
http: {source: 'path'}},
|
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'},
|
'Model instance data'},
|
||||||
],
|
],
|
||||||
returns: {arg: 'data', type: typeName, root: true},
|
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.',
|
description: 'Delete a model instance by {{id}} from the data source.',
|
||||||
accessType: 'WRITE',
|
accessType: 'WRITE',
|
||||||
accepts: {arg: 'id', type: 'any', description: 'Model id', required: true,
|
accepts: {arg: 'id', type: 'any', description: 'Model id', required: true,
|
||||||
http: {source: 'path'}},
|
http: {source: 'path'}},
|
||||||
http: {verb: 'del', path: '/:id'},
|
http: {verb: 'del', path: '/:id'},
|
||||||
returns: {arg: 'count', type: 'object', root: true},
|
returns: {arg: 'count', type: 'object', root: true},
|
||||||
});
|
});
|
||||||
|
@ -865,7 +865,7 @@ module.exports = function(registry) {
|
||||||
accepts: [
|
accepts: [
|
||||||
{arg: 'since', type: 'number', description: 'Find deltas since this checkpoint'},
|
{arg: 'since', type: 'number', description: 'Find deltas since this checkpoint'},
|
||||||
{arg: 'remoteChanges', type: 'array', description: 'an array of change objects',
|
{arg: 'remoteChanges', type: 'array', description: 'an array of change objects',
|
||||||
http: {source: 'body'}},
|
http: {source: 'body'}},
|
||||||
],
|
],
|
||||||
returns: {arg: 'result', type: 'object', root: true},
|
returns: {arg: 'result', type: 'object', root: true},
|
||||||
http: {verb: 'post', path: '/diff'},
|
http: {verb: 'post', path: '/diff'},
|
||||||
|
|
|
@ -68,14 +68,14 @@
|
||||||
"cookie-parser": "^1.3.4",
|
"cookie-parser": "^1.3.4",
|
||||||
"dirty-chai": "^1.2.2",
|
"dirty-chai": "^1.2.2",
|
||||||
"es5-shim": "^4.1.0",
|
"es5-shim": "^4.1.0",
|
||||||
"eslint-config-loopback": "^5.0.0",
|
"eslint-config-loopback": "^6.0.0",
|
||||||
"express-session": "^1.14.0",
|
"express-session": "^1.14.0",
|
||||||
"grunt": "^1.0.1",
|
"grunt": "^1.0.1",
|
||||||
"grunt-browserify": "^5.0.0",
|
"grunt-browserify": "^5.0.0",
|
||||||
"grunt-cli": "^1.2.0",
|
"grunt-cli": "^1.2.0",
|
||||||
"grunt-contrib-uglify": "^2.0.0",
|
"grunt-contrib-uglify": "^2.0.0",
|
||||||
"grunt-contrib-watch": "^1.0.0",
|
"grunt-contrib-watch": "^1.0.0",
|
||||||
"grunt-eslint": "^18.1.0",
|
"grunt-eslint": "^19.0.0",
|
||||||
"grunt-karma": "^2.0.0",
|
"grunt-karma": "^2.0.0",
|
||||||
"grunt-mocha-test": "^0.12.7",
|
"grunt-mocha-test": "^0.12.7",
|
||||||
"karma": "^1.1.2",
|
"karma": "^1.1.2",
|
||||||
|
|
|
@ -65,29 +65,30 @@ describe('Application', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Create a new application with push settings', function(done) {
|
it('Create a new application with push settings', function(done) {
|
||||||
Application.create({owner: 'rfeng',
|
Application.create({
|
||||||
name: 'MyAppWithPush',
|
owner: 'rfeng',
|
||||||
description: 'My push mobile application',
|
name: 'MyAppWithPush',
|
||||||
pushSettings: {
|
description: 'My push mobile application',
|
||||||
apns: {
|
pushSettings: {
|
||||||
production: false,
|
apns: {
|
||||||
certData: 'cert',
|
production: false,
|
||||||
keyData: 'key',
|
certData: 'cert',
|
||||||
pushOptions: {
|
keyData: 'key',
|
||||||
gateway: 'gateway.sandbox.push.apple.com',
|
pushOptions: {
|
||||||
port: 2195,
|
gateway: 'gateway.sandbox.push.apple.com',
|
||||||
},
|
port: 2195,
|
||||||
feedbackOptions: {
|
|
||||||
gateway: 'feedback.sandbox.push.apple.com',
|
|
||||||
port: 2196,
|
|
||||||
interval: 300,
|
|
||||||
batchFeedback: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
gcm: {
|
feedbackOptions: {
|
||||||
serverApiKey: 'serverKey',
|
gateway: 'feedback.sandbox.push.apple.com',
|
||||||
|
port: 2196,
|
||||||
|
interval: 300,
|
||||||
|
batchFeedback: true,
|
||||||
},
|
},
|
||||||
}},
|
},
|
||||||
|
gcm: {
|
||||||
|
serverApiKey: 'serverKey',
|
||||||
|
},
|
||||||
|
}},
|
||||||
function(err, result) {
|
function(err, result) {
|
||||||
var app = result;
|
var app = result;
|
||||||
assert.deepEqual(app.pushSettings.toObject(), {
|
assert.deepEqual(app.pushSettings.toObject(), {
|
||||||
|
|
|
@ -139,8 +139,7 @@ describe('loopback.rest', function() {
|
||||||
it('allows models to provide a custom HTTP path', function(done) {
|
it('allows models to provide a custom HTTP path', function(done) {
|
||||||
var CustomModel = app.registry.createModel('CustomModel',
|
var CustomModel = app.registry.createModel('CustomModel',
|
||||||
{name: String},
|
{name: String},
|
||||||
{http: {'path': 'domain1/CustomModelPath'},
|
{http: {'path': 'domain1/CustomModelPath'}});
|
||||||
});
|
|
||||||
|
|
||||||
app.model(CustomModel, {dataSource: 'db'});
|
app.model(CustomModel, {dataSource: 'db'});
|
||||||
app.use(loopback.rest());
|
app.use(loopback.rest());
|
||||||
|
@ -151,8 +150,7 @@ describe('loopback.rest', function() {
|
||||||
it('should report 200 for url-encoded HTTP path', function(done) {
|
it('should report 200 for url-encoded HTTP path', function(done) {
|
||||||
var CustomModel = app.registry.createModel('CustomModel',
|
var CustomModel = app.registry.createModel('CustomModel',
|
||||||
{name: String},
|
{name: String},
|
||||||
{http: {path: 'domain%20one/CustomModelPath'},
|
{http: {path: 'domain%20one/CustomModelPath'}});
|
||||||
});
|
|
||||||
|
|
||||||
app.model(CustomModel, {dataSource: 'db'});
|
app.model(CustomModel, {dataSource: 'db'});
|
||||||
app.use(loopback.rest());
|
app.use(loopback.rest());
|
||||||
|
|
Loading…
Reference in New Issue