chore: Improve linting within @k8slens/core

- Turning on @typescript-eslint/recommended-requiring-type-checking
- Turning off @typescript-eslint/no-unnecessary-type-assertion (due too many false positives)
- Making @typescript-eslint/no-explicit-any an error (except in tests)

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2023-06-01 09:17:17 -04:00
1 parent 6184c2f03b
commit fa44b795d4
734 files changed
+32216 -4566

No files matched your search

@@ -2,9 +2,24 @@
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectionToken } from "@ogre-tools/injectable";
import type { DiContainerForInjection } from "@ogre-tools/injectable";
import { getInjectable, getInjectionToken } from "@ogre-tools/injectable";
import type { KubeApi } from "@k8slens/kube-api";
export const kubeApiInjectionToken = getInjectionToken<KubeApi<any, any>>({
export const kubeApiInjectionToken = getInjectionToken<KubeApi>({
id: "kube-api-injection-token",
});
export interface KubeApiInjectableParts<Api> {
id: string;
instantiate: (
di: DiContainerForInjection,
) => Api extends KubeApi<infer Kube, infer Data> ? KubeApi<Kube, Data> & Api : never;
}
export const getKubeApiInjectable = <Api>(parts: KubeApiInjectableParts<Api>) =>
getInjectable({
id: parts.id,
instantiate: (di) => parts.instantiate(di),
injectionToken: kubeApiInjectionToken,
});