fix(prettier): Properly handle lint-stage files (#6970)

Now handles top level files and recursive files in folders.

Set max line length to be 100
This commit is contained in:
Diamond Lewis
2020-10-25 15:06:58 -05:00
committed by GitHub
parent c2f2281e6d
commit e6ac3b6932
178 changed files with 5585 additions and 10688 deletions

View File

@@ -28,10 +28,7 @@ function makeBatchRoutingPathFunction(originalUrl, serverURL, publicServerURL) {
const makeRoutablePath = function (requestPath) {
// The routablePath is the path minus the api prefix
if (requestPath.slice(0, apiPrefix.length) != apiPrefix) {
throw new Parse.Error(
Parse.Error.INVALID_JSON,
'cannot route batch path ' + requestPath
);
throw new Parse.Error(Parse.Error.INVALID_JSON, 'cannot route batch path ' + requestPath);
}
return path.posix.join('/', requestPath.slice(apiPrefix.length));
};
@@ -44,12 +41,7 @@ function makeBatchRoutingPathFunction(originalUrl, serverURL, publicServerURL) {
return function (requestPath) {
// Build the new path by removing the public path
// and joining with the local path
const newPath = path.posix.join(
'/',
localPath,
'/',
requestPath.slice(publicPath.length)
);
const newPath = path.posix.join('/', localPath, '/', requestPath.slice(publicPath.length));
// Use the method for local routing
return makeRoutablePath(newPath);
};
@@ -62,10 +54,7 @@ function makeBatchRoutingPathFunction(originalUrl, serverURL, publicServerURL) {
// TODO: pass along auth correctly
function handleBatch(router, req) {
if (!Array.isArray(req.body.requests)) {
throw new Parse.Error(
Parse.Error.INVALID_JSON,
'requests must be an array'
);
throw new Parse.Error(Parse.Error.INVALID_JSON, 'requests must be an array');
}
// The batch paths are all from the root of our domain.
@@ -100,16 +89,14 @@ function handleBatch(router, req) {
info: req.info,
};
return router
.tryRouteRequest(restRequest.method, routablePath, request)
.then(
response => {
return { success: response.response };
},
error => {
return { error: { code: error.code, error: error.message } };
}
);
return router.tryRouteRequest(restRequest.method, routablePath, request).then(
response => {
return { success: response.response };
},
error => {
return { error: { code: error.code, error: error.message } };
}
);
});
return Promise.all(promises).then(results => {