Adds liniting into the workflow (#3082)
* initial linting of src * fix indent to 2 spaces * Removes unnecessary rules * ignore spec folder for now * Spec linting * Fix spec indent * nits * nits * no no-empty rule
This commit is contained in:
@@ -142,21 +142,21 @@ export function handleParseHeaders(req, res, next) {
|
||||
return;
|
||||
}
|
||||
|
||||
return Promise.resolve().then(() => {
|
||||
return Promise.resolve().then(() => {
|
||||
// handle the upgradeToRevocableSession path on it's own
|
||||
if (info.sessionToken &&
|
||||
req.url === '/upgradeToRevocableSession' &&
|
||||
info.sessionToken.indexOf('r:') != 0) {
|
||||
return auth.getAuthForLegacySessionToken({ config: req.config, installationId: info.installationId, sessionToken: info.sessionToken })
|
||||
return auth.getAuthForLegacySessionToken({ config: req.config, installationId: info.installationId, sessionToken: info.sessionToken })
|
||||
} else {
|
||||
return auth.getAuthForSessionToken({ config: req.config, installationId: info.installationId, sessionToken: info.sessionToken })
|
||||
return auth.getAuthForSessionToken({ config: req.config, installationId: info.installationId, sessionToken: info.sessionToken })
|
||||
}
|
||||
}).then((auth) => {
|
||||
if (auth) {
|
||||
req.auth = auth;
|
||||
next();
|
||||
}
|
||||
})
|
||||
if (auth) {
|
||||
req.auth = auth;
|
||||
next();
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
if(error instanceof Parse.Error) {
|
||||
next(error);
|
||||
@@ -221,7 +221,7 @@ export function allowCrossDomain(req, res, next) {
|
||||
else {
|
||||
next();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function allowMethodOverride(req, res, next) {
|
||||
if (req.method === 'POST' && req.body._method) {
|
||||
@@ -230,7 +230,7 @@ export function allowMethodOverride(req, res, next) {
|
||||
delete req.body._method;
|
||||
}
|
||||
next();
|
||||
};
|
||||
}
|
||||
|
||||
export function handleParseErrors(err, req, res, next) {
|
||||
// TODO: Add logging as those errors won't make it to the PromiseRouter
|
||||
@@ -258,10 +258,10 @@ export function handleParseErrors(err, req, res, next) {
|
||||
log.error('Uncaught internal server error.', err, err.stack);
|
||||
res.status(500);
|
||||
res.json({code: Parse.Error.INTERNAL_SERVER_ERROR,
|
||||
message: 'Internal server error.'});
|
||||
message: 'Internal server error.'});
|
||||
}
|
||||
next(err);
|
||||
};
|
||||
}
|
||||
|
||||
export function enforceMasterKeyAccess(req, res, next) {
|
||||
if (!req.auth.isMaster) {
|
||||
|
||||
Reference in New Issue
Block a user