Skip to content

Commit 41b1ac1

Browse files
LabhanshAgrawalStanzilla
authored andcommitted
fix prettier errors
1 parent d2d31e3 commit 41b1ac1

39 files changed

+150
-153
lines changed

app/commands.ts

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,41 @@ const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
88
// If window is created on the same tick, it will consume event too
99
setTimeout(app.createWindow, 0);
1010
},
11-
'tab:new': focusedWindow => {
11+
'tab:new': (focusedWindow) => {
1212
if (focusedWindow) {
1313
focusedWindow.rpc.emit('termgroup add req', {});
1414
} else {
1515
setTimeout(app.createWindow, 0);
1616
}
1717
},
18-
'pane:splitRight': focusedWindow => {
18+
'pane:splitRight': (focusedWindow) => {
1919
focusedWindow && focusedWindow.rpc.emit('split request vertical', {});
2020
},
21-
'pane:splitDown': focusedWindow => {
21+
'pane:splitDown': (focusedWindow) => {
2222
focusedWindow && focusedWindow.rpc.emit('split request horizontal', {});
2323
},
24-
'pane:close': focusedWindow => {
24+
'pane:close': (focusedWindow) => {
2525
focusedWindow && focusedWindow.rpc.emit('termgroup close req');
2626
},
2727
'window:preferences': () => {
2828
openConfig();
2929
},
30-
'editor:clearBuffer': focusedWindow => {
30+
'editor:clearBuffer': (focusedWindow) => {
3131
focusedWindow && focusedWindow.rpc.emit('session clear req');
3232
},
33-
'editor:selectAll': focusedWindow => {
33+
'editor:selectAll': (focusedWindow) => {
3434
focusedWindow && focusedWindow.rpc.emit('term selectAll');
3535
},
3636
'plugins:update': () => {
3737
updatePlugins();
3838
},
39-
'window:reload': focusedWindow => {
39+
'window:reload': (focusedWindow) => {
4040
focusedWindow && focusedWindow.rpc.emit('reload');
4141
},
42-
'window:reloadFull': focusedWindow => {
42+
'window:reloadFull': (focusedWindow) => {
4343
focusedWindow && focusedWindow.reload();
4444
},
45-
'window:devtools': focusedWindow => {
45+
'window:devtools': (focusedWindow) => {
4646
if (!focusedWindow) {
4747
return;
4848
}
@@ -53,58 +53,58 @@ const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
5353
webContents.openDevTools({mode: 'detach'});
5454
}
5555
},
56-
'zoom:reset': focusedWindow => {
56+
'zoom:reset': (focusedWindow) => {
5757
focusedWindow && focusedWindow.rpc.emit('reset fontSize req');
5858
},
59-
'zoom:in': focusedWindow => {
59+
'zoom:in': (focusedWindow) => {
6060
focusedWindow && focusedWindow.rpc.emit('increase fontSize req');
6161
},
62-
'zoom:out': focusedWindow => {
62+
'zoom:out': (focusedWindow) => {
6363
focusedWindow && focusedWindow.rpc.emit('decrease fontSize req');
6464
},
65-
'tab:prev': focusedWindow => {
65+
'tab:prev': (focusedWindow) => {
6666
focusedWindow && focusedWindow.rpc.emit('move left req');
6767
},
68-
'tab:next': focusedWindow => {
68+
'tab:next': (focusedWindow) => {
6969
focusedWindow && focusedWindow.rpc.emit('move right req');
7070
},
71-
'pane:prev': focusedWindow => {
71+
'pane:prev': (focusedWindow) => {
7272
focusedWindow && focusedWindow.rpc.emit('prev pane req');
7373
},
74-
'pane:next': focusedWindow => {
74+
'pane:next': (focusedWindow) => {
7575
focusedWindow && focusedWindow.rpc.emit('next pane req');
7676
},
77-
'editor:movePreviousWord': focusedWindow => {
77+
'editor:movePreviousWord': (focusedWindow) => {
7878
focusedWindow && focusedWindow.rpc.emit('session move word left req');
7979
},
80-
'editor:moveNextWord': focusedWindow => {
80+
'editor:moveNextWord': (focusedWindow) => {
8181
focusedWindow && focusedWindow.rpc.emit('session move word right req');
8282
},
83-
'editor:moveBeginningLine': focusedWindow => {
83+
'editor:moveBeginningLine': (focusedWindow) => {
8484
focusedWindow && focusedWindow.rpc.emit('session move line beginning req');
8585
},
86-
'editor:moveEndLine': focusedWindow => {
86+
'editor:moveEndLine': (focusedWindow) => {
8787
focusedWindow && focusedWindow.rpc.emit('session move line end req');
8888
},
89-
'editor:deletePreviousWord': focusedWindow => {
89+
'editor:deletePreviousWord': (focusedWindow) => {
9090
focusedWindow && focusedWindow.rpc.emit('session del word left req');
9191
},
92-
'editor:deleteNextWord': focusedWindow => {
92+
'editor:deleteNextWord': (focusedWindow) => {
9393
focusedWindow && focusedWindow.rpc.emit('session del word right req');
9494
},
95-
'editor:deleteBeginningLine': focusedWindow => {
95+
'editor:deleteBeginningLine': (focusedWindow) => {
9696
focusedWindow && focusedWindow.rpc.emit('session del line beginning req');
9797
},
98-
'editor:deleteEndLine': focusedWindow => {
98+
'editor:deleteEndLine': (focusedWindow) => {
9999
focusedWindow && focusedWindow.rpc.emit('session del line end req');
100100
},
101-
'editor:break': focusedWindow => {
101+
'editor:break': (focusedWindow) => {
102102
focusedWindow && focusedWindow.rpc.emit('session break req');
103103
},
104-
'editor:search': focusedWindow => {
104+
'editor:search': (focusedWindow) => {
105105
focusedWindow && focusedWindow.rpc.emit('session search');
106106
},
107-
'editor:search-close': focusedWindow => {
107+
'editor:search-close': (focusedWindow) => {
108108
focusedWindow && focusedWindow.rpc.emit('session search close');
109109
},
110110
'cli:install': () => {
@@ -118,9 +118,9 @@ const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
118118
};
119119

120120
//Special numeric command
121-
([1, 2, 3, 4, 5, 6, 7, 8, 'last'] as const).forEach(cmdIndex => {
121+
([1, 2, 3, 4, 5, 6, 7, 8, 'last'] as const).forEach((cmdIndex) => {
122122
const index = cmdIndex === 'last' ? cmdIndex : cmdIndex - 1;
123-
commands[`tab:jump:${cmdIndex}`] = focusedWindow => {
123+
commands[`tab:jump:${cmdIndex}`] = (focusedWindow) => {
124124
focusedWindow && focusedWindow.rpc.emit('move jump req', index);
125125
};
126126
});

app/config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ let _watcher: fs.FSWatcher;
1313
export const getDeprecatedCSS = (config: Record<string, any>) => {
1414
const deprecated: string[] = [];
1515
const deprecatedCSS = ['x-screen', 'x-row', 'cursor-node', '::selection'];
16-
deprecatedCSS.forEach(css => {
16+
deprecatedCSS.forEach((css) => {
1717
if ((config.css && config.css.includes(css)) || (config.termCSS && config.termCSS.includes(css))) {
1818
deprecated.push(css);
1919
}
@@ -43,7 +43,7 @@ const _watch = () => {
4343
setTimeout(() => {
4444
cfg = _import();
4545
notify('Configuration updated', 'Hyper configuration reloaded!');
46-
watchers.forEach(fn => fn());
46+
watchers.forEach((fn) => fn());
4747
checkDeprecatedConfig();
4848
}, 100);
4949
};
@@ -64,7 +64,7 @@ const _watch = () => {
6464
// macOS/Linux
6565
function setWatcher() {
6666
try {
67-
_watcher = fs.watch(cfgPath, eventType => {
67+
_watcher = fs.watch(cfgPath, (eventType) => {
6868
if (eventType === 'rename') {
6969
_watcher.close();
7070
// Ensure that new file has been written
@@ -76,7 +76,7 @@ const _watch = () => {
7676
return;
7777
}
7878
_watcher.on('change', onChange);
79-
_watcher.on('error', error => {
79+
_watcher.on('error', (error) => {
8080
console.error('error watching config', error);
8181
});
8282
}
@@ -140,7 +140,7 @@ export const htermConfigTranslate = (config: Record<string, any>) => {
140140
'x-screen a([ {.[])': '.terminal a$1',
141141
'x-row a([ {.[])': '.terminal a$1'
142142
};
143-
Object.keys(cssReplacements).forEach(pattern => {
143+
Object.keys(cssReplacements).forEach((pattern) => {
144144
const searchvalue = new RegExp(pattern, 'g');
145145
const newvalue = cssReplacements[pattern];
146146
config.css = config.css && config.css.replace(searchvalue, newvalue);

app/config/open.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default () => {
2626
Registry.closeKey(fileExtsKeys);
2727

2828
// Find UserChoice key
29-
const userChoice = keys.find(k => k.endsWith('UserChoice'));
29+
const userChoice = keys.find((k) => k.endsWith('UserChoice'));
3030
return userChoice
3131
? `Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\.js\\${userChoice}`
3232
: userChoice;
@@ -44,13 +44,13 @@ export default () => {
4444
// Load key values
4545
const userChoiceKey = Registry.openKey(Registry.HKCU, userChoice, Registry.Access.READ)!;
4646
const values: string[] = Registry.enumValueNames(userChoiceKey).map(
47-
x => (Registry.queryValue(userChoiceKey, x) as string) || ''
47+
(x) => (Registry.queryValue(userChoiceKey, x) as string) || ''
4848
);
4949
Registry.closeKey(userChoiceKey);
5050

5151
// Look for default program
5252
const hasDefaultProgramConfigured = values.every(
53-
value => value && typeof value === 'string' && !value.includes('WScript.exe') && !value.includes('JSFile')
53+
(value) => value && typeof value === 'string' && !value.includes('WScript.exe') && !value.includes('JSFile')
5454
);
5555

5656
return hasDefaultProgramConfigured;
@@ -62,21 +62,21 @@ export default () => {
6262

6363
// This mimics shell.openItem, true if it worked, false if not.
6464
const openNotepad = (file: string) =>
65-
new Promise<boolean>(resolve => {
66-
exec(`start notepad.exe ${file}`, error => {
65+
new Promise<boolean>((resolve) => {
66+
exec(`start notepad.exe ${file}`, (error) => {
6767
resolve(!error);
6868
});
6969
});
7070

7171
return hasDefaultSet()
72-
.then(yes => {
72+
.then((yes) => {
7373
if (yes) {
7474
return shell.openItem(cfgPath);
7575
}
7676
console.warn('No default app set for .js files, using notepad.exe fallback');
7777
return openNotepad(cfgPath);
7878
})
79-
.catch(err => {
79+
.catch((err) => {
8080
console.error('Open config with default app error:', err);
8181
return openNotepad(cfgPath);
8282
});

app/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function installDevExtensions(isDev_: boolean) {
129129
const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'] as const;
130130
const forceDownload = Boolean(process.env.UPGRADE_EXTENSIONS);
131131

132-
return Promise.all(extensions.map(name => installer.default(installer[name], forceDownload)));
132+
return Promise.all(extensions.map((name) => installer.default(installer[name], forceDownload)));
133133
}
134134

135135
app.on('ready', () =>
@@ -249,7 +249,7 @@ app.on('ready', () =>
249249
installCLI(false);
250250
}
251251
})
252-
.catch(err => {
252+
.catch((err) => {
253253
console.error('Error while loading devtools extensions', err);
254254
})
255255
);

app/menus/menu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const createMenu = (
4141
const showAbout = () => {
4242
const loadedPlugins = getLoadedPluginVersions();
4343
const pluginList =
44-
loadedPlugins.length === 0 ? 'none' : loadedPlugins.map(plugin => `\n ${plugin.name} (${plugin.version})`);
44+
loadedPlugins.length === 0 ? 'none' : loadedPlugins.map((plugin) => `\n ${plugin.name} (${plugin.version})`);
4545

4646
const rendererCounts = Object.values(getRendererTypes()).reduce((acc: Record<string, number>, type) => {
4747
acc[type] = acc[type] ? acc[type] + 1 : 1;

app/notifications.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export default function fetchNotifications(win: BrowserWindow) {
2020
'X-Hyper-Platform': process.platform
2121
}
2222
})
23-
.then(res => res.json())
24-
.then(data => {
23+
.then((res) => res.json())
24+
.then((data) => {
2525
const {message} = data || {};
2626
if (typeof message !== 'object' && message !== '') {
2727
throw new Error('Bad response');

app/plugins.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function patchModuleLoad() {
8282
}
8383

8484
function checkDeprecatedExtendKeymaps() {
85-
modules.forEach(plugin => {
85+
modules.forEach((plugin) => {
8686
if (plugin.extendKeymaps) {
8787
notify('Plugin warning!', `"${plugin._name}" use deprecated "extendKeymaps" handler`);
8888
return;
@@ -124,7 +124,7 @@ function updatePlugins({force = false} = {}) {
124124
cache.set('hyper.plugin-versions', pluginVersions);
125125

126126
// notify watchers
127-
watchers.forEach(fn => fn(err, {force}));
127+
watchers.forEach((fn) => fn(err, {force}));
128128

129129
if (force || changed) {
130130
if (changed) {
@@ -140,7 +140,7 @@ function updatePlugins({force = false} = {}) {
140140

141141
function getPluginVersions() {
142142
const paths_ = paths.plugins.concat(paths.localPlugins);
143-
return paths_.map(path_ => {
143+
return paths_.map((path_) => {
144144
let version = null;
145145
try {
146146
version = require(resolve(path_, 'package.json')).version;
@@ -152,7 +152,7 @@ function getPluginVersions() {
152152

153153
function clearCache() {
154154
// trigger unload hooks
155-
modules.forEach(mod => {
155+
modules.forEach((mod) => {
156156
if (mod.onUnload) {
157157
mod.onUnload(app);
158158
}
@@ -169,7 +169,7 @@ function clearCache() {
169169
export {updatePlugins};
170170

171171
export const getLoadedPluginVersions = () => {
172-
return modules.map(mod => ({name: mod._name, version: mod._version}));
172+
return modules.map((mod) => ({name: mod._name, version: mod._version}));
173173
};
174174

175175
// we schedule the initial plugins update
@@ -224,7 +224,7 @@ function alert(message: string) {
224224

225225
function toDependencies(plugins_: {plugins: string[]}) {
226226
const obj: Record<string, string> = {};
227-
plugins_.plugins.forEach(plugin => {
227+
plugins_.plugins.forEach((plugin) => {
228228
const regex = /.(@|#)/;
229229
const match = regex.exec(plugin);
230230

@@ -251,10 +251,10 @@ export const subscribe = (fn: Function) => {
251251

252252
function getPaths() {
253253
return {
254-
plugins: plugins.plugins.map(name => {
254+
plugins: plugins.plugins.map((name) => {
255255
return resolve(path, 'node_modules', name.split('#')[0]);
256256
}),
257-
localPlugins: plugins.localPlugins.map(name => {
257+
localPlugins: plugins.localPlugins.map((name) => {
258258
return resolve(localPath, name);
259259
})
260260
};
@@ -275,7 +275,7 @@ function requirePlugins(): any[] {
275275
let mod: any;
276276
try {
277277
mod = require(path_);
278-
const exposed = mod && Object.keys(mod).some(key => availableExtensions.has(key));
278+
const exposed = mod && Object.keys(mod).some((key) => availableExtensions.has(key));
279279
if (!exposed) {
280280
notify('Plugin error!', `${`Plugin "${basename(path_)}" does not expose any `}Hyper extension API methods`);
281281
return;
@@ -303,11 +303,11 @@ function requirePlugins(): any[] {
303303
return plugins_
304304
.map(load)
305305
.concat(localPlugins.map(load))
306-
.filter(v => Boolean(v));
306+
.filter((v) => Boolean(v));
307307
}
308308

309309
export const onApp = (app_: App) => {
310-
modules.forEach(plugin => {
310+
modules.forEach((plugin) => {
311311
if (plugin.onApp) {
312312
try {
313313
plugin.onApp(app_);
@@ -321,7 +321,7 @@ export const onApp = (app_: App) => {
321321
};
322322

323323
export const onWindowClass = (win: BrowserWindow) => {
324-
modules.forEach(plugin => {
324+
modules.forEach((plugin) => {
325325
if (plugin.onWindowClass) {
326326
try {
327327
plugin.onWindowClass(win);
@@ -335,7 +335,7 @@ export const onWindowClass = (win: BrowserWindow) => {
335335
};
336336

337337
export const onWindow = (win: BrowserWindow) => {
338-
modules.forEach(plugin => {
338+
modules.forEach((plugin) => {
339339
if (plugin.onWindow) {
340340
try {
341341
plugin.onWindow(win);
@@ -352,7 +352,7 @@ export const onWindow = (win: BrowserWindow) => {
352352
// for all the available plugins
353353
function decorateEntity(base: any, key: string, type: 'object' | 'function') {
354354
let decorated = base;
355-
modules.forEach(plugin => {
355+
modules.forEach((plugin) => {
356356
if (plugin[key]) {
357357
let res;
358358
try {
@@ -383,7 +383,7 @@ function decorateClass(base: any, key: string) {
383383
export const getDeprecatedConfig = () => {
384384
const deprecated: Record<string, any> = {};
385385
const baseConfig = config.getConfig();
386-
modules.forEach(plugin => {
386+
modules.forEach((plugin) => {
387387
if (!plugin.decorateConfig) {
388388
return;
389389
}

0 commit comments

Comments
 (0)