diff --git a/README.md b/README.md index 9be0b3270..2c868f9c9 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Optional: If you prefer to use your own OAuth credentials, you can do so by pass To watch for changes(`webpack`) in the `src` directory: - pnpm run watch + pnpm watch To run the **electron app**: @@ -54,15 +54,17 @@ The release process is automated. Follow the steps below. ### Tests There are 2 checks - one for prettier and one for the unit tests with `jest`. - +``` // Run prettier to check - pnpm run prettier:check + pnpm prettier:check // Run linter & unit tests with coverage - pnpm run test + pnpm test - // Run jest directly - allows to pass arguments like `--watch` - pnpm run jest + // If you want to pass arguments to jest (or other `pnpm` commands) + // like `--watch`, you can prepend `--` to the command + pnpm test -- --watch +``` ### FAQ diff --git a/package.json b/package.json index 1e5e6ca6b..69e56a6ea 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "jest": "^26.6.3", "nock": "^13.0.5", "postcss-loader": "^4.1.0", - "prettier": "=2.2.1", + "prettier": "^2.8.8", "react-test-renderer": "=16.13.1", "style-loader": "^2.0.0", "ts-jest": "^26.4.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fe33b0505..70ec2ff02 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -112,8 +112,8 @@ devDependencies: specifier: ^4.1.0 version: 4.1.0(postcss@8.4.23)(webpack@5.83.1) prettier: - specifier: '=2.2.1' - version: 2.2.1 + specifier: ^2.8.8 + version: 2.8.8 react-test-renderer: specifier: '=16.13.1' version: 16.13.1(react@16.13.1) @@ -4706,8 +4706,8 @@ packages: resolution: {integrity: sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA==} engines: {node: '>=4'} - /prettier@2.2.1: - resolution: {integrity: sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==} + /prettier@2.8.8: + resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} engines: {node: '>=10.13.0'} hasBin: true dev: true diff --git a/src/routes/Notifications.tsx b/src/routes/Notifications.tsx index 247aa5695..d028744a1 100644 --- a/src/routes/Notifications.tsx +++ b/src/routes/Notifications.tsx @@ -8,17 +8,19 @@ import { Oops } from '../components/Oops'; export const NotificationsRoute: React.FC = (props) => { const { notifications, requestFailed } = useContext(AppContext); - const hasMultipleAccounts = useMemo(() => notifications.length > 1, [ - notifications, - ]); + const hasMultipleAccounts = useMemo( + () => notifications.length > 1, + [notifications] + ); const notificationsCount = useMemo( () => notifications.reduce((memo, acc) => memo + acc.notifications.length, 0), [notifications] ); - const hasNotifications = useMemo(() => notificationsCount > 0, [ - notificationsCount, - ]); + const hasNotifications = useMemo( + () => notificationsCount > 0, + [notificationsCount] + ); if (requestFailed) { return ; diff --git a/src/utils/github-api.ts b/src/utils/github-api.ts index 73737520f..ecc2dfb0f 100644 --- a/src/utils/github-api.ts +++ b/src/utils/github-api.ts @@ -18,9 +18,10 @@ const DESCRIPTIONS = { UNKNOWN: 'The reason for this notification is not supported by the app.', }; -export function formatReason( - reason: Reason -): { type: string; description: string } { +export function formatReason(reason: Reason): { + type: string; + description: string; +} { // prettier-ignore switch (reason) { case 'assign': diff --git a/src/utils/notifications.test.ts b/src/utils/notifications.test.ts index 86bea2f3a..89b75ff56 100644 --- a/src/utils/notifications.test.ts +++ b/src/utils/notifications.test.ts @@ -104,10 +104,11 @@ describe('utils/notifications.ts', () => { it('should click on a native notification (with 1 notification)', () => { spyOn(comms, 'openExternalLink'); - const nativeNotification: Notification = notificationsHelpers.raiseNativeNotification( - [mockedGithubNotifications[0]], - mockedUser.id - ); + const nativeNotification: Notification = + notificationsHelpers.raiseNativeNotification( + [mockedGithubNotifications[0]], + mockedUser.id + ); nativeNotification.onclick(null); const notif = mockedGithubNotifications[0]; diff --git a/src/utils/notifications.ts b/src/utils/notifications.ts index 969dddf19..2496a4822 100644 --- a/src/utils/notifications.ts +++ b/src/utils/notifications.ts @@ -31,9 +31,8 @@ export const triggerNativeNotifications = ( return account.notifications; } - const accountPreviousNotificationsIds = accountPreviousNotifications.notifications.map( - (item) => item.id - ); + const accountPreviousNotificationsIds = + accountPreviousNotifications.notifications.map((item) => item.id); const accountNewNotifications = account.notifications.filter((item) => { return !accountPreviousNotificationsIds.includes(`${item.id}`);