Skip to content

Commit 436a15e

Browse files
authored
Merge pull request #1009 from ipython/dependabot/npm_and_yarn/typescript-6.0.3
Bump typescript from 5.9.3 to 6.0.3
2 parents 97027d4 + dcc15cf commit 436a15e

11 files changed

Lines changed: 621 additions & 450 deletions

.eslintignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ repos:
4343
- id: check-case-conflict
4444
- id: check-executables-have-shebangs
4545
- id: requirements-txt-fixer
46-
- repo: https://github.com/pre-commit/mirrors-eslint
47-
rev: 9158d5162f915488785c296b5d08d6d18be10d32 # frozen: v10.3.0
48-
hooks:
49-
- id: eslint
50-
files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
51-
exclude: ipyparallel/nbextension/.*
52-
types: [file]
53-
additional_dependencies:
54-
- "@typescript-eslint/eslint-plugin@2.27.0"
55-
- "@typescript-eslint/parser@2.27.0"
56-
- eslint@^6.0.0
57-
- eslint-config-prettier@6.10.1
58-
- eslint-plugin-prettier@3.1.4
59-
- eslint-plugin-react@7.21.5
60-
- typescript@4.1.3
46+
# - repo: https://github.com/pre-commit/mirrors-eslint
47+
# rev: 9158d5162f915488785c296b5d08d6d18be10d32 # frozen: v10.3.0
48+
# hooks:
49+
# - id: eslint
50+
# files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
51+
# exclude: ipyparallel/nbextension/.*
52+
# types: [file]
53+
# additional_dependencies:
54+
# - "@typescript-eslint/eslint-plugin@8.59.2"
55+
# - "@typescript-eslint/parser@2.27.0"
56+
# - eslint@^6.0.0
57+
# - eslint-config-prettier@6.10.1
58+
# - eslint-plugin-prettier@3.1.4
59+
# - eslint-plugin-react@7.21.5
60+
# - typescript@4.1.3

eslint.config.mjs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import js from "@eslint/js";
2+
import { defineConfig } from "eslint/config";
3+
import tseslint from "typescript-eslint";
4+
import prettierRecommended from "eslint-plugin-prettier/recommended";
5+
import globals from "globals";
6+
import jupyterPlugin from "@jupyter/eslint-plugin";
7+
8+
// workaround: plugin recommended config doesn't enable itself
9+
for (var cfg of jupyterPlugin.configs.recommended) {
10+
cfg.plugins = {
11+
jupyter: jupyterPlugin,
12+
};
13+
}
14+
15+
export default defineConfig([
16+
{
17+
ignores: ["node_modules", "dist", "coverage", "**/*.js", "**/*.d.ts"],
18+
},
19+
js.configs.recommended,
20+
tseslint.configs.recommended,
21+
jupyterPlugin.configs.recommended,
22+
{
23+
files: ["**/*.ts", "**/*.tsx"],
24+
plugins: {
25+
jupyter: jupyterPlugin,
26+
},
27+
languageOptions: {
28+
globals: {
29+
...globals.browser,
30+
...globals.es2015,
31+
...globals.node,
32+
},
33+
parserOptions: {
34+
project: "tsconfig.eslint.json",
35+
sourceType: "module",
36+
},
37+
},
38+
rules: {
39+
"@typescript-eslint/naming-convention": [
40+
"error",
41+
{
42+
selector: "interface",
43+
format: ["PascalCase"],
44+
custom: {
45+
regex: "^I[A-Z]",
46+
match: true,
47+
},
48+
},
49+
],
50+
"@typescript-eslint/no-unused-vars": ["warn", { args: "none" }],
51+
"@typescript-eslint/no-explicit-any": "off",
52+
"@typescript-eslint/no-namespace": "off",
53+
"@typescript-eslint/no-use-before-define": "off",
54+
"@typescript-eslint/quotes": [
55+
"error",
56+
"single",
57+
{ avoidEscape: true, allowTemplateLiterals: false },
58+
],
59+
curly: ["error", "all"],
60+
eqeqeq: "error",
61+
"prefer-arrow-callback": "error",
62+
},
63+
},
64+
prettierRecommended,
65+
]);

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/global.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare module "*.css" {}
2+
3+
declare module "*.svg" {}

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;

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,23 @@
7272
"react-dom": "^18.2.0"
7373
},
7474
"devDependencies": {
75+
"@eslint/js": "^9.0.0",
76+
"@jupyter/eslint-plugin": "^1.0.0",
7577
"@jupyterlab/builder": "^4.5.7",
7678
"@types/react": "^18.0.26",
7779
"@types/react-dom": "~18.3.7",
7880
"@typescript-eslint/eslint-plugin": "^8.59.2",
7981
"@typescript-eslint/parser": "^8.59.2",
80-
"eslint": "^10.2.1",
81-
"eslint-config-prettier": "^10.1.8",
82+
"eslint": "^9.7",
83+
"eslint-config-prettier": "^9",
8284
"eslint-plugin-prettier": "^5.5.5",
8385
"eslint-plugin-react": "^7.37.5",
86+
"jsonc-eslint-parser": "^3.1.0",
8487
"npm-run-all2": "^8.0.4",
8588
"prettier": "^3.8.3",
8689
"rimraf": "^6.1.3",
87-
"typescript": "~5.9.3"
90+
"typescript": "~6.0.3",
91+
"typescript-eslint": "^8.59.3"
8892
},
8993
"resolutions": {
9094
"@types/react": "^18.0.26"

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
],
1616
"jsx": "react",
1717
"module": "esnext",
18-
"moduleResolution": "node",
18+
"moduleResolution": "bundler",
1919
"noEmitOnError": true,
2020
"noImplicitAny": true,
2121
"noUnusedLocals": true,

0 commit comments

Comments
 (0)