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

@@ -19,10 +19,7 @@ export class ClassesRouter extends PromiseRouter {
}
handleFind(req) {
const body = Object.assign(
req.body,
ClassesRouter.JSONFromQuery(req.query)
);
const body = Object.assign(req.body, ClassesRouter.JSONFromQuery(req.query));
const options = ClassesRouter.optionsFromBody(body);
if (req.config.maxLimit && body.limit > req.config.maxLimit) {
// Silently replace the limit on the query with the max configured
@@ -51,18 +48,12 @@ export class ClassesRouter extends PromiseRouter {
// Returns a promise for a {response} object.
handleGet(req) {
const body = Object.assign(
req.body,
ClassesRouter.JSONFromQuery(req.query)
);
const body = Object.assign(req.body, ClassesRouter.JSONFromQuery(req.query));
const options = {};
for (const key of Object.keys(body)) {
if (ALLOWED_GET_QUERY_KEYS.indexOf(key) === -1) {
throw new Parse.Error(
Parse.Error.INVALID_QUERY,
'Improper encode of parameter'
);
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Improper encode of parameter');
}
}
@@ -96,10 +87,7 @@ export class ClassesRouter extends PromiseRouter {
)
.then(response => {
if (!response.results || response.results.length == 0) {
throw new Parse.Error(
Parse.Error.OBJECT_NOT_FOUND,
'Object not found.'
);
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Object not found.');
}
if (this.className(req) === '_User') {
@@ -142,13 +130,7 @@ export class ClassesRouter extends PromiseRouter {
handleDelete(req) {
return rest
.del(
req.config,
req.auth,
this.className(req),
req.params.objectId,
req.info.context
)
.del(req.config, req.auth, this.className(req), req.params.objectId, req.info.context)
.then(() => {
return { response: {} };
});
@@ -187,10 +169,7 @@ export class ClassesRouter extends PromiseRouter {
for (const key of Object.keys(body)) {
if (allowConstraints.indexOf(key) === -1) {
throw new Parse.Error(
Parse.Error.INVALID_QUERY,
`Invalid parameter for query: ${key}`
);
throw new Parse.Error(Parse.Error.INVALID_QUERY, `Invalid parameter for query: ${key}`);
}
}
const options = {};
@@ -229,10 +208,7 @@ export class ClassesRouter extends PromiseRouter {
if (typeof body.subqueryReadPreference === 'string') {
options.subqueryReadPreference = body.subqueryReadPreference;
}
if (
body.hint &&
(typeof body.hint === 'string' || typeof body.hint === 'object')
) {
if (body.hint && (typeof body.hint === 'string' || typeof body.hint === 'object')) {
options.hint = body.hint;
}
if (body.explain) {
@@ -251,14 +227,9 @@ export class ClassesRouter extends PromiseRouter {
this.route('POST', '/classes/:className', promiseEnsureIdempotency, req => {
return this.handleCreate(req);
});
this.route(
'PUT',
'/classes/:className/:objectId',
promiseEnsureIdempotency,
req => {
return this.handleUpdate(req);
}
);
this.route('PUT', '/classes/:className/:objectId', promiseEnsureIdempotency, req => {
return this.handleUpdate(req);
});
this.route('DELETE', '/classes/:className/:objectId', req => {
return this.handleDelete(req);
});