Skip to content

Commit 17bea0b

Browse files
committed
Lint widget_string.ts
1 parent ccc845f commit 17bea0b

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

packages/controls/src/widget_string.ts

+16-17
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class TextareaView extends DescriptionView {
178178
this.update(); // Set defaults.
179179

180180
this.listenTo(this.model, 'change:placeholder',
181-
function(model, value, options) {
181+
(model, value, options) => {
182182
this.update_placeholder(value);
183183
});
184184

@@ -211,10 +211,10 @@ class TextareaView extends DescriptionView {
211211

212212
events() {
213213
return {
214-
'keydown input' : 'handleKeyDown',
215-
'keypress input' : 'handleKeypress',
216-
'input textarea' : 'handleChanging',
217-
'change textarea' : 'handleChanged'
214+
'keydown input': 'handleKeyDown',
215+
'keypress input': 'handleKeypress',
216+
'input textarea': 'handleChanging',
217+
'change textarea': 'handleChanged'
218218
};
219219
}
220220

@@ -285,7 +285,7 @@ class TextView extends DescriptionView {
285285
this.el.appendChild(this.textbox);
286286

287287
this.update(); // Set defaults.
288-
this.listenTo(this.model, 'change:placeholder', function(model, value, options) {
288+
this.listenTo(this.model, 'change:placeholder', (model, value, options) => {
289289
this.update_placeholder(value);
290290
});
291291
this.listenTo(this.model, 'change:description_tooltip', this.update_title);
@@ -305,9 +305,8 @@ class TextView extends DescriptionView {
305305
update_title() {
306306
let title = this.model.get('description_tooltip');
307307
if (!title) {
308-
this.textbox.removeAttribute('title');
309-
}
310-
else if (this.model.get('description').length === 0) {
308+
this.textbox.removeAttribute('title');
309+
} else if (this.model.get('description').length === 0) {
311310
this.textbox.setAttribute('title', title);
312311
}
313312
}
@@ -319,9 +318,9 @@ class TextView extends DescriptionView {
319318
* Called when the model is changed. The model may have been
320319
* changed by another view or by a state update from the back-end.
321320
*/
322-
if (options === undefined || options.updated_view != this) {
323-
if (this.textbox.value != this.model.get('value')) {
324-
this.textbox.value = this.model.get('value');
321+
if (options === undefined || options.updated_view !== this) {
322+
if (this.textbox.value !== this.model.get('value')) {
323+
this.textbox.value = this.model.get('value');
325324
}
326325

327326
this.textbox.disabled = this.model.get('disabled');
@@ -331,10 +330,10 @@ class TextView extends DescriptionView {
331330

332331
events() {
333332
return {
334-
'keydown input' : 'handleKeyDown',
335-
'keypress input' : 'handleKeypress',
336-
'input input' : 'handleChanging',
337-
'change input' : 'handleChanged'
333+
'keydown input': 'handleKeyDown',
334+
'keypress input': 'handleKeypress',
335+
'input input': 'handleChanging',
336+
'change input': 'handleChanged'
338337
};
339338
}
340339

@@ -353,8 +352,8 @@ class TextView extends DescriptionView {
353352
handleKeypress(e) {
354353
e.stopPropagation();
355354
// The submit message is deprecated in widgets 7
356-
if (e.keyCode == 13) { // Return key
357355
this.send({event: 'submit'});
356+
if (e.keyCode === 13) { // Return key
358357
}
359358
}
360359

0 commit comments

Comments
 (0)