ci: Add lint rule for mandatory curly braces (#9348)

This commit is contained in:
Manuel
2024-10-16 19:57:42 +02:00
committed by GitHub
parent 714acaa906
commit dfd5a8edbf
22 changed files with 145 additions and 137 deletions

View File

@@ -142,7 +142,7 @@ const filterSensitiveData = (
object: any
) => {
let userId = null;
if (auth && auth.user) userId = auth.user.id;
if (auth && auth.user) { userId = auth.user.id; }
// replace protectedFields when using pointer-permissions
const perms =
@@ -1592,12 +1592,12 @@ class DatabaseController {
schema && schema.getClassLevelPermissions
? schema.getClassLevelPermissions(className)
: schema;
if (!perms) return null;
if (!perms) { return null; }
const protectedFields = perms.protectedFields;
if (!protectedFields) return null;
if (!protectedFields) { return null; }
if (aclGroup.indexOf(query.objectId) > -1) return null;
if (aclGroup.indexOf(query.objectId) > -1) { return null; }
// for queries where "keys" are set and do not include all 'userField':{field},
// we have to transparently include it, and then remove before returning to client

View File

@@ -666,10 +666,10 @@ const VolatileClassesSchemas = [
];
const dbTypeMatchesObjectType = (dbType: SchemaField | string, objectType: SchemaField) => {
if (dbType.type !== objectType.type) return false;
if (dbType.targetClass !== objectType.targetClass) return false;
if (dbType === objectType.type) return true;
if (dbType.type === objectType.type) return true;
if (dbType.type !== objectType.type) { return false; }
if (dbType.targetClass !== objectType.targetClass) { return false; }
if (dbType === objectType.type) { return true; }
if (dbType.type === objectType.type) { return true; }
return false;
};
@@ -1020,7 +1020,7 @@ export default class SchemaController {
}
const fieldType = fields[fieldName];
const error = fieldTypeIsInvalid(fieldType);
if (error) return { code: error.code, error: error.message };
if (error) { return { code: error.code, error: error.message }; }
if (fieldType.defaultValue !== undefined) {
let defaultValueType = getType(fieldType.defaultValue);
if (typeof defaultValueType === 'string') {

View File

@@ -122,7 +122,7 @@ export class UserController extends AdaptableController {
if (expiresDate && expiresDate.__type == 'Date') {
expiresDate = new Date(expiresDate.iso);
}
if (expiresDate < new Date()) throw 'The password reset link has expired';
if (expiresDate < new Date()) { throw 'The password reset link has expired'; }
}
return results[0];
});