Skip to content

Commit a270632

Browse files
Arthur Cinaderflovilmart
authored andcommitted
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.
1 parent b9afccd commit a270632

19 files changed

+51
-56
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"indent": ["error", 2],
1818
"linebreak-style": ["error", "unix"],
1919
"no-trailing-spaces": 2,
20-
"eol-last": 2
20+
"eol-last": 2,
21+
"space-in-parens": ["error", "never"]
2122
}
2223
}

spec/.eslintrc.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
2-
"extends": "eslint:recommended",
32
"env": {
4-
"node": true,
5-
"es6": true,
63
"jasmine": true
74
},
85
"globals": {
@@ -29,9 +26,6 @@
2926
"arrayContains": true
3027
},
3128
"rules": {
32-
"no-console": [0],
33-
"indent": ["error", 2],
34-
"no-trailing-spaces": 2,
35-
"eol-last": 2
29+
"no-console": [0]
3630
}
3731
}

spec/EmailVerificationToken.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ describe("Email Verification Token Expiration: ", () => {
460460
user.set('email', '[email protected]');
461461
return new Promise((resolve) => {
462462
// wait for half a sec to get a new expiration time
463-
setTimeout( () => resolve(user.save()), 500 );
463+
setTimeout(() => resolve(user.save()), 500);
464464
});
465465
})
466466
.then(() => {

spec/ParseAPI.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ describe('miscellaneous', function() {
816816

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

spec/ParseHooks.spec.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('Hooks', () => {
2626
});
2727

2828
it("should have no triggers registered", (done) => {
29-
Parse.Hooks.getTriggers().then( (res) => {
29+
Parse.Hooks.getTriggers().then((res) => {
3030
expect(res.constructor).toBe(Array.prototype.constructor);
3131
done();
3232
}, (err) => {
@@ -143,11 +143,11 @@ describe('Hooks', () => {
143143
});
144144

145145
it("should fail trying to create two times the same function", (done) => {
146-
Parse.Hooks.createFunction("my_new_function", "http://url.com").then( () => {
146+
Parse.Hooks.createFunction("my_new_function", "http://url.com").then(() => {
147147
return Parse.Hooks.createFunction("my_new_function", "http://url.com")
148148
}, () => {
149149
fail("should create a new function");
150-
}).then( () => {
150+
}).then(() => {
151151
fail("should not be able to create the same function");
152152
}, (err) => {
153153
expect(err).not.toBe(undefined);
@@ -166,11 +166,11 @@ describe('Hooks', () => {
166166
});
167167

168168
it("should fail trying to create two times the same trigger", (done) => {
169-
Parse.Hooks.createTrigger("MyClass", "beforeSave", "http://url.com").then( () => {
169+
Parse.Hooks.createTrigger("MyClass", "beforeSave", "http://url.com").then(() => {
170170
return Parse.Hooks.createTrigger("MyClass", "beforeSave", "http://url.com")
171171
}, () => {
172172
fail("should create a new trigger");
173-
}).then( () => {
173+
}).then(() => {
174174
fail("should not be able to create the same trigger");
175175
}, (err) => {
176176
expect(err).not.toBe(undefined);
@@ -189,7 +189,7 @@ describe('Hooks', () => {
189189
});
190190

191191
it("should fail trying to update a function that don't exist", (done) => {
192-
Parse.Hooks.updateFunction("A_COOL_FUNCTION", "http://url.com").then( () => {
192+
Parse.Hooks.updateFunction("A_COOL_FUNCTION", "http://url.com").then(() => {
193193
fail("Should not succeed")
194194
}, (err) => {
195195
expect(err).not.toBe(undefined);
@@ -214,7 +214,7 @@ describe('Hooks', () => {
214214
});
215215

216216
it("should fail trying to update a trigger that don't exist", (done) => {
217-
Parse.Hooks.updateTrigger("AClassName","beforeSave", "http://url.com").then( () => {
217+
Parse.Hooks.updateTrigger("AClassName","beforeSave", "http://url.com").then(() => {
218218
fail("Should not succeed")
219219
}, (err) => {
220220
expect(err).not.toBe(undefined);
@@ -240,7 +240,7 @@ describe('Hooks', () => {
240240

241241

242242
it("should fail trying to create a malformed function", (done) => {
243-
Parse.Hooks.createFunction("MyFunction").then( (res) => {
243+
Parse.Hooks.createFunction("MyFunction").then((res) => {
244244
fail(res);
245245
}, (err) => {
246246
expect(err).not.toBe(undefined);

spec/ParseObject.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,18 +1842,18 @@ describe('Parse.Object testing', () => {
18421842
"_nested": "key"
18431843
}
18441844
});
1845-
object.save().then( res => {
1845+
object.save().then(res => {
18461846
ok(res);
18471847
return res.fetch();
1848-
}).then( res => {
1848+
}).then(res => {
18491849
const foo = res.get("foo");
18501850
expect(foo["_bar"]).toEqual("_");
18511851
expect(foo["baz_bar"]).toEqual(1);
18521852
expect(foo["__foo_bar"]).toBe(true);
18531853
expect(foo["_0"]).toEqual("underscore_zero");
18541854
expect(foo["_more"]["_nested"]).toEqual("key");
18551855
done();
1856-
}).fail( err => {
1856+
}).fail(err => {
18571857
jfail(err);
18581858
fail("should not fail");
18591859
done();

spec/ParseQuery.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ describe('Parse.Query testing', () => {
816816
var makeBoxedNumber = function(i) {
817817
return new BoxedNumber({ number: i });
818818
};
819-
Parse.Object.saveAll([3, 1, 2].map(makeBoxedNumber)).then( function() {
819+
Parse.Object.saveAll([3, 1, 2].map(makeBoxedNumber)).then(function() {
820820
var query = new Parse.Query(BoxedNumber);
821821
query.descending("number");
822822
query.find(expectSuccess({
@@ -2435,7 +2435,7 @@ describe('Parse.Query testing', () => {
24352435
var user = new Parse.User();
24362436
user.set("username", "foo");
24372437
user.set("password", "bar");
2438-
return user.save().then( (user) => {
2438+
return user.save().then((user) => {
24392439
var objIdQuery = new Parse.Query("_User").equalTo("objectId", user.id);
24402440
var blockedUserQuery = user.relation("blockedUsers").query();
24412441

spec/ParseRole.spec.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ describe('Parse Role testing', () => {
9898
var user,
9999
auth,
100100
getAllRolesSpy;
101-
createTestUser().then( (newUser) => {
101+
createTestUser().then((newUser) => {
102102
user = newUser;
103103
return createAllRoles(user);
104-
}).then ( (roles) => {
104+
}).then ((roles) => {
105105
var rootRoleObj = roleObjs[rootRole];
106106
roles.forEach(function(role, i) {
107107
// Add all roles to the RootRole
@@ -115,12 +115,12 @@ describe('Parse Role testing', () => {
115115
});
116116

117117
return Parse.Object.saveAll(roles, { useMasterKey: true });
118-
}).then( () => {
118+
}).then(() => {
119119
auth = new Auth({config: new Config("test"), isMaster: true, user: user});
120120
getAllRolesSpy = spyOn(auth, "_getAllRolesNamesForRoleIds").and.callThrough();
121121

122122
return auth._loadRoles();
123-
}).then ( (roles) => {
123+
}).then ((roles) => {
124124
expect(roles.length).toEqual(4);
125125

126126
allRoles.forEach(function(name) {
@@ -135,7 +135,7 @@ describe('Parse Role testing', () => {
135135
// 1 call for the 2nd layer
136136
expect(getAllRolesSpy.calls.count()).toEqual(2);
137137
done()
138-
}).catch( () => {
138+
}).catch(() => {
139139
fail("should succeed");
140140
done();
141141
});
@@ -145,26 +145,26 @@ describe('Parse Role testing', () => {
145145
it("should recursively load roles", (done) => {
146146
var rolesNames = ["FooRole", "BarRole", "BazRole"];
147147
var roleIds = {};
148-
createTestUser().then( (user) => {
148+
createTestUser().then((user) => {
149149
// Put the user on the 1st role
150-
return createRole(rolesNames[0], null, user).then( (aRole) => {
150+
return createRole(rolesNames[0], null, user).then((aRole) => {
151151
roleIds[aRole.get("name")] = aRole.id;
152152
// set the 1st role as a sibling of the second
153153
// user will should have 2 role now
154154
return createRole(rolesNames[1], aRole, null);
155-
}).then( (anotherRole) => {
155+
}).then((anotherRole) => {
156156
roleIds[anotherRole.get("name")] = anotherRole.id;
157157
// set this role as a sibling of the last
158158
// the user should now have 3 roles
159159
return createRole(rolesNames[2], anotherRole, null);
160-
}).then( (lastRole) => {
160+
}).then((lastRole) => {
161161
roleIds[lastRole.get("name")] = lastRole.id;
162162
var auth = new Auth({ config: new Config("test"), isMaster: true, user: user });
163163
return auth._loadRoles();
164164
})
165-
}).then( (roles) => {
165+
}).then((roles) => {
166166
expect(roles.length).toEqual(3);
167-
rolesNames.forEach( (name) => {
167+
rolesNames.forEach((name) => {
168168
expect(roles.indexOf('role:'+name)).not.toBe(-1);
169169
});
170170
done();

spec/PurchaseValidation.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function createProduct() {
2020
}
2121

2222
describe("test validate_receipt endpoint", () => {
23-
beforeEach( done => {
23+
beforeEach(done => {
2424
createProduct().then(done).fail(function(){
2525
done();
2626
});

spec/schemas.spec.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,13 +1283,13 @@ describe('schemas', () => {
12831283
})
12841284
}).then(() => {
12851285
return Parse.User.logIn('admin', 'admin');
1286-
}).then( () => {
1286+
}).then(() => {
12871287
let query = new Parse.Query('AClass');
12881288
return query.find();
12891289
}).then((results) => {
12901290
expect(results.length).toBe(1);
12911291
done();
1292-
}).catch( (err) => {
1292+
}).catch((err) => {
12931293
jfail(err);
12941294
done();
12951295
})
@@ -1346,13 +1346,13 @@ describe('schemas', () => {
13461346
});
13471347
}).then(() => {
13481348
return Parse.User.logIn('admin', 'admin');
1349-
}).then( () => {
1349+
}).then(() => {
13501350
let query = new Parse.Query('AClass');
13511351
return query.find();
13521352
}).then((results) => {
13531353
expect(results.length).toBe(1);
13541354
done();
1355-
}).catch( (err) => {
1355+
}).catch((err) => {
13561356
jfail(err);
13571357
done();
13581358
})
@@ -1404,7 +1404,7 @@ describe('schemas', () => {
14041404
});
14051405
}).then(() => {
14061406
return Parse.User.logIn('admin', 'admin');
1407-
}).then( () => {
1407+
}).then(() => {
14081408
let query = new Parse.Query('AClass');
14091409
return query.find();
14101410
}).then((results) => {
@@ -1470,13 +1470,13 @@ describe('schemas', () => {
14701470
});
14711471
}).then(() => {
14721472
return Parse.User.logIn('admin', 'admin');
1473-
}).then( () => {
1473+
}).then(() => {
14741474
let query = new Parse.Query('AClass');
14751475
return query.find();
14761476
}).then((results) => {
14771477
expect(results.length).toBe(1);
14781478
done();
1479-
}).catch( (err) => {
1479+
}).catch((err) => {
14801480
jfail(err);
14811481
done();
14821482
})
@@ -1523,7 +1523,7 @@ describe('schemas', () => {
15231523
})
15241524
}).then(() => {
15251525
return Parse.User.logIn('admin', 'admin');
1526-
}).then( () => {
1526+
}).then(() => {
15271527
let query = new Parse.Query('AClass');
15281528
return query.find();
15291529
}).then(() => {
@@ -1534,7 +1534,7 @@ describe('schemas', () => {
15341534
return Promise.resolve();
15351535
}).then(() => {
15361536
return Parse.User.logIn('user2', 'user2');
1537-
}).then( () => {
1537+
}).then(() => {
15381538
let query = new Parse.Query('AClass');
15391539
return query.find();
15401540
}).then(() => {

0 commit comments

Comments
 (0)