Skip to content

Commit 9bb49c2

Browse files
authored
refactor: streamline imports and improve type usage across components (#116)
- Updated import statements to use `type` for TypeScript types in various components and hooks. - Reordered props in `ProjectMenu`, `PullRequest`, and other components for consistency. - Removed unnecessary imports and cleaned up code formatting in multiple files. - Enhanced the `getStatusIcon` utility to handle GitHub action statuses more effectively. - Introduced a new utility file `gitHubStatusUtils.ts` for managing GitHub action status icons. - Improved type definitions in `Modal`, `Group`, and `Project` types for better clarity and maintainability. - Added ESLint configuration for improved code quality and consistency. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a utility to display GitHub action run statuses with corresponding icons. * **Bug Fixes** * Improved accuracy and consistency in type definitions and prop handling across multiple components. * **Refactor** * Streamlined import statements to use explicit type-only imports for better type clarity. * Reorganized and updated type declarations, converting many interfaces to type aliases. * Enhanced code readability by reordering props, destructuring, and import statements throughout the codebase. * **Chores** * Updated and renamed scripts in the project configuration. * Upgraded dependency versions for improved stability and compatibility. * Introduced a new ESLint configuration for TypeScript files. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent e927dca commit 9bb49c2

File tree

85 files changed

+2758
-2814
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2758
-2814
lines changed

eslint.config.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import config from '@egor.xyz/eslint-config';
2+
import tseslint from 'typescript-eslint';
3+
4+
export default tseslint.config(
5+
{
6+
// ignore files and folders from root: node_modules, dist, build, *.js, *.ts
7+
ignores: ['node_modules', 'dist', 'build', '*.js', '*.ts', '.tmp', '.vite']
8+
},
9+
{
10+
extends: config,
11+
files: ['**/*.{ts,tsx}']
12+
}
13+
);

package-lock.json

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

package.json

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
"description": "Your Daily GitHub Desktop Assistant",
66
"main": ".vite/build/app.js",
77
"scripts": {
8-
"start": "electron-forge start",
8+
"dev": "electron-forge start",
99
"package:arm": "electron-forge package --arch=arm64",
1010
"make": "electron-forge make --arch=x64,arm64",
1111
"make:arm": "NODE_ENV=production electron-forge make --arch=arm64",
1212
"publish": "electron-forge publish --arch=x64,arm64 --platform=darwin",
13-
"eslint": "eslint --ext .ts,.tsx . --fix",
13+
"lint": "eslint --ext .ts,.tsx . --fix",
1414
"debug": "electron-forge start --vscode"
1515
},
1616
"keywords": [],
@@ -23,55 +23,56 @@
2323
"homepage": "https://devkitty.app/",
2424
"license": "MIT",
2525
"dependencies": {
26-
"@blueprintjs/core": "^5.16.0",
27-
"@blueprintjs/select": "^5.3.5",
26+
"@blueprintjs/core": "^5.19.1",
27+
"@blueprintjs/select": "^5.3.21",
2828
"clsx": "^2.1.1",
29-
"electron-log": "5.2.3",
30-
"electron-store": "^10.0.0",
31-
"get-installed-apps": "^1.1.0",
29+
"electron-log": "^5.4.1",
30+
"electron-store": "^10.1.0",
31+
"get-installed-apps": "^1.1.1",
3232
"lodash": "^4.17.21",
33-
"octokit": "^4.0.2",
33+
"octokit": "^4.1.4",
3434
"polished": "^4.3.1",
3535
"react": "^18.3.1",
3636
"react-dnd": "^16.0.1",
3737
"react-dnd-html5-backend": "^16.0.1",
3838
"react-dom": "^18.3.1",
39-
"react-icons": "^5.3.0",
40-
"react-router": "^7.0.1",
41-
"simple-git": "^3.27.0",
42-
"styled-components": "^6.1.13",
43-
"update-electron-app": "^3.0.0",
44-
"uuid": "^11.0.3",
45-
"zustand": "^5.0.1"
39+
"react-icons": "^5.5.0",
40+
"react-router": "^7.6.2",
41+
"simple-git": "^3.28.0",
42+
"styled-components": "^6.1.19",
43+
"update-electron-app": "^3.1.1",
44+
"uuid": "^11.1.0",
45+
"zustand": "^5.0.5"
4646
},
4747
"devDependencies": {
48-
"@egor.xyz/eslint-config": "3.0.0",
49-
"@electron-forge/cli": "^7.6.0",
50-
"@electron-forge/maker-deb": "^7.6.0",
51-
"@electron-forge/maker-dmg": "^7.6.0",
52-
"@electron-forge/maker-rpm": "^7.6.0",
53-
"@electron-forge/maker-squirrel": "^7.6.0",
54-
"@electron-forge/maker-zip": "^7.6.0",
55-
"@electron-forge/plugin-auto-unpack-natives": "^7.6.0",
56-
"@electron-forge/plugin-fuses": "^7.6.0",
57-
"@electron-forge/plugin-vite": "^7.6.0",
58-
"@electron-forge/publisher-github": "^7.6.0",
48+
"@egor.xyz/eslint-config": "^3.5.0",
49+
"@electron-forge/cli": "^7.8.1",
50+
"@electron-forge/maker-deb": "^7.8.1",
51+
"@electron-forge/maker-dmg": "^7.8.1",
52+
"@electron-forge/maker-rpm": "^7.8.1",
53+
"@electron-forge/maker-squirrel": "^7.8.1",
54+
"@electron-forge/maker-zip": "^7.8.1",
55+
"@electron-forge/plugin-auto-unpack-natives": "^7.8.1",
56+
"@electron-forge/plugin-fuses": "^7.8.1",
57+
"@electron-forge/plugin-vite": "^7.8.1",
58+
"@electron-forge/publisher-github": "^7.8.1",
5959
"@electron/fuses": "^1.8.0",
60-
"@types/lodash": "^4.17.13",
61-
"@types/react": "^18.3.12",
62-
"@types/react-dom": "^18.3.1",
60+
"@eslint/eslintrc": "^3.3.1",
61+
"@types/lodash": "^4.17.19",
62+
"@types/react": "^18.3.23",
63+
"@types/react-dom": "^18.3.7",
6364
"@types/styled-components": "^5.1.34",
6465
"@types/uuid": "^10.0.0",
65-
"@vitejs/plugin-react": "^4.3.4",
66+
"@vitejs/plugin-react": "^4.6.0",
6667
"babel-plugin-styled-components": "^2.1.4",
67-
"dotenv": "^16.4.5",
68-
"electron": "^33.2.1",
69-
"electron-devtools-installer": "^3.2.0",
68+
"dotenv": "^16.5.0",
69+
"electron": "^33.4.11",
70+
"electron-devtools-installer": "^3.2.1",
7071
"ts-node": "^10.9.2",
71-
"typescript": "^5.7.2",
72-
"vite": "^6.0.1",
73-
"vite-plugin-checker": "^0.8.0",
72+
"typescript": "^5.8.3",
73+
"vite": "^6.3.5",
74+
"vite-plugin-checker": "^0.9.3",
7475
"vite-plugin-svgr": "^4.3.0",
75-
"vite-tsconfig-paths": "^5.1.3"
76+
"vite-tsconfig-paths": "^5.1.4"
7677
}
7778
}

