More lint tweaking (#3164)

1. Add no space in paren rule
2. fix spec/eslintrc.json so it allow for inheriting from root rc.

Because the spce rc specified reccomended, it "turned off" all of the
rule tweaks in the root.  This fixes that.
This commit is contained in:
Arthur Cinader
2016-12-02 16:11:54 -08:00
committed by Florent Vilmart
parent b9afccd338
commit a270632570
19 changed files with 51 additions and 56 deletions

View File

@@ -1,8 +1,5 @@
{
"extends": "eslint:recommended",
"env": {
"node": true,
"es6": true,
"jasmine": true
},
"globals": {
@@ -29,9 +26,6 @@
"arrayContains": true
},
"rules": {
"no-console": [0],
"indent": ["error", 2],
"no-trailing-spaces": 2,
"eol-last": 2
"no-console": [0]
}
}

View File

@@ -460,7 +460,7 @@ describe("Email Verification Token Expiration: ", () => {
user.set('email', 'user@parse.com');
return new Promise((resolve) => {
// wait for half a sec to get a new expiration time
setTimeout( () => resolve(user.save()), 500 );
setTimeout(() => resolve(user.save()), 500);
});
})
.then(() => {

View File

@@ -816,7 +816,7 @@ describe('miscellaneous', function() {
it('should return the updated fields on PUT', done => {
let obj = new Parse.Object('GameScore');
obj.save({a:'hello', c: 1, d: ['1'], e:['1'], f:['1','2']}).then(( ) => {
obj.save({a:'hello', c: 1, d: ['1'], e:['1'], f:['1','2']}).then(() => {
var headers = {
'Content-Type': 'application/json',
'X-Parse-Application-Id': 'test',

View File

@@ -26,7 +26,7 @@ describe('Hooks', () => {
});
it("should have no triggers registered", (done) => {
Parse.Hooks.getTriggers().then( (res) => {
Parse.Hooks.getTriggers().then((res) => {
expect(res.constructor).toBe(Array.prototype.constructor);
done();
}, (err) => {
@@ -143,11 +143,11 @@ describe('Hooks', () => {
});
it("should fail trying to create two times the same function", (done) => {
Parse.Hooks.createFunction("my_new_function", "http://url.com").then( () => {
Parse.Hooks.createFunction("my_new_function", "http://url.com").then(() => {
return Parse.Hooks.createFunction("my_new_function", "http://url.com")
}, () => {
fail("should create a new function");
}).then( () => {
}).then(() => {
fail("should not be able to create the same function");
}, (err) => {
expect(err).not.toBe(undefined);
@@ -166,11 +166,11 @@ describe('Hooks', () => {
});
it("should fail trying to create two times the same trigger", (done) => {
Parse.Hooks.createTrigger("MyClass", "beforeSave", "http://url.com").then( () => {
Parse.Hooks.createTrigger("MyClass", "beforeSave", "http://url.com").then(() => {
return Parse.Hooks.createTrigger("MyClass", "beforeSave", "http://url.com")
}, () => {
fail("should create a new trigger");
}).then( () => {
}).then(() => {
fail("should not be able to create the same trigger");
}, (err) => {
expect(err).not.toBe(undefined);
@@ -189,7 +189,7 @@ describe('Hooks', () => {
});
it("should fail trying to update a function that don't exist", (done) => {
Parse.Hooks.updateFunction("A_COOL_FUNCTION", "http://url.com").then( () => {
Parse.Hooks.updateFunction("A_COOL_FUNCTION", "http://url.com").then(() => {
fail("Should not succeed")
}, (err) => {
expect(err).not.toBe(undefined);
@@ -214,7 +214,7 @@ describe('Hooks', () => {
});
it("should fail trying to update a trigger that don't exist", (done) => {
Parse.Hooks.updateTrigger("AClassName","beforeSave", "http://url.com").then( () => {
Parse.Hooks.updateTrigger("AClassName","beforeSave", "http://url.com").then(() => {
fail("Should not succeed")
}, (err) => {
expect(err).not.toBe(undefined);
@@ -240,7 +240,7 @@ describe('Hooks', () => {
it("should fail trying to create a malformed function", (done) => {
Parse.Hooks.createFunction("MyFunction").then( (res) => {
Parse.Hooks.createFunction("MyFunction").then((res) => {
fail(res);
}, (err) => {
expect(err).not.toBe(undefined);

View File

@@ -1842,10 +1842,10 @@ describe('Parse.Object testing', () => {
"_nested": "key"
}
});
object.save().then( res => {
object.save().then(res => {
ok(res);
return res.fetch();
}).then( res => {
}).then(res => {
const foo = res.get("foo");
expect(foo["_bar"]).toEqual("_");
expect(foo["baz_bar"]).toEqual(1);
@@ -1853,7 +1853,7 @@ describe('Parse.Object testing', () => {
expect(foo["_0"]).toEqual("underscore_zero");
expect(foo["_more"]["_nested"]).toEqual("key");
done();
}).fail( err => {
}).fail(err => {
jfail(err);
fail("should not fail");
done();

View File

@@ -816,7 +816,7 @@ describe('Parse.Query testing', () => {
var makeBoxedNumber = function(i) {
return new BoxedNumber({ number: i });
};
Parse.Object.saveAll([3, 1, 2].map(makeBoxedNumber)).then( function() {
Parse.Object.saveAll([3, 1, 2].map(makeBoxedNumber)).then(function() {
var query = new Parse.Query(BoxedNumber);
query.descending("number");
query.find(expectSuccess({
@@ -2435,7 +2435,7 @@ describe('Parse.Query testing', () => {
var user = new Parse.User();
user.set("username", "foo");
user.set("password", "bar");
return user.save().then( (user) => {
return user.save().then((user) => {
var objIdQuery = new Parse.Query("_User").equalTo("objectId", user.id);
var blockedUserQuery = user.relation("blockedUsers").query();

View File

@@ -98,10 +98,10 @@ describe('Parse Role testing', () => {
var user,
auth,
getAllRolesSpy;
createTestUser().then( (newUser) => {
createTestUser().then((newUser) => {
user = newUser;
return createAllRoles(user);
}).then ( (roles) => {
}).then ((roles) => {
var rootRoleObj = roleObjs[rootRole];
roles.forEach(function(role, i) {
// Add all roles to the RootRole
@@ -115,12 +115,12 @@ describe('Parse Role testing', () => {
});
return Parse.Object.saveAll(roles, { useMasterKey: true });
}).then( () => {
}).then(() => {
auth = new Auth({config: new Config("test"), isMaster: true, user: user});
getAllRolesSpy = spyOn(auth, "_getAllRolesNamesForRoleIds").and.callThrough();
return auth._loadRoles();
}).then ( (roles) => {
}).then ((roles) => {
expect(roles.length).toEqual(4);
allRoles.forEach(function(name) {
@@ -135,7 +135,7 @@ describe('Parse Role testing', () => {
// 1 call for the 2nd layer
expect(getAllRolesSpy.calls.count()).toEqual(2);
done()
}).catch( () => {
}).catch(() => {
fail("should succeed");
done();
});
@@ -145,26 +145,26 @@ describe('Parse Role testing', () => {
it("should recursively load roles", (done) => {
var rolesNames = ["FooRole", "BarRole", "BazRole"];
var roleIds = {};
createTestUser().then( (user) => {
createTestUser().then((user) => {
// Put the user on the 1st role
return createRole(rolesNames[0], null, user).then( (aRole) => {
return createRole(rolesNames[0], null, user).then((aRole) => {
roleIds[aRole.get("name")] = aRole.id;
// set the 1st role as a sibling of the second
// user will should have 2 role now
return createRole(rolesNames[1], aRole, null);
}).then( (anotherRole) => {
}).then((anotherRole) => {
roleIds[anotherRole.get("name")] = anotherRole.id;
// set this role as a sibling of the last
// the user should now have 3 roles
return createRole(rolesNames[2], anotherRole, null);
}).then( (lastRole) => {
}).then((lastRole) => {
roleIds[lastRole.get("name")] = lastRole.id;
var auth = new Auth({ config: new Config("test"), isMaster: true, user: user });
return auth._loadRoles();
})
}).then( (roles) => {
}).then((roles) => {
expect(roles.length).toEqual(3);
rolesNames.forEach( (name) => {
rolesNames.forEach((name) => {
expect(roles.indexOf('role:'+name)).not.toBe(-1);
});
done();

View File

@@ -20,7 +20,7 @@ function createProduct() {
}
describe("test validate_receipt endpoint", () => {
beforeEach( done => {
beforeEach(done => {
createProduct().then(done).fail(function(){
done();
});

View File

@@ -1283,13 +1283,13 @@ describe('schemas', () => {
})
}).then(() => {
return Parse.User.logIn('admin', 'admin');
}).then( () => {
}).then(() => {
let query = new Parse.Query('AClass');
return query.find();
}).then((results) => {
expect(results.length).toBe(1);
done();
}).catch( (err) => {
}).catch((err) => {
jfail(err);
done();
})
@@ -1346,13 +1346,13 @@ describe('schemas', () => {
});
}).then(() => {
return Parse.User.logIn('admin', 'admin');
}).then( () => {
}).then(() => {
let query = new Parse.Query('AClass');
return query.find();
}).then((results) => {
expect(results.length).toBe(1);
done();
}).catch( (err) => {
}).catch((err) => {
jfail(err);
done();
})
@@ -1404,7 +1404,7 @@ describe('schemas', () => {
});
}).then(() => {
return Parse.User.logIn('admin', 'admin');
}).then( () => {
}).then(() => {
let query = new Parse.Query('AClass');
return query.find();
}).then((results) => {
@@ -1470,13 +1470,13 @@ describe('schemas', () => {
});
}).then(() => {
return Parse.User.logIn('admin', 'admin');
}).then( () => {
}).then(() => {
let query = new Parse.Query('AClass');
return query.find();
}).then((results) => {
expect(results.length).toBe(1);
done();
}).catch( (err) => {
}).catch((err) => {
jfail(err);
done();
})
@@ -1523,7 +1523,7 @@ describe('schemas', () => {
})
}).then(() => {
return Parse.User.logIn('admin', 'admin');
}).then( () => {
}).then(() => {
let query = new Parse.Query('AClass');
return query.find();
}).then(() => {
@@ -1534,7 +1534,7 @@ describe('schemas', () => {
return Promise.resolve();
}).then(() => {
return Parse.User.logIn('user2', 'user2');
}).then( () => {
}).then(() => {
let query = new Parse.Query('AClass');
return query.find();
}).then(() => {