Skip to content

Commit b85d98a

Browse files
committed
Fix build error
1 parent e2f81a6 commit b85d98a

13 files changed

+145
-145
lines changed

src/CodeSnippetDisplay.tsx

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
addIcon,
2626
pythonIcon,
2727
fileIcon,
28-
rKernelIcon
28+
rKernelIcon,
2929
} from '@jupyterlab/ui-components';
3030
import { CodeEditor, IEditorServices } from '@jupyterlab/codeeditor';
3131
import * as nbformat from '@jupyterlab/nbformat';
@@ -35,7 +35,7 @@ import {
3535
CodeCellModel,
3636
ICodeCellModel,
3737
MarkdownCell,
38-
CodeCell
38+
CodeCell,
3939
} from '@jupyterlab/cells';
4040

4141
import { Widget } from '@lumino/widgets';
@@ -92,7 +92,7 @@ import {
9292
sbtIcon,
9393
rustIcon,
9494
qsharpIcon,
95-
sasIcon
95+
sasIcon,
9696
} from './CodeSnippetLanguages';
9797

9898
/**
@@ -141,7 +141,7 @@ const JUPYTER_CELL_MIME = 'application/vnd.jupyter.cells';
141141
*/
142142
const moreOptionsIcon = new LabIcon({
143143
name: 'custom-ui-components:moreOptions',
144-
svgstr: moreSVGstr
144+
svgstr: moreSVGstr,
145145
});
146146

