fix anonymous default exports

This commit is contained in:
Labhansh Agrawal 2023-07-25 21:41:02 +05:30
parent 162b58eed8
commit 692f94a87a
20 changed files with 58 additions and 20 deletions

View file

@ -104,7 +104,8 @@
"lodash/import-scope": [ "error", "method" ],
"lodash/collection-return": "error",
"lodash/collection-method-value": "error",
"import/no-extraneous-dependencies": "error"
"import/no-extraneous-dependencies": "error",
"import/no-anonymous-default-export": "error"
}
},
{

View file

@ -46,4 +46,6 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
}
}
export default new AutoUpdater();
const autoUpdaterLinux = new AutoUpdater();
export default autoUpdaterLinux;

View file

@ -57,7 +57,7 @@ const openNotepad = (file: string) =>
});
});
export default () => {
const openConfig = () => {
// Windows opens .js files with WScript.exe by default
// If the user hasn't set up an editor for .js files, we fallback to notepad.
if (process.platform === 'win32') {
@ -73,3 +73,5 @@ export default () => {
}
return shell.openPath(cfgPath).then((error) => error === '');
};
export default openConfig;

View file

@ -3,7 +3,7 @@
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
import {app} from 'electron';
export default (
const darwinMenu = (
commandKeys: Record<string, string>,
execCommand: (command: string, focusedWindow?: BrowserWindow) => void,
showAbout: () => void
@ -55,3 +55,5 @@ export default (
]
};
};
export default darwinMenu;

View file

@ -1,6 +1,6 @@
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
export default (
const editMenu = (
commandKeys: Record<string, string>,
execCommand: (command: string, focusedWindow?: BrowserWindow) => void
) => {
@ -147,3 +147,5 @@ export default (
submenu
};
};
export default editMenu;

View file

@ -5,7 +5,7 @@ import {getConfig, getPlugins} from '../../config';
const {arch, env, platform, versions} = process;
import {version} from '../../package.json';
export default (commands: Record<string, string>, showAbout: () => void): MenuItemConstructorOptions => {
const helpMenu = (commands: Record<string, string>, showAbout: () => void): MenuItemConstructorOptions => {
const submenu: MenuItemConstructorOptions[] = [
{
label: `${app.name} Website`,
@ -107,3 +107,5 @@ ${JSON.stringify(getPlugins(), null, 2)}
submenu
};
};
export default helpMenu;

View file

@ -1,6 +1,6 @@
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
export default (
const shellMenu = (
commandKeys: Record<string, string>,
execCommand: (command: string, focusedWindow?: BrowserWindow) => void,
profiles: string[]
@ -100,3 +100,5 @@ export default (
]
};
};
export default shellMenu;

View file

@ -1,6 +1,6 @@
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
export default (
const toolsMenu = (
commands: Record<string, string>,
execCommand: (command: string, focusedWindow?: BrowserWindow) => void
): MenuItemConstructorOptions => {
@ -45,3 +45,5 @@ export default (
]
};
};
export default toolsMenu;

View file

@ -1,6 +1,6 @@
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
export default (
const viewMenu = (
commandKeys: Record<string, string>,
execCommand: (command: string, focusedWindow?: BrowserWindow) => void
): MenuItemConstructorOptions => {
@ -55,3 +55,5 @@ export default (
]
};
};
export default viewMenu;

View file

@ -1,6 +1,6 @@
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
export default (
const windowMenu = (
commandKeys: Record<string, string>,
execCommand: (command: string, focusedWindow?: BrowserWindow) => void
): MenuItemConstructorOptions => {
@ -94,3 +94,5 @@ export default (
]
};
};
export default windowMenu;

View file

@ -73,6 +73,8 @@ export class Server {
}
}
export default (win: BrowserWindow) => {
const createRPC = (win: BrowserWindow) => {
return new Server(win);
};
export default createRPC;

View file

@ -21,7 +21,7 @@ const filterCutCopy = (selection: string, menuItem: MenuItemConstructorOptions)
return menuItem;
};
export default (
const contextMenuTemplate = (
createWindow: (fn?: (win: BrowserWindow) => void, options?: Record<string, any>) => BrowserWindow,
selection: string
) => {
@ -36,3 +36,5 @@ export default (
.concat(separator, _shell)
.filter((menuItem) => !Object.prototype.hasOwnProperty.call(menuItem, 'enabled') || menuItem.enabled);
};
export default contextMenuTemplate;

View file

@ -71,7 +71,7 @@ async function init() {
isInit = true;
}
export default (win: BrowserWindow) => {
const updater = (win: BrowserWindow) => {
if (!isInit) {
void init();
}
@ -115,3 +115,5 @@ export default (win: BrowserWindow) => {
}
});
};
export default updater;

View file

@ -11,7 +11,7 @@ const generatePrefixedCommand = (command: string, shortcuts: string[]) => {
return result;
};
export default (config: Record<string, string[] | string>) => {
const mapKeys = (config: Record<string, string[] | string>) => {
return Object.keys(config).reduce((keymap: Record<string, string[]>, command: string) => {
if (!command) {
return keymap;
@ -39,3 +39,5 @@ export default (config: Record<string, string[] | string>) => {
return keymap;
}, {});
};
export default mapKeys;

View file

@ -4,7 +4,7 @@ import Color from 'color';
// returns a background color that's in hex
// format including the alpha channel (e.g.: `#00000050`)
// input can be any css value (rgb, hsl, string…)
export default (bgColor: string) => {
const toElectronBackgroundColor = (bgColor: string) => {
const color = Color(bgColor);
if (color.alpha() === 1) {
@ -15,3 +15,5 @@ export default (bgColor: string) => {
const alphaHex = Math.round(color.alpha() * 255).toString(16);
return `#${alphaHex}${color.hex().toString().slice(1)}`;
};
export default toElectronBackgroundColor;

View file

@ -1,3 +1,5 @@
import RPC from './utils/rpc';
export default new RPC();
const rpc = new RPC();
export default rpc;

View file

@ -9,8 +9,10 @@ import {composeWithDevTools} from '@redux-devtools/extension';
import type {HyperState, HyperActions} from '../../typings/hyper';
const thunk: ThunkMiddleware<HyperState, HyperActions> = _thunk;
export default () => {
const configureStoreForDevelopment = () => {
const enhancer = composeWithDevTools(applyMiddleware(thunk, plugins.middleware, thunk, writeMiddleware, effects));
return createStore(rootReducer, enhancer);
};
export default configureStoreForDevelopment;

View file

@ -8,5 +8,7 @@ import writeMiddleware from './write-middleware';
import type {HyperState, HyperActions} from '../../typings/hyper';
const thunk: ThunkMiddleware<HyperState, HyperActions> = _thunk;
export default () =>
const configureStoreForProd = () =>
createStore(rootReducer, applyMiddleware(thunk, plugins.middleware, thunk, writeMiddleware, effects));
export default configureStoreForProd;

View file

@ -1,10 +1,11 @@
import configureStoreForProduction from './configure-store.prod';
import configureStoreForDevelopment from './configure-store.dev';
export default () => {
const configureStore = () => {
if (process.env.NODE_ENV === 'production') {
return configureStoreForProduction();
}
return configureStoreForDevelopment();
};
export default configureStore;

View file

@ -48,7 +48,7 @@ export function fork() {
console.error('Calling fork from renderer is disabled');
}
export default {
const IPCChildProcess = {
exec,
execSync,
execFile,
@ -57,3 +57,5 @@ export default {
spawnSync,
fork
};
export default IPCChildProcess;