ci: Add lint rule for mandatory curly braces (#9348)
This commit is contained in:
@@ -76,7 +76,7 @@ const load = function (parseGraphQLSchema, parseClass, parseClassConfig: ?ParseG
|
||||
mutateAndGetPayload: async (args, context, mutationInfo) => {
|
||||
try {
|
||||
let { fields } = deepcopy(args);
|
||||
if (!fields) fields = {};
|
||||
if (!fields) { fields = {}; }
|
||||
const { config, auth, info } = context;
|
||||
|
||||
const parseFields = await transformTypes('create', fields, {
|
||||
@@ -179,7 +179,7 @@ const load = function (parseGraphQLSchema, parseClass, parseClassConfig: ?ParseG
|
||||
mutateAndGetPayload: async (args, context, mutationInfo) => {
|
||||
try {
|
||||
let { id, fields } = deepcopy(args);
|
||||
if (!fields) fields = {};
|
||||
if (!fields) { fields = {}; }
|
||||
const { config, auth, info } = context;
|
||||
|
||||
const globalIdObject = fromGlobalId(id);
|
||||
|
||||
@@ -453,7 +453,7 @@ const load = (parseGraphQLSchema, parseClass, parseClassConfig: ?ParseGraphQLCla
|
||||
description: `Use Inline Fragment on Array to get results: https://graphql.org/learn/queries/#inline-fragments`,
|
||||
type: parseClass.fields[field].required ? new GraphQLNonNull(type) : type,
|
||||
async resolve(source) {
|
||||
if (!source[field]) return null;
|
||||
if (!source[field]) { return null; }
|
||||
return source[field].map(async elem => {
|
||||
if (elem.className && elem.objectId && elem.__type === 'Object') {
|
||||
return elem;
|
||||
|
||||
@@ -57,7 +57,7 @@ const load = parseGraphQLSchema => {
|
||||
'viewer.user.',
|
||||
objectId
|
||||
);
|
||||
if (authDataResponse && viewer.user) viewer.user.authDataResponse = authDataResponse;
|
||||
if (authDataResponse && viewer.user) { viewer.user.authDataResponse = authDataResponse; }
|
||||
return {
|
||||
viewer,
|
||||
};
|
||||
@@ -134,7 +134,7 @@ const load = parseGraphQLSchema => {
|
||||
'viewer.user.',
|
||||
objectId
|
||||
);
|
||||
if (authDataResponse && viewer.user) viewer.user.authDataResponse = authDataResponse;
|
||||
if (authDataResponse && viewer.user) { viewer.user.authDataResponse = authDataResponse; }
|
||||
return {
|
||||
viewer,
|
||||
};
|
||||
@@ -198,7 +198,7 @@ const load = parseGraphQLSchema => {
|
||||
'viewer.user.',
|
||||
objectId
|
||||
);
|
||||
if (authDataResponse && viewer.user) viewer.user.authDataResponse = authDataResponse;
|
||||
if (authDataResponse && viewer.user) { viewer.user.authDataResponse = authDataResponse; }
|
||||
return {
|
||||
viewer,
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ export const extractKeysAndInclude = selectedFields => {
|
||||
selectedFields = selectedFields.filter(field => !field.includes('__typename'));
|
||||
// Handles "id" field for both current and included objects
|
||||
selectedFields = selectedFields.map(field => {
|
||||
if (field === 'id') return 'objectId';
|
||||
if (field === 'id') { return 'objectId'; }
|
||||
return field.endsWith('.id')
|
||||
? `${field.substring(0, field.lastIndexOf('.id'))}.objectId`
|
||||
: field;
|
||||
|
||||
@@ -82,7 +82,7 @@ const transformTypes = async (
|
||||
}
|
||||
});
|
||||
await Promise.all(promises);
|
||||
if (fields.ACL) fields.ACL = transformers.ACL(fields.ACL);
|
||||
if (fields.ACL) { fields.ACL = transformers.ACL(fields.ACL); }
|
||||
}
|
||||
return fields;
|
||||
};
|
||||
@@ -148,10 +148,10 @@ const transformers = {
|
||||
{ config, auth, info }
|
||||
) => {
|
||||
if (Object.keys(value).length === 0)
|
||||
throw new Parse.Error(
|
||||
Parse.Error.INVALID_POINTER,
|
||||
`You need to provide at least one operation on the relation mutation of field ${field}`
|
||||
);
|
||||
{ throw new Parse.Error(
|
||||
Parse.Error.INVALID_POINTER,
|
||||
`You need to provide at least one operation on the relation mutation of field ${field}`
|
||||
); }
|
||||
|
||||
const op = {
|
||||
__op: 'Batch',
|
||||
@@ -180,7 +180,7 @@ const transformers = {
|
||||
}
|
||||
|
||||
if (value.add || nestedObjectsToAdd.length > 0) {
|
||||
if (!value.add) value.add = [];
|
||||
if (!value.add) { value.add = []; }
|
||||
value.add = value.add.map(input => {
|
||||
const globalIdObject = fromGlobalId(input);
|
||||
if (globalIdObject.type === targetClass) {
|
||||
@@ -225,10 +225,10 @@ const transformers = {
|
||||
{ config, auth, info }
|
||||
) => {
|
||||
if (Object.keys(value).length > 1 || Object.keys(value).length === 0)
|
||||
throw new Parse.Error(
|
||||
Parse.Error.INVALID_POINTER,
|
||||
`You need to provide link OR createLink on the pointer mutation of field ${field}`
|
||||
);
|
||||
{ throw new Parse.Error(
|
||||
Parse.Error.INVALID_POINTER,
|
||||
`You need to provide link OR createLink on the pointer mutation of field ${field}`
|
||||
); }
|
||||
|
||||
let nestedObjectToAdd;
|
||||
if (value.createAndLink) {
|
||||
|
||||
Reference in New Issue
Block a user