forked from forgejo/forgejo
Enforce trailing comma in JS on multiline (#30002)
To keep blame info accurate and to avoid [changes like
this](https://github.com/go-gitea/gitea/pull/29977/files#diff-c3422631a14edbe1e508c4b22f0c718db318be08a6e889427802f9b6165d88d6R359),
it's good to always have a trailing comma, so let's enforce it in JS.
This rule is completely automatically fixable with `make lint-js-fix`
and that's what I did here.
(cherry picked from commit 3d751b6ec18e57698ce86b79866031d2c80c2071)
Conflicts:
web_src/js/components/DashboardRepoList.vue
trivial context conflict because of '3b7b899afa
fix commit_status'
This commit is contained in:
parent
9c9f40f6d3
commit
b96845ae01
48 changed files with 117 additions and 117 deletions
|
@ -9,7 +9,7 @@ export async function initCaptcha() {
|
|||
|
||||
const params = {
|
||||
sitekey: siteKey,
|
||||
theme: isDark ? 'dark' : 'light'
|
||||
theme: isDark ? 'dark' : 'light',
|
||||
};
|
||||
|
||||
switch (captchaEl.getAttribute('data-captcha-type')) {
|
||||
|
@ -42,7 +42,7 @@ export async function initCaptcha() {
|
|||
siteKey: {
|
||||
instanceUrl: new URL(instanceURL),
|
||||
key: siteKey,
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ export async function initRepoCodeFrequency() {
|
|||
loadingTitle: el.getAttribute('data-locale-loading-title'),
|
||||
loadingTitleFailed: el.getAttribute('data-locale-loading-title-failed'),
|
||||
loadingInfo: el.getAttribute('data-locale-loading-info'),
|
||||
}
|
||||
},
|
||||
});
|
||||
View.mount(el);
|
||||
} catch (err) {
|
||||
|
|
|
@ -80,7 +80,7 @@ export async function createMonaco(textarea, filename, editorOpts) {
|
|||
rules: [
|
||||
{
|
||||
background: getColor('--color-code-bg'),
|
||||
}
|
||||
},
|
||||
],
|
||||
colors: {
|
||||
'editor.background': getColor('--color-code-bg'),
|
||||
|
@ -98,7 +98,7 @@ export async function createMonaco(textarea, filename, editorOpts) {
|
|||
'input.foreground': getColor('--color-input-text'),
|
||||
'scrollbar.shadow': getColor('--color-shadow'),
|
||||
'progressBar.background': getColor('--color-primary'),
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// Quick fix: https://github.com/microsoft/monaco-editor/issues/2962
|
||||
|
|
|
@ -335,7 +335,7 @@ export function initGlobalLinkActions() {
|
|||
const data = await response.json();
|
||||
window.location.href = data.redirect;
|
||||
}
|
||||
}
|
||||
},
|
||||
}).modal('show');
|
||||
}
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ export function easyMDEToolbarActions(EasyMDE, editor) {
|
|||
},
|
||||
icon: svg('octicon-chevron-right'),
|
||||
title: 'Add Inline Code',
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
for (const [key, value] of Object.entries(actions)) {
|
||||
|
|
|
@ -22,7 +22,7 @@ export function initCompSearchUserBox() {
|
|||
$.each(response.data, (_i, item) => {
|
||||
const resultItem = {
|
||||
title: item.login,
|
||||
image: item.avatar_url
|
||||
image: item.avatar_url,
|
||||
};
|
||||
if (item.full_name) {
|
||||
resultItem.description = htmlEscape(item.full_name);
|
||||
|
@ -37,15 +37,15 @@ export function initCompSearchUserBox() {
|
|||
if (allowEmailInput && items.length === 0 && looksLikeEmailAddressCheck.test(searchQuery)) {
|
||||
const resultItem = {
|
||||
title: searchQuery,
|
||||
description: allowEmailDescription
|
||||
description: allowEmailDescription,
|
||||
};
|
||||
items.push(resultItem);
|
||||
}
|
||||
|
||||
return {results: items};
|
||||
}
|
||||
},
|
||||
},
|
||||
searchFields: ['login', 'full_name'],
|
||||
showNoResults: false
|
||||
showNoResults: false,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ export function attachRefIssueContextPopup(refIssues) {
|
|||
interactiveBorder: 5,
|
||||
onShow: () => {
|
||||
el.firstChild.dispatchEvent(new CustomEvent('ce-load-context-popup', {detail: {owner, repo, index}}));
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ export async function initRepoContributors() {
|
|||
loadingTitle: el.getAttribute('data-locale-loading-title'),
|
||||
loadingTitleFailed: el.getAttribute('data-locale-loading-title-failed'),
|
||||
loadingInfo: el.getAttribute('data-locale-loading-info'),
|
||||
}
|
||||
},
|
||||
});
|
||||
View.mount(el);
|
||||
} catch (err) {
|
||||
|
|
|
@ -48,7 +48,7 @@ class Source {
|
|||
this.eventSource.addEventListener(eventType, (event) => {
|
||||
this.notifyClients({
|
||||
type: eventType,
|
||||
data: event.data
|
||||
data: event.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -20,19 +20,19 @@ function getDefaultSvgBoundsIfUndefined(text, src) {
|
|||
if (img.width > 1 && img.width < MaxSize && img.height > 1 && img.height < MaxSize) {
|
||||
return {
|
||||
width: img.width,
|
||||
height: img.height
|
||||
height: img.height,
|
||||
};
|
||||
}
|
||||
if (svg.hasAttribute('viewBox')) {
|
||||
const viewBox = svg.viewBox.baseVal;
|
||||
return {
|
||||
width: DefaultSize,
|
||||
height: DefaultSize * viewBox.width / viewBox.height
|
||||
height: DefaultSize * viewBox.width / viewBox.height,
|
||||
};
|
||||
}
|
||||
return {
|
||||
width: DefaultSize,
|
||||
height: DefaultSize
|
||||
height: DefaultSize,
|
||||
};
|
||||
}
|
||||
return null;
|
||||
|
@ -42,15 +42,15 @@ export function initImageDiff() {
|
|||
function createContext(image1, image2) {
|
||||
const size1 = {
|
||||
width: image1 && image1.width || 0,
|
||||
height: image1 && image1.height || 0
|
||||
height: image1 && image1.height || 0,
|
||||
};
|
||||
const size2 = {
|
||||
width: image2 && image2.width || 0,
|
||||
height: image2 && image2.height || 0
|
||||
height: image2 && image2.height || 0,
|
||||
};
|
||||
const max = {
|
||||
width: Math.max(size2.width, size1.width),
|
||||
height: Math.max(size2.height, size1.height)
|
||||
height: Math.max(size2.height, size1.height),
|
||||
};
|
||||
|
||||
return {
|
||||
|
@ -63,8 +63,8 @@ export function initImageDiff() {
|
|||
Math.floor(max.width - size1.width) / 2,
|
||||
Math.floor(max.height - size1.height) / 2,
|
||||
Math.floor(max.width - size2.width) / 2,
|
||||
Math.floor(max.height - size2.height) / 2
|
||||
]
|
||||
Math.floor(max.height - size2.height) / 2,
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -79,12 +79,12 @@ export function initImageDiff() {
|
|||
path: this.getAttribute('data-path-after'),
|
||||
mime: this.getAttribute('data-mime-after'),
|
||||
$images: $container.find('img.image-after'), // matches 3 <img>
|
||||
$boundsInfo: $container.find('.bounds-info-after')
|
||||
$boundsInfo: $container.find('.bounds-info-after'),
|
||||
}, {
|
||||
path: this.getAttribute('data-path-before'),
|
||||
mime: this.getAttribute('data-mime-before'),
|
||||
$images: $container.find('img.image-before'), // matches 3 <img>
|
||||
$boundsInfo: $container.find('.bounds-info-before')
|
||||
$boundsInfo: $container.find('.bounds-info-before'),
|
||||
}];
|
||||
|
||||
await Promise.all(imageInfos.map(async (info) => {
|
||||
|
@ -222,21 +222,21 @@ export function initImageDiff() {
|
|||
|
||||
sizes.image1.css({
|
||||
width: sizes.size1.width * factor,
|
||||
height: sizes.size1.height * factor
|
||||
height: sizes.size1.height * factor,
|
||||
});
|
||||
sizes.image2.css({
|
||||
width: sizes.size2.width * factor,
|
||||
height: sizes.size2.height * factor
|
||||
height: sizes.size2.height * factor,
|
||||
});
|
||||
sizes.image1.parent().css({
|
||||
margin: `${sizes.ratio[1] * factor}px ${sizes.ratio[0] * factor}px`,
|
||||
width: sizes.size1.width * factor + 2,
|
||||
height: sizes.size1.height * factor + 2
|
||||
height: sizes.size1.height * factor + 2,
|
||||
});
|
||||
sizes.image2.parent().css({
|
||||
margin: `${sizes.ratio[3] * factor}px ${sizes.ratio[2] * factor}px`,
|
||||
width: sizes.size2.width * factor + 2,
|
||||
height: sizes.size2.height * factor + 2
|
||||
height: sizes.size2.height * factor + 2,
|
||||
});
|
||||
|
||||
// some inner elements are `position: absolute`, so the container's height must be large enough
|
||||
|
@ -248,7 +248,7 @@ export function initImageDiff() {
|
|||
|
||||
const $range = $container.find("input[type='range']");
|
||||
const onInput = () => sizes.image1.parent().css({
|
||||
opacity: $range.val() / 100
|
||||
opacity: $range.val() / 100,
|
||||
});
|
||||
$range.on('input', onInput);
|
||||
onInput();
|
||||
|
|
|
@ -19,7 +19,7 @@ function initPreInstall() {
|
|||
const defaultDbHosts = {
|
||||
mysql: '127.0.0.1:3306',
|
||||
postgres: '127.0.0.1:5432',
|
||||
mssql: '127.0.0.1:1433'
|
||||
mssql: '127.0.0.1:1433',
|
||||
};
|
||||
|
||||
const dbHost = document.getElementById('db_host');
|
||||
|
|
|
@ -26,14 +26,14 @@ export function initOrgTeamSearchRepoBox() {
|
|||
$.each(response.data, (_i, item) => {
|
||||
items.push({
|
||||
title: item.repository.full_name.split('/')[1],
|
||||
description: item.repository.full_name
|
||||
description: item.repository.full_name,
|
||||
});
|
||||
});
|
||||
|
||||
return {results: items};
|
||||
}
|
||||
},
|
||||
},
|
||||
searchFields: ['full_name'],
|
||||
showNoResults: false
|
||||
showNoResults: false,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ export async function initRepoRecentCommits() {
|
|||
loadingTitle: el.getAttribute('data-locale-loading-title'),
|
||||
loadingTitleFailed: el.getAttribute('data-locale-loading-title-failed'),
|
||||
loadingInfo: el.getAttribute('data-locale-loading-info'),
|
||||
}
|
||||
},
|
||||
});
|
||||
View.mount(el);
|
||||
} catch (err) {
|
||||
|
|
|
@ -116,7 +116,7 @@ function showLineButton() {
|
|||
tippy.popper.addEventListener('click', () => {
|
||||
tippy.hide();
|
||||
}, {once: true});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ export function initRepoTopicBar() {
|
|||
addedValue = addedValue.toLowerCase().trim();
|
||||
$($addedChoice).attr('data-value', addedValue);
|
||||
$($addedChoice).attr('data-text', addedValue);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
$.fn.form.settings.rules.validateTopic = function (_values, regExp) {
|
||||
|
@ -168,14 +168,14 @@ export function initRepoTopicBar() {
|
|||
{
|
||||
type: 'validateTopic',
|
||||
value: /^\s*[a-z0-9][-.a-z0-9]{0,35}\s*$/,
|
||||
prompt: topicPrompts.formatPrompt
|
||||
prompt: topicPrompts.formatPrompt,
|
||||
},
|
||||
{
|
||||
type: 'maxCount[25]',
|
||||
prompt: topicPrompts.countPrompt
|
||||
}
|
||||
]
|
||||
prompt: topicPrompts.countPrompt,
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ function showContentHistoryDetail(issueBaseUrl, commentId, historyId, itemTitleH
|
|||
},
|
||||
onHide() {
|
||||
$(this).dropdown('clear', true);
|
||||
}
|
||||
},
|
||||
});
|
||||
$dialog.modal({
|
||||
async onShow() {
|
||||
|
|
|
@ -59,7 +59,7 @@ async function updateDeadline(deadlineString) {
|
|||
|
||||
try {
|
||||
const response = await POST($('#update-issue-deadline-form').attr('action'), {
|
||||
data: {due_date: realDeadline}
|
||||
data: {due_date: realDeadline},
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
|
@ -268,7 +268,7 @@ export function initRepoPullRequestUpdate() {
|
|||
$pullUpdateButton.find('.button-text').text($choice.text());
|
||||
$pullUpdateButton.data('do', $url);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ export function initRepoIssueReferenceRepositorySearch() {
|
|||
$.each(response.data, (_r, repo) => {
|
||||
filteredResponse.results.push({
|
||||
name: htmlEscape(repo.repository.full_name),
|
||||
value: repo.repository.full_name
|
||||
value: repo.repository.full_name,
|
||||
});
|
||||
});
|
||||
return filteredResponse;
|
||||
|
@ -327,7 +327,7 @@ export function initRepoIssueReferenceRepositorySearch() {
|
|||
const $form = $choice.closest('form');
|
||||
$form.attr('action', `${appSubUrl}/${_text}/issues/new`);
|
||||
},
|
||||
fullTextSearch: true
|
||||
fullTextSearch: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -443,7 +443,7 @@ export function initRepoPullRequestReview() {
|
|||
}
|
||||
window.scrollTo({
|
||||
top: $commentDiv.offset().top - offset,
|
||||
behavior: 'instant'
|
||||
behavior: 'instant',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -661,7 +661,7 @@ export function initRepoIssueBranchSelect() {
|
|||
// Replace branch name to keep translation from HTML template
|
||||
$selectionTextField.html($selectionTextField.html().replace(
|
||||
`${baseName}:${branchNameOld}`,
|
||||
`${baseName}:${branchNameNew}`
|
||||
`${baseName}:${branchNameNew}`,
|
||||
));
|
||||
$selectionTextField.data('branch', branchNameNew); // update branch name in setting
|
||||
};
|
||||
|
@ -695,7 +695,7 @@ export function initIssueTemplateCommentEditors($commentForm) {
|
|||
const editor = await initComboMarkdownEditor($markdownEditor, {
|
||||
onContentChanged: (editor) => {
|
||||
$formField.val(editor.value());
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
$formField.on('focus', async () => {
|
||||
|
|
|
@ -39,7 +39,7 @@ export function initRepoSettingsCollaboration() {
|
|||
$text.text('(none)'); // prevent from misleading users when the access mode is undefined
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -56,15 +56,15 @@ export function initRepoSettingSearchTeamBox() {
|
|||
$.each(response.data, (_i, item) => {
|
||||
items.push({
|
||||
title: item.name,
|
||||
description: `${item.permission} access` // TODO: translate this string
|
||||
description: `${item.permission} access`, // TODO: translate this string
|
||||
});
|
||||
});
|
||||
|
||||
return {results: items};
|
||||
}
|
||||
},
|
||||
},
|
||||
searchFields: ['name', 'description'],
|
||||
showNoResults: false
|
||||
showNoResults: false,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -29,13 +29,13 @@ export function initRepoTemplateSearch() {
|
|||
const filteredResponse = {success: true, results: []};
|
||||
filteredResponse.results.push({
|
||||
name: '',
|
||||
value: ''
|
||||
value: '',
|
||||
});
|
||||
// Parse the response from the api to work with our dropdown
|
||||
$.each(response.data, (_r, repo) => {
|
||||
filteredResponse.results.push({
|
||||
name: htmlEscape(repo.repository.full_name),
|
||||
value: repo.repository.id
|
||||
value: repo.repository.id,
|
||||
});
|
||||
});
|
||||
return filteredResponse;
|
||||
|
@ -43,7 +43,7 @@ export function initRepoTemplateSearch() {
|
|||
cache: false,
|
||||
},
|
||||
|
||||
fullTextSearch: true
|
||||
fullTextSearch: true,
|
||||
});
|
||||
};
|
||||
$('#uid').on('change', changeOwner);
|
||||
|
|
|
@ -60,7 +60,7 @@ async function initRepoWikiFormEditor() {
|
|||
'gitea-code-inline', 'code', 'quote', '|', 'gitea-checkbox-empty', 'gitea-checkbox-checked', '|',
|
||||
'unordered-list', 'ordered-list', '|',
|
||||
'link', 'image', 'table', 'horizontal-rule', '|',
|
||||
'preview', 'fullscreen', 'side-by-side', '|', 'gitea-switch-to-textarea'
|
||||
'preview', 'fullscreen', 'side-by-side', '|', 'gitea-switch-to-textarea',
|
||||
],
|
||||
},
|
||||
});
|
||||
|
|
|
@ -25,7 +25,7 @@ function makeCollections({mentions, emoji}) {
|
|||
},
|
||||
menuItemTemplate: (item) => {
|
||||
return `<div class="tribute-item">${emojiHTML(item.original)}<span>${htmlEscape(item.original)}</span></div>`;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ function makeCollections({mentions, emoji}) {
|
|||
${item.original.fullname && item.original.fullname !== '' ? `<span class="fullname">${htmlEscape(item.original.fullname)}</span>` : ''}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ export async function initUserAuthWebAuthn() {
|
|||
}
|
||||
try {
|
||||
const credential = await navigator.credentials.get({
|
||||
publicKey: options.publicKey
|
||||
publicKey: options.publicKey,
|
||||
});
|
||||
await verifyAssertion(credential);
|
||||
} catch (err) {
|
||||
|
@ -37,7 +37,7 @@ export async function initUserAuthWebAuthn() {
|
|||
delete options.publicKey.extensions.appid;
|
||||
try {
|
||||
const credential = await navigator.credentials.get({
|
||||
publicKey: options.publicKey
|
||||
publicKey: options.publicKey,
|
||||
});
|
||||
await verifyAssertion(credential);
|
||||
} catch (err) {
|
||||
|
@ -185,7 +185,7 @@ async function webAuthnRegisterRequest() {
|
|||
|
||||
try {
|
||||
const credential = await navigator.credentials.create({
|
||||
publicKey: options.publicKey
|
||||
publicKey: options.publicKey,
|
||||
});
|
||||
await webauthnRegistered(credential);
|
||||
} catch (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue