mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
prefer optional chain
This commit is contained in:
parent
8d4ed96d89
commit
bad51f9c15
4 changed files with 30 additions and 29 deletions
|
|
@ -94,7 +94,8 @@
|
|||
"rules": {
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-non-null-assertion": "off"
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"@typescript-eslint/prefer-optional-chain": "error"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -16,31 +16,31 @@ const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
|
|||
}
|
||||
},
|
||||
'pane:splitRight': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('split request vertical', {});
|
||||
focusedWindow?.rpc.emit('split request vertical', {});
|
||||
},
|
||||
'pane:splitDown': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('split request horizontal', {});
|
||||
focusedWindow?.rpc.emit('split request horizontal', {});
|
||||
},
|
||||
'pane:close': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('termgroup close req');
|
||||
focusedWindow?.rpc.emit('termgroup close req');
|
||||
},
|
||||
'window:preferences': () => {
|
||||
openConfig();
|
||||
},
|
||||
'editor:clearBuffer': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session clear req');
|
||||
focusedWindow?.rpc.emit('session clear req');
|
||||
},
|
||||
'editor:selectAll': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('term selectAll');
|
||||
focusedWindow?.rpc.emit('term selectAll');
|
||||
},
|
||||
'plugins:update': () => {
|
||||
updatePlugins();
|
||||
},
|
||||
'window:reload': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('reload');
|
||||
focusedWindow?.rpc.emit('reload');
|
||||
},
|
||||
'window:reloadFull': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.reload();
|
||||
focusedWindow?.reload();
|
||||
},
|
||||
'window:devtools': (focusedWindow) => {
|
||||
if (!focusedWindow) {
|
||||
|
|
@ -54,58 +54,58 @@ const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
|
|||
}
|
||||
},
|
||||
'zoom:reset': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('reset fontSize req');
|
||||
focusedWindow?.rpc.emit('reset fontSize req');
|
||||
},
|
||||
'zoom:in': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('increase fontSize req');
|
||||
focusedWindow?.rpc.emit('increase fontSize req');
|
||||
},
|
||||
'zoom:out': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('decrease fontSize req');
|
||||
focusedWindow?.rpc.emit('decrease fontSize req');
|
||||
},
|
||||
'tab:prev': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('move left req');
|
||||
focusedWindow?.rpc.emit('move left req');
|
||||
},
|
||||
'tab:next': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('move right req');
|
||||
focusedWindow?.rpc.emit('move right req');
|
||||
},
|
||||
'pane:prev': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('prev pane req');
|
||||
focusedWindow?.rpc.emit('prev pane req');
|
||||
},
|
||||
'pane:next': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('next pane req');
|
||||
focusedWindow?.rpc.emit('next pane req');
|
||||
},
|
||||
'editor:movePreviousWord': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session move word left req');
|
||||
focusedWindow?.rpc.emit('session move word left req');
|
||||
},
|
||||
'editor:moveNextWord': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session move word right req');
|
||||
focusedWindow?.rpc.emit('session move word right req');
|
||||
},
|
||||
'editor:moveBeginningLine': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session move line beginning req');
|
||||
focusedWindow?.rpc.emit('session move line beginning req');
|
||||
},
|
||||
'editor:moveEndLine': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session move line end req');
|
||||
focusedWindow?.rpc.emit('session move line end req');
|
||||
},
|
||||
'editor:deletePreviousWord': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session del word left req');
|
||||
focusedWindow?.rpc.emit('session del word left req');
|
||||
},
|
||||
'editor:deleteNextWord': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session del word right req');
|
||||
focusedWindow?.rpc.emit('session del word right req');
|
||||
},
|
||||
'editor:deleteBeginningLine': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session del line beginning req');
|
||||
focusedWindow?.rpc.emit('session del line beginning req');
|
||||
},
|
||||
'editor:deleteEndLine': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session del line end req');
|
||||
focusedWindow?.rpc.emit('session del line end req');
|
||||
},
|
||||
'editor:break': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session break req');
|
||||
focusedWindow?.rpc.emit('session break req');
|
||||
},
|
||||
'editor:search': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session search');
|
||||
focusedWindow?.rpc.emit('session search');
|
||||
},
|
||||
'editor:search-close': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session search close');
|
||||
focusedWindow?.rpc.emit('session search close');
|
||||
},
|
||||
'cli:install': () => {
|
||||
installCLI(true);
|
||||
|
|
@ -121,7 +121,7 @@ const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
|
|||
([1, 2, 3, 4, 5, 6, 7, 8, 'last'] as const).forEach((cmdIndex) => {
|
||||
const index = cmdIndex === 'last' ? cmdIndex : cmdIndex - 1;
|
||||
commands[`tab:jump:${cmdIndex}`] = (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('move jump req', index);
|
||||
focusedWindow?.rpc.emit('move jump req', index);
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export const createMenu = (
|
|||
|
||||
let updateChannel = 'stable';
|
||||
|
||||
if (config && config.updateChannel && config.updateChannel === 'canary') {
|
||||
if (config?.updateChannel && config.updateChannel === 'canary') {
|
||||
updateChannel = 'canary';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export default class SearchBox extends React.PureComponent<SearchBoxProps> {
|
|||
render() {
|
||||
return (
|
||||
<div style={searchBoxStyling}>
|
||||
<input type="text" className="search-box" onKeyUp={this.handleChange} ref={(input) => input && input.focus()} />
|
||||
<input type="text" className="search-box" onKeyUp={this.handleChange} ref={(input) => input?.focus()} />
|
||||
<span className="search-button" onClick={() => this.props.prev(this.searchTerm)}>
|
||||
{' '}
|
||||
←{' '}
|
||||
|
|
|
|||
Loading…
Reference in a new issue