Skip to content

Commit 71ce76a

Browse files
jtpiokrassowski
andauthored
Fix lint warnings (jupyter#7881)
* Fix lint warnings * error out * Apply suggestions from code review Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com> * more fixes --------- Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
1 parent 6dabe35 commit 71ce76a

8 files changed

Lines changed: 201 additions & 2 deletions

File tree

eslint.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ export default defineConfig([
6363
},
6464
},
6565
rules: {
66-
'jupyter/command-described-by': 'warn',
66+
'jupyter/command-described-by': 'error',
6767
'jupyter/plugin-activation-args': 'error',
68-
'jupyter/plugin-description': 'warn',
68+
'jupyter/plugin-description': 'error',
6969
'@typescript-eslint/naming-convention': [
7070
'error',
7171
{

packages/application-extension/src/index.ts

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ const dirty: JupyterFrontEndPlugin<void> = {
166166
*/
167167
const info: JupyterFrontEndPlugin<JupyterLab.IInfo> = {
168168
id: '@jupyter-notebook/application-extension:info',
169+
description: 'Provides application information for the current notebook app.',
169170
autoStart: true,
170171
provides: JupyterLab.IInfo,
171172
activate: (app: JupyterFrontEnd): JupyterLab.IInfo => {
@@ -268,6 +269,22 @@ const opener: JupyterFrontEndPlugin<void> = {
268269
});
269270
});
270271
},
272+
describedBy: {
273+
args: {
274+
type: 'object',
275+
properties: {
276+
path: {
277+
type: 'string',
278+
description: 'The routed URL path to handle.',
279+
},
280+
search: {
281+
type: 'string',
282+
description: 'The routed URL query string.',
283+
},
284+
},
285+
required: ['path'],
286+
},
287+
},
271288
});
272289

273290
router.register({ command, pattern: TREE_PATTERN });
@@ -342,6 +359,12 @@ const pages: JupyterFrontEndPlugin<void> = {
342359
execute: () => {
343360
window.open(URLExt.join(baseUrl, 'lab'));
344361
},
362+
describedBy: {
363+
args: {
364+
type: 'object',
365+
properties: {},
366+
},
367+
},
345368
});
346369
const page = PageConfig.getOption('notebookPage');
347370

@@ -354,6 +377,12 @@ const pages: JupyterFrontEndPlugin<void> = {
354377
window.open(URLExt.join(baseUrl, 'tree'));
355378
}
356379
},
380+
describedBy: {
381+
args: {
382+
type: 'object',
383+
properties: {},
384+
},
385+
},
357386
});
358387

359388
if (palette) {
@@ -438,6 +467,18 @@ const rendermime: JupyterFrontEndPlugin<IRenderMimeRegistry> = {
438467
});
439468
});
440469
},
470+
describedBy: {
471+
args: {
472+
type: 'object',
473+
properties: {
474+
path: {
475+
type: 'string',
476+
description: 'The local path to open.',
477+
},
478+
},
479+
required: ['path'],
480+
},
481+
},
441482
});
442483
}
443484
return new RenderMimeRegistry({
@@ -649,6 +690,12 @@ const title: JupyterFrontEndPlugin<void> = {
649690
const result = await docManager.duplicate(current.context.path);
650691
await commands.execute('docmanager:open', { path: result.path });
651692
},
693+
describedBy: {
694+
args: {
695+
type: 'object',
696+
properties: {},
697+
},
698+
},
652699
});
653700

654701
commands.addCommand(CommandIDs.rename, {
@@ -696,6 +743,12 @@ const title: JupyterFrontEndPlugin<void> = {
696743
skipRouting: true,
697744
});
698745
},
746+
describedBy: {
747+
args: {
748+
type: 'object',
749+
properties: {},
750+
},
751+
},
699752
});
700753

701754
node.onclick = async () => {
@@ -740,6 +793,12 @@ const topVisibility: JupyterFrontEndPlugin<void> = {
740793
}
741794
},
742795
isToggled: () => top.isVisible,
796+
describedBy: {
797+
args: {
798+
type: 'object',
799+
properties: {},
800+
},
801+
},
743802
});
744803

745804
let adjustToScreen = false;
@@ -890,6 +949,27 @@ const sidePanelVisibility: JupyterFrontEndPlugin<void> = {
890949
}
891950
return false;
892951
},
952+
describedBy: {
953+
args: {
954+
type: 'object',
955+
properties: {
956+
side: {
957+
type: 'string',
958+
enum: ['left', 'right'],
959+
description: 'The side panel area to toggle.',
960+
},
961+
title: {
962+
type: 'string',
963+
description: 'The title shown for the side panel entry.',
964+
},
965+
id: {
966+
type: 'string',
967+
description: 'The widget id to show or hide in the side panel.',
968+
},
969+
},
970+
required: ['side', 'title', 'id'],
971+
},
972+
},
893973
});
894974

895975
const sidePanelMenu: { [area in SidePanel.Area]: IDisposable | null } = {
@@ -1057,6 +1137,17 @@ const tree: JupyterFrontEndPlugin<JupyterFrontEnd.ITreeResolver> = {
10571137

10581138
delegate.resolve({ browser, file: PageConfig.getOption('treePath') });
10591139
}) as (args: any) => Promise<void>,
1140+
describedBy: {
1141+
args: {
1142+
type: 'object',
1143+
properties: {
1144+
search: {
1145+
type: 'string',
1146+
description: 'The routed URL query string.',
1147+
},
1148+
},
1149+
},
1150+
},
10601151
})
10611152
);
10621153
set.add(
@@ -1169,6 +1260,12 @@ const zen: JupyterFrontEndPlugin<void> = {
11691260
toggleOff();
11701261
}
11711262
},
1263+
describedBy: {
1264+
args: {
1265+
type: 'object',
1266+
properties: {},
1267+
},
1268+
},
11721269
});
11731270

