Run Prettier JS #2 (#6796)

This commit is contained in:
Diamond Lewis
2020-07-13 17:13:08 -05:00
committed by GitHub
parent e6a6354b29
commit 142eaa71bd
40 changed files with 323 additions and 330 deletions

View File

@@ -217,7 +217,7 @@ class ParseGraphQLSchema {
}
};
Object.values(customGraphQLSchemaTypeMap).forEach(
(customGraphQLSchemaType) => {
customGraphQLSchemaType => {
if (
!customGraphQLSchemaType ||
!customGraphQLSchemaType.name ||
@@ -236,7 +236,7 @@ class ParseGraphQLSchema {
}
);
Object.values(customGraphQLSchemaTypeMap).forEach(
(customGraphQLSchemaType) => {
customGraphQLSchemaType => {
if (
!customGraphQLSchemaType ||
!customGraphQLSchemaType.name ||
@@ -253,7 +253,7 @@ class ParseGraphQLSchema {
typeof customGraphQLSchemaType.getFields === 'function'
) {
Object.values(customGraphQLSchemaType.getFields()).forEach(
(field) => {
field => {
findAndReplaceLastType(field, 'type');
}
);
@@ -289,24 +289,24 @@ class ParseGraphQLSchema {
}
const graphQLSchemaTypeMap = this.graphQLSchema.getTypeMap();
Object.keys(graphQLSchemaTypeMap).forEach((graphQLSchemaTypeName) => {
Object.keys(graphQLSchemaTypeMap).forEach(graphQLSchemaTypeName => {
const graphQLSchemaType = graphQLSchemaTypeMap[graphQLSchemaTypeName];
if (
typeof graphQLSchemaType.getFields === 'function' &&
this.graphQLCustomTypeDefs.definitions
) {
const graphQLCustomTypeDef = this.graphQLCustomTypeDefs.definitions.find(
(definition) => definition.name.value === graphQLSchemaTypeName
definition => definition.name.value === graphQLSchemaTypeName
);
if (graphQLCustomTypeDef) {
const graphQLSchemaTypeFieldMap = graphQLSchemaType.getFields();
Object.keys(graphQLSchemaTypeFieldMap).forEach(
(graphQLSchemaTypeFieldName) => {
graphQLSchemaTypeFieldName => {
const graphQLSchemaTypeField =
graphQLSchemaTypeFieldMap[graphQLSchemaTypeFieldName];
if (!graphQLSchemaTypeField.astNode) {
const astNode = graphQLCustomTypeDef.fields.find(
(field) => field.name.value === graphQLSchemaTypeFieldName
field => field.name.value === graphQLSchemaTypeFieldName
);
if (astNode) {
graphQLSchemaTypeField.astNode = astNode;
@@ -337,9 +337,7 @@ class ParseGraphQLSchema {
) {
if (
(!ignoreReserved && RESERVED_GRAPHQL_TYPE_NAMES.includes(type.name)) ||
this.graphQLTypes.find(
(existingType) => existingType.name === type.name
) ||
this.graphQLTypes.find(existingType => existingType.name === type.name) ||
(!ignoreConnection && type.name.endsWith('Connection'))
) {
const message = `Type ${type.name} could not be added to the auto schema because it collided with an existing type.`;
@@ -429,7 +427,7 @@ class ParseGraphQLSchema {
if (Array.isArray(enabledForClasses) || Array.isArray(disabledForClasses)) {
let includedClasses = allClasses;
if (enabledForClasses) {
includedClasses = allClasses.filter((clazz) => {
includedClasses = allClasses.filter(clazz => {
return enabledForClasses.includes(clazz.className);
});
}
@@ -437,12 +435,12 @@ class ParseGraphQLSchema {
// Classes included in `enabledForClasses` that
// are also present in `disabledForClasses` will
// still be filtered out
includedClasses = includedClasses.filter((clazz) => {
includedClasses = includedClasses.filter(clazz => {
return !disabledForClasses.includes(clazz.className);
});
}
this.isUsersClassDisabled = !includedClasses.some((clazz) => {
this.isUsersClassDisabled = !includedClasses.some(clazz => {
return clazz.className === '_User';
});
@@ -487,11 +485,11 @@ class ParseGraphQLSchema {
}
};
return parseClasses.sort(sortClasses).map((parseClass) => {
return parseClasses.sort(sortClasses).map(parseClass => {
let parseClassConfig;
if (classConfigs) {
parseClassConfig = classConfigs.find(
(c) => c.className === parseClass.className
c => c.className === parseClass.className
);
}
return [parseClass, parseClassConfig];
@@ -499,7 +497,7 @@ class ParseGraphQLSchema {
}
async _getFunctionNames() {
return await getFunctionNames(this.appId).filter((functionName) => {
return await getFunctionNames(this.appId).filter(functionName => {
if (/^[_a-zA-Z][_a-zA-Z0-9]*$/.test(functionName)) {
return true;
} else {