Enable prefer-const lint rule (#3202)

This commit is contained in:
Arthur Cinader
2016-12-07 15:17:05 -08:00
committed by Florent Vilmart
parent a6c988176e
commit ca286b7108
106 changed files with 1183 additions and 1183 deletions

View File

@@ -44,7 +44,7 @@ function nobody(config) {
var getAuthForSessionToken = function({ config, sessionToken, installationId } = {}) {
return config.cacheController.user.get(sessionToken).then((userJSON) => {
if (userJSON) {
let cachedUser = Parse.Object.fromJSON(userJSON);
const cachedUser = Parse.Object.fromJSON(userJSON);
return Promise.resolve(new Auth({config, isMaster: false, installationId, user: cachedUser}));
}
@@ -71,7 +71,7 @@ var getAuthForSessionToken = function({ config, sessionToken, installationId } =
obj['className'] = '_User';
obj['sessionToken'] = sessionToken;
config.cacheController.user.put(sessionToken, obj);
let userObject = Parse.Object.fromJSON(obj);
const userObject = Parse.Object.fromJSON(obj);
return new Auth({config, isMaster: false, installationId, user: userObject});
});
});
@@ -87,9 +87,9 @@ var getAuthForLegacySessionToken = function({config, sessionToken, installationI
if (results.length !== 1) {
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'invalid legacy session token');
}
let obj = results[0];
const obj = results[0];
obj.className = '_User';
let userObject = Parse.Object.fromJSON(obj);
const userObject = Parse.Object.fromJSON(obj);
return new Auth({config, isMaster: false, installationId, user: userObject});
});
}
@@ -162,7 +162,7 @@ Auth.prototype._loadRoles = function() {
// Given a list of roleIds, find all the parent roles, returns a promise with all names
Auth.prototype._getAllRolesNamesForRoleIds = function(roleIDs, names = [], queriedRoles = {}) {
let ins = roleIDs.filter((roleID) => {
const ins = roleIDs.filter((roleID) => {
return queriedRoles[roleID] !== true;
}).map((roleID) => {
// mark as queried
@@ -185,7 +185,7 @@ Auth.prototype._getAllRolesNamesForRoleIds = function(roleIDs, names = [], queri
} else {
restWhere = { 'roles': { '$in': ins }}
}
let query = new RestQuery(this.config, master(this.config), '_Role', restWhere, {});
const query = new RestQuery(this.config, master(this.config), '_Role', restWhere, {});
return query.execute().then((response) => {
var results = response.results;
// Nothing found
@@ -193,7 +193,7 @@ Auth.prototype._getAllRolesNamesForRoleIds = function(roleIDs, names = [], queri
return Promise.resolve(names);
}
// Map the results with all Ids and names
let resultMap = results.reduce((memo, role) => {
const resultMap = results.reduce((memo, role) => {
memo.names.push(role.name);
memo.ids.push(role.objectId);
return memo;