Permalink
Browse files

Add lint rule space-infix-ops (#3237)

Disallows: 1+1.  Must be 1 + 1.
  • Loading branch information...
1 parent 56bb505 commit 4cb6e7d209903990c02e2e3f1a9bcd4aa03983aa @acinader acinader committed on GitHub Jan 11, 2017
Showing with 145 additions and 144 deletions.
  1. +2 −1 .eslintrc.json
  2. +2 −2 spec/AuthenticationAdapters.spec.js
  3. +1 −1 spec/CloudCode.spec.js
  4. +10 −10 spec/HTTPRequest.spec.js
  5. +1 −1 spec/Logger.spec.js
  6. +1 −1 spec/OAuth1.spec.js
  7. +3 −3 spec/Parse.Push.spec.js
  8. +2 −2 spec/ParseAPI.spec.js
  9. +21 −21 spec/ParseHooks.spec.js
  10. +6 −6 spec/ParseObject.spec.js
  11. +3 −3 spec/ParseQuery.spec.js
  12. +2 −2 spec/ParseRole.spec.js
  13. +2 −2 spec/ParseUser.spec.js
  14. +13 −13 spec/PushController.spec.js
  15. +1 −1 spec/PushRouter.spec.js
  16. +2 −2 spec/RevocableSessionsUpgrade.spec.js
  17. +1 −1 spec/helper.js
  18. +1 −1 spec/rest.spec.js
  19. +1 −1 spec/schemas.spec.js
  20. +1 −1 src/AccountLockout.js
  21. +6 −6 src/Adapters/Auth/OAuth1Client.js
  22. +1 −1 src/Adapters/Auth/github.js
  23. +2 −2 src/Adapters/Auth/google.js
  24. +1 −1 src/Adapters/Auth/instagram.js
  25. +1 −1 src/Adapters/Auth/meetup.js
  26. +4 −4 src/Adapters/Auth/qq.js
  27. +1 −1 src/Adapters/Auth/spotify.js
  28. +1 −1 src/Adapters/Auth/twitter.js
  29. +1 −1 src/Adapters/Auth/wechat.js
  30. +1 −1 src/Adapters/Storage/Mongo/MongoTransform.js
  31. +22 −22 src/Adapters/Storage/Postgres/PostgresStorageAdapter.js
  32. +3 −3 src/Config.js
  33. +1 −1 src/Controllers/AdaptableController.js
  34. +1 −1 src/Controllers/LoggerController.js
  35. +2 −2 src/Controllers/PushController.js
  36. +8 −8 src/Controllers/SchemaCache.js
  37. +2 −2 src/Controllers/SchemaController.js
  38. +1 −1 src/LiveQuery/SessionTokenCache.js
  39. +1 −1 src/PromiseRouter.js
  40. +3 −3 src/RestQuery.js
  41. +1 −1 src/Routers/FilesRouter.js
  42. +1 −1 src/batch.js
  43. +2 −2 src/cli/parse-server.js
  44. +1 −1 src/cryptoUtils.js
  45. +1 −1 src/triggers.js
View
@@ -20,6 +20,7 @@
"eol-last": 2,
"space-in-parens": ["error", "never"],
"no-multiple-empty-lines": 1,
- "prefer-const": "error"
+ "prefer-const": "error",
+ "space-infix-ops": "error"
}
}
@@ -6,8 +6,8 @@ var path = require('path');
describe('AuthenticationProviers', function() {
["facebook", "github", "instagram", "google", "linkedin", "meetup", "twitter", "janrainengage", "janraincapture", "vkontakte"].map(function(providerName){
- it("Should validate structure of "+providerName, (done) => {
- var provider = require("../src/Adapters/Auth/"+providerName);
+ it("Should validate structure of " + providerName, (done) => {
+ var provider = require("../src/Adapters/Auth/" + providerName);
jequal(typeof provider.validateAuthData, "function");
jequal(typeof provider.validateAppId, "function");
jequal(provider.validateAuthData({}, {}).constructor, Promise.prototype.constructor);
@@ -1361,7 +1361,7 @@ describe('afterFind hooks', () => {
Parse.Cloud.afterFind('MyObject', (req, res) => {
const filteredResults = [];
for(let i = 0 ; i < req.objects.length ; i++){
- if(req.objects[i].get("secretField")==="SSID1") {
+ if(req.objects[i].get("secretField") === "SSID1") {
filteredResults.push(req.objects[i]);
}
}
@@ -6,7 +6,7 @@ var httpRequest = require("../src/cloud-code/httpRequest"),
express = require("express");
var port = 13371;
-var httpRequestServer = "http://localhost:"+port;
+var httpRequestServer = "http://localhost:" + port;
var app = express();
app.use(bodyParser.json({ 'type': '*/*' }));
@@ -39,7 +39,7 @@ app.listen(13371);
describe("httpRequest", () => {
it("should do /hello", (done) => {
httpRequest({
- url: httpRequestServer+"/hello"
+ url: httpRequestServer + "/hello"
}).then(function(httpResponse){
expect(httpResponse.status).toBe(200);
expect(httpResponse.buffer).toEqual(new Buffer('{"response":"OK"}'));
@@ -55,7 +55,7 @@ describe("httpRequest", () => {
it("should do /hello with callback and promises", (done) => {
var calls = 0;
httpRequest({
- url: httpRequestServer+"/hello",
+ url: httpRequestServer + "/hello",
success: function() { calls++; },
error: function() { calls++; }
}).then(function(httpResponse){
@@ -74,7 +74,7 @@ describe("httpRequest", () => {
it("should do not follow redirects by default", (done) => {
httpRequest({
- url: httpRequestServer+"/301"
+ url: httpRequestServer + "/301"
}).then(function(httpResponse){
expect(httpResponse.status).toBe(301);
done();
@@ -87,7 +87,7 @@ describe("httpRequest", () => {
it("should follow redirects when set", (done) => {
httpRequest({
- url: httpRequestServer+"/301",
+ url: httpRequestServer + "/301",
followRedirects: true
}).then(function(httpResponse){
expect(httpResponse.status).toBe(200);
@@ -104,7 +104,7 @@ describe("httpRequest", () => {
it("should fail on 404", (done) => {
var calls = 0;
httpRequest({
- url: httpRequestServer+"/404",
+ url: httpRequestServer + "/404",
success: function() {
calls++;
fail("should not succeed");
@@ -124,7 +124,7 @@ describe("httpRequest", () => {
it("should fail on 404", (done) => {
httpRequest({
- url: httpRequestServer+"/404",
+ url: httpRequestServer + "/404",
}).then(function(){
fail("should not succeed");
done();
@@ -141,7 +141,7 @@ describe("httpRequest", () => {
var calls = 0;
httpRequest({
method: "POST",
- url: httpRequestServer+"/echo",
+ url: httpRequestServer + "/echo",
body: {
foo: "bar"
},
@@ -218,7 +218,7 @@ describe("httpRequest", () => {
it("should params object to query string", (done) => {
httpRequest({
- url: httpRequestServer+"/qs",
+ url: httpRequestServer + "/qs",
params: {
foo: "bar"
}
@@ -234,7 +234,7 @@ describe("httpRequest", () => {
it("should params string to query string", (done) => {
httpRequest({
- url: httpRequestServer+"/qs",
+ url: httpRequestServer + "/qs",
params: "foo=bar&foo2=bar2"
}).then(function(httpResponse){
expect(httpResponse.status).toBe(200);
View
@@ -52,7 +52,7 @@ describe('Logger', () => {
logging.logger.info('hi', {key: 'value'});
expect(process.stdout.write).toHaveBeenCalled();
var firstLog = process.stdout.write.calls.first().args[0];
- expect(firstLog).toEqual(JSON.stringify({key: 'value', level: 'info', message: 'hi' })+'\n');
+ expect(firstLog).toEqual(JSON.stringify({key: 'value', level: 'info', message: 'hi' }) + '\n');
return reconfigureServer({
jsonLogs: false
});
View
@@ -64,7 +64,7 @@ describe('OAuth', function() {
var req = oauthClient.buildRequest(method, path, {"query": "param"});
jequal(req.host, options.host);
- jequal(req.path, "/"+path+"?query=param");
+ jequal(req.path, "/" + path + "?query=param");
jequal(req.method, "GET");
jequal(req.headers['Content-Type'], 'application/x-www-form-urlencoded');
jequal(req.headers['Authorization'], 'OAuth oauth_consumer_key="hello", oauth_nonce="AAAAAAAAAAAAAAAAA", oauth_signature="wNkyEkDE%2F0JZ2idmqyrgHdvC0rs%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="123450000", oauth_token="token", oauth_version="1.0"')
@@ -10,7 +10,7 @@ describe('Parse.Push', () => {
const promises = installations.map((installation) => {
if (installation.deviceType == "ios") {
expect(installation.badge).toEqual(badge);
- expect(installation.originalBadge+1).toEqual(installation.badge);
+ expect(installation.originalBadge + 1).toEqual(installation.badge);
} else {
expect(installation.badge).toBeUndefined();
}
@@ -39,8 +39,8 @@ describe('Parse.Push', () => {
var installations = [];
while(installations.length != 10) {
var installation = new Parse.Object("_Installation");
- installation.set("installationId", "installation_"+installations.length);
- installation.set("deviceToken","device_token_"+installations.length)
+ installation.set("installationId", "installation_" + installations.length);
+ installation.set("deviceToken","device_token_" + installations.length)
installation.set("badge", installations.length);
installation.set("originalBadge", installations.length);
installation.set("deviceType", "ios");
@@ -825,7 +825,7 @@ describe('miscellaneous', function() {
};
request.put({
headers: headers,
- url: 'http://localhost:8378/1/classes/GameScore/'+obj.id,
+ url: 'http://localhost:8378/1/classes/GameScore/' + obj.id,
body: JSON.stringify({
a: 'b',
c: {"__op":"Increment","amount":2},
@@ -1241,7 +1241,7 @@ describe('miscellaneous', function() {
amount: amount
}
},
- url: 'http://localhost:8378/1/classes/AnObject/'+object.id
+ url: 'http://localhost:8378/1/classes/AnObject/' + object.id
})
return new Promise((resolve, reject) => {
request.put(options, (err, res, body) => {
@@ -7,7 +7,7 @@ var express = require("express");
var bodyParser = require('body-parser');
var port = 12345;
-var hookServerURL = "http://localhost:"+port;
+var hookServerURL = "http://localhost:" + port;
const AppCache = require('../src/cache').AppCache;
var app = express();
@@ -129,7 +129,7 @@ describe('Hooks', () => {
});
it("should fail to register hooks without Master Key", (done) => {
- request.post(Parse.serverURL+"/hooks/functions", {
+ request.post(Parse.serverURL + "/hooks/functions", {
headers: {
"X-Parse-Application-Id": Parse.applicationId,
"X-Parse-REST-API-Key": Parse.restKey,
@@ -254,7 +254,7 @@ describe('Hooks', () => {
});
it("should fail trying to create a malformed function (REST)", (done) => {
- request.post(Parse.serverURL+"/hooks/functions", {
+ request.post(Parse.serverURL + "/hooks/functions", {
headers: {
"X-Parse-Application-Id": Parse.applicationId,
"X-Parse-Master-Key": Parse.masterKey,
@@ -272,18 +272,18 @@ describe('Hooks', () => {
it("should create hooks and properly preload them", (done) => {
var promises = [];
- for (var i = 0; i<5; i++) {
- promises.push(Parse.Hooks.createTrigger("MyClass"+i, "beforeSave", "http://url.com/beforeSave/"+i));
- promises.push(Parse.Hooks.createFunction("AFunction"+i, "http://url.com/function"+i));
+ for (var i = 0; i < 5; i++) {
+ promises.push(Parse.Hooks.createTrigger("MyClass" + i, "beforeSave", "http://url.com/beforeSave/" + i));
+ promises.push(Parse.Hooks.createFunction("AFunction" + i, "http://url.com/function" + i));
}
Parse.Promise.when(promises).then(function(){
- for (var i=0; i<5; i++) {
+ for (var i = 0; i < 5; i++) {
// Delete everything from memory, as the server just started
- triggers.removeTrigger("beforeSave", "MyClass"+i, Parse.applicationId);
- triggers.removeFunction("AFunction"+i, Parse.applicationId);
- expect(triggers.getTrigger("MyClass"+i, "beforeSave", Parse.applicationId)).toBeUndefined();
- expect(triggers.getFunction("AFunction"+i, Parse.applicationId)).toBeUndefined();
+ triggers.removeTrigger("beforeSave", "MyClass" + i, Parse.applicationId);
+ triggers.removeFunction("AFunction" + i, Parse.applicationId);
+ expect(triggers.getTrigger("MyClass" + i, "beforeSave", Parse.applicationId)).toBeUndefined();
+ expect(triggers.getFunction("AFunction" + i, Parse.applicationId)).toBeUndefined();
}
const hooksController = new HooksController(Parse.applicationId, AppCache.get('test').databaseController);
return hooksController.load()
@@ -292,9 +292,9 @@ describe('Hooks', () => {
fail('Should properly create all hooks');
done();
}).then(function() {
- for (var i=0; i<5; i++) {
- expect(triggers.getTrigger("MyClass"+i, "beforeSave", Parse.applicationId)).not.toBeUndefined();
- expect(triggers.getFunction("AFunction"+i, Parse.applicationId)).not.toBeUndefined();
+ for (var i = 0; i < 5; i++) {
+ expect(triggers.getTrigger("MyClass" + i, "beforeSave", Parse.applicationId)).not.toBeUndefined();
+ expect(triggers.getFunction("AFunction" + i, Parse.applicationId)).not.toBeUndefined();
}
done();
}, (err) => {
@@ -310,7 +310,7 @@ describe('Hooks', () => {
res.json({success:"OK!"});
});
- Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL+"/SomeFunction").then(function(){
+ Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL + "/SomeFunction").then(function(){
return Parse.Cloud.run("SOME_TEST_FUNCTION")
}, (err) => {
jfail(err);
@@ -332,7 +332,7 @@ describe('Hooks', () => {
res.json({error: {code: 1337, error: "hacking that one!"}});
});
// The function is deleted as the DB is dropped between calls
- Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL+"/SomeFunctionError").then(function(){
+ Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL + "/SomeFunctionError").then(function(){
return Parse.Cloud.run("SOME_TEST_FUNCTION")
}, (err) => {
jfail(err);
@@ -362,7 +362,7 @@ describe('Hooks', () => {
}
});
- Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL+"/ExpectingKey").then(function(){
+ Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL + "/ExpectingKey").then(function(){
return Parse.Cloud.run("SOME_TEST_FUNCTION")
}, (err) => {
jfail(err);
@@ -389,7 +389,7 @@ describe('Hooks', () => {
}
});
- Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL+"/ExpectingKeyAlso").then(function(){
+ Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL + "/ExpectingKeyAlso").then(function(){
return Parse.Cloud.run("SOME_TEST_FUNCTION")
}, (err) => {
jfail(err);
@@ -422,7 +422,7 @@ describe('Hooks', () => {
res.json({success: object});
});
// The function is delete as the DB is dropped between calls
- Parse.Hooks.createTrigger("SomeRandomObject", "beforeSave" ,hookServerURL+"/BeforeSaveSome").then(function(){
+ Parse.Hooks.createTrigger("SomeRandomObject", "beforeSave" ,hookServerURL + "/BeforeSaveSome").then(function(){
const obj = new Parse.Object("SomeRandomObject");
return obj.save();
}).then(function(res) {
@@ -444,7 +444,7 @@ describe('Hooks', () => {
object.set('hello', "world");
res.json({success: object});
});
- Parse.Hooks.createTrigger("SomeRandomObject2", "beforeSave" ,hookServerURL+"/BeforeSaveSome2").then(function(){
+ Parse.Hooks.createTrigger("SomeRandomObject2", "beforeSave" ,hookServerURL + "/BeforeSaveSome2").then(function(){
const obj = new Parse.Object("SomeRandomObject2");
return obj.save();
}).then(function(res) {
@@ -471,7 +471,7 @@ describe('Hooks', () => {
})
});
// The function is delete as the DB is dropped between calls
- Parse.Hooks.createTrigger("SomeRandomObject", "afterSave" ,hookServerURL+"/AfterSaveSome").then(function(){
+ Parse.Hooks.createTrigger("SomeRandomObject", "afterSave" ,hookServerURL + "/AfterSaveSome").then(function(){
const obj = new Parse.Object("SomeRandomObject");
return obj.save();
}).then(function() {
@@ -1390,7 +1390,7 @@ describe('Parse.Object testing', () => {
}
equal(itemsAgain.length, numItems, "Should get the array back");
itemsAgain.forEach(function(item, i) {
- var newValue = i*2;
+ var newValue = i * 2;
item.set("x", newValue);
});
return Parse.Object.saveAll(itemsAgain);
@@ -1400,7 +1400,7 @@ describe('Parse.Object testing', () => {
equal(fetchedItemsAgain.length, numItems,
"Number of items fetched should not change");
fetchedItemsAgain.forEach(function(item, i) {
- equal(item.get("x"), i*2);
+ equal(item.get("x"), i * 2);
});
done();
});
@@ -1457,7 +1457,7 @@ describe('Parse.Object testing', () => {
}
equal(itemsAgain.length, numItems, "Should get the array back");
itemsAgain.forEach(function(item, i) {
- var newValue = i*2;
+ var newValue = i * 2;
item.set("x", newValue);
});
return Parse.Object.saveAll(itemsAgain);
@@ -1467,7 +1467,7 @@ describe('Parse.Object testing', () => {
equal(fetchedItemsAgain.length, numItems,
"Number of items fetched should not change");
fetchedItemsAgain.forEach(function(item, i) {
- equal(item.get("x"), i*2);
+ equal(item.get("x"), i * 2);
});
done();
},
@@ -1581,7 +1581,7 @@ describe('Parse.Object testing', () => {
return;
}
itemsAgain.forEach(function(item, i) {
- item.set("x", i*2);
+ item.set("x", i * 2);
});
return Parse.Object.saveAll(itemsAgain);
}).then(function() {
@@ -1619,7 +1619,7 @@ describe('Parse.Object testing', () => {
return;
}
itemsAgain.forEach(function(item, i) {
- item.set("x", i*2);
+ item.set("x", i * 2);
});
return Parse.Object.saveAll(itemsAgain);
}).then(function() {
@@ -1652,8 +1652,8 @@ describe('Parse.Query testing', () => {
}
Parse.Object.saveAll(objects).then(() => {
const object = new Parse.Object("AContainer");
- for (var i=0; i<objects.length; i++) {
- if (i%2 == 0) {
+ for (var i = 0; i < objects.length; i++) {
+ if (i % 2 == 0) {
objects[i].id = 'randomThing'
} else {
total += objects[i].get('key');
@@ -2401,7 +2401,7 @@ describe('Parse.Query testing', () => {
it('query match on array with multiple objects', (done) => {
var target1 = {__type: 'Pointer', className: 'TestObject', objectId: 'abc'};
var target2 = {__type: 'Pointer', className: 'TestObject', objectId: '123'};
- var obj= new Parse.Object('TestObject');
+ var obj = new Parse.Object('TestObject');
obj.set('someObjs', [target1, target2]);
obj.save().then(() => {
var query = new Parse.Query('TestObject');
@@ -124,7 +124,7 @@ describe('Parse Role testing', () => {
expect(roles.length).toEqual(4);
allRoles.forEach(function(name) {
- expect(roles.indexOf("role:"+name)).not.toBe(-1);
+ expect(roles.indexOf("role:" + name)).not.toBe(-1);
});
// 1 Query for the initial setup
@@ -165,7 +165,7 @@ describe('Parse Role testing', () => {
}).then((roles) => {
expect(roles.length).toEqual(3);
rolesNames.forEach((name) => {
- expect(roles.indexOf('role:'+name)).not.toBe(-1);
+ expect(roles.indexOf('role:' + name)).not.toBe(-1);
});
done();
}, function(){
Oops, something went wrong.

0 comments on commit 4cb6e7d

Please sign in to comment.