TWNTY-3794 - ESLint rule: only take explicit boolean predicates in if statements (#4354)

* ESLint rule: only take explicit boolean predicates in if statements

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>

* Merge main

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>

* Fix frontend linter errors

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>

* Fix jest

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>

* Refactor according to review

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>

* Refactor according to review

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>

* Fix lint on new code

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>
This commit is contained in:
gitstart-app[bot]
2024-03-09 10:48:19 +01:00
committed by GitHub
parent 40bea0d95e
commit 17511be0cf
164 changed files with 655 additions and 367 deletions

View File

@ -27,7 +27,7 @@ export const ChangePassword = () => {
email: currentUser.email,
},
});
if (data?.emailPasswordResetLink?.success) {
if (data?.emailPasswordResetLink?.success === true) {
enqueueSnackBar('Password reset link has been sent to the email', {
variant: 'success',
});

View File

@ -47,12 +47,9 @@ export const NameFields = ({
// TODO: Enhance this with react-web-hook-form (https://www.react-hook-form.com)
const debouncedUpdate = debounce(async () => {
if (onFirstNameUpdate) {
onFirstNameUpdate(firstName);
}
if (onLastNameUpdate) {
onLastNameUpdate(lastName);
}
onFirstNameUpdate?.(firstName);
onLastNameUpdate?.(lastName);
try {
if (!currentWorkspaceMember?.id) {
throw new Error('User is not logged in');

View File

@ -7,6 +7,8 @@ import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
import { ImageInput } from '@/ui/input/components/ImageInput';
import { getImageAbsoluteURIOrBase64 } from '@/users/utils/getProfilePictureAbsoluteURI';
import { useUploadProfilePictureMutation } from '~/generated/graphql';
import { isNonNullable } from '~/utils/isNonNullable';
import { isNullable } from '~/utils/isNullable';
export const ProfilePictureUploader = () => {
const [uploadPicture, { loading: isUploading }] =
@ -25,7 +27,7 @@ export const ProfilePictureUploader = () => {
});
const handleUpload = async (file: File) => {
if (!file) {
if (isNullable(file)) {
return;
}
@ -72,7 +74,7 @@ export const ProfilePictureUploader = () => {
};
const handleAbort = async () => {
if (uploadController) {
if (isNonNullable(uploadController)) {
uploadController.abort();
setUploadController(null);
}