Skip to content

Commit c49ee0f

Browse files
committed
Fixed linting errors.
1 parent f793954 commit c49ee0f

File tree

5 files changed

+45
-45
lines changed

5 files changed

+45
-45
lines changed

src/CodeSnippetSearchTools.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export class SearchMultiOption extends React.Component<
6060
if (selected) {
6161
// select option
6262
this.setState(
63-
state => ({
64-
currSelected: [...state.currSelected, selectedOption]
63+
(state) => ({
64+
currSelected: [...state.currSelected, selectedOption],
6565
}),
6666
() => {
6767
//callback
@@ -76,7 +76,7 @@ export class SearchMultiOption extends React.Component<
7676
array.splice(index, 1);
7777
this.setState(
7878
{
79-
currSelected: array
79+
currSelected: array,
8080
},
8181
() => {
8282
this.props.handleOptionClick(this.state.currSelected);
@@ -119,7 +119,7 @@ export class SearchTools extends React.Component<
119119
super(props);
120120
this.state = {
121121
optionName: '',
122-
currSelected: this.props.selectedSearchOptions
122+
currSelected: this.props.selectedSearchOptions,
123123
};
124124
this.handleClick = this.handleClick.bind(this);
125125
this.handleOptionClick = this.handleOptionClick.bind(this);
@@ -158,7 +158,7 @@ export class SearchTools extends React.Component<
158158

159159
handleOptionClick(selectedOptions: string[]): void {
160160
this.setState({
161-
currSelected: selectedOptions
161+
currSelected: selectedOptions,
162162
});
163163
this.props.setSearchOptions(selectedOptions);
164164
}

src/CodeSnippetService.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class CodeSnippetService {
7676
private convertToICodeSnippetList(snippets: JSONArray): ICodeSnippet[] {
7777
const snippetList: ICodeSnippet[] = [];
7878

79-
snippets.forEach(snippet => {
79+
snippets.forEach((snippet) => {
8080
snippetList.push((snippet as unknown) as ICodeSnippet);
8181
});
8282
return snippetList;
@@ -98,7 +98,7 @@ export class CodeSnippetService {
9898

9999
getSnippet(snippetName: string): ICodeSnippet[] {
100100
return this.codeSnippetList.filter(
101-
snippet => snippet.name.toLowerCase() === snippetName.toLowerCase()
101+
(snippet) => snippet.name.toLowerCase() === snippetName.toLowerCase()
102102
);
103103
}
104104

@@ -116,7 +116,7 @@ export class CodeSnippetService {
116116

117117
await this.settingManager
118118
.set('snippets', (this.codeSnippetList as unknown) as PartialJSONValue)
119-
.catch(_ => {
119+
.catch((_) => {
120120
return false;
121121
});
122122
return true;
@@ -144,7 +144,7 @@ export class CodeSnippetService {
144144

145145
await this.settingManager
146146
.set('snippets', (this.codeSnippetList as unknown) as PartialJSONValue)
147-
.catch(_ => {
147+
.catch((_) => {
148148
return false;
149149
});
150150

@@ -160,7 +160,7 @@ export class CodeSnippetService {
160160
}
161161
await this.settingManager
162162
.set('snippets', (this.codeSnippetList as unknown) as PartialJSONValue)
163-
.catch(_ => {
163+
.catch((_) => {
164164
return false;
165165
});
166166
return true;
@@ -188,7 +188,7 @@ export class CodeSnippetService {
188188

189189
await this.settingManager
190190
.set('snippets', (this.codeSnippetList as unknown) as PartialJSONValue)
191-
.catch(_ => {
191+
.catch((_) => {
192192
return false;
193193
});
194194
return true;
@@ -220,7 +220,7 @@ export class CodeSnippetService {
220220

221221
await this.settingManager
222222
.set('snippets', (this.codeSnippetList as unknown) as PartialJSONValue)
223-
.catch(_ => {
223+
.catch((_) => {
224224
return false;
225225
});
226226
return true;
@@ -237,7 +237,7 @@ export class CodeSnippetService {
237237

238238
await this.settingManager
239239
.set('snippets', (this.codeSnippetList as unknown) as PartialJSONValue)
240-
.catch(_ => {
240+
.catch((_) => {
241241
return false;
242242
});
243243
return true;

src/CodeSnippetWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const DROP_TARGET_CLASS = 'jp-codeSnippet-dropTarget';
4949
const CODE_SNIPPET_EDITOR = 'jp-codeSnippet-editor';
5050

5151
const commands = {
52-
OPEN_CODE_SNIPPET_EDITOR: `${CODE_SNIPPET_EDITOR}:open`
52+
OPEN_CODE_SNIPPET_EDITOR: `${CODE_SNIPPET_EDITOR}:open`,
5353
};
5454

5555
/**

src/FilterTools.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,21 @@ export class FilterTools extends React.Component<
5050
this.setState({
5151
show: false,
5252
selectedTags: [],
53-
searchValue: ''
53+
searchValue: '',
5454
});
5555
}
5656

5757
componentDidUpdate(prevProps: IFilterSnippetProps): void {
5858
if (prevProps !== this.props) {
5959
// get all the tags together in one list
60-
let flattenTags = this.props.allTags.reduce(
60+
const flattenTags = this.props.allTags.reduce(
6161
(accumulator, value) => accumulator.concat(value),
6262
[]
6363
);
64-
this.setState(state => ({
64+
this.setState((state) => ({
6565
selectedTags: state.selectedTags
66-
.filter(tag => flattenTags.includes(tag))
67-
.sort()
66+
.filter((tag) => flattenTags.includes(tag))
67+
.sort(),
6868
}));
6969
}
7070
}
@@ -80,7 +80,7 @@ export class FilterTools extends React.Component<
8080

8181
renderTags(tags: string[][], type: string): JSX.Element {
8282
// get all the tags together in one list
83-
let flattenTags = tags.reduce(
83+
const flattenTags = tags.reduce(
8484
(accumulator, value) => accumulator.concat(value),
8585
[]
8686
);
@@ -148,12 +148,12 @@ export class FilterTools extends React.Component<
148148
const clickedTag = target.innerText;
149149
const parent = target.parentElement;
150150
this.setState(
151-
state => ({
151+
(state) => ({
152152
selectedTags: this.handleClickHelper(
153153
parent,
154154
state.selectedTags,
155155
clickedTag
156-
)
156+
),
157157
}),
158158
this.filterSnippets
159159
);

src/index.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import {
1919
JupyterFrontEnd,
2020
JupyterFrontEndPlugin,
21-
ILayoutRestorer
21+
ILayoutRestorer,
2222
} from '@jupyterlab/application';
2323
import { ICommandPalette, WidgetTracker } from '@jupyterlab/apputils';
2424
import { ISettingRegistry, Settings } from '@jupyterlab/settingregistry';
@@ -36,7 +36,7 @@ import { CodeSnippetInputDialog } from './CodeSnippetInputDialog';
3636
import { CodeSnippetWidget } from './CodeSnippetWidget';
3737
import {
3838
CodeSnippetEditor,
39-
ICodeSnippetEditorMetadata
39+
ICodeSnippetEditorMetadata,
4040
} from './CodeSnippetEditor';
4141
import { CodeSnippetService } from './CodeSnippetService';
4242
import { NotebookPanel } from '@jupyterlab/notebook';
@@ -50,15 +50,15 @@ const CODE_SNIPPET_SETTING_ID = 'jupyterlab-code-snippets:snippets';
5050
*/
5151
const editorIcon = new LabIcon({
5252
name: 'custom-ui-components:codeSnippetEditorIcon',
53-
svgstr: editorIconSVGstr
53+
svgstr: editorIconSVGstr,
5454
});
5555

5656
/**
5757
* Snippet Icon
5858
*/
5959
const codeSnippetIcon = new LabIcon({
6060
name: 'custom-ui-components:codeSnippetIcon',
61-
svgstr: codeSnippetIconSVGstr
61+
svgstr: codeSnippetIconSVGstr,
6262
});
6363

6464
/**
@@ -68,7 +68,7 @@ const code_snippet_extension: JupyterFrontEndPlugin<void> = {
6868
id: CODE_SNIPPET_EXTENSION_ID,
6969
autoStart: true,
7070
requires: [ICommandPalette, ILayoutRestorer, IEditorServices],
71-
activate: activateCodeSnippet
71+
activate: activateCodeSnippet,
7272
};
7373

7474
function activateCodeSnippet(
@@ -138,7 +138,7 @@ function activateCodeSnippet(
138138

139139
if (!codeSnippetEditor.isAttached) {
140140
app.shell.add(codeSnippetEditor, 'main', {
141-
mode: 'tab-after'
141+
mode: 'tab-after',
142142
});
143143
}
144144

@@ -151,22 +151,22 @@ function activateCodeSnippet(
151151
execute: () => {
152152
const editor = tracker.currentWidget;
153153
editor.updateSnippet();
154-
}
154+
},
155155
});
156156

157157
// Add keybinding to save
158158
app.commands.addKeyBinding({
159159
command: editorSaveCommand,
160160
args: {},
161161
keys: ['Accel S'],
162-
selector: '.jp-codeSnippet-editor'
162+
selector: '.jp-codeSnippet-editor',
163163
});
164164

165165
const editorCommand = 'jp-codeSnippet-editor:open';
166166
app.commands.addCommand(editorCommand, {
167167
execute: (args: any) => {
168168
openCodeSnippetEditor(args);
169-
}
169+
},
170170
});
171171

172172
//Add an application command
@@ -224,55 +224,55 @@ function activateCodeSnippet(
224224
codeSnippetWidget.codeSnippetManager.snippets.length
225225
);
226226
}
227-
}
227+
},
228228
});
229229

230230
// Put the saveCommand above in context menu
231231
app.contextMenu.addItem({
232232
type: 'separator',
233233
selector: '.jp-Notebook',
234-
rank: 13
234+
rank: 13,
235235
});
236236

237237
app.contextMenu.addItem({
238238
command: saveCommand,
239239
selector: '.jp-Notebook',
240-
rank: 14
240+
rank: 14,
241241
});
242242

243243
app.contextMenu.addItem({
244244
type: 'separator',
245245
selector: '.jp-Notebook',
246-
rank: 15
246+
rank: 15,
247247
});
248248

249249
// Put the saveCommand in non-notebook file context menu
250250
app.contextMenu.addItem({
251251
type: 'separator',
252252
selector: '.jp-FileEditor',
253-
rank: 7
253+
rank: 7,
254254
});
255255

256256
app.contextMenu.addItem({
257257
command: saveCommand,
258258
selector: '.jp-FileEditor',
259-
rank: 8
259+
rank: 8,
260260
});
261261

262262
app.contextMenu.addItem({
263263
type: 'separator',
264264
selector: '.jp-FileEditor',
265-
rank: 9
265+
rank: 9,
266266
});
267267

268268
// Track and restore the widget state
269269
const tracker = new WidgetTracker<CodeSnippetEditor>({
270-
namespace: 'codeSnippetEditor'
270+
namespace: 'codeSnippetEditor',
271271
});
272272

273273
restorer.restore(tracker, {
274274
command: editorCommand,
275-
args: widget => {
275+
args: (widget) => {
276276
const editorMetadata = widget.codeSnippetEditorMetadata;
277277
return {
278278
name: editorMetadata.name,
@@ -282,12 +282,12 @@ function activateCodeSnippet(
282282
id: editorMetadata.id,
283283
selectedTags: editorMetadata.selectedTags,
284284
allTags: editorMetadata.allTags,
285-
fromScratch: editorMetadata.fromScratch
285+
fromScratch: editorMetadata.fromScratch,
286286
};
287287
},
288-
name: widget => {
288+
name: (widget) => {
289289
return widget.id;
290-
}
290+
},
291291
});
292292
}
293293

@@ -302,8 +302,8 @@ const codeSnippetExtensionSetting: JupyterFrontEndPlugin<void> = {
302302
CodeSnippetService.init(settings as Settings, app);
303303
console.log('JupyterLab extension code-snippets setting is activated!');
304304
})
305-
.catch(e => console.log(e));
306-
}
305+
.catch((e) => console.log(e));
306+
},
307307
};
308308

309309
function getSelectedText(): string {

0 commit comments

Comments
 (0)