Skip to content

Commit a270632

Browse files
Arthur Cinaderflovilmart
Arthur Cinader
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

+2-1
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

+1-7
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

+1-1
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

+1-1
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

+8-8
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

+3-3
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

+2-2
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

+11-11
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

+1-1
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

+9-9
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(() => {

src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ const buildWhereClause = ({ schema, query, index }) => {
258258
let allowNull = false;
259259
values.push(fieldName);
260260
fieldValue.$in.forEach((listElem, listIndex) => {
261-
if (listElem === null ) {
261+
if (listElem === null) {
262262
allowNull = true;
263263
} else {
264264
values.push(listElem);

src/Config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export class Config {
131131
throw 'passwordPolicy.validatorPattern must be a RegExp.';
132132
}
133133

134-
if(passwordPolicy.validatorCallback && typeof passwordPolicy.validatorCallback !== 'function' ) {
134+
if(passwordPolicy.validatorCallback && typeof passwordPolicy.validatorCallback !== 'function') {
135135
throw 'passwordPolicy.validatorCallback must be a function.';
136136
}
137137

src/Controllers/AdaptableController.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export class AdaptableController {
4949
}
5050

5151
// Makes sure the prototype matches
52-
let mismatches = Object.getOwnPropertyNames(Type.prototype).reduce( (obj, key) => {
52+
let mismatches = Object.getOwnPropertyNames(Type.prototype).reduce((obj, key) => {
5353
const adapterType = typeof adapter[key];
5454
const expectedType = typeof Type.prototype[key];
5555
if (adapterType !== expectedType) {

src/ParseServer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ class ParseServer {
305305
//This causes tests to spew some useless warnings, so disable in test
306306
if (!process.env.TESTING) {
307307
process.on('uncaughtException', (err) => {
308-
if ( err.code === "EADDRINUSE" ) { // user-friendly message for this common error
308+
if (err.code === "EADDRINUSE") { // user-friendly message for this common error
309309
/* eslint-disable no-console */
310310
console.error(`Unable to listen on port ${err.port}. The port is already in use.`);
311311
/* eslint-enable no-console */

src/Routers/HooksRouter.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as middleware from "../middlewares";
44

55
export class HooksRouter extends PromiseRouter {
66
createHook(aHook, config) {
7-
return config.hooksController.createHook(aHook).then( (hook) => ({response: hook}));
7+
return config.hooksController.createHook(aHook).then((hook) => ({response: hook}));
88
}
99

1010
updateHook(aHook, config) {
@@ -18,7 +18,7 @@ export class HooksRouter extends PromiseRouter {
1818
handleGetFunctions(req) {
1919
var hooksController = req.config.hooksController;
2020
if (req.params.functionName) {
21-
return hooksController.getFunction(req.params.functionName).then( (foundFunction) => {
21+
return hooksController.getFunction(req.params.functionName).then((foundFunction) => {
2222
if (!foundFunction) {
2323
throw new Parse.Error(143, `no function named: ${req.params.functionName} is defined`);
2424
}

src/Routers/IAPValidationRouter.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ export class IAPValidationRouter extends PromiseRouter {
8888
return Promise.resolve({response: appStoreError(error.status) });
8989
}
9090

91-
return validateWithAppStore(IAP_PRODUCTION_URL, receipt).then( () => {
91+
return validateWithAppStore(IAP_PRODUCTION_URL, receipt).then(() => {
9292

9393
return successCallback();
9494

9595
}, (error) => {
9696
if (error.status == 21007) {
97-
return validateWithAppStore(IAP_SANDBOX_URL, receipt).then( () => {
97+
return validateWithAppStore(IAP_SANDBOX_URL, receipt).then(() => {
9898
return successCallback();
9999
}, (error) => {
100100
return errorCallback(error);

src/Routers/PublicAPIRouter.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class PublicAPIRouter extends PromiseRouter {
2424
}
2525

2626
let userController = config.userController;
27-
return userController.verifyEmail(username, token).then( () => {
27+
return userController.verifyEmail(username, token).then(() => {
2828
let params = qs.stringify({username});
2929
return Promise.resolve({
3030
status: 302,
@@ -71,7 +71,7 @@ export class PublicAPIRouter extends PromiseRouter {
7171
return this.invalidLink(req);
7272
}
7373

74-
return config.userController.checkResetTokenValidity(username, token).then( () => {
74+
return config.userController.checkResetTokenValidity(username, token).then(() => {
7575
let params = qs.stringify({token, id: config.applicationId, username, app: config.appName, });
7676
return Promise.resolve({
7777
status: 302,

0 commit comments

Comments
 (0)