weareinreach / InReach

Logical operator can be refactored to optional chain JS-W1044
Anti-pattern
Minor
23 days ago10 months old
Prefer using an optional chain expression instead, as it's more concise and easier to read
201						rightSection: { display: 'none' },
202					}}
203					filter={(value, item) =>
204						item &&205						item.label &&206						(item.label.toLowerCase().includes((value || '').toLowerCase().trim()) ||
207							item.tsKey.toLowerCase().includes((value || '').toLowerCase().trim()))
208					}
Prefer using an optional chain expression instead, as it's more concise and easier to read
244	api.geo.geoByPlaceId.useQuery(locationSearch, {
245		enabled: locationSearch !== '',
246		onSuccess: ({ result }) => {
247			if (result && result.city && result.govDist && result.country)248				form.setValues({ location: { city: result.city, govDist: result.govDist, country: result.country } })
249		},
250	})
Prefer using an optional chain expression instead, as it's more concise and easier to read
61					>{`Edit ${badgeType === 'organization-leadership' ? 'Organization Leadership' : 'Service Focus'} Badges`}</Title>
62					<Chip.Group multiple control={form.control} name='badges'>
63						<Stack spacing={12}>
64							{badgeOptions &&65								badgeOptions.map(({ id, tsKey, tsNs, icon }) => (66									<Chip.Item key={id} value={id}>67										{`${icon} ${t(tsKey, { ns: tsNs })}`}68									</Chip.Item>69								))}70						</Stack>
71					</Chip.Group>
72					<Button
Prefer using an optional chain expression instead, as it's more concise and easier to read
 74			onChange(updatedValue)
 75		} else {
 76			onChange(null)
 77			form && form.setError(name, { message: 'Invalid time range' }) 78		}
 79		// eslint-disable-next-line react-hooks/exhaustive-deps
 80	}, [openValue, closeValue])