Skip to content

Commit fccf4a4

Browse files
committed
Update READMEs
Lint server-extension
1 parent 96998d0 commit fccf4a4

File tree

14 files changed

+126
-77
lines changed

14 files changed

+126
-77
lines changed

command-palette/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ const extension: JupyterFrontEndPlugin<void> = {
4242
console.log(
4343
`jlab-examples:command-palette has been called ${args['origin']}.`
4444
);
45-
}
45+
},
4646
});
4747

4848
// Add the command to the command palette
4949
const category = 'Extension Examples';
5050
palette.addItem({ command, category, args: { origin: 'from palette' } });
51-
}
51+
},
5252
```
5353
5454
The `ICommandPalette`

commands/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ with the unique command id and optionally the arguments.
7171
```ts
7272
// src/index.ts#L31-L36
7373

74-
commands.execute(command, { origin: 'init' }).catch(reason => {
74+
commands.execute(command, { origin: 'init' }).catch((reason) => {
7575
console.error(
7676
`An error occurred during the execution of jlab-examples:command.\n${reason}`
7777
);
7878
});
79-
}
79+
},
8080
```
8181

8282
When running JupyterLab with this extension, the following message should

context-menu/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ app.docRegistry.addFileType({
5252
extensions: ['.example'],
5353
fileFormat: 'text',
5454
contentType: 'file',
55-
mimeTypes: ['text/plain']
55+
mimeTypes: ['text/plain'],
5656
});
5757
```
5858
<!-- prettier-ignore-end -->
@@ -73,9 +73,9 @@ app.commands.addCommand('jlab-examples/context-menu:open', {
7373
showDialog({
7474
title: file.name,
7575
body: 'Path: ' + file.path,
76-
buttons: [Dialog.okButton()]
77-
}).catch(e => console.log(e));
78-
}
76+
buttons: [Dialog.okButton()],
77+
}).catch((e) => console.log(e));
78+
},
7979
});
8080
```
8181
<!-- prettier-ignore-end -->
@@ -93,7 +93,7 @@ Finally, you can add the command to a context menu using the `addItem()` method
9393
app.contextMenu.addItem({
9494
command: 'jlab-examples/context-menu:open',
9595
selector: '.jp-DirListing-item[data-file-type="example"]',
96-
rank: 0
96+
rank: 0,
9797
});
9898
```
9999
<!-- prettier-ignore-end -->

custom-log-console/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ To initialize a new `LogConsoleWidget` you have to create a `LogConsolePanel` to
7474
logConsolePanel = new LogConsolePanel(
7575
new LoggerRegistry({
7676
defaultRendermime: rendermime,
77-
maxLength: 1000
77+
maxLength: 1000,
7878
})
7979
);
8080
```
@@ -97,7 +97,7 @@ Now you are ready to initialize a new `MainAreaWidget` passing the `logConsolePa
9797
// src/index.ts#L86-L88
9898

9999
logConsoleWidget = new MainAreaWidget<LogConsolePanel>({
100-
content: logConsolePanel
100+
content: logConsolePanel,
101101
});
102102
```
103103
<!-- prettier-ignore-end -->
@@ -133,7 +133,7 @@ commands.addCommand('jlab-examples/custom-log-console:open', {
133133
} else {
134134
createLogConsoleWidget();
135135
}
136-
}
136+
},
137137
});
138138
```
139139
@@ -147,7 +147,7 @@ Finally, you can send log messages calling `log` method present on the `logger`
147147
const msg: IHtmlLog = {
148148
type: 'html',
149149
level: 'debug',
150-
data: '<div>Hello world HTML!!</div>'
150+
data: '<div>Hello world HTML!!</div>',
151151
};
152152

153153
logConsolePanel?.logger?.log(msg);
@@ -180,14 +180,14 @@ logConsolePanel?.logger?.log(msg);
180180
const data: nbformat.IOutput = {
181181
output_type: 'display_data',
182182
data: {
183-
'text/plain': 'Hello world nbformat!!'
184-
}
183+
'text/plain': 'Hello world nbformat!!',
184+
},
185185
};
186186

187187
const msg: IOutputLog = {
188188
type: 'output',
189189
level: 'warning',
190-
data
190+
data,
191191
};
192192

193193
logConsolePanel?.logger?.log(msg);

hello-world/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ The following sections will walk you through the extension code files.
100100
Start with the file `src/index.ts`. This typescript file contains the main
101101
logic of the extension. It begins with the following import section:
102102

103+
<!-- prettier-ignore-start -->
103104
```ts
104105
// src/index.ts#L1-L4
105106

@@ -108,6 +109,7 @@ import {
108109
JupyterFrontEndPlugin,
109110
} from '@jupyterlab/application';
110111
```
112+
<!-- prettier-ignore-end -->
111113

