Skip to content

Commit

Permalink
More lint tweaking
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Arthur Cinader committed Dec 2, 2016
1 parent b9afccd commit 4dcec6c
Show file tree
Hide file tree
Showing 19 changed files with 51 additions and 56 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"indent": ["error", 2],
"linebreak-style": ["error", "unix"],
"no-trailing-spaces": 2,
"eol-last": 2
"eol-last": 2,
"space-in-parens": ["error", "never"]
}
}
8 changes: 1 addition & 7 deletions spec/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"extends": "eslint:recommended",
"env": {
"node": true,
"es6": true,
"jasmine": true
},
"globals": {
Expand All @@ -29,9 +26,6 @@
"arrayContains": true
},
"rules": {
"no-console": [0],
"indent": ["error", 2],
"no-trailing-spaces": 2,
"eol-last": 2
"no-console": [0]
}
}
2 changes: 1 addition & 1 deletion spec/EmailVerificationToken.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion spec/ParseAPI.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
16 changes: 8 additions & 8 deletions spec/ParseHooks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions spec/ParseObject.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1842,18 +1842,18 @@ 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);
expect(foo["__foo_bar"]).toBe(true);
expect(foo["_0"]).toEqual("underscore_zero");
expect(foo["_more"]["_nested"]).toEqual("key");
done();
}).fail( err => {
}).fail(err => {
jfail(err);
fail("should not fail");
done();
Expand Down
4 changes: 2 additions & 2 deletions spec/ParseQuery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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();

Expand Down
22 changes: 11 additions & 11 deletions spec/ParseRole.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand All @@ -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();
});
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion spec/PurchaseValidation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function createProduct() {
}

describe("test validate_receipt endpoint", () => {
beforeEach( done => {
beforeEach(done => {
createProduct().then(done).fail(function(){
done();
});
Expand Down
18 changes: 9 additions & 9 deletions spec/schemas.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
})
Expand Down Expand Up @@ -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();
})
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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();
})
Expand Down Expand Up @@ -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(() => {
Expand All @@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/Storage/Postgres/PostgresStorageAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ const buildWhereClause = ({ schema, query, index }) => {
let allowNull = false;
values.push(fieldName);
fieldValue.$in.forEach((listElem, listIndex) => {
if (listElem === null ) {
if (listElem === null) {
allowNull = true;
} else {
values.push(listElem);
Expand Down
2 changes: 1 addition & 1 deletion src/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class Config {
throw 'passwordPolicy.validatorPattern must be a RegExp.';
}

if(passwordPolicy.validatorCallback && typeof passwordPolicy.validatorCallback !== 'function' ) {
if(passwordPolicy.validatorCallback && typeof passwordPolicy.validatorCallback !== 'function') {
throw 'passwordPolicy.validatorCallback must be a function.';
}

Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/AdaptableController.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class AdaptableController {
}

// Makes sure the prototype matches
let mismatches = Object.getOwnPropertyNames(Type.prototype).reduce( (obj, key) => {
let mismatches = Object.getOwnPropertyNames(Type.prototype).reduce((obj, key) => {
const adapterType = typeof adapter[key];
const expectedType = typeof Type.prototype[key];
if (adapterType !== expectedType) {
Expand Down
2 changes: 1 addition & 1 deletion src/ParseServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ class ParseServer {
//This causes tests to spew some useless warnings, so disable in test
if (!process.env.TESTING) {
process.on('uncaughtException', (err) => {
if ( err.code === "EADDRINUSE" ) { // user-friendly message for this common error
if (err.code === "EADDRINUSE") { // user-friendly message for this common error
/* eslint-disable no-console */
console.error(`Unable to listen on port ${err.port}. The port is already in use.`);
/* eslint-enable no-console */
Expand Down
4 changes: 2 additions & 2 deletions src/Routers/HooksRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as middleware from "../middlewares";

export class HooksRouter extends PromiseRouter {
createHook(aHook, config) {
return config.hooksController.createHook(aHook).then( (hook) => ({response: hook}));
return config.hooksController.createHook(aHook).then((hook) => ({response: hook}));
}

updateHook(aHook, config) {
Expand All @@ -18,7 +18,7 @@ export class HooksRouter extends PromiseRouter {
handleGetFunctions(req) {
var hooksController = req.config.hooksController;
if (req.params.functionName) {
return hooksController.getFunction(req.params.functionName).then( (foundFunction) => {
return hooksController.getFunction(req.params.functionName).then((foundFunction) => {
if (!foundFunction) {
throw new Parse.Error(143, `no function named: ${req.params.functionName} is defined`);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Routers/IAPValidationRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ export class IAPValidationRouter extends PromiseRouter {
return Promise.resolve({response: appStoreError(error.status) });
}

return validateWithAppStore(IAP_PRODUCTION_URL, receipt).then( () => {
return validateWithAppStore(IAP_PRODUCTION_URL, receipt).then(() => {

return successCallback();

}, (error) => {
if (error.status == 21007) {
return validateWithAppStore(IAP_SANDBOX_URL, receipt).then( () => {
return validateWithAppStore(IAP_SANDBOX_URL, receipt).then(() => {
return successCallback();
}, (error) => {
return errorCallback(error);
Expand Down
4 changes: 2 additions & 2 deletions src/Routers/PublicAPIRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class PublicAPIRouter extends PromiseRouter {
}

let userController = config.userController;
return userController.verifyEmail(username, token).then( () => {
return userController.verifyEmail(username, token).then(() => {
let params = qs.stringify({username});
return Promise.resolve({
status: 302,
Expand Down Expand Up @@ -71,7 +71,7 @@ export class PublicAPIRouter extends PromiseRouter {
return this.invalidLink(req);
}

return config.userController.checkResetTokenValidity(username, token).then( () => {
return config.userController.checkResetTokenValidity(username, token).then(() => {
let params = qs.stringify({token, id: config.applicationId, username, app: config.appName, });
return Promise.resolve({
status: 302,
Expand Down
Loading

0 comments on commit 4dcec6c

Please sign in to comment.