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

Lint fixes

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2022-01-10 14:53:00 +03:00
parent f698a792e0
commit 27ca597f3a
4 changed files with 22 additions and 43 deletions

View File

@ -32,6 +32,7 @@ import type remote from "@electron/remote";
const electronRemote = (() => { const electronRemote = (() => {
if (ipcRenderer) { if (ipcRenderer) {
/* eslint no-empty: ["error", { "allowEmptyCatch": true }] */
try { try {
return require("@electron/remote"); return require("@electron/remote");
} catch {} } catch {}

View File

@ -40,8 +40,8 @@ const url = extensionSettingsURL({
const routeMatch: match<{ extensionId: string }> = { const routeMatch: match<{ extensionId: string }> = {
isExact: true, isExact: true,
path: extensionSettingsRoute.path as string, path: extensionSettingsRoute.path as string,
url: url, url,
params: { extensionId: "@k8slens/crd-example" } params: { extensionId: "@k8slens/crd-example" },
}; };
const location = createLocation(routeMatch.url); const location = createLocation(routeMatch.url);
@ -56,7 +56,7 @@ const crdExtension = {
isBundled: false, isBundled: false,
isEnabled: true, isEnabled: true,
isCompatible: true, isCompatible: true,
} };
const sampleExtension = { const sampleExtension = {
id: "/absolute/path/sample", id: "/absolute/path/sample",
@ -69,7 +69,7 @@ const sampleExtension = {
isBundled: false, isBundled: false,
isEnabled: true, isEnabled: true,
isCompatible: true, isCompatible: true,
} };
describe("<ExtensionSettingsPage/>", () => { describe("<ExtensionSettingsPage/>", () => {
let di: ConfigurableDependencyInjectionContainer; let di: ConfigurableDependencyInjectionContainer;
@ -84,7 +84,7 @@ describe("<ExtensionSettingsPage/>", () => {
{ {
components: { components: {
Input: () => <input data-testid="crd-name"/>, Input: () => <input data-testid="crd-name"/>,
Hint: () => <div>choose crd name</div> Hint: () => <div>choose crd name</div>,
}, },
extensionId: "@k8slens/crd-example", extensionId: "@k8slens/crd-example",
title: "CRD Preferences", title: "CRD Preferences",
@ -92,7 +92,7 @@ describe("<ExtensionSettingsPage/>", () => {
{ {
components: { components: {
Input: () => <input type="checkbox" data-testid="save-to-file"/>, Input: () => <input type="checkbox" data-testid="save-to-file"/>,
Hint: () => <div>save to file</div> Hint: () => <div>save to file</div>,
}, },
extensionId: "@k8slens/crd-example", extensionId: "@k8slens/crd-example",
title: "Filesystem", title: "Filesystem",
@ -102,11 +102,11 @@ describe("<ExtensionSettingsPage/>", () => {
{ {
components: { components: {
Input: () => <input data-testid="sample-entity-name"/>, Input: () => <input data-testid="sample-entity-name"/>,
Hint: () => <div>sample hint</div> Hint: () => <div>sample hint</div>,
}, },
extensionId: "@k8slens/sample", extensionId: "@k8slens/sample",
title: "Sample preferences", title: "Sample preferences",
} },
], new LensExtension(sampleExtension)); ], new LensExtension(sampleExtension));
}); });

View File

@ -42,7 +42,7 @@ const extension = {
isBundled: false, isBundled: false,
isEnabled: true, isEnabled: true,
isCompatible: true, isCompatible: true,
} };
const crdExtension = { const crdExtension = {
id: "/absolute/path/crd", id: "/absolute/path/crd",
@ -55,7 +55,7 @@ const crdExtension = {
isBundled: false, isBundled: false,
isEnabled: true, isEnabled: true,
isCompatible: true, isCompatible: true,
} };
const sampleExtension = { const sampleExtension = {
id: "/absolute/path/sample", id: "/absolute/path/sample",
@ -68,7 +68,7 @@ const sampleExtension = {
isBundled: false, isBundled: false,
isEnabled: true, isEnabled: true,
isCompatible: true, isCompatible: true,
} };
describe("Preferences", () => { describe("Preferences", () => {
let di: ConfigurableDependencyInjectionContainer; let di: ConfigurableDependencyInjectionContainer;
@ -83,33 +83,33 @@ describe("Preferences", () => {
{ {
components: { components: {
Input: () => <div>input</div>, Input: () => <div>input</div>,
Hint: () => <div>hint</div> Hint: () => <div>hint</div>,
}, },
extensionId: "@k8slens/test", extensionId: "@k8slens/test",
id: "example-preferences", id: "example-preferences",
title: "Example Preferences", title: "Example Preferences",
} },
], new LensExtension(extension)); ], new LensExtension(extension));
AppPreferenceRegistry.getInstance().add([ AppPreferenceRegistry.getInstance().add([
{ {
components: { components: {
Input: () => <div>crd input</div>, Input: () => <div>crd input</div>,
Hint: () => <div>crd hint</div> Hint: () => <div>crd hint</div>,
}, },
extensionId: "@k8slens/crd-example", extensionId: "@k8slens/crd-example",
title: "Example Preferences", title: "Example Preferences",
} },
], new LensExtension(crdExtension)); ], new LensExtension(crdExtension));
AppPreferenceRegistry.getInstance().add([ AppPreferenceRegistry.getInstance().add([
{ {
components: { components: {
Input: () => <div>sample input</div>, Input: () => <div>sample input</div>,
Hint: () => <div>sample hint</div> Hint: () => <div>sample hint</div>,
}, },
extensionId: "@k8slens/crd-example", extensionId: "@k8slens/crd-example",
title: "Extension with duplicated name", title: "Extension with duplicated name",
} },
], new LensExtension(crdExtension)) ], new LensExtension(crdExtension));
}); });
afterEach(() => { afterEach(() => {
@ -137,7 +137,7 @@ describe("Preferences", () => {
const { getByTestId } = render(<MemoryRouter><Preferences /></MemoryRouter>); const { getByTestId } = render(<MemoryRouter><Preferences /></MemoryRouter>);
expect(getByTestId("custom-settings")).toBeInTheDocument(); expect(getByTestId("custom-settings")).toBeInTheDocument();
}) });
it("renders tabs for each extension having custom settings", () => { it("renders tabs for each extension having custom settings", () => {
di.override(userExtensionsInjectable, () => { di.override(userExtensionsInjectable, () => {
@ -159,6 +159,6 @@ describe("Preferences", () => {
const { getAllByText } = render(<MemoryRouter><Preferences /></MemoryRouter>); const { getAllByText } = render(<MemoryRouter><Preferences /></MemoryRouter>);
expect(getAllByText("@k8slens/crd-example").length).toBe(1); expect(getAllByText("@k8slens/crd-example").length).toBe(1);
}) });
}); });
}); });

View File

@ -1,22 +0,0 @@
/**
* Copyright (c) 2021 OpenLens Authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
export * from "./preferences";