Skip to content

Commit 538b7e5

Browse files
authored
refactor: fix sonarlint issues (#2280)
* fix: sonarlint issues Signed-off-by: Adam Setch <[email protected]> * fix: sonarlint issues Signed-off-by: Adam Setch <[email protected]> * fix: sonarlint issues Signed-off-by: Adam Setch <[email protected]> --------- Signed-off-by: Adam Setch <[email protected]>
1 parent fcdfced commit 538b7e5

File tree

15 files changed

+26
-26
lines changed

15 files changed

+26
-26
lines changed

src/main/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { sendRendererEvent } from './events';
1414

1515
export function takeScreenshot(mb: Menubar) {
1616
const date = new Date();
17-
const dateStr = date.toISOString().replace(/:/g, '-');
17+
const dateStr = date.toISOString().replaceAll(':', '-');
1818

1919
const capturedPicFilePath = path.join(
2020
os.homedir(),

src/renderer/components/filters/TokenSearchInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface TokenSearchInputProps {
1919
onRemove: (token: SearchToken) => void;
2020
}
2121

22-
const INPUT_KEY_EVENTS = ['Enter', 'Tab', ' ', ','];
22+
const INPUT_KEY_EVENTS: Set<string> = new Set(['Enter', 'Tab', ' ', ',']);
2323

2424
export const TokenSearchInput: FC<TokenSearchInputProps> = ({
2525
label,
@@ -51,7 +51,7 @@ export const TokenSearchInput: FC<TokenSearchInputProps> = ({
5151
}
5252

5353
function onKeyDown(e: React.KeyboardEvent<HTMLInputElement>) {
54-
if (INPUT_KEY_EVENTS.includes(e.key)) {
54+
if (INPUT_KEY_EVENTS.has(e.key)) {
5555
tryAddToken(e);
5656
setShowSuggestions(false);
5757
} else if (e.key === 'ArrowDown') {

src/renderer/components/metrics/MetricPill.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import { Label, Stack, Text } from '@primer/react';
66
import { type IconColor, Size } from '../../types';
77

88
export interface IMetricPill {
9-
key?: string;
109
title: string;
1110
metric?: number;
1211
icon: Icon;
1312
color: IconColor;
1413
}
1514

1615
export const MetricPill: FC<IMetricPill> = (props: IMetricPill) => {
16+
const Icon = props.icon;
17+
1718
return (
1819
<Label
1920
className="hover:bg-gitify-notification-pill-hover"
@@ -22,7 +23,7 @@ export const MetricPill: FC<IMetricPill> = (props: IMetricPill) => {
2223
variant="secondary"
2324
>
2425
<Stack align="center" direction="horizontal" gap="none">
25-
<props.icon className={props.color} size={Size.XSMALL} />
26+
<Icon className={props.color} size={Size.XSMALL} />
2627
{props.metric ? (
2728
<Text className="text-xxs px-1">{props.metric}</Text>
2829
) : null}

src/renderer/components/primitives/Title.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface ITitle {
1313
}
1414

1515
export const Title: FC<ITitle> = ({ size = 2, ...props }) => {
16-
const name = props.children.toLowerCase().replace(' ', '-');
16+
const name = props.children.toLowerCase().replaceAll(' ', '-');
1717

1818
return (
1919
<legend>

src/renderer/components/settings/AppearanceSettings.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ export const AppearanceSettings: FC = () => {
5959
<FieldLabel label="Theme:" name="theme" />
6060
<Select
6161
data-testid="settings-theme"
62-
id="theme"
6362
onChange={(evt) =>
6463
updateSetting('theme', evt.target.value as Theme)
6564
}

src/renderer/routes/__snapshots__/LoginWithOAuthApp.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/routes/__snapshots__/LoginWithPersonalAccessToken.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/routes/__snapshots__/Settings.test.tsx.snap

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/utils/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export function actionsURL(repositoryURL: string, filters: string[]): Link {
7777
}
7878

7979
// Note: the GitHub Actions UI cannot handle encoded '+' characters.
80-
return url.toString().replace(/%2B/g, '+') as Link;
80+
return url.toString().replaceAll('%2B', '+') as Link;
8181
}
8282

8383
async function getDiscussionUrl(notification: Notification): Promise<Link> {

src/renderer/utils/notifications/handlers/pullRequest.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ export async function getLatestReviewForReviewers(
139139
(review) => review.state === prReview.state,
140140
);
141141

142-
if (!reviewerFound) {
142+
if (reviewerFound) {
143+
reviewerFound.users.push(prReview.user.login);
144+
} else {
143145
reviewers.push({
144146
state: prReview.state,
145147
users: [prReview.user.login],
146148
});
147-
} else {
148-
reviewerFound.users.push(prReview.user.login);
149149
}
150150
}
151151

0 commit comments

Comments
 (0)