Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix React ESLint errors #6307

Merged
merged 3 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/vs/base/browser/ui/positronComponents/button/button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2024 Posit Software, PBC. All rights reserved.
* Copyright (C) 2024-2025 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

Expand Down Expand Up @@ -165,24 +165,24 @@ export const Button = forwardRef<HTMLButtonElement, PropsWithChildren<ButtonProp
return (
<button
ref={buttonRef}
aria-disabled={props.disabled ? 'true' : undefined}
aria-label={props.ariaLabel}
className={positronClassNames(
'positron-button',
props.className,
{ 'disabled': props.disabled }
)}
style={props.style}
tabIndex={props.tabIndex ?? 0}
disabled={props.disabled}
role='button'
aria-label={props.ariaLabel}
aria-disabled={props.disabled ? 'true' : undefined}
onFocus={props.onFocus}
style={props.style}
tabIndex={props.tabIndex ?? 0}
onBlur={props.onBlur}
onKeyDown={keyDownHandler}
onClick={clickHandler}
onFocus={props.onFocus}
onKeyDown={keyDownHandler}
onMouseDown={mouseDownHandler}
onMouseEnter={mouseEnterHandler}
onMouseLeave={mouseLeaveHandler}
onMouseDown={mouseDownHandler}
>
{props.children}
</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2022-2024 Posit Software, PBC. All rights reserved.
* Copyright (C) 2022-2025 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

Expand Down Expand Up @@ -106,16 +106,16 @@ export const PositronButton = forwardRef<HTMLDivElement, PropsWithChildren<Props
return (
<div
ref={ref}
aria-disabled={props.disabled ? 'true' : undefined}
aria-label={props.ariaLabel}
className={positronClassNames(
props.className,
{ 'disabled': props.disabled }
)}
tabIndex={0}
role='button'
aria-label={props.ariaLabel}
aria-disabled={props.disabled ? 'true' : undefined}
onKeyDown={keyDownHandler}
tabIndex={0}
onClick={clickHandler}
onKeyDown={keyDownHandler}
onMouseDown={mouseDownHandler}
>
{props.children}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2024 Posit Software, PBC. All rights reserved.
* Copyright (C) 2024-2025 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

Expand Down Expand Up @@ -111,7 +111,7 @@ export const Scrollable = (props: PropsWithChildren<ScrollableProps>) => {
};

return (
<div className={positronClassNames('scrollable', { 'grab': !grabbing, 'grabbing': grabbing })} ref={scrollableRef} onMouseMoveCapture={panImage} onMouseDown={updateCursor} onMouseUp={updateCursor}>
<div ref={scrollableRef} className={positronClassNames('scrollable', { 'grab': !grabbing, 'grabbing': grabbing })} onMouseDown={updateCursor} onMouseMoveCapture={panImage} onMouseUp={updateCursor}>
{props.children}
</div >
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,9 @@ export const VerticalSplitter = ({
left: collapsible ? -1 : -(sashWidth / 2),
width: collapsible ? sashWidth + 2 : sashWidth
}}
onPointerDown={sashPointerDownHandler}
onPointerEnter={sashPointerEnterHandler}
onPointerLeave={sashPointerLeaveHandler}
onPointerDown={sashPointerDownHandler}
>
{showSash && (hovering || resizing) &&
<div
Expand All @@ -406,12 +406,12 @@ export const VerticalSplitter = ({
<Button
ref={expandCollapseButtonRef}
className='expand-collapse-button'
mouseTrigger={MouseTrigger.MouseDown}
style={{
top: EXPAND_COLLAPSE_BUTTON_TOP,
width: EXPAND_COLLAPSE_BUTTON_SIZE,
height: EXPAND_COLLAPSE_BUTTON_SIZE
}}
mouseTrigger={MouseTrigger.MouseDown}
onPressed={expandCollapseButtonPressedHandler}
>
<div
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2022-2024 Posit Software, PBC. All rights reserved.
* Copyright (C) 2022-2025 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

Expand Down Expand Up @@ -77,7 +77,7 @@ export const ActionBarButton = forwardRef<
*/
const ActionBarButtonFace = () => {
return (
<div className='action-bar-button-face' aria-hidden='true'>
<div aria-hidden='true' className='action-bar-button-face'>
{props.iconId && (
<div
className={positronClassNames(
Expand Down Expand Up @@ -114,16 +114,16 @@ export const ActionBarButton = forwardRef<
return (
<Button
ref={buttonRef}
hoverManager={context.hoverManager}
ariaLabel={ariaLabel}
className={positronClassNames(
'action-bar-button',
{ 'fade-in': optionalBoolean(props.fadeIn) },
{ 'checked': optionalBoolean(props.checked) }
)}
ariaLabel={ariaLabel}
tooltip={props.tooltip}
disabled={props.disabled}
hoverManager={context.hoverManager}
mouseTrigger={props.mouseTrigger}
tooltip={props.tooltip}
onMouseEnter={props.onMouseEnter}
onMouseLeave={props.onMouseLeave}
onPressed={props.onPressed}
Expand All @@ -141,12 +141,12 @@ export const ActionBarButton = forwardRef<
)}>
<Button
ref={buttonRef}
hoverManager={context.hoverManager}
className='action-bar-button-action-button'
ariaLabel={ariaLabel}
tooltip={props.tooltip}
className='action-bar-button-action-button'
disabled={props.disabled}
hoverManager={context.hoverManager}
mouseTrigger={props.mouseTrigger}
tooltip={props.tooltip}
onMouseEnter={props.onMouseEnter}
onMouseLeave={props.onMouseLeave}
onPressed={props.onPressed}
Expand All @@ -155,11 +155,11 @@ export const ActionBarButton = forwardRef<
</Button>
<Button
ref={dropdownButtonRef}
hoverManager={context.hoverManager}
className='action-bar-button-drop-down-button'
ariaLabel={props.dropdownAriaLabel}
tooltip={props.dropdownTooltip}
className='action-bar-button-drop-down-button'
hoverManager={context.hoverManager}
mouseTrigger={MouseTrigger.MouseDown}
tooltip={props.dropdownTooltip}
onPressed={props.onDropdownPressed}
>
<div className='action-bar-button-drop-down-arrow codicon codicon-positron-drop-down-arrow' />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2022-2024 Posit Software, PBC. All rights reserved.
* Copyright (C) 2022-2025 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

Expand Down Expand Up @@ -88,8 +88,8 @@ export const ActionBarCommandButton = (props: ActionBarCommandButtonProps) => {
<ActionBarButton
ref={buttonRef}
{...props}
tooltip={tooltip}
disabled={props.disabled || commandDisabled}
tooltip={tooltip}
onPressed={() =>
positronActionBarContext.commandService.executeCommand(props.commandId)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2022-2024 Posit Software, PBC. All rights reserved.
* Copyright (C) 2022-2025 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

Expand Down Expand Up @@ -54,13 +54,13 @@ export const ActionBarFilter = (props: ActionBarFilterProps) => {
<div className={positronClassNames('action-bar-filter-input', { 'focused': focused })}>
<input
ref={inputRef}
type='text'
className='text-input'
placeholder={(() => localize('positronFilterPlacehold', "filter"))()}
type='text'
value={filterText}
onFocus={() => setFocused(true)}
onBlur={() => setFocused(false)}
onChange={changeHandler} />
onChange={changeHandler}
onFocus={() => setFocused(true)} />
{filterText !== '' && (
<button className='clear-button'>
<div className={'codicon codicon-positron-search-cancel'} onClick={buttonClearClickHandler} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2022-2024 Posit Software, PBC. All rights reserved.
* Copyright (C) 2022-2025 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

Expand Down Expand Up @@ -56,21 +56,21 @@ export const ActionBarFind = (props: ActionBarFindProps) => {
<div className={positronClassNames('action-bar-find-input', { 'focused': focused })}>
<input
ref={inputRef}
type='text'
className='text-input'
placeholder={(() => localize('positronFindPlacehold', "find"))()}
type='text'
value={findText}
onFocus={() => setFocused(true)}
onBlur={() => setFocused(false)}
onChange={changeHandler} />
onChange={changeHandler}
onFocus={() => setFocused(true)} />
{findText !== '' && (
<button className='clear-button'>
<div className={'codicon codicon-positron-search-cancel'} onClick={buttonClearClickHandler} />
</button>
)}
</div>
<ActionBarButton iconId='chevron-up' align='right' tooltip={(() => localize('positronFindPrevious', "Find previous"))()} disabled={!props.findResults} onPressed={() => props.onFindPrevious!()} />
<ActionBarButton iconId='chevron-down' align='right' tooltip={(() => localize('positronFindNext', "Find next"))()} disabled={!props.findResults} onPressed={() => props.onFindNext!()} />
<ActionBarButton align='right' disabled={!props.findResults} iconId='chevron-up' tooltip={(() => localize('positronFindPrevious', "Find previous"))()} onPressed={() => props.onFindPrevious!()} />
<ActionBarButton align='right' disabled={!props.findResults} iconId='chevron-down' tooltip={(() => localize('positronFindNext', "Find next"))()} onPressed={() => props.onFindNext!()} />
</div>
);
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2022-2024 Posit Software, PBC. All rights reserved.
* Copyright (C) 2022-2025 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

Expand Down Expand Up @@ -131,6 +131,7 @@ export const ActionBarMenuButton = (props: ActionBarMenuButtonProps) => {
{...props}
dropdownIndicator={props.dropdownIndicator ?? 'enabled'}
mouseTrigger={MouseTrigger.MouseDown}
onDropdownPressed={async () => await showMenu()}
onPressed={async () => {
if (props.dropdownIndicator !== 'enabled-split') {
await showMenu();
Expand All @@ -139,7 +140,6 @@ export const ActionBarMenuButton = (props: ActionBarMenuButtonProps) => {
defaultAction ? defaultAction.run() : actions[0].run();
}
}}
onDropdownPressed={async () => await showMenu()}
/>
);
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2022-2024 Posit Software, PBC. All rights reserved.
* Copyright (C) 2022-2025 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

Expand Down Expand Up @@ -52,12 +52,12 @@ export const ActionBarSearch = (props: ActionBarSearchProps) => {
</button>
<input
ref={inputRef}
type='text'
className='text-input'
placeholder={props.placeholder}
onFocus={() => setFocused(true)}
type='text'
onBlur={() => setFocused(false)}
onChange={(e) => setSearchText(e.target.value)} />
onChange={(e) => setSearchText(e.target.value)}
onFocus={() => setFocused(true)} />
<button className='action-bar-search-button' onClick={cancelButtonClickHandler}>
<div className={positronClassNames('action-bar-search-button-icon', 'codicon', 'codicon-positron-search-cancel', { 'disabled': searchText === '' })} />
</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2022-2024 Posit Software, PBC. All rights reserved.
* Copyright (C) 2022-2025 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

Expand Down Expand Up @@ -27,11 +27,11 @@ export const ActionBarSeparator = (props: ActionBarSeparatorProps) => {
// Render.
return (
<div
aria-hidden='true'
className={positronClassNames(
'action-bar-separator',
{ 'fade-in': optionalBoolean(props.fadeIn) }
)}
aria-hidden='true' >
)} >
<div className='action-bar-separator-icon codicon codicon-positron-separator' />
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2022-2024 Posit Software, PBC. All rights reserved.
* Copyright (C) 2022-2025 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

Expand Down Expand Up @@ -127,12 +127,12 @@ export const PositronActionBar = (props: PropsWithChildren<PositronActionBarProp
return (
<div
className={classNames}
onKeyDown={props.nestedActionBar ? undefined : keyDownHandler}
style={{
gap: optionalValue(props.gap, 0),
paddingLeft: optionalValue(props.paddingLeft, 0),
paddingRight: optionalValue(props.paddingRight, 0)
}}>
}}
onKeyDown={props.nestedActionBar ? undefined : keyDownHandler}>
{props.children}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2023 Posit Software, PBC. All rights reserved.
* Copyright (C) 2023-2025 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

Expand Down Expand Up @@ -27,5 +27,5 @@ export const useRegisterWithActionBar = (refs: MutableRefObject<HTMLElement>[])
return () => {
refs.forEach(ref => focusableComponents.delete(ref.current));
};
}, []);
}, [focusableComponents, refs]);
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2024 Posit Software, PBC. All rights reserved.
* Copyright (C) 2024-2025 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

Expand Down Expand Up @@ -105,9 +105,9 @@ export class EditorActionBarControl extends Disposable {
configurationService={this._configurationService}
contextKeyService={this._contextKeyService}
contextMenuService={this._contextMenuService}
editorActionBarFactory={editorActionBarFactory}
hoverService={this._hoverService}
keybindingService={this._keybindingService}
editorActionBarFactory={editorActionBarFactory}
/>
);
}
Expand Down
Loading
Loading