Skip to content

Commit

Permalink
Re-Added lint and typecheck step to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Nils-Kolvenbach committed Jul 25, 2024
1 parent ce5d9c1 commit eb00217
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 62 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ jobs:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
# - name: Run linter
# run: npm run lint
- name: Run linter
run: npm run lint
- name: Run typecheck
run: npm run typecheck
# - name: Identify misconfigurations and security anti-patterns
# uses: doyensec/electronegativity-action@v2
# - name: Upload report
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"scripts": {
"clean": "rimraf ./out && rimraf ./dist",
"format": "prettier --write .",
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix",
"lint": "eslint ./src --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix",
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false",
"typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false",
"typecheck": "npm run typecheck:node && npm run typecheck:web",
Expand Down
69 changes: 27 additions & 42 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Main {
}

private onWebContentsCreated(
event: {
_event: {
preventDefault: () => void;
readonly defaultPrevented: boolean;
},
Expand Down Expand Up @@ -117,7 +117,7 @@ class Main {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) {
this.createWindow('/projects');
this.createWindow();
}
}

Expand All @@ -132,24 +132,12 @@ class Main {
return net.fetch(filePath);
});

// Check in Core if either local or cloud user is set
// If no, show the user the /user/create page
// If yes use this to init core and show /projects

const core = new ElekIoCore({
environment: app.isPackaged ? 'production' : 'development',
});
this.registerIpcMain(core);

// const user = await core.user.get();
// let mainWindow: BrowserWindow;
this.createWindow('/');

// if (user) {
// mainWindow = await this.createWindow('/projects');
// } else {
// mainWindow = await this.createWindow('/user/create');
// }
const window = this.createWindow();
this.registerIpcMain(window, core);
}

