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:
committed by
GitHub
parent
40bea0d95e
commit
17511be0cf
@ -19,6 +19,7 @@ import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownM
|
||||
import { SelectableItem } from '@/ui/layout/selectable-list/components/SelectableItem';
|
||||
import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList';
|
||||
import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem';
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
|
||||
export const StyledSelectableItem = styled(SelectableItem)`
|
||||
height: 100%;
|
||||
@ -152,7 +153,7 @@ export const MultipleObjectRecordSelect = ({
|
||||
(entity) => entity.record.id === recordId,
|
||||
);
|
||||
|
||||
if (correspondingRecordForSelect) {
|
||||
if (isNonNullable(correspondingRecordForSelect)) {
|
||||
handleSelectChange(
|
||||
correspondingRecordForSelect,
|
||||
!recordIsSelected,
|
||||
|
||||
@ -6,6 +6,7 @@ import {
|
||||
} from '@/object-record/relation-picker/components/SingleEntitySelectMenuItemsWithSearch';
|
||||
import { DropdownMenu } from '@/ui/layout/dropdown/components/DropdownMenu';
|
||||
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
|
||||
export type SingleEntitySelectProps = {
|
||||
disableBackgroundBlur?: boolean;
|
||||
@ -37,7 +38,7 @@ export const SingleEntitySelect = ({
|
||||
event.target instanceof HTMLInputElement &&
|
||||
event.target.tagName === 'INPUT'
|
||||
);
|
||||
if (weAreNotInAnHTMLInput && onCancel) {
|
||||
if (weAreNotInAnHTMLInput && isNonNullable(onCancel)) {
|
||||
onCancel();
|
||||
}
|
||||
},
|
||||
|
||||
@ -76,7 +76,7 @@ export const SingleEntitySelectMenuItems = ({
|
||||
selectableItemIdArray={selectableItemIds}
|
||||
hotkeyScope={RelationPickerHotkeyScope.RelationPicker}
|
||||
onEnter={(itemId) => {
|
||||
if (showCreateButton) {
|
||||
if (showCreateButton === true) {
|
||||
onCreate?.();
|
||||
} else {
|
||||
const entity = entitiesInDropdown.findIndex(
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
|
||||
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||
import { getLabelIdentifierFieldMetadataItem } from '@/object-metadata/utils/getLabelIdentifierFieldMetadataItem';
|
||||
import { ObjectRecordQueryFilter } from '@/object-record/record-filter/types/ObjectRecordQueryFilter';
|
||||
@ -23,10 +25,10 @@ export const useSearchFilterPerMetadataItem = ({
|
||||
|
||||
let searchFilter: ObjectRecordQueryFilter = {};
|
||||
|
||||
if (labelIdentifierFieldMetadataItem) {
|
||||
if (isNonNullable(labelIdentifierFieldMetadataItem)) {
|
||||
switch (labelIdentifierFieldMetadataItem.type) {
|
||||
case FieldMetadataType.FullName: {
|
||||
if (searchFilterValue) {
|
||||
if (isNonEmptyString(searchFilterValue)) {
|
||||
const fullNameFilter = makeOrFilterVariables([
|
||||
{
|
||||
[labelIdentifierFieldMetadataItem.name]: {
|
||||
@ -44,14 +46,14 @@ export const useSearchFilterPerMetadataItem = ({
|
||||
},
|
||||
]);
|
||||
|
||||
if (fullNameFilter) {
|
||||
if (isNonNullable(fullNameFilter)) {
|
||||
searchFilter = fullNameFilter;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (searchFilterValue) {
|
||||
if (isNonEmptyString(searchFilterValue)) {
|
||||
searchFilter = {
|
||||
[labelIdentifierFieldMetadataItem.name]: {
|
||||
ilike: `%${searchFilterValue}%`,
|
||||
|
||||
Reference in New Issue
Block a user