1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-22 16:44:26 +00:00

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>
This commit is contained in:
silverwind 2023-05-09 04:35:49 +02:00 committed by GitHub
parent 1dd83dbb91
commit d5b2bf9044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 667 additions and 528 deletions

View File

@ -113,9 +113,9 @@ rules:
import/namespace: [0] import/namespace: [0]
import/newline-after-import: [0] import/newline-after-import: [0]
import/no-absolute-path: [0] import/no-absolute-path: [0]
import/no-amd: [0] import/no-amd: [2]
import/no-anonymous-default-export: [0] import/no-anonymous-default-export: [0]
import/no-commonjs: [0] import/no-commonjs: [2]
import/no-cycle: [2, {ignoreExternal: true, maxDepth: 1}] import/no-cycle: [2, {ignoreExternal: true, maxDepth: 1}]
import/no-default-export: [0] import/no-default-export: [0]
import/no-deprecated: [0] import/no-deprecated: [0]
@ -576,7 +576,7 @@ rules:
sonarjs/no-nested-template-literals: [0] sonarjs/no-nested-template-literals: [0]
sonarjs/no-one-iteration-loop: [2] sonarjs/no-one-iteration-loop: [2]
sonarjs/no-redundant-boolean: [2] sonarjs/no-redundant-boolean: [2]
sonarjs/no-redundant-jump: [0] sonarjs/no-redundant-jump: [2]
sonarjs/no-same-line-conditional: [2] sonarjs/no-same-line-conditional: [2]
sonarjs/no-small-switch: [0] sonarjs/no-small-switch: [0]
sonarjs/no-unused-collection: [2] sonarjs/no-unused-collection: [2]
@ -616,17 +616,18 @@ rules:
unicorn/import-style: [0] unicorn/import-style: [0]
unicorn/new-for-builtins: [2] unicorn/new-for-builtins: [2]
unicorn/no-abusive-eslint-disable: [0] unicorn/no-abusive-eslint-disable: [0]
unicorn/no-array-callback-reference: [0]
unicorn/no-array-for-each: [2] unicorn/no-array-for-each: [2]
unicorn/no-array-instanceof: [0]
unicorn/no-array-method-this-argument: [2] unicorn/no-array-method-this-argument: [2]
unicorn/no-array-push-push: [2] unicorn/no-array-push-push: [2]
unicorn/no-array-reduce: [2]
unicorn/no-await-expression-member: [0] unicorn/no-await-expression-member: [0]
unicorn/no-console-spaces: [0] unicorn/no-console-spaces: [0]
unicorn/no-document-cookie: [2] unicorn/no-document-cookie: [2]
unicorn/no-empty-file: [2] unicorn/no-empty-file: [2]
unicorn/no-fn-reference-in-iterator: [0]
unicorn/no-for-loop: [0] unicorn/no-for-loop: [0]
unicorn/no-hex-escape: [0] unicorn/no-hex-escape: [0]
unicorn/no-instanceof-array: [0]
unicorn/no-invalid-remove-event-listener: [2] unicorn/no-invalid-remove-event-listener: [2]
unicorn/no-keyword-prefix: [0] unicorn/no-keyword-prefix: [0]
unicorn/no-lonely-if: [2] unicorn/no-lonely-if: [2]
@ -637,7 +638,6 @@ rules:
unicorn/no-null: [0] unicorn/no-null: [0]
unicorn/no-object-as-default-parameter: [0] unicorn/no-object-as-default-parameter: [0]
unicorn/no-process-exit: [0] unicorn/no-process-exit: [0]
unicorn/no-reduce: [2]
unicorn/no-static-only-class: [2] unicorn/no-static-only-class: [2]
unicorn/no-thenable: [2] unicorn/no-thenable: [2]
unicorn/no-this-assignment: [2] unicorn/no-this-assignment: [2]
@ -663,15 +663,19 @@ rules:
unicorn/prefer-array-index-of: [2] unicorn/prefer-array-index-of: [2]
unicorn/prefer-array-some: [2] unicorn/prefer-array-some: [2]
unicorn/prefer-at: [0] unicorn/prefer-at: [0]
unicorn/prefer-blob-reading-methods: [2]
unicorn/prefer-code-point: [0] unicorn/prefer-code-point: [0]
unicorn/prefer-dataset: [2]
unicorn/prefer-date-now: [2] unicorn/prefer-date-now: [2]
unicorn/prefer-default-parameters: [0] unicorn/prefer-default-parameters: [0]
unicorn/prefer-event-key: [2] unicorn/prefer-dom-node-append: [2]
unicorn/prefer-dom-node-dataset: [0]
unicorn/prefer-dom-node-remove: [2]
unicorn/prefer-dom-node-text-content: [2]
unicorn/prefer-event-target: [2] unicorn/prefer-event-target: [2]
unicorn/prefer-export-from: [2, {ignoreUsedVariables: true}] unicorn/prefer-export-from: [2, {ignoreUsedVariables: true}]
unicorn/prefer-includes: [2] unicorn/prefer-includes: [2]
unicorn/prefer-json-parse-buffer: [0] unicorn/prefer-json-parse-buffer: [0]
unicorn/prefer-keyboard-event-key: [2]
unicorn/prefer-logical-operator-over-ternary: [2] unicorn/prefer-logical-operator-over-ternary: [2]
unicorn/prefer-math-trunc: [2] unicorn/prefer-math-trunc: [2]
unicorn/prefer-modern-dom-apis: [0] unicorn/prefer-modern-dom-apis: [0]
@ -679,9 +683,7 @@ rules:
unicorn/prefer-module: [2] unicorn/prefer-module: [2]
unicorn/prefer-native-coercion-functions: [2] unicorn/prefer-native-coercion-functions: [2]
unicorn/prefer-negative-index: [2] unicorn/prefer-negative-index: [2]
unicorn/prefer-node-append: [0]
unicorn/prefer-node-protocol: [2] unicorn/prefer-node-protocol: [2]
unicorn/prefer-node-remove: [0]
unicorn/prefer-number-properties: [0] unicorn/prefer-number-properties: [0]
unicorn/prefer-object-from-entries: [2] unicorn/prefer-object-from-entries: [2]
unicorn/prefer-object-has-own: [0] unicorn/prefer-object-has-own: [0]
@ -690,17 +692,17 @@ rules:
unicorn/prefer-query-selector: [0] unicorn/prefer-query-selector: [0]
unicorn/prefer-reflect-apply: [0] unicorn/prefer-reflect-apply: [0]
unicorn/prefer-regexp-test: [2] unicorn/prefer-regexp-test: [2]
unicorn/prefer-replace-all: [0]
unicorn/prefer-set-has: [0] unicorn/prefer-set-has: [0]
unicorn/prefer-set-size: [2] unicorn/prefer-set-size: [2]
unicorn/prefer-spread: [0] unicorn/prefer-spread: [0]
unicorn/prefer-starts-ends-with: [2] unicorn/prefer-string-replace-all: [0]
unicorn/prefer-string-slice: [0] unicorn/prefer-string-slice: [0]
unicorn/prefer-string-starts-ends-with: [2]
unicorn/prefer-string-trim-start-end: [2]
unicorn/prefer-switch: [0] unicorn/prefer-switch: [0]
unicorn/prefer-ternary: [0] unicorn/prefer-ternary: [0]
unicorn/prefer-text-content: [2] unicorn/prefer-text-content: [2]
unicorn/prefer-top-level-await: [0] unicorn/prefer-top-level-await: [0]
unicorn/prefer-trim-start-end: [2]
unicorn/prefer-type-error: [0] unicorn/prefer-type-error: [0]
unicorn/prevent-abbreviations: [0] unicorn/prevent-abbreviations: [0]
unicorn/relative-url-style: [2] unicorn/relative-url-style: [2]