/**
Expand Down Expand Up @@ -182,10 +170,7 @@ class Main {
return windowSize;
}

private createWindow(
path: string,
options?: BrowserWindowConstructorOptions
) {
private createWindow(options?: BrowserWindowConstructorOptions) {
const { width, height } = this.getWindowSize();

// Set defaults if missing
Expand Down Expand Up @@ -263,41 +248,41 @@ class Main {
return window;
}

private registerIpcMain(core: ElekIoCore) {
ipcMain.handle('electron:dialog:showOpenDialog', async (event, args) => {
return await dialog.showOpenDialog(undefined, args);
private registerIpcMain(window: Electron.BrowserWindow, core: ElekIoCore) {
ipcMain.handle('electron:dialog:showOpenDialog', async (_event, args) => {
return await dialog.showOpenDialog(window, args);
});
ipcMain.handle('core:user:get', async () => {
return await core.user.get();
});
ipcMain.handle('core:user:set', async (event, args) => {
ipcMain.handle('core:user:set', async (_event, args) => {
return await core.user.set(args[0]);
});
ipcMain.handle('core:projects:count', async () => {
return await core.projects.count();
});
ipcMain.handle('core:projects:create', async (event, args) => {
ipcMain.handle('core:projects:create', async (_event, args) => {
return await core.projects.create(args[0]);
});
ipcMain.handle('core:projects:list', async (event, args) => {
ipcMain.handle('core:projects:list', async (_event, args) => {
return await core.projects.list(args[0]);
});
ipcMain.handle('core:projects:read', async (event, args) => {
ipcMain.handle('core:projects:read', async (_event, args) => {
return await core.projects.read(args[0]);
});
ipcMain.handle('core:projects:update', async (event, args) => {
ipcMain.handle('core:projects:update', async (_event, args) => {
return await core.projects.update(args[0]);
});
ipcMain.handle('core:projects:delete', async (event, args) => {
ipcMain.handle('core:projects:delete', async (_event, args) => {
return await core.projects.delete(args[0]);
});
ipcMain.handle('core:assets:list', async (event, args) => {
ipcMain.handle('core:assets:list', async (_event, args) => {
return await core.assets.list(args[0]);
});
ipcMain.handle('core:assets:create', async (event, args) => {
ipcMain.handle('core:assets:create', async (_event, args) => {
return await core.assets.create(args[0]);
});
ipcMain.handle('core:assets:delete', async (event, args) => {
ipcMain.handle('core:assets:delete', async (_event, args) => {
return await core.assets.delete(args[0]);
});
// ipcMain.handle('core:snapshots:list', async (event, args) => {
Expand All @@ -312,34 +297,34 @@ class Main {
// ipcMain.handle('core:snapshots:commitHistory', async (event, args) => {
// return await core.snapshots.commitHistory(args[0]);
// });
ipcMain.handle('core:collections:list', async (event, args) => {
ipcMain.handle('core:collections:list', async (_event, args) => {
return await core.collections.list(args[0]);
});
ipcMain.handle('core:collections:create', async (event, args) => {
ipcMain.handle('core:collections:create', async (_event, args) => {
return await core.collections.create(args[0]);
});
ipcMain.handle('core:collections:read', async (event, args) => {
ipcMain.handle('core:collections:read', async (_event, args) => {
return await core.collections.read(args[0]);
});
ipcMain.handle('core:collections:update', async (event, args) => {
ipcMain.handle('core:collections:update', async (_event, args) => {
return await core.collections.update(args[0]);
});
ipcMain.handle('core:collections:delete', async (event, args) => {
ipcMain.handle('core:collections:delete', async (_event, args) => {
return await core.collections.delete(args[0]);
});
ipcMain.handle('core:entries:list', async (event, args) => {
ipcMain.handle('core:entries:list', async (_event, args) => {
return await core.entries.list(args[0]);
});
ipcMain.handle('core:entries:create', async (event, args) => {
ipcMain.handle('core:entries:create', async (_event, args) => {
return await core.entries.create(args[0]);
});
ipcMain.handle('core:entries:read', async (event, args) => {
ipcMain.handle('core:entries:read', async (_event, args) => {
return await core.entries.read(args[0]);
});
ipcMain.handle('core:entries:update', async (event, args) => {
ipcMain.handle('core:entries:update', async (_event, args) => {
return await core.entries.update(args[0]);
});
ipcMain.handle('core:entries:delete', async (event, args) => {
ipcMain.handle('core:entries:delete', async (_event, args) => {
return await core.entries.delete(args[0]);
});
// this.handleIpcMain<Parameters<AssetService['list']>>('core:assets:list', async (event, args) => {
Expand Down
34 changes: 17 additions & 17 deletions src/renderer/src/components/ui/alert.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import * as React from 'react';
import { cva, type VariantProps } from 'class-variance-authority';

import { cn } from "@renderer/util"
import { cn } from '@renderer/util';

const alertVariants = cva(
"relative w-full rounded-lg border border-zinc-200 px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-zinc-950 [&>svg~*]:pl-7 dark:border-zinc-800 dark:[&>svg]:text-zinc-50",
'relative w-full rounded-lg border border-zinc-200 px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-zinc-950 [&>svg~*]:pl-7 dark:border-zinc-800 dark:[&>svg]:text-zinc-50',
{
variants: {
variant: {
default: "bg-white text-zinc-950 dark:bg-zinc-950 dark:text-zinc-50",
default: 'bg-white text-zinc-950 dark:bg-zinc-950 dark:text-zinc-50',
destructive:
"border-red-500/50 text-red-500 dark:border-red-500 [&>svg]:text-red-500 dark:border-red-900/50 dark:text-red-900 dark:dark:border-red-900 dark:[&>svg]:text-red-900",
'border-red-500/50 text-red-500 dark:border-red-500 [&>svg]:text-red-500 dark:border-red-900/50 dark:text-red-900 dark:dark:border-red-900 dark:[&>svg]:text-red-900',
},
},
defaultVariants: {
variant: "default",
variant: 'default',
},
}
)
);

const Alert = React.forwardRef<
HTMLDivElement,
Expand All @@ -29,31 +29,31 @@ const Alert = React.forwardRef<
className={cn(alertVariants({ variant }), className)}
{...props}
/>
))
Alert.displayName = "Alert"
));
Alert.displayName = 'Alert';

const AlertTitle = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLHeadingElement>
>(({ className, ...props }, ref) => (
<h5
ref={ref}
className={cn("mb-1 font-medium leading-none tracking-tight", className)}
className={cn('mb-1 font-medium leading-none tracking-tight', className)}
{...props}
/>
))
AlertTitle.displayName = "AlertTitle"
));
AlertTitle.displayName = 'AlertTitle';

const AlertDescription = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("text-sm [&_p]:leading-relaxed", className)}
className={cn('text-sm [&_p]:leading-relaxed', className)}
{...props}
/>
))
AlertDescription.displayName = "AlertDescription"
));
AlertDescription.displayName = 'AlertDescription';

export { Alert, AlertTitle, AlertDescription }
export { Alert, AlertTitle, AlertDescription };

0 comments on commit eb00217

Please sign in to comment.