Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix lint config #18

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ indent_style=space
indent_size=2
tab_width=2
end_of_line=lf
insert_final_newline=false
charset=utf-8
insert_final_newline=true
charset=utf-8
7 changes: 5 additions & 2 deletions apps/app/src/nativeBridge/module.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable @typescript-eslint/ban-types */
import { BrowserWindow } from 'electron';

type ModuleFunction = {
name: string;
value: (_mainWindow: BrowserWindow, ..._args: any[]) => Promise<any>;
value: (_mainWindow: BrowserWindow, ..._args: unknown[]) => Promise<unknown>;
};

type ModuleEventType = 'on' | 'once';
Expand Down Expand Up @@ -61,6 +62,7 @@ export function getModuleEventKey(moduleName: string, eventName: string): string
}

export function moduleFunction(nameOverride?: string) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (target: any, key: string, descriptor: PropertyDescriptor) => {
if (!target.constructor) {
throw new Error('@moduleFunction must be used within a class');
Expand All @@ -75,6 +77,7 @@ export function moduleFunction(nameOverride?: string) {
}

export function moduleEvent(type: ModuleEventType, nameOverride?: string) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (target: any, key: string, descriptor: PropertyDescriptor) => {
if (!target.constructor) {
throw new Error('@moduleEvent must be used within a class');
Expand All @@ -86,7 +89,7 @@ export function moduleEvent(type: ModuleEventType, nameOverride?: string) {
name: nameOverride || key,
};

descriptor.value = (mainWindow: BrowserWindow, ...args: any[]) => {
descriptor.value = (mainWindow: BrowserWindow, ...args: unknown[]) => {
const eventKey = `${getModuleKey(mod.name)}:${key}`;
mainWindow.webContents.send(eventKey, ...args);
};
Expand Down
4 changes: 2 additions & 2 deletions apps/app/src/nativeBridge/modules/configModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class ConfigModule extends NativeBridgeModule {

try {
const script = new vm.Script(configContent, { filename: 'config.js', displayErrors: true });
const mod: Record<string, any> = {};
const mod: Record<string, unknown> = {};
script.runInNewContext({
module: mod,
require: (moduleName: string) => {
Expand All @@ -53,7 +53,7 @@ export class ConfigModule extends NativeBridgeModule {

const resolved = resolveConfig(mod.exports);
this.config = resolved;
} catch (err: any) {
} catch (err: unknown) {
Logger.getInstance().log('error', JSON.stringify(err));
}
}
Expand Down
1 change: 1 addition & 0 deletions apps/app/src/nativeBridge/modules/terminalModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class PTYInstance {
process.env[process.platform === 'win32' ? 'COMSPEC' : 'SHELL'] ||
(process.platform === 'win32' ? 'cmd.exe' : '/bin/bash');

// eslint-disable-next-line @typescript-eslint/no-var-requires
this.ptyProcess = require('node-pty').spawn(shell, [], {
name: 'xterm-256color',
cols: cols,
Expand Down
8 changes: 4 additions & 4 deletions apps/app/src/nativeBridge/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class NativeBridgeRegistry {
this.modules.push(mod);
}

public generateAPIObject(): Object {
public generateAPIObject(): Record<string, unknown> {
return Object.assign(
{},
...this.modules.map((module) => {
Expand All @@ -25,16 +25,16 @@ export class NativeBridgeRegistry {
throw new Error('module metadata not found');
}

const moduleApi: Record<string, Object> = {};
const moduleApi: Record<string, unknown> = {};

Object.values(moduleMetadata.functions).forEach((func) => {
moduleApi[func.name] = (...args: any[]) => {
moduleApi[func.name] = (...args: unknown[]) => {
return ipcRenderer.invoke(getModuleFunctionKey(moduleMetadata.name, func.name), ...args);
};
});

Object.values(moduleMetadata.events).forEach((evt) => {
moduleApi[evt.name] = (callback: (_event: IpcRendererEvent, ..._args: any[]) => void) =>
moduleApi[evt.name] = (callback: (_event: IpcRendererEvent, ..._args: unknown[]) => void) =>
evt.type === 'on'
? ipcRenderer.on(getModuleEventKey(moduleMetadata.name, evt.name), callback)
: ipcRenderer.once(getModuleEventKey(moduleMetadata.name, evt.name), callback);
Expand Down
1 change: 1 addition & 0 deletions apps/app/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');

Expand Down
1 change: 1 addition & 0 deletions apps/app/webpack.preload.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
const webpack = require('webpack');

Expand Down
2 changes: 1 addition & 1 deletion apps/terminal/components/TitleBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { FiMaximize2, FiMinimize2, FiMinus, FiX } from 'react-icons/fi';

import styles from './index.module.css';

function TitleBar(props: PropsWithChildren<{}>) {
function TitleBar(props: PropsWithChildren) {
const [isMaximized, setIsMaximized] = useState(false);

useEffect(() => {
Expand Down
Loading