View File

@ -53,7 +53,7 @@ function doSearch() {
} else { } else {
const para = document.createElement('P'); const para = document.createElement('P');
para.textContent = 'Please enter a word or phrase above'; para.textContent = 'Please enter a word or phrase above';
document.getElementById('search-results').appendChild(para); document.getElementById('search-results').append(para);
} }
} }
@ -85,7 +85,7 @@ function executeSearch(searchQuery) {
} else { } else {
const para = document.createElement('P'); const para = document.createElement('P');
para.textContent = 'No matches found'; para.textContent = 'No matches found';
document.getElementById('search-results').appendChild(para); document.getElementById('search-results').append(para);
} }
}); });
} }
@ -128,7 +128,7 @@ function populateResults(result) {
categories: value.item.categories, categories: value.item.categories,
snippet snippet
}); });
document.getElementById('search-results').appendChild(htmlToElement(output)); document.getElementById('search-results').append(htmlToElement(output));
for (const snipvalue of snippetHighlights) { for (const snipvalue of snippetHighlights) {
new Mark(document.getElementById(`summary-${key}`)).mark(snipvalue); new Mark(document.getElementById(`summary-${key}`)).mark(snipvalue);

1100
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -31,50 +31,50 @@
"fast-glob": "3.2.12", "fast-glob": "3.2.12",
"jquery": "3.6.4", "jquery": "3.6.4",
"jquery.are-you-sure": "1.9.0", "jquery.are-you-sure": "1.9.0",
"katex": "0.16.6", "katex": "0.16.7",
"license-checker-webpack-plugin": "0.2.1", "license-checker-webpack-plugin": "0.2.1",
"mermaid": "10.1.0", "mermaid": "10.1.0",
"mini-css-extract-plugin": "2.7.5", "mini-css-extract-plugin": "2.7.5",
"monaco-editor": "0.37.1", "monaco-editor": "0.38.0",
"monaco-editor-webpack-plugin": "7.0.1", "monaco-editor-webpack-plugin": "7.0.1",
"pretty-ms": "8.0.0", "pretty-ms": "8.0.0",
"sortablejs": "1.15.0", "sortablejs": "1.15.0",
"swagger-ui-dist": "4.18.2", "swagger-ui-dist": "4.18.3",
"throttle-debounce": "5.0.0", "throttle-debounce": "5.0.0",
"tippy.js": "6.3.7", "tippy.js": "6.3.7",
"tributejs": "5.1.3", "tributejs": "5.1.3",
"uint8-to-base64": "0.2.0", "uint8-to-base64": "0.2.0",
"vue": "3.2.47", "vue": "3.2.47",
"vue-bar-graph": "2.0.0", "vue-bar-graph": "2.0.0",
"vue-loader": "17.0.1", "vue-loader": "17.1.0",
"vue3-calendar-heatmap": "2.0.5", "vue3-calendar-heatmap": "2.0.5",
"webpack": "5.80.0", "webpack": "5.82.0",
"webpack-cli": "5.0.1", "webpack-cli": "5.1.0",
"workbox-routing": "6.5.4", "workbox-routing": "6.5.4",
"workbox-strategies": "6.5.4", "workbox-strategies": "6.5.4",
"wrap-ansi": "8.1.0" "wrap-ansi": "8.1.0"
}, },
"devDependencies": { "devDependencies": {
"@playwright/test": "1.32.3", "@playwright/test": "1.33.0",
"@rollup/pluginutils": "5.0.2", "@rollup/pluginutils": "5.0.2",
"@stoplight/spectral-cli": "6.6.0", "@stoplight/spectral-cli": "6.6.0",
"@vitejs/plugin-vue": "4.1.0", "@vitejs/plugin-vue": "4.2.1",
"eslint": "8.38.0", "eslint": "8.40.0",
"eslint-plugin-custom-elements": "0.0.8", "eslint-plugin-custom-elements": "0.0.8",
"eslint-plugin-import": "2.27.5", "eslint-plugin-import": "2.27.5",
"eslint-plugin-jquery": "1.5.1", "eslint-plugin-jquery": "1.5.1",
"eslint-plugin-no-jquery": "2.7.0", "eslint-plugin-no-jquery": "2.7.0",
"eslint-plugin-regexp": "1.14.0", "eslint-plugin-regexp": "1.14.0",
"eslint-plugin-sonarjs": "0.19.0", "eslint-plugin-sonarjs": "0.19.0",
"eslint-plugin-unicorn": "46.0.0", "eslint-plugin-unicorn": "47.0.0",
"eslint-plugin-vue": "9.11.0", "eslint-plugin-vue": "9.11.1",
"jsdom": "21.1.1", "jsdom": "22.0.0",
"markdownlint-cli": "0.33.0", "markdownlint-cli": "0.34.0",
"stylelint": "15.5.0", "stylelint": "15.6.1",
"stylelint-declaration-strict-value": "1.9.2", "stylelint-declaration-strict-value": "1.9.2",
"svgo": "3.0.2", "svgo": "3.0.2",
"updates": "14.0.1", "updates": "14.1.0",
"vitest": "0.30.1" "vitest": "0.31.0"
}, },
"browserslist": [ "browserslist": [
"defaults", "defaults",

View File

@ -175,8 +175,8 @@ const sfc = {
const elJobLogList = document.createElement('div'); const elJobLogList = document.createElement('div');
elJobLogList.classList.add('job-log-list'); elJobLogList.classList.add('job-log-list');
elJobLogGroup.appendChild(elJobLogGroupSummary); elJobLogGroup.append(elJobLogGroupSummary);
elJobLogGroup.appendChild(elJobLogList); elJobLogGroup.append(elJobLogList);
el._stepLogsActiveContainer = elJobLogList; el._stepLogsActiveContainer = elJobLogList;
}, },
// end a log group // end a log group
@ -219,15 +219,15 @@ const sfc = {
const lineNumber = document.createElement('div'); const lineNumber = document.createElement('div');
lineNumber.className = 'line-num'; lineNumber.className = 'line-num';
lineNumber.innerText = line.index; lineNumber.textContent = line.index;
div.appendChild(lineNumber); div.append(lineNumber);
// TODO: Support displaying time optionally // TODO: Support displaying time optionally
const logMessage = document.createElement('div'); const logMessage = document.createElement('div');
logMessage.className = 'log-msg'; logMessage.className = 'log-msg';
logMessage.innerHTML = ansiLogToHTML(line.message); logMessage.innerHTML = ansiLogToHTML(line.message);
div.appendChild(logMessage); div.append(logMessage);
return div; return div;
}, },

