refactor: remove true from boolean attribute (#2579)

When using a boolean attribute in JSX, you can set the attribute value to true or omit the value. This helps to keep consistency in code.

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
This commit is contained in:
deepsource-autofix[bot] 2023-11-01 12:30:21 +05:30 committed by GitHub
parent b7d5a42d45
commit 80e6d7e1ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 35 additions and 35 deletions

View File

@ -23,8 +23,8 @@ export const ImageResizer = ({ editor }: { editor: Editor }) => {
origin={false}
edge={false}
throttleDrag={0}
keepRatio={true}
resizable={true}
keepRatio
resizable
throttleResize={0}
onResize={({ target, width, height, delta }: any) => {
delta[0] && (target!.style.width = `${width}px`);
@ -33,7 +33,7 @@ export const ImageResizer = ({ editor }: { editor: Editor }) => {
onResizeEnd={() => {
updateMediaSize();
}}
scalable={true}
scalable
renderDirections={["w", "e"]}
onScale={({ target, transform }: any) => {
target!.style.transform = transform;

View File

@ -334,7 +334,7 @@ export const SingleCycleCard: React.FC<TSingleStatProps> = ({
position="bottom"
>
<div className="flex w-full items-center">
<LinearProgressIndicator data={progressIndicatorData} noTooltip={true} />
<LinearProgressIndicator data={progressIndicatorData} noTooltip />
</div>
</Tooltip>
<Disclosure.Button>

View File

@ -128,7 +128,7 @@ export const Exporter: React.FC<Props> = observer((props) => {
value={value ?? []}
onChange={(val: string[]) => onChange(val)}
options={options}
input={true}
input
label={
value && value.length > 0
? projects &&

View File

@ -150,7 +150,7 @@ const IntegrationGuide = () => {
</>
{provider && (
<Exporter
isOpen={true}
isOpen
handleClose={() => handleCsvClose()}
data={null}
user={user}

View File

@ -114,7 +114,7 @@ export const IssueDescriptionForm: FC<IssueDetailsProps> = (props) => {
onChange(e.target.value);
debouncedFormSave();
}}
required={true}
required
className="min-h-10 block w-full resize-none overflow-hidden rounded border-none bg-transparent px-3 py-2 text-xl outline-none ring-0 focus:ring-1 focus:ring-custom-primary"
hasError={Boolean(errors?.description)}
role="textbox"

View File

@ -111,7 +111,7 @@ export const KanBanProperties: React.FC<IKanBanProperties> = observer((props) =>
onChange={handleState}
states={states}
disabled={false}
hideDropdownArrow={true}
hideDropdownArrow
/>
)}
@ -121,7 +121,7 @@ export const KanBanProperties: React.FC<IKanBanProperties> = observer((props) =>
value={issue?.priority || null}
onChange={handlePriority}
disabled={false}
hideDropdownArrow={true}
hideDropdownArrow
/>
)}
@ -132,7 +132,7 @@ export const KanBanProperties: React.FC<IKanBanProperties> = observer((props) =>
onChange={handleLabel}
labels={labels}
disabled={false}
hideDropdownArrow={true}
hideDropdownArrow
/>
)}
@ -140,7 +140,7 @@ export const KanBanProperties: React.FC<IKanBanProperties> = observer((props) =>
{displayProperties && displayProperties?.assignee && (
<IssuePropertyAssignee
value={issue?.assignees || null}
hideDropdownArrow={true}
hideDropdownArrow
onChange={handleAssignee}
members={members}
disabled={false}
@ -174,7 +174,7 @@ export const KanBanProperties: React.FC<IKanBanProperties> = observer((props) =>
onChange={handleEstimate}
estimatePoints={estimates}
disabled={false}
hideDropdownArrow={true}
hideDropdownArrow
/>
)}

View File

@ -136,7 +136,7 @@ export const List: React.FC<IList> = observer((props) => {
handleIssues={handleIssues}
quickActions={quickActions}
display_properties={display_properties}
is_list={true}
is_list
states={states}
labels={labels}
members={members}

View File

@ -62,7 +62,7 @@ export const KanBanProperties: FC<IKanBanProperties> = observer((props) => {
{display_properties && display_properties?.state && states && (
<IssuePropertyState
value={issue?.state_detail || null}
hideDropdownArrow={true}
hideDropdownArrow
onChange={handleState}
disabled={false}
states={states}
@ -75,7 +75,7 @@ export const KanBanProperties: FC<IKanBanProperties> = observer((props) => {
value={issue?.priority || null}
onChange={handlePriority}
disabled={false}
hideDropdownArrow={true}
hideDropdownArrow
/>
)}
@ -86,7 +86,7 @@ export const KanBanProperties: FC<IKanBanProperties> = observer((props) => {
onChange={handleLabel}
labels={labels}
disabled={false}
hideDropdownArrow={true}
hideDropdownArrow
/>
)}
@ -94,7 +94,7 @@ export const KanBanProperties: FC<IKanBanProperties> = observer((props) => {
{display_properties && display_properties?.assignee && members && (
<IssuePropertyAssignee
value={issue?.assignees || null}
hideDropdownArrow={true}
hideDropdownArrow
onChange={handleAssignee}
disabled={false}
members={members}
@ -126,7 +126,7 @@ export const KanBanProperties: FC<IKanBanProperties> = observer((props) => {
<IssuePropertyEstimates
value={issue?.estimate_point || null}
estimatePoints={estimates}
hideDropdownArrow={true}
hideDropdownArrow
onChange={handleEstimate}
disabled={false}
/>

View File

@ -57,7 +57,7 @@ export const PeekOverviewProperties: FC<IPeekOverviewProperties> = (props) => {
onChange={handleState}
states={states}
disabled={false}
hideDropdownArrow={true}
hideDropdownArrow
/>
</div>
</div>
@ -75,7 +75,7 @@ export const PeekOverviewProperties: FC<IPeekOverviewProperties> = (props) => {
value={issue?.assignees || null}
onChange={(ids: string[]) => handleAssignee(ids)}
disabled={false}
hideDropdownArrow={true}
hideDropdownArrow
members={members}
/>
</div>
@ -94,7 +94,7 @@ export const PeekOverviewProperties: FC<IPeekOverviewProperties> = (props) => {
value={issue?.priority || null}
onChange={handlePriority}
disabled={false}
hideDropdownArrow={true}
hideDropdownArrow
/>
</div>
</div>

View File

@ -50,7 +50,7 @@ export const IssueAssigneeSelect: React.FC<Props> = ({ projectId, value = [], on
<div className="flex items-center gap-2 cursor-pointer text-xs text-custom-text-200">
{value && value.length > 0 && Array.isArray(value) ? (
<div className="-my-0.5 flex items-center justify-center gap-2">
<AssigneesList userIds={value} length={3} showLength={true} />
<AssigneesList userIds={value} length={3} showLength />
</div>
) : (
<div className="flex items-center justify-center gap-2 px-1.5 py-1 rounded shadow-sm border border-custom-border-300 hover:bg-custom-background-80">

View File

@ -49,7 +49,7 @@ export const IssueLabelSelect: React.FC<Props> = ({ setIsOpen, value, onChange,
<IssueLabelsList
labels={value.map((v) => issueLabels?.find((l) => l.id === v)) ?? []}
length={3}
showLength={true}
showLength
/>
</span>
) : (

View File

@ -177,7 +177,7 @@ export const ProjectCard: React.FC<ProjectCardProps> = observer((props) => {
>
{projectMembersIds.length > 0 ? (
<div className="flex items-center cursor-pointer gap-2 text-custom-text-200">
<AssigneesList userIds={projectMembersIds} length={3} showLength={true} />
<AssigneesList userIds={projectMembersIds} length={3} showLength />
</div>
) : (
<span className="text-sm italic text-custom-text-400">No Member Yet</span>

View File

@ -87,7 +87,7 @@ export const MembersSelect: React.FC<Props> = ({
>
<div className="flex items-center cursor-pointer h-full w-full gap-2 text-custom-text-200">
{value && value.length > 0 && Array.isArray(value) ? (
<AssigneesList userIds={value} length={3} showLength={true} />
<AssigneesList userIds={value} length={3} showLength />
) : (
<span
className="flex items-center justify-between gap-1 h-full w-full text-xs px-2.5 py-1 rounded border-[0.5px] border-custom-border-300 duration-300 focus:outline-none

View File

@ -121,7 +121,7 @@ export const ProjectSidebarList: FC = observer(() => {
{(provided) => (
<div ref={provided.innerRef} {...provided.droppableProps}>
{orderedFavProjects && orderedFavProjects.length > 0 && (
<Disclosure as="div" className="flex flex-col" defaultOpen={true}>
<Disclosure as="div" className="flex flex-col" defaultOpen>
{({ open }) => (
<>
{!isCollapsed && (
@ -186,7 +186,7 @@ export const ProjectSidebarList: FC = observer(() => {
{(provided) => (
<div ref={provided.innerRef} {...provided.droppableProps}>
{orderedJoinedProjects && orderedJoinedProjects.length > 0 && (
<Disclosure as="div" className="flex flex-col" defaultOpen={true}>
<Disclosure as="div" className="flex flex-col" defaultOpen>
{({ open }) => (
<>
{!isCollapsed && (

View File

@ -43,7 +43,7 @@ export const BarGraph: React.FC<Props & TGraph & Omit<BarSvgProps<any>, "height"
}}
labelTextColor={{ from: "color", modifiers: [["darker", 1.6]] }}
theme={{ ...CHARTS_THEME, ...(theme ?? {}) }}
animate={true}
animate
enableLabel={rest.enableLabel ?? false}
{...rest}
/>

View File

@ -30,7 +30,7 @@ export const LineGraph: React.FC<Props & TGraph & LineSvgProps> = ({
: undefined,
}}
theme={{ ...CHARTS_THEME, ...(theme ?? {}) }}
animate={true}
animate
{...rest}
/>
</div>

View File

@ -16,7 +16,7 @@ export const PieGraph: React.FC<TGraph & Omit<PieSvgProps<any>, "height" | "widt
<ResponsivePie
margin={{ ...DEFAULT_MARGIN, ...(margin ?? {}) }}
theme={{ ...CHARTS_THEME, ...(theme ?? {}) }}
animate={true}
animate
{...rest}
/>
</div>

View File

@ -11,7 +11,7 @@ export const ScatterPlotGraph: React.FC<
<div style={{ height, width }}>
<ResponsiveScatterPlot
margin={{ ...DEFAULT_MARGIN, ...(margin ?? {}) }}
animate={true}
animate
theme={{ ...CHARTS_THEME, ...(theme ?? {}) }}
{...rest}
/>

View File

@ -89,7 +89,7 @@ export const IssueWebViewForm: React.FC<Props> = (props) => {
setIsSubmitting("submitting");
debouncedTitleSave();
}}
required={true}
required
className="min-h-10 block w-full resize-none overflow-hidden rounded border bg-transparent px-3 py-2 text-xl outline-none ring-0 focus:ring-1 focus:ring-custom-primary"
role="textbox"
disabled={!isAllowed}
@ -125,7 +125,7 @@ export const IssueWebViewForm: React.FC<Props> = (props) => {
? "<p></p>"
: value
}
debouncedUpdatesEnabled={true}
debouncedUpdatesEnabled
setShouldShowAlert={setShowAlert}
setIsSubmitting={setIsSubmitting}
customClassName={isAllowed ? "min-h-[150px] shadow-sm" : "!p-0 !pt-2 text-custom-text-200"}

View File

@ -338,7 +338,7 @@ const SinglePage: NextPage = () => {
placeholder="Page Title"
onBlur={handleSubmit(updatePage)}
onChange={(e) => setValue("name", e.target.value)}
required={true}
required
className="min-h-10 block w-full resize-none overflow-hidden rounded border-none bg-transparent !px-3 !py-2 text-xl font-semibold outline-none ring-0"
role="textbox"
/>

View File

@ -62,7 +62,7 @@ const Editor: NextPage = () => {
deleteFile={fileService.deleteImage}
borderOnFocus={false}
value={!value || value === "" ? "<p></p>" : value}
noBorder={true}
noBorder
customClassName="h-full shadow-sm overflow-auto"
editorContentCustomClassNames="pb-9"
onChange={(description: Object, description_html: string) => {