add no-unused and react/recommended to eslint (#1523)

* add no-unused-vars and no-unused-imports

* added quotes: double, and remove ignore pattern

* move itif and describeif into utils

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2020-11-27 08:48:38 -05:00
1 parent 10eb082854
commit 7451869c25
199 files changed
+1178 -807

No files matched your search

@@ -8,7 +8,7 @@ jest.mock(
"electron",
() => ({
ipcRenderer: {
invoke: jest.fn(async (channel: string, ...args: any[]) => {
invoke: jest.fn(async (channel: string) => {
if (channel === "extensions:loaded") {
return [
[
+1 -1
View File
@@ -112,7 +112,7 @@ export abstract class ClusterFeature {
fs.readdirSync(folderPath).forEach(filename => {
const file = path.join(folderPath, filename);
const raw = fs.readFileSync(file);
if (filename.endsWith('.hb')) {
if (filename.endsWith(".hb")) {
const template = hb.compile(raw.toString());
resources.push(template(this.templateContext));
} else {
+1 -2
View File
@@ -162,7 +162,7 @@ export class ExtensionDiscovery {
if (path.relative(this.localFolderPath, filePath) === extensionFolderName) {
const extensionName: string | undefined = Object
.entries(this.packagesJson.dependencies)
.find(([_name, extensionFolder]) => filePath === extensionFolder)?.[0];
.find(([, extensionFolder]) => filePath === extensionFolder)?.[0];
if (extensionName !== undefined) {
delete this.packagesJson.dependencies[extensionName];
@@ -244,7 +244,6 @@ export class ExtensionDiscovery {
isBundled?: boolean;
} = {}): Promise<InstalledExtension | null> {
let manifestJson: LensExtensionManifest;
let isEnabled: boolean;
try {
// check manifest file for existence
+2 -2
View File
@@ -1,4 +1,4 @@
import AwaitLock from 'await-lock';
import AwaitLock from "await-lock";
import child_process from "child_process";
import fs from "fs-extra";
import path from "path";
@@ -27,7 +27,7 @@ export class ExtensionInstaller {
}
get npmPath() {
return __non_webpack_require__.resolve('npm/bin/npm-cli');
return __non_webpack_require__.resolve("npm/bin/npm-cli");
}
installDependencies(): Promise<void> {
+3 -7
View File
@@ -21,13 +21,9 @@ export class ExtensionsStore extends BaseStore<LensExtensionsStoreModel> {
@computed
get enabledExtensions() {
const extensions: string[] = [];
this.state.forEach((state, id) => {
if (state.enabled) {
extensions.push(state.name);
}
});
return extensions;
return Array.from(this.state.values())
.filter(({enabled}) => enabled)
.map(({name}) => name);
}
protected state = observable.map<LensExtensionId, LensExtensionState>();
-1
View File
@@ -1,5 +1,4 @@
import type { MenuRegistration } from "./registries/menu-registry";
import { observable } from "mobx";
import { LensExtension } from "./lens-extension";
import { WindowManager } from "../main/window-manager";
import { getExtensionPageUrl } from "./registries/page-registry";
+1 -1
View File
@@ -1,6 +1,5 @@
import type { AppPreferenceRegistration, ClusterFeatureRegistration, KubeObjectDetailRegistration, KubeObjectMenuRegistration, KubeObjectStatusRegistration, PageMenuRegistration, PageRegistration, StatusBarRegistration, } from "./registries";
import type { Cluster } from "../main/cluster";
import { observable } from "mobx";
import { LensExtension } from "./lens-extension";
import { getExtensionPageUrl } from "./registries/page-registry";
@@ -30,6 +29,7 @@ export class LensRendererExtension extends LensExtension {
/**
* Defines if extension is enabled for a given cluster. Defaults to `true`.
*/
// eslint-disable-next-line unused-imports/no-unused-vars-ts
async isEnabledForCluster(cluster: Cluster): Promise<Boolean> {
return true;
}
@@ -1,4 +1,4 @@
import { getExtensionPageUrl, globalPageRegistry, PageRegistration } from "../page-registry";
import { getExtensionPageUrl, globalPageRegistry } from "../page-registry";
import { LensExtension } from "../../lens-extension";
import React from "react";
@@ -53,18 +53,18 @@ describe("globalPageRegistry", () => {
{
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);
@@ -1,7 +1,7 @@
// Extensions-api -> Register page menu items
import type { IconProps } from "../../renderer/components/icon";
import type React from "react";
import { action, computed } from "mobx";
import { action } from "mobx";
import { BaseRegistry } from "./base-registry";
import { LensExtension } from "../lens-extension";
import { RegisteredPage } from "./page-registry";