mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Lint: comma-spacing (error) & comma-dangle (error) (#4200)
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
02e77afcd1
commit
c6dce043a7
406 files changed
+1590
-1580
No files matched your search
@@ -39,7 +39,7 @@ describe("extension compatibility", () => {
|
||||
it("has no extension comparator", () => {
|
||||
const manifest = { name: "extensionName", version: "0.0.1" };
|
||||
|
||||
expect(isCompatibleExtension(manifest,)).toBe(false);
|
||||
expect(isCompatibleExtension(manifest)).toBe(false);
|
||||
});
|
||||
|
||||
it.each([
|
||||
@@ -78,7 +78,7 @@ describe("extension compatibility", () => {
|
||||
])("extension comparator test: %p", ({ comparator, expected }) => {
|
||||
const manifest: LensExtensionManifest = { name: "extensionName", version: "0.0.1", engines: { lens: comparator }};
|
||||
|
||||
expect(isCompatibleExtension(manifest,)).toBe(expected);
|
||||
expect(isCompatibleExtension(manifest)).toBe(expected);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -93,7 +93,7 @@ describe("extension compatibility", () => {
|
||||
it("has no extension comparator", () => {
|
||||
const manifest = { name: "extensionName", version: "0.0.1" };
|
||||
|
||||
expect(isCompatibleExtension(manifest,)).toBe(false);
|
||||
expect(isCompatibleExtension(manifest)).toBe(false);
|
||||
});
|
||||
|
||||
it.each([
|
||||
@@ -132,7 +132,7 @@ describe("extension compatibility", () => {
|
||||
])("extension comparator test: %p", ({ comparator, expected }) => {
|
||||
const manifest: LensExtensionManifest = { name: "extensionName", version: "0.0.1", engines: { lens: comparator }};
|
||||
|
||||
expect(isCompatibleExtension(manifest,)).toBe(expected);
|
||||
expect(isCompatibleExtension(manifest)).toBe(expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -32,13 +32,13 @@ jest.setTimeout(60_000);
|
||||
|
||||
jest.mock("../../common/ipc");
|
||||
jest.mock("chokidar", () => ({
|
||||
watch: jest.fn()
|
||||
watch: jest.fn(),
|
||||
}));
|
||||
jest.mock("../extension-installer", () => ({
|
||||
extensionInstaller: {
|
||||
extensionPackagesRoot: "",
|
||||
installPackage: jest.fn()
|
||||
}
|
||||
installPackage: jest.fn(),
|
||||
},
|
||||
}));
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
@@ -72,7 +72,7 @@ describe("ExtensionDiscovery", () => {
|
||||
beforeEach(() => {
|
||||
mockFs({
|
||||
[`${os.homedir()}/.k8slens/extensions/my-extension/package.json`]: JSON.stringify({
|
||||
name: "my-extension"
|
||||
name: "my-extension",
|
||||
}),
|
||||
});
|
||||
});
|
||||
@@ -91,11 +91,11 @@ describe("ExtensionDiscovery", () => {
|
||||
}
|
||||
|
||||
return mockWatchInstance;
|
||||
})
|
||||
}),
|
||||
};
|
||||
|
||||
mockedWatch.mockImplementationOnce(() =>
|
||||
(mockWatchInstance) as any
|
||||
(mockWatchInstance) as any,
|
||||
);
|
||||
|
||||
const extensionDiscovery = ExtensionDiscovery.createInstance();
|
||||
@@ -134,11 +134,11 @@ describe("ExtensionDiscovery", () => {
|
||||
}
|
||||
|
||||
return mockWatchInstance;
|
||||
})
|
||||
}),
|
||||
};
|
||||
|
||||
mockedWatch.mockImplementationOnce(() =>
|
||||
(mockWatchInstance) as any
|
||||
(mockWatchInstance) as any,
|
||||
);
|
||||
const extensionDiscovery = ExtensionDiscovery.createInstance();
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ jest.mock("../extensions-store", () => ({
|
||||
ExtensionsStore: {
|
||||
getInstance: () => ({
|
||||
whenLoaded: Promise.resolve(true),
|
||||
mergeState: jest.fn()
|
||||
})
|
||||
}
|
||||
mergeState: jest.fn(),
|
||||
}),
|
||||
},
|
||||
}));
|
||||
|
||||
jest.mock(
|
||||
@@ -118,13 +118,13 @@ jest.mock(
|
||||
]);
|
||||
}, 10);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
},
|
||||
}),
|
||||
{
|
||||
virtual: true,
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
describe("ExtensionLoader", () => {
|
||||
@@ -189,11 +189,11 @@ describe("ExtensionLoader", () => {
|
||||
expect(ExtensionsStore.getInstance().mergeState).toHaveBeenCalledWith({
|
||||
"manifest/path": {
|
||||
enabled: false,
|
||||
name: "TestExtension"
|
||||
name: "TestExtension",
|
||||
},
|
||||
"manifest/path2": {
|
||||
enabled: true,
|
||||
name: "TestExtension2"
|
||||
name: "TestExtension2",
|
||||
}});
|
||||
});
|
||||
});
|
||||
@@ -32,14 +32,14 @@ describe("lens extension", () => {
|
||||
ext = new LensExtension({
|
||||
manifest: {
|
||||
name: "foo-bar",
|
||||
version: "0.1.1"
|
||||
version: "0.1.1",
|
||||
},
|
||||
id: "/this/is/fake/package.json",
|
||||
absolutePath: "/absolute/fake/",
|
||||
manifestPath: "/this/is/fake/package.json",
|
||||
isBundled: false,
|
||||
isEnabled: true,
|
||||
isCompatible: true
|
||||
isCompatible: true,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -175,8 +175,8 @@ export class ExtensionDiscovery extends Singleton {
|
||||
awaitWriteFinish: {
|
||||
// Wait 300ms until the file size doesn't change to consider the file written.
|
||||
// For a small file like package.json this should be plenty of time.
|
||||
stabilityThreshold: 300
|
||||
}
|
||||
stabilityThreshold: 300,
|
||||
},
|
||||
})
|
||||
// Extension add is detected by watching "<extensionDir>/package.json" add
|
||||
.on("add", this.handleWatchFileAdd)
|
||||
@@ -370,7 +370,7 @@ export class ExtensionDiscovery extends Singleton {
|
||||
manifest,
|
||||
isBundled,
|
||||
isEnabled,
|
||||
isCompatible
|
||||
isCompatible,
|
||||
};
|
||||
} catch (error) {
|
||||
if (error.code === "ENOTDIR") {
|
||||
@@ -407,7 +407,7 @@ export class ExtensionDiscovery extends Singleton {
|
||||
*/
|
||||
installBundledPackages(packageJsonPath: string, extensions: InstalledExtension[]): Promise<void> {
|
||||
const dependencies = Object.fromEntries(
|
||||
extensions.map(extension => [extension.manifest.name, extension.absolutePath])
|
||||
extensions.map(extension => [extension.manifest.name, extension.absolutePath]),
|
||||
);
|
||||
|
||||
return extensionInstaller.installPackages(packageJsonPath, { dependencies });
|
||||
@@ -482,7 +482,7 @@ export class ExtensionDiscovery extends Singleton {
|
||||
|
||||
toJSON(): ExtensionDiscoveryChannelMessage {
|
||||
return toJS({
|
||||
isLoaded: this.isLoaded
|
||||
isLoaded: this.isLoaded,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ export class ExtensionInstaller {
|
||||
try {
|
||||
// Write the package.json which will be installed in .installDependencies()
|
||||
await fs.writeFile(path.join(packageJsonPath), JSON.stringify(packagesJson, null, 2), {
|
||||
mode: 0o600
|
||||
mode: 0o600,
|
||||
});
|
||||
|
||||
logger.info(`${logModule} installing dependencies at ${extensionPackagesRoot()}`);
|
||||
@@ -86,7 +86,7 @@ export class ExtensionInstaller {
|
||||
const child = child_process.fork(this.npmPath, args, {
|
||||
cwd: extensionPackagesRoot(),
|
||||
silent: true,
|
||||
env: {}
|
||||
env: {},
|
||||
});
|
||||
let stderr = "";
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ export class ExtensionLoader extends Singleton {
|
||||
.map(([extId, extension]) => [extId, {
|
||||
enabled: extension.isEnabled,
|
||||
name: extension.manifest.name,
|
||||
}])
|
||||
}]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ export class ExtensionLoader extends Singleton {
|
||||
this.autoInitExtensions(async (extension: LensMainExtension) => {
|
||||
// Each .add returns a function to remove the item
|
||||
const removeItems = [
|
||||
registries.MenuRegistry.getInstance().add(extension.appMenus)
|
||||
registries.MenuRegistry.getInstance().add(extension.appMenus),
|
||||
];
|
||||
|
||||
this.events.on("remove", (removedExtension: LensRendererExtension) => {
|
||||
|
||||
@@ -59,14 +59,14 @@ describe("page registry tests", () => {
|
||||
ext = new LensExtension({
|
||||
manifest: {
|
||||
name: "foo-bar",
|
||||
version: "0.1.1"
|
||||
version: "0.1.1",
|
||||
},
|
||||
id: "/this/is/fake/package.json",
|
||||
absolutePath: "/absolute/fake/",
|
||||
manifestPath: "/this/is/fake/package.json",
|
||||
isBundled: false,
|
||||
isEnabled: true,
|
||||
isCompatible: true
|
||||
isCompatible: true,
|
||||
});
|
||||
UserStore.createInstance();
|
||||
ThemeStore.createInstance();
|
||||
@@ -75,30 +75,30 @@ describe("page registry tests", () => {
|
||||
GlobalPageRegistry.createInstance().add({
|
||||
id: "page-with-params",
|
||||
components: {
|
||||
Page: () => React.createElement("Page with params")
|
||||
Page: () => React.createElement("Page with params"),
|
||||
},
|
||||
params: {
|
||||
test1: "test1-default",
|
||||
test2: "" // no default value, just declaration
|
||||
test2: "", // no default value, just declaration
|
||||
},
|
||||
}, ext);
|
||||
GlobalPageRegistry.createInstance().add([
|
||||
{
|
||||
id: "test-page",
|
||||
components: {
|
||||
Page: () => React.createElement("Text")
|
||||
}
|
||||
Page: () => React.createElement("Text"),
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "another-page",
|
||||
components: {
|
||||
Page: () => React.createElement("Text")
|
||||
Page: () => React.createElement("Text"),
|
||||
},
|
||||
},
|
||||
{
|
||||
components: {
|
||||
Page: () => React.createElement("Default")
|
||||
}
|
||||
Page: () => React.createElement("Default"),
|
||||
},
|
||||
},
|
||||
], ext);
|
||||
});
|
||||
@@ -168,7 +168,7 @@ describe("page registry tests", () => {
|
||||
it("returns matching page", () => {
|
||||
const page = GlobalPageRegistry.getInstance().getByPageTarget({
|
||||
pageId: "test-page",
|
||||
extensionId: ext.name
|
||||
extensionId: ext.name,
|
||||
});
|
||||
|
||||
expect(page.id).toEqual("test-page");
|
||||
@@ -177,7 +177,7 @@ describe("page registry tests", () => {
|
||||
it("returns null if target not found", () => {
|
||||
const page = GlobalPageRegistry.getInstance().getByPageTarget({
|
||||
pageId: "wrong-page",
|
||||
extensionId: ext.name
|
||||
extensionId: ext.name,
|
||||
});
|
||||
|
||||
expect(page).toBeNull();
|
||||
|
||||
@@ -137,7 +137,7 @@ class PageRegistry extends BaseRegistry<PageRegistration, RegisteredPage> {
|
||||
if (notAStringValue && !(parse || stringify)) {
|
||||
throw new Error(
|
||||
`PageRegistry: param's "${paramName}" initialization has failed:
|
||||
paramInit.parse() and paramInit.stringify() are required for non string | string[] "defaultValue"`
|
||||
paramInit.parse() and paramInit.stringify() are required for non string | string[] "defaultValue"`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,5 +28,5 @@ export type KubeObjectStatus = {
|
||||
export enum KubeObjectStatusLevel {
|
||||
INFO = 1,
|
||||
WARNING = 2,
|
||||
CRITICAL = 3
|
||||
CRITICAL = 3,
|
||||
}
|
||||
Reference in new issue
Block a user