src/main/app.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { app, BrowserWindow, nativeTheme, shell } from 'electron';
2-
import path from 'path';
3-
42
import installExtension, { REACT_DEVELOPER_TOOLS } from 'electron-devtools-installer';
53
import log from 'electron-log';
4+
import path from 'path';
65
import { updateElectronApp } from 'update-electron-app';
76

87
import './ipcs';

src/main/ipcs/ipcDarkMode.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { ipcMain, nativeTheme } from 'electron';
2-
3-
import { ThemeSource } from 'types/Modal';
2+
import { type ThemeSource } from 'types/Modal';
43

54
import { settings } from '../settings';
65

src/main/ipcs/ipcGit.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { ipcMain } from 'electron';
2-
32
import { CleanOptions, ResetMode } from 'simple-git';
4-
5-
import { GitStatus } from 'types/project';
3+
import { type GitStatus } from 'types/project';
64

75
import { getGit } from '../libs/git';
86

@@ -21,7 +19,7 @@ ipcMain.handle('git:getStatus', async (_, id: string): Promise<GitStatus> => {
2119
try {
2220
const origin = await git.remote(['get-url', 'origin']);
2321
organization = origin ? origin.split(':')[1].split('/')[0] : undefined;
24-
} catch (e) {
22+
} catch {
2523
/* empty */
2624
}
2725

@@ -67,7 +65,9 @@ ipcMain.handle('git:reset', async (_, id: string, target, force) => {
6765

6866
await git.clean(CleanOptions.FORCE);
6967

70-
force && (await git.push(['-f']));
68+
if (force) {
69+
await git.push(['-f']);
70+
}
7171

7272
return { message: 'Project reset', success: true };
7373
} catch (e) {

src/main/ipcs/ipcGitHub.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { ipcMain, safeStorage } from 'electron';
2-
32
import log from 'electron-log';
43
import { Octokit } from 'octokit';
5-
6-
import { PullType } from 'types/gitHub';
4+
import { type PullType } from 'types/gitHub';
75

86
import { getRepoInfo } from '../libs/git';
97
import { settings } from '../settings';

src/main/ipcs/ipcLaunch.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { ipcMain } from 'electron';
2+
import { type LaunchEditor } from 'types/foundEditor';
3+
import { type LaunchShell } from 'types/foundShell';
24

3-
import { LaunchEditor } from 'types/foundEditor';
4-
import { LaunchShell } from 'types/foundShell';
5-
6-
import { launch } from '../libs/integrations/shellsLaunch';
75
import { launchExternalEditor } from '../libs/integrations/editrosLaunch';
6+
import { launch } from '../libs/integrations/shellsLaunch';
87

98
ipcMain.handle('launch:editor', async (e, launchEditor: LaunchEditor) => {
109
launchExternalEditor(launchEditor.fullPath, launchEditor.editor);
1110
});
1211

1312
ipcMain.handle('launch:shell', async (e, launchShell: LaunchShell) => {
13+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1414
launch(launchShell.shell as any, launchShell.fullPath);
1515
});

src/main/ipcs/ipcProjects.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import { dialog, ipcMain } from 'electron';
2-
2+
import { type Projects } from 'types/project';
33
import { v5 } from 'uuid';
44

5-
import { Projects } from 'types/project';
6-
75
import { settings } from '../settings';
86

9-
ipcMain.handle('projects:get', () => {
10-
return settings.get('projects');
11-
});
7+
ipcMain.handle('projects:get', () => settings.get('projects'));
128

139
ipcMain.handle('projects:add', async () => {
1410
const res = await dialog.showOpenDialog({ properties: ['openDirectory', 'multiSelections'] });

src/main/ipcs/ipcSticker.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { ipcMain, Menu, Tray, nativeImage, BrowserWindow } from 'electron';
2-
import log from 'electron-log';
1+
import { ipcMain, nativeImage, Tray } from 'electron';
32

4-
let tray: Tray | null = null;
3+
let tray: null | Tray = null;
54

65
ipcMain.handle('sticker:add', async (_, text: string): Promise<void> => {
76
if (tray) tray.destroy();

0 commit comments

Comments
 (0)