diff options
author | silverwind <me@silverwind.io> | 2023-05-09 04:35:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-09 02:35:49 +0000 |
commit | d5b2bf9044caad9fb473312c4816f6c6caad4698 (patch) | |
tree | f6f9d829e86a122bd49ae7268204e680d9088c7e /web_src/js | |
parent | 1dd83dbb917d55bd253001646d6743f247a4d98b (diff) | |
download | gitea-d5b2bf9044caad9fb473312c4816f6c6caad4698.tar.gz gitea-d5b2bf9044caad9fb473312c4816f6c6caad4698.zip |
Update JS dependencies, add new eslint rules (#24597)
- Update all JS dependencies
- Enable new eslint rules, fix issue (some via autofix)
- Fix some missed eslint rule renames from [unicorn
v25](https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v25.0.0)
- Tested Monaco, Katex, Swagger UI
---------
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'web_src/js')
-rw-r--r-- | web_src/js/components/RepoActionView.vue | 10 | ||||
-rw-r--r-- | web_src/js/features/codeeditor.js | 2 | ||||
-rw-r--r-- | web_src/js/features/common-global.js | 2 | ||||
-rw-r--r-- | web_src/js/features/pull-view-file.js | 2 | ||||
-rw-r--r-- | web_src/js/features/repo-code.js | 2 | ||||
-rw-r--r-- | web_src/js/features/repo-projects.js | 2 | ||||
-rw-r--r-- | web_src/js/features/repo-release.js | 9 |
7 files changed, 13 insertions, 16 deletions
diff --git a/web_src/js/components/RepoActionView.vue b/web_src/js/components/RepoActionView.vue index 3d44f3ef47..2c51fbe5d1 100644 --- a/web_src/js/components/RepoActionView.vue +++ b/web_src/js/components/RepoActionView.vue @@ -175,8 +175,8 @@ const sfc = { const elJobLogList = document.createElement('div'); elJobLogList.classList.add('job-log-list'); - elJobLogGroup.appendChild(elJobLogGroupSummary); - elJobLogGroup.appendChild(elJobLogList); + elJobLogGroup.append(elJobLogGroupSummary); + elJobLogGroup.append(elJobLogList); el._stepLogsActiveContainer = elJobLogList; }, // end a log group @@ -219,15 +219,15 @@ const sfc = { const lineNumber = document.createElement('div'); lineNumber.className = 'line-num'; - lineNumber.innerText = line.index; - div.appendChild(lineNumber); + lineNumber.textContent = line.index; + div.append(lineNumber); // TODO: Support displaying time optionally const logMessage = document.createElement('div'); logMessage.className = 'log-msg'; logMessage.innerHTML = ansiLogToHTML(line.message); - div.appendChild(logMessage); + div.append(logMessage); return div; }, diff --git a/web_src/js/features/codeeditor.js b/web_src/js/features/codeeditor.js index 3b01b93a80..3a925e08c1 100644 --- a/web_src/js/features/codeeditor.js +++ b/web_src/js/features/codeeditor.js @@ -66,7 +66,7 @@ export async function createMonaco(textarea, filename, editorOpts) { const container = document.createElement('div'); container.className = 'monaco-editor-container'; - textarea.parentNode.appendChild(container); + textarea.parentNode.append(container); // https://github.com/microsoft/monaco-editor/issues/2427 const styles = window.getComputedStyle(document.documentElement); diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js index 16aedc6433..8245aa57f8 100644 --- a/web_src/js/features/common-global.js +++ b/web_src/js/features/common-global.js @@ -172,7 +172,7 @@ export function initGlobalDropzone() { } navigator.clipboard.writeText(fileMarkdown); }); - file.previewTemplate.appendChild(copyLinkElement); + file.previewTemplate.append(copyLinkElement); }); this.on('removedfile', (file) => { $(`#${file.uuid}`).remove(); diff --git a/web_src/js/features/pull-view-file.js b/web_src/js/features/pull-view-file.js index c6985efadb..e57663736a 100644 --- a/web_src/js/features/pull-view-file.js +++ b/web_src/js/features/pull-view-file.js @@ -51,7 +51,7 @@ export function initViewedCheckboxListenerFor() { // Update viewed-files summary and remove "has changed" label if present refreshViewedFilesSummary(); const hasChangedLabel = form.parentNode.querySelector('.changed-since-last-review'); - hasChangedLabel?.parentNode.removeChild(hasChangedLabel); + hasChangedLabel?.remove(); // Unfortunately, actual forms cause too many problems, hence another approach is needed const files = {}; diff --git a/web_src/js/features/repo-code.js b/web_src/js/features/repo-code.js index c0dced44eb..9b504068f6 100644 --- a/web_src/js/features/repo-code.js +++ b/web_src/js/features/repo-code.js @@ -104,7 +104,7 @@ function showLineButton() { td.prepend(btn); // put a copy of the menu back into DOM for the next click - btn.closest('.code-view').appendChild(menu.cloneNode(true)); + btn.closest('.code-view').append(menu.cloneNode(true)); createTippy(btn, { trigger: 'click', diff --git a/web_src/js/features/repo-projects.js b/web_src/js/features/repo-projects.js index 5d40096220..cd38c41e2d 100644 --- a/web_src/js/features/repo-projects.js +++ b/web_src/js/features/repo-projects.js @@ -6,7 +6,7 @@ const {csrfToken} = window.config; function updateIssueCount(cards) { const parent = cards.parentElement; const cnt = parent.getElementsByClassName('board-card').length; - parent.getElementsByClassName('board-card-cnt')[0].innerText = cnt; + parent.getElementsByClassName('board-card-cnt')[0].textContent = cnt; } function moveIssue({item, from, to, oldIndex}) { diff --git a/web_src/js/features/repo-release.js b/web_src/js/features/repo-release.js index 5cc6f1e3cd..3338c2874b 100644 --- a/web_src/js/features/repo-release.js +++ b/web_src/js/features/repo-release.js @@ -32,17 +32,14 @@ function initTagNameEditor() { document.getElementById('tag-name').addEventListener('keyup', (e) => { const value = e.target.value; + const tagHelper = document.getElementById('tag-helper'); if (existingTags.includes(value)) { // If the tag already exists, hide the target branch selector. hideElem('#tag-target-selector'); - document.getElementById('tag-helper').innerText = existingTagHelperText; + tagHelper.textContent = existingTagHelperText; } else { showElem('#tag-target-selector'); - if (value) { - document.getElementById('tag-helper').innerText = newTagHelperText; - } else { - document.getElementById('tag-helper').innerText = defaultTagHelperText; - } + tagHelper.textContent = value ? newTagHelperText : defaultTagHelperText; } }); } |