Skip to content

Commit 3a5c36d

Browse files
committed
code style tweaks and set js indendation to 2 in .editorconfig
1 parent c888223 commit 3a5c36d

File tree

5 files changed

+39
-32
lines changed

5 files changed

+39
-32
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ indent_size = 2
2424

2525
[*.js]
2626
indent_style = space
27-
indent_size = 4
27+
indent_size = 2
2828

2929
[Makefile]
3030
indent_style = tab

.eslintrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ rules:
3030
default-case: [0]
3131
func-names: [0]
3232
max-len: [0]
33+
newline-per-chained-call: [0]
34+
arrow-body-style: [0]
3335
no-alert: [0]
3436
no-continue: [0]
3537
no-mixed-operators: [0]
@@ -42,6 +44,8 @@ rules:
4244
no-unused-vars: [2, {args: all, argsIgnorePattern: ^_, varsIgnorePattern: ^_, ignoreRestSiblings: true}]
4345
no-use-before-define: [0]
4446
no-var: [2]
47+
one-var-declaration-per-line: [0]
48+
one-var: [0]
4549
prefer-const: [2, {destructuring: all}]
4650
prefer-destructuring: [0]
4751
radix: [2, as-needed]

public/js/index.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/index.js.map

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web_src/js/index.js

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ function initCommentPreviewTab($form) {
2727
mode: 'gfm',
2828
context: $this.data('context'),
2929
text: $form.find(`.tab.segment[data-tab="${$tabMenu.data('write')}"] textarea`).val()
30-
},
31-
(data) => {
30+
}, (data) => {
3231
const $previewPanel = $form.find(`.tab.segment[data-tab="${$tabMenu.data('preview')}"]`);
3332
$previewPanel.html(data);
3433
emojify.run($previewPanel[0]);
@@ -54,8 +53,7 @@ function initEditPreviewTab($form) {
5453
mode: 'gfm',
5554
context: $this.data('context'),
5655
text: $form.find(`.tab.segment[data-tab="${$tabMenu.data('write')}"] textarea`).val()
57-
},
58-
(data) => {
56+
}, (data) => {
5957
const $previewPanel = $form.find(`.tab.segment[data-tab="${$tabMenu.data('preview')}"]`);
6058
$previewPanel.html(data);
6159
emojify.run($previewPanel[0]);
@@ -76,8 +74,7 @@ function initEditDiffTab($form) {
7674
_csrf: csrf,
7775
context: $this.data('context'),
7876
content: $form.find(`.tab.segment[data-tab="${$tabMenu.data('write')}"] textarea`).val()
79-
},
80-
(data) => {
77+
}, (data) => {
8178
const $diffPreviewPanel = $form.find(`.tab.segment[data-tab="${$tabMenu.data('diff')}"]`);
8279
$diffPreviewPanel.html(data);
8380
emojify.run($diffPreviewPanel[0]);
@@ -249,7 +246,7 @@ function retrieveImageFromClipboardAsBlob(pasteEvent, callback) {
249246
}
250247

251248
const { items } = pasteEvent.clipboardData;
252-
if (typeof (items) === 'undefined') {
249+
if (typeof items === 'undefined') {
253250
return;
254251
}
255252

@@ -605,8 +602,7 @@ function initRepository() {
605602
}
606603

607604
// File list and commits
608-
if ($('.repository.file.list').length > 0
609-
|| ('.repository.commits').length > 0) {
605+
if ($('.repository.file.list').length > 0 || ('.repository.commits').length > 0) {
610606
initFilterBranchTagDropdown('.choose.reference .dropdown');
611607
}
612608

@@ -844,8 +840,7 @@ function initRepository() {
844840
content: $textarea.val(),
845841
context: $editContentZone.data('context'),
846842
files: $attachments
847-
},
848-
(data) => {
843+
}, (data) => {
849844
if (data.length === 0) {
850845
$renderContent.html($('#no-content').html());
851846
} else {
@@ -859,10 +854,7 @@ function initRepository() {
859854
if (!$content.find('.ui.small.images').length) {
860855
if (data.attachments !== '') {
861856
$content.append(
862-
'<div class="ui bottom attached segment">'
863-
+ ' <div class="ui small images">'
864-
+ ' </div>'
865-
+ '</div>'
857+
'<div class="ui bottom attached segment"><div class="ui small images"></div></div>'
866858
);
867859
$content.find('.ui.small.images').html(data.attachments);
868860
}
@@ -1363,8 +1355,7 @@ function initEditor() {
13631355

13641356
$editFilename.on('keyup', () => {
13651357
const val = $editFilename.val();
1366-
let mode; let spec; let extension; let extWithDot; let dataUrl; let
1367-
apiCall;
1358+
let mode, spec, extension, extWithDot, dataUrl, apiCall;
13681359

13691360
extension = extWithDot = '';
13701361
const m = /.+\.([^.]+)$/.exec(val);
@@ -1553,8 +1544,7 @@ function initAdmin() {
15531544
}
15541545

15551546
// New user
1556-
if ($('.admin.new.user').length > 0
1557-
|| $('.admin.edit.user').length > 0) {
1547+
if ($('.admin.new.user').length > 0 || $('.admin.edit.user').length > 0) {
15581548
$('#login_type').change(function () {
15591549
if ($(this).val().substring(0, 1) === '0') {
15601550
$('#login_name').removeAttr('required');
@@ -1941,11 +1931,12 @@ function u2fError(errorType) {
19411931
5: $('.u2f-error-5')
19421932
};
19431933
u2fErrors[errorType].removeClass('hide');
1944-
for (const type in u2fErrors) {
1934+
1935+
Object.keys(u2fErrors).forEach((type) => {
19451936
if (type !== errorType) {
19461937
u2fErrors[type].addClass('hide');
19471938
}
1948-
}
1939+
});
19491940
$('#u2f-error').modal('show');
19501941
}
19511942

@@ -2058,7 +2049,10 @@ $(document).ready(() => {
20582049

20592050
// Show exact time
20602051
$('.time-since').each(function () {
2061-
$(this).addClass('poping up').attr('data-content', $(this).attr('title')).attr('data-variation', 'inverted tiny')
2052+
$(this)
2053+
.addClass('poping up')
2054+
.attr('data-content', $(this).attr('title'))
2055+
.attr('data-variation', 'inverted tiny')
20622056
.attr('title', '');
20632057
});
20642058

@@ -2245,8 +2239,7 @@ $(document).ready(() => {
22452239
let { elementId } = this.dataset;
22462240
const issueIDs = $('.issue-checkbox').children('input:checked').map(function () {
22472241
return this.dataset.issueId;
2248-
}).get()
2249-
.join();
2242+
}).get().join();
22502243
const { url } = this.dataset;
22512244
if (elementId === '0' && url.substr(-9) === '/assignee') {
22522245
elementId = '';
@@ -2632,7 +2625,6 @@ function initVueApp() {
26322625
new Vue({
26332626
delimiters: ['${', '}'],
26342627
el,
2635-
26362628
data: {
26372629
searchLimit: document.querySelector('meta[name=_search_limit]').content,
26382630
suburl: document.querySelector('meta[name=_suburl]').content,
@@ -2810,18 +2802,17 @@ function initFilterBranchTagDropdown(selector) {
28102802
filteredItems() {
28112803
const vm = this;
28122804

2813-
const items = vm.items.filter((item) => ((vm.mode === 'branches' && item.branch)
2814-
|| (vm.mode === 'tags' && item.tag))
2815-
&& (!vm.searchTerm
2816-
|| item.name.toLowerCase().indexOf(vm.searchTerm.toLowerCase()) >= 0));
2805+
const items = vm.items.filter((item) => {
2806+
return ((vm.mode === 'branches' && item.branch) || (vm.mode === 'tags' && item.tag))
2807+
&& (!vm.searchTerm || item.name.toLowerCase().indexOf(vm.searchTerm.toLowerCase()) >= 0);
2808+
});
28172809

28182810
vm.active = (items.length === 0 && vm.showCreateNewBranch ? 0 : -1);
28192811

28202812
return items;
28212813
},
28222814
showNoResults() {
2823-
return this.filteredItems.length === 0
2824-
&& !this.showCreateNewBranch;
2815+
return this.filteredItems.length === 0 && !this.showCreateNewBranch;
28252816
},
28262817
showCreateNewBranch() {
28272818
const vm = this;

0 commit comments

Comments
 (0)