112114
`JupyterFrontEnd` is the main Jupyterlab application class. It allows you to
113115
access and modify some of its main components. `JupyterFrontEndPlugin` is the class
@@ -116,10 +118,10 @@ called `@jupyterlab/application`. The dependency of your extension on this
116118
package is declared in the file `package.json`:
117119

118120
```json5
119-
// package.json#L46-L48
121+
// package.json#L50-L52
120122

121123
"dependencies": {
122-
"@jupyterlab/application": "^3.0.0"
124+
"@jupyterlab/application": "^3.0.10"
123125
},
124126
```
125127

@@ -143,7 +145,7 @@ const plugin: JupyterFrontEndPlugin<void> = {
143145
```ts
144146
// src/index.ts#L14-L17
145147

146-
}
148+
},
147149
};
148150

149151
export default plugin;
@@ -230,7 +232,7 @@ a bit. Simply replace the `activate` function with the following lines:
230232

231233
activate: (app: JupyterFrontEnd) => {
232234
console.log('the JupyterLab main application:', app);
233-
}
235+
},
234236
```
235237
<!-- prettier-ignore-end -->
236238

kernel-messaging/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ this._sessionContext = new SessionContext({
5151
```ts
5252
void this._sessionContext
5353
.initialize()
54-
.then(async value => {
54+
.then(async (value) => {
5555
if (value) {
5656
await sessionContextDialogs.selectKernel(this._sessionContext);
5757
}
5858
})
59-
.catch(reason => {
59+
.catch((reason) => {
6060
console.error(
6161
`Failed to initialize the session in ExamplePanel.\n${reason}`
6262
);

kernel-output/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ with this line:
7979

8080
void this._sessionContext
8181
.initialize()
82-
.then(async value => {
82+
.then(async (value) => {
8383
if (value) {
8484
await sessionContextDialogs.selectKernel(this._sessionContext);
8585
}
8686
})
87-
.catch(reason => {
87+
.catch((reason) => {
8888
console.error(
8989
`Failed to initialize the session in ExamplePanel.\n${reason}`
9090
);
@@ -145,7 +145,7 @@ execute(code: string): void {
145145
.then((msg: KernelMessage.IExecuteReplyMsg) => {
146146
console.log(msg);
147147
})
148-
.catch(reason => console.error(reason));
148+
.catch((reason) => console.error(reason));
149149
}
150150
```
151151

log-messages/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Finally, you can send log messages by calling the `log` method of the `logger` o
6262
const msg: ITextLog = {
6363
type: 'text',
6464
level: 'info',
65-
data: 'Hello world text!!'
65+
data: 'Hello world text!!',
6666
};
6767

6868
logger?.log(msg);

main-menu/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,20 @@ The `IMainMenu` interface can be requested as a new argument to the `activate`
1414
function, but first it has to be imported. And the class `Menu` to create new
1515
menu needs also to be imported but from the Lumino library:
1616

17+
<!-- prettier-ignore-start -->
1718
```ts
1819
// src/index.ts#L6-L8
1920

2021
import { IMainMenu } from '@jupyterlab/mainmenu';
2122

2223
import { Menu } from '@lumino/widgets';
2324
```
25+
<!-- prettier-ignore-end -->
2426

2527
You can add the `IMainMenu` in the `requires:` property such that it is injected into
2628
the `activate` function. The extension looks like:
2729

30+
<!-- prettier-ignore-start -->
2831
```ts
2932
// src/index.ts#L15-L57
3033

@@ -72,6 +75,7 @@ const extension: JupyterFrontEndPlugin<void> = {
7275
},
7376
};
7477
```
78+
<!-- prettier-ignore-end -->
7579

7680
In this extension, you have the dependencies to _@jupyterlab/mainmenu_ and
7781
_@lumino/widgets_. Before it builds, this dependencies have to be added to the
@@ -85,11 +89,11 @@ After the execution of that command, `package.json` should list them in the
8589
`dependencies`:
8690

8791
```json5
88-
// package.json#L46-L50
92+
// package.json#L50-L54
8993

9094
"dependencies": {
91-
"@jupyterlab/application": "^3.0.0-rc.15",
92-
"@jupyterlab/mainmenu": "^3.0.0-rc.15",
95+
"@jupyterlab/application": "^3.0.10",
96+
"@jupyterlab/mainmenu": "^3.0.8",
9397
"@lumino/widgets": "^1.16.1"
9498
},
9599
```

0 commit comments

Comments
 (0)