147147
/**
@@ -183,7 +183,7 @@ export class CodeSnippetDisplay extends React.Component<
183183
codeSnippets: props.codeSnippets,
184184
matchIndices: [],
185185
searchValue: '',
186-
filterTags: []
186+
filterTags: [],
187187
};
188188
this._drag = null;
189189
this._dragData = null;
@@ -278,7 +278,7 @@ export class CodeSnippetDisplay extends React.Component<
278278
'" is incompatible with ' +
279279
editorLanguage +
280280
'. Continue?',
281-
buttons: [Dialog.cancelButton(), Dialog.okButton()]
281+
buttons: [Dialog.cancelButton(), Dialog.okButton()],
282282
});
283283
};
284284

@@ -287,7 +287,7 @@ export class CodeSnippetDisplay extends React.Component<
287287
return showDialog({
288288
title: 'Error',
289289
body: errMsg,
290-
buttons: [Dialog.okButton()]
290+
buttons: [Dialog.okButton()],
291291
});
292292
};
293293

@@ -412,7 +412,7 @@ export class CodeSnippetDisplay extends React.Component<
412412
await showDialog({
413413
title: 'Duplicate Name of Code Snippet',
414414
body: <p> {`"${newName}" already exists.`} </p>,
415-
buttons: [Dialog.okButton({ label: 'Dismiss' })]
415+
buttons: [Dialog.okButton({ label: 'Dismiss' })],
416416
});
417417
return;
418418
}
@@ -464,7 +464,7 @@ export class CodeSnippetDisplay extends React.Component<
464464
this._dragData = {
465465
pressX: event.clientX,
466466
pressY: event.clientY,
467-
dragImage: target.nextSibling.firstChild.cloneNode(true) as HTMLElement
467+
dragImage: target.nextSibling.firstChild.cloneNode(true) as HTMLElement,
468468
};
469469

470470
const dragImageTextColor = getComputedStyle(document.body).getPropertyValue(
@@ -563,7 +563,7 @@ export class CodeSnippetDisplay extends React.Component<
563563
dragImage: dragImage,
564564
supportedActions: 'copy-move',
565565
proposedAction: 'copy',
566-
source: this
566+
source: this,
567567
});
568568

569569
this._drag.mimeData.setData(JUPYTER_CELL_MIME, selected);
@@ -1142,8 +1142,8 @@ export class CodeSnippetDisplay extends React.Component<
11421142
): void => {
11431143
showMoreOptions({ body: new OptionsHandler(this, codeSnippet) });
11441144
this._setOptionsPosition(event);
1145-
}
1146-
}
1145+
},
1146+
},
11471147
];
11481148
return (
11491149
<div
@@ -1173,7 +1173,7 @@ export class CodeSnippetDisplay extends React.Component<
11731173
id: id,
11741174
title: displayName,
11751175
body: new PreviewHandler(),
1176-
codeSnippet: codeSnippet
1176+
codeSnippet: codeSnippet,
11771177
},
11781178
this.props.editorServices
11791179
);
@@ -1189,7 +1189,7 @@ export class CodeSnippetDisplay extends React.Component<
11891189
{this.boldNameOnSearch(id, language, name)}
11901190
</div>
11911191
<div className={ACTION_BUTTONS_WRAPPER_CLASS} id={id.toString()}>
1192-
{actionButtons.map(btn => {
1192+
{actionButtons.map((btn) => {
11931193
return (
11941194
<button
11951195
key={btn.title}
@@ -1234,7 +1234,7 @@ export class CodeSnippetDisplay extends React.Component<
12341234
codeSnippets: nextProps.codeSnippetManager.snippets,
12351235
matchIndices: [],
12361236
searchValue: '',
1237-
filterTags: []
1237+
filterTags: [],
12381238
};
12391239
}
12401240

@@ -1254,7 +1254,7 @@ export class CodeSnippetDisplay extends React.Component<
12541254
codeSnippets: prevState.codeSnippets,
12551255
matchIndices: prevState.matchIndices,
12561256
searchValue: prevState.searchValue,
1257-
filterTags: prevState.filterTags
1257+
filterTags: prevState.filterTags,
12581258
};
12591259
}
12601260
return null;
@@ -1270,7 +1270,7 @@ export class CodeSnippetDisplay extends React.Component<
12701270
snippet: ICodeSnippet;
12711271
}[] = [];
12721272
if (searchValue !== '') {
1273-
filteredSnippets.forEach(snippet => {
1273+
filteredSnippets.forEach((snippet) => {
12741274
const matchResult = StringExt.matchSumOfSquares(
12751275
(snippet.language + snippet.name).toLowerCase(),
12761276
searchValue.replace(' ', '').toLowerCase()
@@ -1280,29 +1280,29 @@ export class CodeSnippetDisplay extends React.Component<
12801280
matchResults.push(matchResult);
12811281
filteredSnippetsScore.push({
12821282
score: matchResult.score,
1283-
snippet: snippet
1283+
snippet: snippet,
12841284
});
12851285
}
12861286
});
12871287

12881288
// sort snippets by its score
12891289
filteredSnippetsScore.sort((a, b) => a.score - b.score);
12901290
const newFilteredSnippets: ICodeSnippet[] = [];
1291-
filteredSnippetsScore.forEach(snippetScore =>
1291+
filteredSnippetsScore.forEach((snippetScore) =>
12921292
newFilteredSnippets.push(snippetScore.snippet)
12931293
);
12941294
filteredSnippets = newFilteredSnippets;
12951295

12961296
// sort the matchResults by its score
12971297
matchResults.sort((a, b) => a.score - b.score);
1298-
matchResults.forEach(res => matchIndices.push(res.indices));
1298+
matchResults.forEach((res) => matchIndices.push(res.indices));
12991299
}
13001300

13011301
// filter with tags
13021302
if (filterTags.length !== 0) {
13031303
const newMatchIndices = matchIndices.slice();
13041304
filteredSnippets = filteredSnippets.filter((codeSnippet, id) => {
1305-
return filterTags.some(tag => {
1305+
return filterTags.some((tag) => {
13061306
if (codeSnippet.tags) {
13071307
if (codeSnippet.tags.includes(tag)) {
13081308
return true;
@@ -1323,7 +1323,7 @@ export class CodeSnippetDisplay extends React.Component<
13231323
codeSnippets: filteredSnippets,
13241324
matchIndices: matchIndices,
13251325
searchValue: searchValue,
1326-
filterTags: filterTags
1326+
filterTags: filterTags,
13271327
},
13281328
() => {
13291329
console.log('snippets filtered');
@@ -1352,10 +1352,10 @@ export class CodeSnippetDisplay extends React.Component<
13521352
buttons: [
13531353
Dialog.okButton({
13541354
label: 'Delete',
1355-
displayType: 'warn'
1355+
displayType: 'warn',
13561356
}),
1357-
Dialog.cancelButton()
1358-
]
1357+
Dialog.cancelButton(),
1358+
],
13591359
}).then((response: any): void => {
13601360
if (response.button.accept) {
13611361
const widgetId = `${CODE_SNIPPET_EDITOR}-${codeSnippet.id}`;
@@ -1447,7 +1447,7 @@ export class CodeSnippetDisplay extends React.Component<
14471447
id: codeSnippet.id,
14481448
selectedTags: codeSnippet.tags,
14491449
allTags: allTags,
1450-
fromScratch: false
1450+
fromScratch: false,
14511451
});
14521452
this.removeOptionsNode();
14531453
};
@@ -1481,7 +1481,7 @@ export class CodeSnippetDisplay extends React.Component<
14811481
code: [],
14821482
id: 0,
14831483
allTags: this.getActiveTags(),
1484-
fromScratch: true
1484+
fromScratch: true,
14851485
});
14861486
}}
14871487
>

src/CodeSnippetEditor.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
ReactWidget,
2121
showDialog,
2222
Dialog,
23-
WidgetTracker
23+
WidgetTracker,
2424
} from '@jupyterlab/apputils';
2525
import { Button } from '@jupyterlab/ui-components';
2626

@@ -192,9 +192,9 @@ export class CodeSnippetEditor extends ReactWidget {
192192
value: this._codeSnippetEditorMetaData.code.join('\n'),
193193
mimeType: getMimeTypeByLanguage({
194194
name: this._codeSnippetEditorMetaData.language,
195-
codemirror_mode: this._codeSnippetEditorMetaData.language
196-
})
197-
})
195+
codemirror_mode: this._codeSnippetEditorMetaData.language,
196+
}),
197+
}),
198198
});
199199
this.editor.model.value.changed.connect((args: any) => {
200200
this._codeSnippetEditorMetaData.code = args.text.split('\n');
@@ -218,7 +218,7 @@ export class CodeSnippetEditor extends ReactWidget {
218218
this.update();
219219
}
220220

221-
window.addEventListener('beforeunload', e => {
221+
window.addEventListener('beforeunload', (e) => {
222222
if (!this.saved) {
223223
e.preventDefault();
224224
e.returnValue = '';
@@ -253,8 +253,8 @@ export class CodeSnippetEditor extends ReactWidget {
253253
buttons: [
254254
Dialog.cancelButton(),
255255
Dialog.warnButton({ label: 'Discard' }),
256-
Dialog.okButton({ label: 'Save' })
257-
]
256+
Dialog.okButton({ label: 'Save' }),
257+
],
258258
}).then((response: any): void => {
259259
console.log(response.button);
260260
if (response.button.accept) {
@@ -274,7 +274,7 @@ export class CodeSnippetEditor extends ReactWidget {
274274

275275
const validity = this.validateInputs(name, description, language);
276276
if (validity) {
277-
this.updateSnippet().then(value => {
277+
this.updateSnippet().then((value) => {
278278
if (value) {
279279
this.dispose();
280280
super.onCloseRequest(msg);
@@ -415,7 +415,7 @@ export class CodeSnippetEditor extends ReactWidget {
415415
language: this._codeSnippetEditorMetaData.language,
416416
code: this._codeSnippetEditorMetaData.code,
417417
id: this._codeSnippetEditorMetaData.id,
418-
tags: this._codeSnippetEditorMetaData.selectedTags
418+
tags: this._codeSnippetEditorMetaData.selectedTags,
419419
};
420420

421421
if (newName !== oldName) {
@@ -425,7 +425,7 @@ export class CodeSnippetEditor extends ReactWidget {
425425
await showDialog({
426426
title: e.message,
427427
body: <p> {`"${newName}" already exists.`} </p>,
428-
buttons: [Dialog.okButton({ label: 'Dismiss' })]
428+
buttons: [Dialog.okButton({ label: 'Dismiss' })],
429429
});
430430
return false;
431431
}
@@ -547,7 +547,7 @@ export class CodeSnippetEditor extends ReactWidget {
547547
required
548548
/>
549549
<datalist id="languages">
550-
{SUPPORTED_LANGUAGES.map(lang => this.renderLanguageOptions(lang))}
550+
{SUPPORTED_LANGUAGES.map((lang) => this.renderLanguageOptions(lang))}
551551
</datalist>
552552
</div>
553553
);

src/CodeSnippetEditorTags.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class CodeSnippetEditorTags extends React.Component<
3535
selectedTags: [],
3636
tags: [],
3737
plusIconShouldHide: false,
38-
addingNewTag: false
38+
addingNewTag: false,
3939
};
4040
this.renderTags = this.renderTags.bind(this);
4141
this.handleClick = this.handleClick.bind(this);
@@ -46,15 +46,15 @@ export class CodeSnippetEditorTags extends React.Component<
4646
selectedTags: this.props.selectedTags ? this.props.selectedTags : [],
4747
tags: this.props.tags ? this.props.tags : [],
4848
plusIconShouldHide: false,
49-
addingNewTag: false
49+
addingNewTag: false,
5050
});
5151
}
5252

5353
componentDidUpdate(prevProps: ICodeSnippetEditorTagProps): void {
5454
if (prevProps !== this.props) {
5555
this.setState({
5656
selectedTags: this.props.selectedTags ? this.props.selectedTags : [],
57-
tags: this.props.tags ? this.props.tags : []
57+
tags: this.props.tags ? this.props.tags : [],
5858
});
5959
}
6060
}
@@ -65,12 +65,12 @@ export class CodeSnippetEditorTags extends React.Component<
6565
const parent = target.parentElement;
6666

6767
this.setState(
68-
state => ({
68+
(state) => ({
6969
selectedTags: this.handleClickHelper(
7070
parent,
7171
state.selectedTags ? state.selectedTags : [],
7272
clickedTag
73-
)
73+
),
7474
}),
7575
this.handleOnChange
7676
);
@@ -121,11 +121,11 @@ export class CodeSnippetEditorTags extends React.Component<
121121

122122
// update state all tag and selected tag
123123
this.setState(
124-
state => ({
124+
(state) => ({
125125
selectedTags: [...state.selectedTags, newTag],
126126
tags: [...state.tags, newTag],
127127
plusIconShouldHide: false,
128-
addingNewTag: false
128+
addingNewTag: false,
129129
}),
130130
this.handleOnChange
131131
);

0 commit comments

Comments
 (0)