Skip to content

lint for trailing whitespace and eol at end of file. #3154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
},
"rules": {
"indent": ["error", 2],
"linebreak-style": ["error", "unix"]
"linebreak-style": ["error", "unix"],
"no-trailing-spaces": 2,
"eol-last": 2
}
}
10 changes: 5 additions & 5 deletions src/AccountLockout.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ export class AccountLockout {
}

/**
* if the failed login count is greater than the threshold
* then sets lockout expiration to 'currenttime + accountPolicy.duration', i.e., account is locked out for the next 'accountPolicy.duration' minutes
* if the failed login count is greater than the threshold
* then sets lockout expiration to 'currenttime + accountPolicy.duration', i.e., account is locked out for the next 'accountPolicy.duration' minutes
* else do nothing
*/
_setLockoutExpiration() {
Expand Down Expand Up @@ -147,8 +147,8 @@ export class AccountLockout {
* set and/or increment _failed_login_count
* if _failed_login_count > threshold
* set the _account_lockout_expires_at to current_time + accountPolicy.duration
* else
* do nothing
* else
* do nothing
*/
_handleFailedLoginAttempt() {
return new Promise((resolve, reject) => {
Expand All @@ -175,7 +175,7 @@ export class AccountLockout {
if (!this._config.accountLockout) {
return Promise.resolve();
}

return new Promise((resolve, reject) => {
this._notLocked()
.then(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/Adapters/Analytics/AnalyticsAdapter.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*eslint no-unused-vars: "off"*/
export class AnalyticsAdapter {

/*
@param parameters: the analytics request body, analytics info will be in the dimensions property
@param req: the original http request
*/
appOpened(parameters, req) {
return Promise.resolve({});
}

/*
@param eventName: the name of the custom eventName
@param parameters: the analytics request body, analytics info will be in the dimensions property
Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/Email/MailAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class MailAdapter {
* - subject: the subject of the email
*/
sendMail(options) {}

/* You can implement those methods if you want
* to provide HTML templates etc...
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Adapters/Storage/Mongo/MongoTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const transformKey = (className, fieldName, schema) => {
case 'updatedAt': return '_updated_at';
case 'sessionToken': return '_session_token';
}

if (schema.fields[fieldName] && schema.fields[fieldName].__type == 'Pointer') {
fieldName = '_p_' + fieldName;
} else if (schema.fields[fieldName] && schema.fields[fieldName].type == 'Pointer') {
Expand Down Expand Up @@ -911,7 +911,7 @@ var BytesCoder = {
};
},

isValidDatabaseObject(object) {
isValidDatabaseObject(object) {
return (object instanceof mongodb.Binary) || this.isBase64Value(object);
},

Expand Down
28 changes: 14 additions & 14 deletions src/Adapters/Storage/Postgres/PostgresStorageAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const handleDotFields = (object) => {
value = undefined;
}
/* eslint-disable no-cond-assign */
while(next = components.shift()) {
while(next = components.shift()) {
/* eslint-enable no-cond-assign */
currentObj[next] = currentObj[next] || {};
if (components.length === 0) {
Expand All @@ -149,7 +149,7 @@ const validateKeys = (object) => {

if(key.includes('$') || key.includes('.')){
throw new Parse.Error(Parse.Error.INVALID_NESTED_KEY, "Nested keys should not contain the '$' or '.' characters");
}
}
}
}
}
Expand All @@ -165,7 +165,7 @@ const joinTablesForSchema = (schema) => {
});
}
return list;
}
}

const buildWhereClause = ({ schema, query, index }) => {
let patterns = [];
Expand All @@ -174,8 +174,8 @@ const buildWhereClause = ({ schema, query, index }) => {

schema = toPostgresSchema(schema);
for (let fieldName in query) {
let isArrayField = schema.fields
&& schema.fields[fieldName]
let isArrayField = schema.fields
&& schema.fields[fieldName]
&& schema.fields[fieldName].type === 'Array';
let initialPatternsLength = patterns.length;
let fieldValue = query[fieldName];
Expand All @@ -186,14 +186,14 @@ const buildWhereClause = ({ schema, query, index }) => {
if (fieldValue.$exists === false) {
continue;
}
}
}

if (fieldName.indexOf('.') >= 0) {
let components = fieldName.split('.').map((cmpt, index) => {
if (index === 0) {
return `"${cmpt}"`;
}
return `'${cmpt}'`;
return `'${cmpt}'`;
});
let name = components.slice(0, components.length-1).join('->');
name+='->>'+components[components.length-1];
Expand Down Expand Up @@ -252,7 +252,7 @@ const buildWhereClause = ({ schema, query, index }) => {
const isInOrNin = Array.isArray(fieldValue.$in) || Array.isArray(fieldValue.$nin);
if (Array.isArray(fieldValue.$in) &&
isArrayField &&
schema.fields[fieldName].contents &&
schema.fields[fieldName].contents &&
schema.fields[fieldName].contents.type === 'String') {
let inPatterns = [];
let allowNull = false;
Expand Down Expand Up @@ -439,7 +439,7 @@ export class PostgresStorageAdapter {
return this._client.tx(t => {
const q1 = this.createTable(className, schema, t);
const q2 = t.none('INSERT INTO "_SCHEMA" ("className", "schema", "isParseClass") VALUES ($<className>, $<schema>, true)', { className, schema });

return t.batch([q1, q2]);
})
.then(() => {
Expand Down Expand Up @@ -680,7 +680,7 @@ export class PostgresStorageAdapter {
delete object[fieldName];
fieldName = 'authData';
}

columnsArray.push(fieldName);
if (!schema.fields[fieldName] && className === '_User') {
if (fieldName === '_email_verify_token' ||
Expand Down Expand Up @@ -726,7 +726,7 @@ export class PostgresStorageAdapter {
} else {
valuesArray.push(JSON.stringify(object[fieldName]));
}
break;
break;
case 'Object':
case 'String':
case 'Number':
Expand Down Expand Up @@ -843,7 +843,7 @@ export class PostgresStorageAdapter {
// This recursively sets the json_object
// Only 1 level deep
let generate = (jsonb, key, value) => {
return `json_object_set_key(COALESCE(${jsonb}, '{}'::jsonb), ${key}, ${value})::jsonb`;
return `json_object_set_key(COALESCE(${jsonb}, '{}'::jsonb), ${key}, ${value})::jsonb`;
}
let lastKey = `$${index}:name`;
let fieldNameIndex = index;
Expand Down Expand Up @@ -926,7 +926,7 @@ export class PostgresStorageAdapter {
&& schema.fields[fieldName]
&& schema.fields[fieldName].type === 'Object') {
const keysToDelete = Object.keys(originalUpdate).filter(k => {
// choose top level fields that have a delete operation set
// choose top level fields that have a delete operation set
return originalUpdate[k].__op === 'Delete' && k.split('.').length === 2
}).map(k => k.split('.')[1]);

Expand Down Expand Up @@ -990,7 +990,7 @@ export class PostgresStorageAdapter {
let values = [className];
let where = buildWhereClause({ schema, query, index: 2 })
values.push(...where.values);

const wherePattern = where.pattern.length > 0 ? `WHERE ${where.pattern}` : '';
const limitPattern = hasLimit ? `LIMIT $${values.length + 1}` : '';
if (hasLimit) {
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/DatabaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ DatabaseController.prototype.performInitizalization = function() {
return Promise.reject(error);
});

// Create tables for volatile classes
// Create tables for volatile classes
let adapterInit = this.adapter.performInitialization({ VolatileClassesSchemas: SchemaController.VolatileClassesSchemas });
return Promise.all([usernameUniqueness, emailUniqueness, adapterInit]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/LiveQuery/ParseLiveQueryServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ class ParseLiveQueryServer {
if (classSubscriptions.size === 0) {
this.subscriptions.delete(className);
}

if (!notifyClient) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ParseServerRESTController.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function ParseServerRESTController(applicationId, router) {
function handleRequest(method, path, data = {}, options = {}) {
// Store the arguments, for later use if internal fails
let args = arguments;

let config = new Config(applicationId);
let serverURL = URL.parse(config.serverURL);
if (path.indexOf(serverURL.path) === 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/RestWrite.js
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ RestWrite.prototype.handleInstallation = function() {
}

// Updating _Installation but not updating anything critical
if (this.query && !this.data.deviceToken
if (this.query && !this.data.deviceToken
&& !installationId && !this.data.deviceType) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Routers/CloudCodeRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ export class CloudCodeRouter extends PromiseRouter {
})
});
}
}
}
20 changes: 10 additions & 10 deletions src/Routers/IAPValidationRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const APP_STORE_ERRORS = {
21005: "The receipt server is not currently available.",
21006: "This receipt is valid but the subscription has expired.",
21007: "This receipt is from the test environment, but it was sent to the production environment for verification. Send it to the test environment instead.",
21008: "This receipt is from the production environment, but it was sent to the test environment for verification. Send it to the production environment instead."
21008: "This receipt is from the production environment, but it was sent to the test environment for verification. Send it to the production environment instead."
}

function appStoreError(status) {
Expand Down Expand Up @@ -49,7 +49,7 @@ function getFileForProductIdentifier(productIdentifier, req) {
// Error not found or too many
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Object not found.')
}

var download = products[0].download;
return Promise.resolve({response: download});
});
Expand All @@ -58,24 +58,24 @@ function getFileForProductIdentifier(productIdentifier, req) {


export class IAPValidationRouter extends PromiseRouter {

handleRequest(req) {
let receipt = req.body.receipt;
const productIdentifier = req.body.productIdentifier;

if (!receipt || ! productIdentifier) {
// TODO: Error, malformed request
throw new Parse.Error(Parse.Error.INVALID_JSON, "missing receipt or productIdentifier");
}

// Transform the object if there
// otherwise assume it's in Base64 already
if (typeof receipt == "object") {
if (receipt["__type"] == "Bytes") {
receipt = receipt.base64;
}
}

if (process.env.NODE_ENV == "test" && req.body.bypassAppStoreValidation) {
return getFileForProductIdentifier(productIdentifier, req);
}
Expand All @@ -87,9 +87,9 @@ export class IAPValidationRouter extends PromiseRouter {
function errorCallback(error) {
return Promise.resolve({response: appStoreError(error.status) });
}

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

return successCallback();

}, (error) => {
Expand All @@ -100,12 +100,12 @@ export class IAPValidationRouter extends PromiseRouter {
return errorCallback(error);
}
);
}
}

return errorCallback(error);
});
}

mountRoutes() {
this.route("POST","/validate_purchase", this.handleRequest);
}
Expand Down
2 changes: 1 addition & 1 deletion src/authDataManager/OAuth1Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,4 @@ OAuth.signRequest = function(request, oauth_parameters, consumer_secret, auth_to

}

module.exports = OAuth;
module.exports = OAuth;
2 changes: 1 addition & 1 deletion src/authDataManager/google.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function validateAuthToken(id, token) {
// Returns a promise that fulfills if this user id is valid.
function validateAuthData(authData) {
if (authData.id_token) {
return validateIdToken(authData.id, authData.id_token);
return validateIdToken(authData.id, authData.id_token);
} else {
return validateAuthToken(authData.id, authData.access_token).then(() => {
// Validation with auth token worked
Expand Down
2 changes: 1 addition & 1 deletion src/authDataManager/twitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function validateAuthData(authData, options) {
client.host = "api.twitter.com";
client.auth_token = authData.auth_token;
client.auth_token_secret = authData.auth_token_secret;

return client.get("/1.1/account/verify_credentials.json").then((data) => {
if (data && data.id_str == ''+authData.id) {
return;
Expand Down
4 changes: 2 additions & 2 deletions src/authDataManager/vkontakte.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var Parse = require('parse/node').Parse;
var logger = require('../logger').default;

// Returns a promise that fulfills iff this user id is valid.
function validateAuthData(authData, params) {
function validateAuthData(authData, params) {
return vkOAuth2Request(params).then(function (response) {
if (response && response && response.access_token) {
return request("api.vk.com", "method/secure.checkToken?token=" + authData.access_token + "&client_secret=" + params.appSecret + "&access_token=" + response.access_token).then(function (response) {
Expand Down Expand Up @@ -59,4 +59,4 @@ function request(host, path) {
module.exports = {
validateAppId: validateAppId,
validateAuthData: validateAuthData
};
};
2 changes: 1 addition & 1 deletion src/batch.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function makeBatchRoutingPathFunction(originalUrl, serverURL, publicServerURL) {
return path.posix.join('/', requestPath.slice(apiPrefix.length));
}

if (serverURL && publicServerURL
if (serverURL && publicServerURL
&& (serverURL.path != publicServerURL.path)) {
let localPath = serverURL.path;
let publicPath = publicServerURL.path;
Expand Down
2 changes: 1 addition & 1 deletion src/cli/utils/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ export default function({
start(program, options, function() {
logStartupOptions(options);
});
}
}
2 changes: 1 addition & 1 deletion src/cloud-code/HTTPResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class HTTPResponse {
} else if (!_text && _data) {
_text = JSON.stringify(_data);
}
return _text;
return _text;
}

let getData = () => {
Expand Down
4 changes: 2 additions & 2 deletions src/middlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ export function handleParseHeaders(req, res, next) {

return Promise.resolve().then(() => {
// handle the upgradeToRevocableSession path on it's own
if (info.sessionToken &&
req.url === '/upgradeToRevocableSession' &&
if (info.sessionToken &&
req.url === '/upgradeToRevocableSession' &&
info.sessionToken.indexOf('r:') != 0) {
return auth.getAuthForLegacySessionToken({ config: req.config, installationId: info.installationId, sessionToken: info.sessionToken })
} else {
Expand Down
Loading