Skip to content

Commit 08c9c5d

Browse files
committed
Lint example
1 parent 78c9410 commit 08c9c5d

File tree

4 files changed

+24
-21
lines changed

4 files changed

+24
-21
lines changed

server-extension/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ JupyterLab is looking for frontend extensions when the Python package is install
664664
The last piece of configuration needed is the enabling of the server extension. This is
665665
done by copying the following JSON file:
666666
667+
<!-- prettier-ignore-start -->
667668
```json5
668669
// jupyter-config/server-config/jlab_ext_example.json
669670

@@ -676,6 +677,7 @@ done by copying the following JSON file:
676677
}
677678

678679
```
680+
<!-- prettier-ignore-end -->
679681
680682
in the appropriate jupyter folder (`etc/jupyter/jupyter_server_config.d`):
681683

toolbar-button/.eslintrc.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ module.exports = {
55
'plugin:@typescript-eslint/recommended',
66
'plugin:jsdoc/recommended',
77
'plugin:prettier/recommended',
8-
'plugin:react/recommended'
8+
'plugin:react/recommended',
99
],
1010
parser: '@typescript-eslint/parser',
1111
parserOptions: {
1212
project: 'tsconfig.json',
13-
sourceType: 'module'
13+
sourceType: 'module',
1414
},
1515
plugins: ['@typescript-eslint', 'jsdoc'],
1616
rules: {
1717
'@typescript-eslint/interface-name-prefix': [
1818
'error',
19-
{ prefixWithI: 'always' }
19+
{ prefixWithI: 'always' },
2020
],
2121
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
2222
'@typescript-eslint/no-explicit-any': 'off',
@@ -26,22 +26,22 @@ module.exports = {
2626
'@typescript-eslint/quotes': [
2727
'error',
2828
'single',
29-
{ avoidEscape: true, allowTemplateLiterals: false }
29+
{ avoidEscape: true, allowTemplateLiterals: false },
3030
],
3131
curly: ['error', 'all'],
3232
eqeqeq: 'error',
3333
'jsdoc/require-param-type': 'off',
3434
'jsdoc/require-property-type': 'off',
3535
'jsdoc/require-returns-type': 'off',
3636
'jsdoc/no-types': 'warn',
37-
'prefer-arrow-callback': 'error'
37+
'prefer-arrow-callback': 'error',
3838
},
3939
settings: {
4040
jsdoc: {
41-
mode: 'typescript'
41+
mode: 'typescript',
4242
},
4343
react: {
44-
version: 'detect'
45-
}
46-
}
44+
version: 'detect',
45+
},
46+
},
4747
};

toolbar-button/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { IDisposable, DisposableDelegate } from '@lumino/disposable';
1515

1616
import {
1717
JupyterFrontEnd,
18-
JupyterFrontEndPlugin
18+
JupyterFrontEndPlugin,
1919
} from '@jupyterlab/application';
2020

2121
import { ToolbarButton } from '@jupyterlab/apputils';
@@ -25,7 +25,7 @@ import { DocumentRegistry } from '@jupyterlab/docregistry';
2525
import {
2626
NotebookActions,
2727
NotebookPanel,
28-
INotebookModel
28+
INotebookModel,
2929
} from '@jupyterlab/notebook';
3030
```
3131

@@ -37,7 +37,7 @@ Firstly you have to register the plugin information. For that you have to pass a
3737
const plugin: JupyterFrontEndPlugin<void> = {
3838
activate,
3939
id: 'toolbar-button',
40-
autoStart: true
40+
autoStart: true,
4141
};
4242
```
4343

@@ -48,7 +48,8 @@ document widget; in this case a notebook panel.
4848
// src/index.ts#L30-L54
4949

5050
export class ButtonExtension
51-
implements DocumentRegistry.IWidgetExtension<NotebookPanel, INotebookModel> {
51+
implements DocumentRegistry.IWidgetExtension<NotebookPanel, INotebookModel>
52+
{
5253
/**
5354
* Create a new extension for the notebook panel widget.
5455
*/
@@ -63,25 +64,24 @@ export class ButtonExtension
6364
className: 'clear-output-button',
6465
label: 'Clear All Outputs',
6566
onClick: clearOutput,
66-
tooltip: 'Clear All Outputs'
67+
tooltip: 'Clear All Outputs',
6768
});
6869

6970
panel.toolbar.insertItem(10, 'clearOutputs', button);
7071
return new DisposableDelegate(() => {
7172
button.dispose();
7273
});
7374
}
74-
}
7575
```
7676
7777
Finally you need to tell the document registry about your widget extension:
7878
7979
```ts
8080
// src/index.ts#L59-L61
8181

82+
*/
8283
function activate(app: JupyterFrontEnd) {
8384
app.docRegistry.addWidgetExtension('Notebook', new ButtonExtension());
84-
}
8585
```
8686
8787
## Where to Go Next

toolbar-button/src/index.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { IDisposable, DisposableDelegate } from '@lumino/disposable';
22

33
import {
44
JupyterFrontEnd,
5-
JupyterFrontEndPlugin
5+
JupyterFrontEndPlugin,
66
} from '@jupyterlab/application';
77

88
import { ToolbarButton } from '@jupyterlab/apputils';
@@ -12,7 +12,7 @@ import { DocumentRegistry } from '@jupyterlab/docregistry';
1212
import {
1313
NotebookActions,
1414
NotebookPanel,
15-
INotebookModel
15+
INotebookModel,
1616
} from '@jupyterlab/notebook';
1717

1818
/**
@@ -21,14 +21,15 @@ import {
2121
const plugin: JupyterFrontEndPlugin<void> = {
2222
activate,
2323
id: 'toolbar-button',
24-
autoStart: true
24+
autoStart: true,
2525
};
2626

2727
/**
2828
* A notebook widget extension that adds a button to the toolbar.
2929
*/
3030
export class ButtonExtension
31-
implements DocumentRegistry.IWidgetExtension<NotebookPanel, INotebookModel> {
31+
implements DocumentRegistry.IWidgetExtension<NotebookPanel, INotebookModel>
32+
{
3233
/**
3334
* Create a new extension for the notebook panel widget.
3435
*/
@@ -43,7 +44,7 @@ export class ButtonExtension
4344
className: 'clear-output-button',
4445
label: 'Clear All Outputs',
4546
onClick: clearOutput,
46-
tooltip: 'Clear All Outputs'
47+
tooltip: 'Clear All Outputs',
4748
});
4849

4950
panel.toolbar.insertItem(10, 'clearOutputs', button);

0 commit comments

Comments
 (0)