Skip to content

Commit 1d9a907

Browse files
committed
lint code
1 parent bda5bb2 commit 1d9a907

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed
Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
11
import $ from 'jquery';
2+
import {hideElem, showElem} from '../utils/dom.js';
23

34
export function initTagNameEditor() {
4-
const el = document.getElementById('tag-name-editor');
5-
if (!el) return;
5+
const el = document.getElementById('tag-name-editor');
6+
if (!el) return;
67

7-
const existingTags = JSON.parse(el.getAttribute('data-existing-tags'))
8-
if (!Array.isArray(existingTags)) return
8+
const existingTags = JSON.parse(el.getAttribute('data-existing-tags'));
9+
if (!Array.isArray(existingTags)) return;
910

10-
const defaultTagHelperText = el.getAttribute('data-tag-helper')
11-
const newTagHelperText = el.getAttribute('data-tag-helper-new')
12-
const existingTagHelperText = el.getAttribute('data-tag-helper-existing')
11+
const defaultTagHelperText = el.getAttribute('data-tag-helper');
12+
const newTagHelperText = el.getAttribute('data-tag-helper-new');
13+
const existingTagHelperText = el.getAttribute('data-tag-helper-existing');
1314

14-
$('#tag-name').on('keyup', function(e) {
15-
const value = e.target.value
16-
if (existingTags.includes(value)) {
17-
// If the tag already exists, hide the target branch selector.
18-
$('#tag-target-selector').hide()
19-
$('#tag-helper').text(existingTagHelperText)
20-
} else {
21-
$('#tag-target-selector').show()
22-
if (typeof value == 'string' && value.length > 0) {
23-
$('#tag-helper').text(newTagHelperText)
24-
} else {
25-
$('#tag-helper').text(defaultTagHelperText)
26-
}
27-
}
28-
})
15+
$('#tag-name').on('keyup', (e) => {
16+
const value = e.target.value;
17+
if (existingTags.includes(value)) {
18+
// If the tag already exists, hide the target branch selector.
19+
hideElem($('#tag-target-selector'));
20+
$('#tag-helper').text(existingTagHelperText);
21+
} else {
22+
showElem($('#tag-target-selector'));
23+
if (typeof value === 'string' && value.length > 0) {
24+
$('#tag-helper').text(newTagHelperText);
25+
} else {
26+
$('#tag-helper').text(defaultTagHelperText);
27+
}
28+
}
29+
});
2930
}

0 commit comments

Comments
 (0)