Skip to content

Commit 91c6d8b

Browse files
committed
Update eslint and prettier, and run eslint
1 parent a1ea675 commit 91c6d8b

File tree

7 files changed

+627
-730
lines changed

7 files changed

+627
-730
lines changed

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@
5454
},
5555
"devDependencies": {
5656
"@jupyterlab/builder": "^4.0.0-alpha.4",
57-
"@typescript-eslint/eslint-plugin": "^4.8.1",
58-
"@typescript-eslint/parser": "^4.8.1",
59-
"eslint": "^7.14.0",
60-
"eslint-config-prettier": "^6.15.0",
61-
"eslint-plugin-prettier": "^3.1.4",
57+
"@typescript-eslint/eslint-plugin": "^5.12.1",
58+
"@typescript-eslint/parser": "^5.12.1",
59+
"eslint": "^8.9.0",
60+
"eslint-config-prettier": "^8.4.0",
61+
"eslint-plugin-prettier": "^4.0.0",
6262
"npm-run-all": "^4.1.5",
63-
"prettier": "^2.1.1",
63+
"prettier": "^2.5.1",
6464
"rimraf": "^3.0.2",
6565
"typescript": "~4.5.2"
6666
},

src/factory.ts

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
import {
2-
ABCWidgetFactory,
3-
DocumentRegistry,
4-
DocumentModel
5-
} from '@jupyterlab/docregistry';
6-
7-
import { BlocklyEditor, BlocklyPanel } from './widget';
8-
2+
ABCWidgetFactory,
3+
DocumentRegistry,
4+
DocumentModel
5+
} from '@jupyterlab/docregistry';
6+
7+
import { BlocklyEditor, BlocklyPanel } from './widget';
8+
9+
/**
10+
* A widget factory to create new instances of ExampleDocWidget.
11+
*/
12+
export class BlocklyEditorFactory extends ABCWidgetFactory<
13+
BlocklyEditor,
14+
DocumentModel
15+
> {
916
/**
10-
* A widget factory to create new instances of ExampleDocWidget.
17+
* Constructor of ExampleWidgetFactory.
18+
*
19+
* @param options Constructor options
1120
*/
12-
export class BlocklyEditorFactory extends ABCWidgetFactory<
13-
BlocklyEditor,
14-
DocumentModel
15-
> {
16-
/**
17-
* Constructor of ExampleWidgetFactory.
18-
*
19-
* @param options Constructor options
20-
*/
21-
constructor(options: DocumentRegistry.IWidgetFactoryOptions) {
22-
super(options);
23-
}
24-
25-
/**
26-
* Create a new widget given a context.
27-
*
28-
* @param context Contains the information of the file
29-
* @returns The widget
30-
*/
31-
protected createNewWidget(
32-
context: DocumentRegistry.IContext<DocumentModel>
33-
): BlocklyEditor {
34-
return new BlocklyEditor({
35-
context,
36-
content: new BlocklyPanel(context)
37-
});
38-
}
39-
}
21+
constructor(options: DocumentRegistry.IWidgetFactoryOptions) {
22+
super(options);
23+
}
24+
25+
/**
26+
* Create a new widget given a context.
27+
*
28+
* @param context Contains the information of the file
29+
* @returns The widget
30+
*/
31+
protected createNewWidget(
32+
context: DocumentRegistry.IContext<DocumentModel>
33+
): BlocklyEditor {
34+
return new BlocklyEditor({
35+
context,
36+
content: new BlocklyPanel(context)
37+
});
38+
}
39+
}

src/index.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,21 @@ import { WidgetTracker } from '@jupyterlab/apputils';
88

99
import { BlocklyEditorFactory } from './factory';
1010

11-
1211
import { BlocklyEditor } from './widget';
1312

1413
/**
1514
* The name of the factory that creates the editor widgets.
1615
*/
17-
const FACTORY = 'Blockly editor';
16+
const FACTORY = 'Blockly editor';
1817

1918
/**
2019
* Initialization data for the jupyterlab-blocky extension.
2120
*/
2221
const plugin: JupyterFrontEndPlugin<void> = {
2322
id: 'jupyterlab-blocky:plugin',
2423
autoStart: true,
25-
requires: [ILayoutRestorer],
26-
activate: (app: JupyterFrontEnd, restorer: ILayoutRestorer) => {
24+
requires: [ILayoutRestorer],
25+
activate: (app: JupyterFrontEnd, restorer: ILayoutRestorer) => {
2726
console.log('JupyterLab extension jupyterlab-blocky is activated!');
2827

2928
// Namespace for the tracker
@@ -44,22 +43,22 @@ const plugin: JupyterFrontEndPlugin<void> = {
4443

4544
// Creating the widget factory to register it so the document manager knows about
4645
// our new DocumentWidget
47-
const widgetFactory = new BlocklyEditorFactory({
48-
name: FACTORY,
49-
modelName: 'text',
50-
fileTypes: ['json']
46+
const widgetFactory = new BlocklyEditorFactory({
47+
name: FACTORY,
48+
modelName: 'text',
49+
fileTypes: ['json']
5150
});
5251

53-
// Add the widget to the tracker when it's created
52+
// Add the widget to the tracker when it's created
5453
widgetFactory.widgetCreated.connect((sender, widget) => {
5554
// Notify the instance tracker if restore data needs to update.
5655
widget.context.pathChanged.connect(() => {
5756
tracker.save(widget);
5857
});
5958
tracker.add(widget);
60-
});
61-
// Registering the widget factory
62-
app.docRegistry.addWidgetFactory(widgetFactory);
59+
});
60+
// Registering the widget factory
61+
app.docRegistry.addWidgetFactory(widgetFactory);
6362
}
6463
};
6564

src/layout.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class BlocklyLayout extends Layout {
9090
protected onResize(msg: Message): void {
9191
console.debug('[BlocklyLayout] onResize');
9292
// TODO: write the resize logic
93-
var rect = this.parent.node.getBoundingClientRect();
93+
const rect = this.parent.node.getBoundingClientRect();
9494
this._host.style.width = rect.width + 'px';
9595
this._host.style.height = rect.height + 'px';
9696
Blockly.svgResize(this._workspace);
@@ -121,4 +121,4 @@ export class BlocklyLayout extends Layout {
121121
protected onAfterShow(msg: Message): void {
122122
console.debug('[BlocklyLayout] onAfterShow');
123123
}
124-
}
124+
}

0 commit comments

Comments
 (0)