1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

chore: Run lint:fix on all files

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2023-04-03 14:42:53 -04:00
parent 85d7980ab0
commit 5d14434e65
6 changed files with 22 additions and 48 deletions

View File

@ -1,11 +1,7 @@
import { pipeline } from "@ogre-tools/fp"; import { pipeline } from "@ogre-tools/fp";
import { filter, isString } from "lodash/fp"; import { filter, isString } from "lodash/fp";
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import { import { Binding, KeyboardShortcut, keyboardShortcutInjectionToken } from "./keyboard-shortcut-injection-token";
Binding,
KeyboardShortcut,
keyboardShortcutInjectionToken,
} from "./keyboard-shortcut-injection-token";
import platformInjectable from "./platform.injectable"; import platformInjectable from "./platform.injectable";
export type InvokeShortcut = (event: KeyboardEvent) => void; export type InvokeShortcut = (event: KeyboardEvent) => void;
@ -46,8 +42,7 @@ const toBindingWithDefaults = (binding: Binding) =>
...binding, ...binding,
}; };
const toShortcutsWithMatchingBinding = const toShortcutsWithMatchingBinding = (event: KeyboardEvent, platform: string) => (shortcut: KeyboardShortcut) => {
(event: KeyboardEvent, platform: string) => (shortcut: KeyboardShortcut) => {
const binding = toBindingWithDefaults(shortcut.binding); const binding = toBindingWithDefaults(shortcut.binding);
const shiftModifierMatches = binding.shift === event.shiftKey; const shiftModifierMatches = binding.shift === event.shiftKey;
@ -55,11 +50,9 @@ const toShortcutsWithMatchingBinding =
const isMac = platform === "darwin"; const isMac = platform === "darwin";
const ctrlModifierMatches = const ctrlModifierMatches = binding.ctrl === event.ctrlKey || (!isMac && binding.ctrlOrCommand === event.ctrlKey);
binding.ctrl === event.ctrlKey || (!isMac && binding.ctrlOrCommand === event.ctrlKey);
const metaModifierMatches = const metaModifierMatches = binding.meta === event.metaKey || (isMac && binding.ctrlOrCommand === event.metaKey);
binding.meta === event.metaKey || (isMac && binding.ctrlOrCommand === event.metaKey);
return ( return (
event.code === binding.code && event.code === binding.code &&

View File

@ -26,10 +26,7 @@ const NonInjectedKeyboardShortcutListener = ({
return <>{children}</>; return <>{children}</>;
}; };
export const KeyboardShortcutListener = withInjectables< export const KeyboardShortcutListener = withInjectables<Dependencies, KeyboardShortcutListenerProps>(
Dependencies,
KeyboardShortcutListenerProps
>(
NonInjectedKeyboardShortcutListener, NonInjectedKeyboardShortcutListener,
{ {

View File

@ -175,8 +175,7 @@ describe("keyboard-shortcuts", () => {
shouldCallCallback: true, shouldCallCallback: true,
}, },
{ {
scenario: scenario: "given shortcut with shift modifier, when shortcut is pressed, calls the callback",
"given shortcut with shift modifier, when shortcut is pressed, calls the callback",
binding: { shift: true, code: "F1" }, binding: { shift: true, code: "F1" },
keyboard: "{Shift>}[F1]", keyboard: "{Shift>}[F1]",

View File

@ -3,7 +3,4 @@ export {
computedChannelObserverInjectionToken, computedChannelObserverInjectionToken,
} from "./src/computed-channel/computed-channel.injectable"; } from "./src/computed-channel/computed-channel.injectable";
export type { export type { ChannelObserver, ComputedChannelFactory } from "./src/computed-channel/computed-channel.injectable";
ChannelObserver,
ComputedChannelFactory,
} from "./src/computed-channel/computed-channel.injectable";

View File

@ -1,23 +1,13 @@
import { getInjectable, getInjectionToken } from "@ogre-tools/injectable"; import { getInjectable, getInjectionToken } from "@ogre-tools/injectable";
import { import { computed, IComputedValue, observable, onBecomeObserved, onBecomeUnobserved, runInAction } from "mobx";
computed,
IComputedValue,
observable,
onBecomeObserved,
onBecomeUnobserved,
runInAction,
} from "mobx";
import type { MessageChannel } from "@k8slens/messaging"; import type { MessageChannel } from "@k8slens/messaging";
import { getMessageChannelListenerInjectable } from "@k8slens/messaging"; import { getMessageChannelListenerInjectable } from "@k8slens/messaging";
import { sendMessageToChannelInjectionToken } from "@k8slens/messaging"; import { sendMessageToChannelInjectionToken } from "@k8slens/messaging";
import { computedChannelAdministrationChannel } from "./computed-channel-administration-channel.injectable"; import { computedChannelAdministrationChannel } from "./computed-channel-administration-channel.injectable";
export type ComputedChannelFactory = <T>( export type ComputedChannelFactory = <T>(channel: MessageChannel<T>, pendingValue: T) => IComputedValue<T>;
channel: MessageChannel<T>,
pendingValue: T,
) => IComputedValue<T>;
export const computedChannelInjectionToken = getInjectionToken<ComputedChannelFactory>({ export const computedChannelInjectionToken = getInjectionToken<ComputedChannelFactory>({
id: "computed-channel-injection-token", id: "computed-channel-injection-token",

View File

@ -27,9 +27,7 @@ const render = (components: ReactApplicationHigherOrderComponent[]) => {
export const ReactApplication = observer(({ di }: ReactApplicationProps) => { export const ReactApplication = observer(({ di }: ReactApplicationProps) => {
const computedInjectMany = di.inject(computedInjectManyInjectable); const computedInjectMany = di.inject(computedInjectManyInjectable);
const higherOrderComponents = computedInjectMany( const higherOrderComponents = computedInjectMany(reactApplicationHigherOrderComponentInjectionToken);
reactApplicationHigherOrderComponentInjectionToken,
);
const Components = [...higherOrderComponents.get(), ReactApplicationContent]; const Components = [...higherOrderComponents.get(), ReactApplicationContent];