-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ban circular dependencies #3547
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
module.exports = { | ||
"overrides": [ | ||
{ | ||
files: [ | ||
"**/*.ts", | ||
"**/*.tsx", | ||
], | ||
rules: { | ||
"import/no-unresolved": ["error", { | ||
ignore: ["@k8slens/extensions"], | ||
}], | ||
}, | ||
}, | ||
], | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,15 @@ import { ClusterFrameInfo, clusterFrameMap } from "../cluster-frames"; | |
import type { Disposer } from "../utils"; | ||
import type remote from "@electron/remote"; | ||
|
||
const electronRemote = ipcMain ? null : require("@electron/remote"); | ||
const electronRemote = (() => { | ||
if (ipcRenderer) { | ||
try { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm. Add comment to explain the underlying very good reason for this wild-card try/catch. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code will be going away as soon as #4625 is merged so I don't think it is really necessary. |
||
return require("@electron/remote"); | ||
} catch {} | ||
} | ||
|
||
return null; | ||
})(); | ||
|
||
const subFramesChannel = "ipc:get-sub-frames"; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,9 @@ import type { IKubeWatchEvent } from "./kube-watch-api"; | |
import { KubeJsonApi, KubeJsonApiData } from "./kube-json-api"; | ||
import { noop } from "../utils"; | ||
import type { RequestInit } from "node-fetch"; | ||
|
||
// BUG: https://github.com/mysticatea/abort-controller/pull/22 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could explain more about the relevancy of this bug? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So there is the rule However, in this case there is a bug in the "abort-controller" package where (even though according to the typings there is an export called "AbortController") in fact it is only default exported in the JS. |
||
// eslint-disable-next-line import/no-named-as-default | ||
import AbortController from "abort-controller"; | ||
import { Agent, AgentOptions } from "https"; | ||
import type { Patch } from "rfc6902"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,9 @@ import { ensureObjectSelfLink, IKubeApiQueryParams, KubeApi } from "./kube-api"; | |
import { parseKubeApi } from "./kube-api-parse"; | ||
import type { KubeJsonApiData } from "./kube-json-api"; | ||
import type { RequestInit } from "node-fetch"; | ||
|
||
// BUG: https://github.com/mysticatea/abort-controller/pull/22 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as before. |
||
// eslint-disable-next-line import/no-named-as-default | ||
import AbortController from "abort-controller"; | ||
import type { Patch } from "rfc6902"; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,6 @@ import { apiManager } from "../../../common/k8s-api/api-manager"; | |
import { crdStore } from "../+custom-resources/crd.store"; | ||
import { KubeObjectMenu } from "../kube-object-menu"; | ||
import { KubeObjectDetailRegistry } from "../../api/kube-object-detail-registry"; | ||
import logger from "../../../main/logger"; | ||
import { CrdResourceDetails } from "../+custom-resources"; | ||
import { KubeObjectMeta } from "../kube-object-meta"; | ||
import { hideDetails, kubeDetailsUrlParam } from "../kube-detail-params"; | ||
|
@@ -62,7 +61,7 @@ export class KubeObjectDetails extends React.Component { | |
.getStore(this.path) | ||
?.getByPath(this.path); | ||
} catch (error) { | ||
logger.error(`[KUBE-OBJECT-DETAILS]: failed to get store or object: ${error}`, { path: this.path }); | ||
console.error(`[KUBE-OBJECT-DETAILS]: failed to get store or object: ${error}`, { path: this.path }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm. Should not use explicit console.error instead of abstracted logger. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough, I don't exactly remember why I did this since in #4317 I revert this back.... will revert. |
||
|
||
return undefined; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is non-env-agnostic code in common, which is bad. However, the tooling to solve something like this is not here yet -> ok for now.