Skip to content

Commit dcc15cf

Browse files
committed
address most lint
not translation, yet
1 parent 9a95908 commit dcc15cf

4 files changed

Lines changed: 23 additions & 23 deletions

File tree

lab/src/clusters.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ export class ClusterManager extends Widget {
282282
*/
283283
protected onAfterAttach(msg: Message): void {
284284
super.onAfterAttach(msg);
285-
let node = this._clusterListing.node;
285+
const node = this._clusterListing.node;
286286
node.addEventListener("p-dragenter", this);
287287
node.addEventListener("p-dragleave", this);
288288
node.addEventListener("p-dragover", this);
@@ -293,7 +293,7 @@ export class ClusterManager extends Widget {
293293
* Handle `before-detach` messages for the widget.
294294
*/
295295
protected onBeforeDetach(msg: Message): void {
296-
let node = this._clusterListing.node;
296+
const node = this._clusterListing.node;
297297
node.removeEventListener("p-dragenter", this);
298298
node.removeEventListener("p-dragleave", this);
299299
node.removeEventListener("p-dragover", this);
@@ -378,13 +378,13 @@ export class ClusterManager extends Widget {
378378
* Handle the `'mousemove'` event for the widget.
379379
*/
380380
private _evtMouseMove(event: MouseEvent): void {
381-
let data = this._dragData;
381+
const data = this._dragData;
382382
if (!data) {
383383
return;
384384
}
385385
// Check for a drag initialization.
386-
let dx = Math.abs(event.clientX - data.pressX);
387-
let dy = Math.abs(event.clientY - data.pressY);
386+
const dx = Math.abs(event.clientX - data.pressX);
387+
const dy = Math.abs(event.clientY - data.pressY);
388388
if (dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD) {
389389
event.preventDefault();
390390
event.stopPropagation();
@@ -641,7 +641,7 @@ export namespace ClusterManager {
641641
* A React component for a launcher button listing.
642642
*/
643643
function ClusterListing(props: IClusterListingProps) {
644-
let listing = props.clusters.map((cluster) => {
644+
const listing = props.clusters.map((cluster) => {
645645
return (
646646
<ClusterListingItem
647647
isActive={cluster.id === props.activeClusterId}
@@ -716,13 +716,13 @@ function ClusterListingItem(props: IClusterListingItemProps) {
716716
let cluster_state = "Stopped";
717717
if (cluster.controller) {
718718
cluster_state = cluster.controller.state.state;
719-
if (cluster_state == "after") {
719+
if (cluster_state === "after") {
720720
cluster_state = "Stopped";
721721
}
722722
}
723723

724724
// stop action is 'delete' for already-stopped clusters
725-
let STOP = cluster_state === "Stopped" ? "DELETE" : "STOP";
725+
const STOP = cluster_state === "Stopped" ? "DELETE" : "STOP";
726726

727727
return (
728728
<li
@@ -749,7 +749,7 @@ function ClusterListingItem(props: IClusterListingItemProps) {
749749
/>
750750
<button
751751
className={`ipp-ClusterListingItem-button ipp-ClusterListingItem-start jp-mod-styled ${
752-
cluster_state == "Stopped" ? "" : "ipp-hidden"
752+
cluster_state === "Stopped" ? "" : "ipp-hidden"
753753
}`}
754754
onClick={async (evt) => {
755755
evt.stopPropagation();

lab/src/dialog.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ export class NewCluster extends React.Component<
6262
*/
6363
constructor(props: NewCluster.IProps) {
6464
super(props);
65-
let model: INewCluster;
66-
model = props.initialModel;
65+
const model: INewCluster = props.initialModel;
6766

6867
this.state = { model };
6968
}
@@ -74,7 +73,7 @@ export class NewCluster extends React.Component<
7473
* be sent as the result of the dialog.
7574
*/
7675
componentDidUpdate(): void {
77-
let model: INewCluster = { ...this.state.model };
76+
const model: INewCluster = { ...this.state.model };
7877
this.props.stateEscapeHatch(model);
7978
}
8079

@@ -171,7 +170,7 @@ export class NewCluster extends React.Component<
171170
*
172171
* @param model: the initial model.
173172
*
174-
* @returns a promse that resolves with the user-selected Dialogs for the
173+
* @returns a promise that resolves with the user-selected Dialogs for the
175174
* cluster model. If they pressed the cancel button, it resolves with
176175
* the original model.
177176
*/

lab/src/index.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const plugin: JupyterFrontEndPlugin<void> = {
5353
activate,
5454
id: PLUGIN_ID,
5555
requires: [IConsoleTracker, INotebookTracker, ISettingRegistry, IStateDB],
56+
description: "Manage IPython Parallel clusters from the JupyterLab sidebar.",
5657
optional: [ILabShell],
5758
autoStart: true,
5859
};
@@ -76,7 +77,7 @@ async function activate(
7677
const id = "ipp-cluster-launcher";
7778

7879
const isLab = !!labShell;
79-
const isRetroTree = PageConfig.getOption("retroPage") == "tree";
80+
const isRetroTree = PageConfig.getOption("retroPage") === "tree";
8081

8182
const clientCodeInjector = async (model: IClusterModel) => {
8283
const editor = await Private.getCurrentEditor(
@@ -177,7 +178,7 @@ async function activate(
177178

178179
// Whether the cluster clients should aggressively inject themselves
179180
// into the current session.
180-
let autoStartClient: boolean = false;
181+
const autoStartClient: boolean = false;
181182

182183
// Update the existing trackers and signals in light of a change to the
183184
// settings system. In particular, this reacts to a change in the setting
@@ -246,6 +247,7 @@ async function activate(
246247
// If either is not found, it bails.
247248
app.commands.addCommand(CommandIDs.injectClientCode, {
248249
label: "Inject IPython Client Connection Code",
250+
describedBy: {},
249251
execute: async () => {
250252
const cluster = Private.clusterFromClick(app, sidebar.clusterManager);
251253
if (!cluster) {
@@ -258,6 +260,7 @@ async function activate(
258260
// Add a command to launch a new cluster.
259261
app.commands.addCommand(CommandIDs.newCluster, {
260262
label: (args) => (args["isPalette"] ? "Create New Cluster" : "NEW"),
263+
describedBy: {},
261264
execute: () => sidebar.clusterManager.create(),
262265
iconClass: (args) =>
263266
args["isPalette"] ? "" : "jp-AddIcon jp-Icon jp-Icon-16",
@@ -273,6 +276,7 @@ async function activate(
273276
// Add a command to launch a new cluster.
274277
app.commands.addCommand(CommandIDs.startCluster, {
275278
label: "Start Cluster",
279+
describedBy: {},
276280
execute: () => {
277281
const cluster = Private.clusterFromClick(app, sidebar.clusterManager);
278282
if (!cluster) {
@@ -285,6 +289,7 @@ async function activate(
285289
// Add a command to stop a cluster.
286290
app.commands.addCommand(CommandIDs.stopCluster, {
287291
label: "Shutdown Cluster",
292+
describedBy: {},
288293
execute: () => {
289294
const cluster = Private.clusterFromClick(app, sidebar.clusterManager);
290295
if (!cluster) {
@@ -297,6 +302,7 @@ async function activate(
297302
// Add a command to resize a cluster.
298303
app.commands.addCommand(CommandIDs.scaleCluster, {
299304
label: "Scale Cluster…",
305+
describedBy: {},
300306
execute: () => {
301307
const cluster = Private.clusterFromClick(app, sidebar.clusterManager);
302308
if (!cluster) {
@@ -361,11 +367,6 @@ async function activate(
361367
}
362368

363369
namespace Private {
364-
/**
365-
* A private counter for ids.
366-
*/
367-
export let id = 0;
368-
369370
/**
370371
* Whether a kernel should be used. Only evaluates to true
371372
* if it is valid and in python.
@@ -438,7 +439,7 @@ rc`;
438439
): Kernel.IKernelConnection | null | undefined {
439440
// Get a handle on the most relevant kernel,
440441
// whether it is attached to a notebook or a console.
441-
let current = shell.currentWidget;
442+
const current = shell.currentWidget;
442443
let kernel: Kernel.IKernelConnection | null | undefined;
443444
if (current && notebookTracker.has(current)) {
444445
kernel = (current as NotebookPanel).sessionContext.session?.kernel;
@@ -467,7 +468,7 @@ rc`;
467468
): Promise<CodeEditor.IEditor | null | undefined> {
468469
// Get a handle on the most relevant kernel,
469470
// whether it is attached to a notebook or a console.
470-
let current = app.shell.currentWidget;
471+
const current = app.shell.currentWidget;
471472
let editor: CodeEditor.IEditor | null | undefined;
472473
if (current && notebookTracker.has(current)) {
473474
NotebookActions.insertAbove((current as NotebookPanel).content);

lab/src/sidebar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class Sidebar extends Widget {
1313
constructor(options: Sidebar.IOptions) {
1414
super();
1515
this.addClass("ipp-Sidebar");
16-
let layout = (this.layout = new PanelLayout());
16+
const layout = (this.layout = new PanelLayout());
1717

1818
const injectClientCodeForCluster = options.clientCodeInjector;
1919
const getClientCodeForCluster = options.clientCodeGetter;

0 commit comments

Comments
 (0)