View File

@ -66,7 +66,7 @@ export async function createMonaco(textarea, filename, editorOpts) {
const container = document.createElement('div'); const container = document.createElement('div');
container.className = 'monaco-editor-container'; container.className = 'monaco-editor-container';
textarea.parentNode.appendChild(container); textarea.parentNode.append(container);
// https://github.com/microsoft/monaco-editor/issues/2427 // https://github.com/microsoft/monaco-editor/issues/2427
const styles = window.getComputedStyle(document.documentElement); const styles = window.getComputedStyle(document.documentElement);

View File

@ -172,7 +172,7 @@ export function initGlobalDropzone() {
} }
navigator.clipboard.writeText(fileMarkdown); navigator.clipboard.writeText(fileMarkdown);
}); });
file.previewTemplate.appendChild(copyLinkElement); file.previewTemplate.append(copyLinkElement);
}); });
this.on('removedfile', (file) => { this.on('removedfile', (file) => {
$(`#${file.uuid}`).remove(); $(`#${file.uuid}`).remove();

View File

@ -51,7 +51,7 @@ export function initViewedCheckboxListenerFor() {
// Update viewed-files summary and remove "has changed" label if present // Update viewed-files summary and remove "has changed" label if present
refreshViewedFilesSummary(); refreshViewedFilesSummary();
const hasChangedLabel = form.parentNode.querySelector('.changed-since-last-review'); 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 // Unfortunately, actual forms cause too many problems, hence another approach is needed
const files = {}; const files = {};

View File

@ -104,7 +104,7 @@ function showLineButton() {
td.prepend(btn); td.prepend(btn);
// put a copy of the menu back into DOM for the next click // 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, { createTippy(btn, {
trigger: 'click', trigger: 'click',

View File

@ -6,7 +6,7 @@ const {csrfToken} = window.config;
function updateIssueCount(cards) { function updateIssueCount(cards) {
const parent = cards.parentElement; const parent = cards.parentElement;
const cnt = parent.getElementsByClassName('board-card').length; 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}) { function moveIssue({item, from, to, oldIndex}) {

View File

@ -32,17 +32,14 @@ function initTagNameEditor() {
document.getElementById('tag-name').addEventListener('keyup', (e) => { document.getElementById('tag-name').addEventListener('keyup', (e) => {
const value = e.target.value; const value = e.target.value;
const tagHelper = document.getElementById('tag-helper');
if (existingTags.includes(value)) { if (existingTags.includes(value)) {
// If the tag already exists, hide the target branch selector. // If the tag already exists, hide the target branch selector.
hideElem('#tag-target-selector'); hideElem('#tag-target-selector');
document.getElementById('tag-helper').innerText = existingTagHelperText; tagHelper.textContent = existingTagHelperText;
} else { } else {
showElem('#tag-target-selector'); showElem('#tag-target-selector');
if (value) { tagHelper.textContent = value ? newTagHelperText : defaultTagHelperText;
document.getElementById('tag-helper').innerText = newTagHelperText;
} else {
document.getElementById('tag-helper').innerText = defaultTagHelperText;
}
} }
}); });
} }