Skip to content

Commit

Permalink
refactor: enable nursery use default switch clause rule
Browse files Browse the repository at this point in the history
  • Loading branch information
setchy committed Jun 12, 2024
1 parent b16c249 commit bf68df9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"rules": {
"recommended": true,
"nursery": {
"noUnusedFunctionParameters": "error"
"noUnusedFunctionParameters": "error",
"useDefaultSwitchClause": "error"
},
"correctness": {
"useExhaustiveDependencies": {
Expand Down
1 change: 0 additions & 1 deletion src/components/AccountNotifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export const AccountNotifications = (props: IProps) => {
return (
<RepositoryNotifications
key={repoSlug}
account={account}
repoName={repoSlug}
repoNotifications={repoNotifications}
/>
Expand Down
3 changes: 0 additions & 3 deletions src/components/Repository.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@ import { CheckIcon, MarkGithubIcon, ReadIcon } from '@primer/octicons-react';
import { type FC, useCallback, useContext } from 'react';
import { CSSTransition, TransitionGroup } from 'react-transition-group';
import { AppContext } from '../context/App';
import type { Account } from '../types';
import type { Notification } from '../typesGitHub';
import { openRepository } from '../utils/links';
import { NotificationRow } from './NotificationRow';

interface IProps {
account: Account;
repoNotifications: Notification[];
repoName: string;
}

export const RepositoryNotifications: FC<IProps> = ({
repoName,
repoNotifications,
account,
}) => {
const { markRepoNotificationsRead, markRepoNotificationsDone } =
useContext(AppContext);
Expand Down
10 changes: 10 additions & 0 deletions src/utils/auth/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { AxiosPromise, AxiosResponse } from 'axios';
import { mockAuth, mockGitHubCloudAccount } from '../../__mocks__/state-mocks';
import type { Account, AuthState } from '../../types';
import * as apiRequests from '../api/request';
import type { AuthMethod } from './types';
import * as auth from './utils';
import { getNewOAuthAppURL, getNewTokenURL } from './utils';

Expand Down Expand Up @@ -222,18 +223,27 @@ describe('utils/auth/utils.ts', () => {
method: 'GitHub App',
} as Account),
).toBe('https://github.com/settings/apps');

expect(
auth.getDeveloperSettingsURL({
hostname: 'github.com',
method: 'OAuth App',
} as Account),
).toBe('https://github.com/settings/developers');

expect(
auth.getDeveloperSettingsURL({
hostname: 'github.com',
method: 'Personal Access Token',
} as Account),
).toBe('https://github.com/settings/tokens');

expect(
auth.getDeveloperSettingsURL({
hostname: 'github.com',
method: 'unknown' as AuthMethod,
} as Account),
).toBe('https://github.com/settings');
});

describe('getNewTokenURL', () => {
Expand Down
3 changes: 3 additions & 0 deletions src/utils/auth/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ export function getDeveloperSettingsURL(account: Account): string {
case 'Personal Access Token':
settingsURL.pathname = '/settings/tokens';
break;
default:
settingsURL.pathname = '/settings';
break;
}
return settingsURL.toString();
}
Expand Down

0 comments on commit bf68df9

Please sign in to comment.