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

@@ -2,10 +2,7 @@ import { Parse } from 'parse/node';
import * as triggers from '../triggers';
function isParseObjectConstructor(object) {
return (
typeof object === 'function' &&
Object.prototype.hasOwnProperty.call(object, 'className')
);
return typeof object === 'function' && Object.prototype.hasOwnProperty.call(object, 'className');
}
function getClassName(parseClass) {
@@ -52,12 +49,7 @@ var ParseCloud = {};
* @param {(Object|Function)} validator An optional function to help validating cloud code. This function can be an async function and should take one parameter a {@link Parse.Cloud.FunctionRequest}, or a {@link Parse.Cloud.ValidatorObject}.
*/
ParseCloud.define = function (functionName, handler, validationHandler) {
triggers.addFunction(
functionName,
handler,
validationHandler,
Parse.applicationId
);
triggers.addFunction(functionName, handler, validationHandler, Parse.applicationId);
};
/**
@@ -178,12 +170,7 @@ ParseCloud.beforeLogin = function (handler) {
className = getClassName(handler);
handler = arguments[1];
}
triggers.addTrigger(
triggers.Types.beforeLogin,
className,
handler,
Parse.applicationId
);
triggers.addTrigger(triggers.Types.beforeLogin, className, handler, Parse.applicationId);
};
/**
@@ -213,12 +200,7 @@ ParseCloud.afterLogin = function (handler) {
className = getClassName(handler);
handler = arguments[1];
}
triggers.addTrigger(
triggers.Types.afterLogin,
className,
handler,
Parse.applicationId
);
triggers.addTrigger(triggers.Types.afterLogin, className, handler, Parse.applicationId);
};
/**
@@ -247,12 +229,7 @@ ParseCloud.afterLogout = function (handler) {
className = getClassName(handler);
handler = arguments[1];
}
triggers.addTrigger(
triggers.Types.afterLogout,
className,
handler,
Parse.applicationId
);
triggers.addTrigger(triggers.Types.afterLogout, className, handler, Parse.applicationId);
};
/**
@@ -613,11 +590,7 @@ ParseCloud.onLiveQueryEvent = function (handler) {
* @param {Function} func The function to run after a live query event. This function can be async and should take one parameter, a {@link Parse.Cloud.LiveQueryEventTrigger}.
* @param {(Object|Function)} validator An optional function to help validating cloud code. This function can be an async function and should take one parameter a {@link Parse.Cloud.LiveQueryEventTrigger}, or a {@link Parse.Cloud.ValidatorObject}.
*/
ParseCloud.afterLiveQueryEvent = function (
parseClass,
handler,
validationHandler
) {
ParseCloud.afterLiveQueryEvent = function (parseClass, handler, validationHandler) {
const className = getClassName(parseClass);
triggers.addTrigger(
triggers.Types.afterEvent,

View File

@@ -47,18 +47,13 @@ const encodeBody = function ({ body, headers = {} }) {
} else {
/* istanbul ignore next */
if (contentTypeKeys.length > 1) {
log.error(
'Parse.Cloud.httpRequest',
'multiple content-type headers are set.'
);
log.error('Parse.Cloud.httpRequest', 'multiple content-type headers are set.');
}
// There maybe many, we'll just take the 1st one
var contentType = contentTypeKeys[0];
if (headers[contentType].match(/application\/json/i)) {
body = JSON.stringify(body);
} else if (
headers[contentType].match(/application\/x-www-form-urlencoded/i)
) {
} else if (headers[contentType].match(/application\/x-www-form-urlencoded/i)) {
body = querystring.stringify(body);
}
}
@@ -137,10 +132,7 @@ module.exports = function httpRequest(options) {
requestOptions.agent = options.agent;
}
return new Promise((resolve, reject) => {
const req = client.request(
requestOptions,
makeCallback(resolve, reject, options)
);
const req = client.request(requestOptions, makeCallback(resolve, reject, options));
if (options.body) {
req.write(options.body);
}