Skip to content
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
22 changes: 22 additions & 0 deletions electron/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,26 @@ export default [
'no-plusplus': 'off',
},
},
// CommonJS files (preload scripts must be CJS when sandbox is enabled)
{
files: ['**/*.cjs'],
plugins: {
prettier: prettierPlugin,
},
languageOptions: {
ecmaVersion: 2022,
sourceType: 'commonjs',
globals: {
...globals.node,
...globals.es2021,
},
},
rules: {
'prettier/prettier': 'error',
...prettierConfig.rules,
'max-len': 'off',
'no-unused-vars': 'warn',
'no-plusplus': 'off',
},
},
];
19 changes: 12 additions & 7 deletions electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
* Handles window creation, IPC communication, and app lifecycle.
*/

const { app, BrowserWindow, ipcMain } = require('electron');
const path = require('path');
const url = require('url');
import { app, BrowserWindow, ipcMain } from 'electron';
import path from 'path';
import url from 'url';
import { fileURLToPath } from 'url';

// ESM equivalent of __dirname
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

// Services
const ConnectionManager = require('./services/ConnectionManager');
const VersionChecker = require('./services/VersionChecker');
const MDNSDiscovery = require('./services/MDNSDiscovery');
import ConnectionManager from './services/ConnectionManager.js';
import VersionChecker from './services/VersionChecker.js';
import MDNSDiscovery from './services/MDNSDiscovery.js';

// Determine if running in development mode
const isDev = process.argv.includes('--dev') || process.env.NODE_ENV === 'development';
Expand All @@ -32,7 +37,7 @@ function createWindow() {
minWidth: 800,
minHeight: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
preload: path.join(__dirname, 'preload.cjs'),
nodeIntegration: false,
contextIsolation: true,
sandbox: true,
Expand Down
Loading
Loading