11741271
document.addEventListener('fullscreenchange', () => {

packages/console-extension/src/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ const opener: JupyterFrontEndPlugin<void> = {
5959
const path = decodeURIComponent(match);
6060
commands.execute('console:create', { path });
6161
},
62+
describedBy: {
63+
args: {
64+
type: 'object',
65+
properties: {
66+
path: {
67+
type: 'string',
68+
description: 'The routed URL path to handle.',
69+
},
70+
},
71+
required: ['path'],
72+
},
73+
},
6274
});
6375

6476
router.register({ command, pattern: consolePattern });

packages/help-extension/src/index.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ const open: JupyterFrontEndPlugin<void> = {
5959
const url = args['url'] as string;
6060
window.open(url);
6161
},
62+
describedBy: {
63+
args: {
64+
type: 'object',
65+
properties: {
66+
text: {
67+
type: 'string',
68+
description: 'The label to display for the help resource.',
69+
},
70+
url: {
71+
type: 'string',
72+
description: 'The URL to open in a new browser tab.',
73+
},
74+
},
75+
required: ['text', 'url'],
76+
},
77+
},
6278
});
6379
},
6480
};
@@ -144,6 +160,12 @@ const about: JupyterFrontEndPlugin<void> = {
144160
dialog.addClass('jp-AboutNotebook');
145161
void dialog.launch();
146162
},
163+
describedBy: {
164+
args: {
165+
type: 'object',
166+
properties: {},
167+
},
168+
},
147169
});
148170

149171
if (palette) {

packages/lab-extension/src/index.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,26 @@ const interfaceSwitcher: JupyterFrontEndPlugin<void> = {
166166
caption: commandLabel,
167167
execute,
168168
isEnabled,
169+
describedBy: {
170+
args: {
171+
type: 'object',
172+
properties: {
173+
noLabel: {
174+
type: 'boolean',
175+
description: 'Whether to hide the command label.',
176+
},
177+
isMenu: {
178+
type: 'boolean',
179+
description: 'Whether the command is rendered in a menu.',
180+
},
181+
isPalette: {
182+
type: 'boolean',
183+
description:
184+
'Whether the command is rendered in the command palette.',
185+
},
186+
},
187+
},
188+
},
169189
});
170190

171191
if (palette) {
@@ -246,6 +266,12 @@ const launchNotebookTree: JupyterFrontEndPlugin<void> = {
246266
const url = URLExt.join(PageConfig.getBaseUrl(), 'tree');
247267
window.open(url);
248268
},
269+
describedBy: {
270+
args: {
271+
type: 'object',
272+
properties: {},
273+
},
274+
},
249275
});
250276

251277
if (palette) {

packages/notebook-extension/src/index.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ const closeTab: JupyterFrontEndPlugin<void> = {
255255
await commands.execute('notebook:shutdown-kernel', { activate: false });
256256
window.close();
257257
},
258+
describedBy: {
259+
args: {
260+
type: 'object',
261+
properties: {},
262+
},
263+
},
258264
});
259265
menu.fileMenu.closeAndCleaners.add({
260266
id,
@@ -286,6 +292,12 @@ const openTreeTab: JupyterFrontEndPlugin<void> = {
286292
const url = URLExt.join(PageConfig.getBaseUrl(), 'tree');
287293
window.open(url);
288294
},
295+
describedBy: {
296+
args: {
297+
type: 'object',
298+
properties: {},
299+
},
300+
},
289301
});
290302
},
291303
};
@@ -356,6 +368,12 @@ const fullWidthNotebook: JupyterFrontEndPlugin<void> = {
356368
},
357369
isEnabled: () => tracker.currentWidget !== null,
358370
isToggled: () => fullWidth,
371+
describedBy: {
372+
args: {
373+
type: 'object',
374+
properties: {},
375+
},
376+
},
359377
});
360378

361379
if (palette) {
@@ -744,6 +762,12 @@ const editNotebookMetadata: JupyterFrontEndPlugin<void> = {
744762
isVisible: () =>
745763
shell.currentWidget !== null &&
746764
shell.currentWidget instanceof NotebookPanel,
765+
describedBy: {
766+
args: {
767+
type: 'object',
768+
properties: {},
769+
},
770+
},
747771
});
748772

749773
if (palette) {

packages/terminal-extension/src/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ const opener: JupyterFrontEndPlugin<void> = {
5252
});
5353
commands.execute('terminal:open', { name });
5454
},
55+
describedBy: {
56+
args: {
57+
type: 'object',
58+
properties: {
59+
path: {
60+
type: 'string',
61+
description: 'The routed URL path to handle.',
62+
},
63+
},
64+
required: ['path'],
65+
},
66+
},
5567
});
5668

5769
router.register({ command, pattern: terminalPattern });

packages/tree-extension/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,12 @@ const openFileBrowser: JupyterFrontEndPlugin<void> = {
318318
execute: () => {
319319
notebookTree.currentWidget = browser;
320320
},
321+
describedBy: {
322+
args: {
323+
type: 'object',
324+
properties: {},
325+
},
326+
},
321327
});
322328
},
323329
};

0 commit comments

Comments
 (0)