0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-10-14 17:14:16 -04:00

Update JS deps, misc tweaks (#35643)

- Update all JS dependencies
- Enable eslint `no-useless-assignment` and fix 2 discovered issues
- Replace `gitea-vscode` svg with new `octicon-vscode`
- Remove now-unused `@ts-expect-error` comments
- Change Monaco wrapping behaviour to match the wrapping in code view:
no wrapping indent and break on any character.
This commit is contained in:
silverwind
2025-10-12 23:07:15 +02:00
committed by GitHub
parent 912515e63a
commit 49a0a11f55
11 changed files with 654 additions and 580 deletions

View File

@@ -52,21 +52,16 @@ export default defineConfig([
},
plugins: {
'@eslint-community/eslint-comments': comments,
// @ts-expect-error
'@stylistic': stylistic,
'@typescript-eslint': typescriptPlugin.plugin,
'array-func': arrayFunc,
// @ts-expect-error -- https://github.com/un-ts/eslint-plugin-import-x/issues/203
'import-x': importPlugin,
'no-use-extend-native': noUseExtendNative,
// @ts-expect-error
regexp,
// @ts-expect-error
sonarjs,
// @ts-expect-error
unicorn,
github,
// @ts-expect-error
wc,
},
settings: {
@@ -595,6 +590,7 @@ export default defineConfig([
'no-unused-vars': [0], // handled by @typescript-eslint/no-unused-vars
'no-use-before-define': [0], // handled by @typescript-eslint/no-use-before-define
'no-use-extend-native/no-use-extend-native': [2],
'no-useless-assignment': [2],
'no-useless-backreference': [2],
'no-useless-call': [2],
'no-useless-catch': [2],
@@ -900,7 +896,6 @@ export default defineConfig([
'yoda': [2, 'never'],
},
},
// @ts-expect-error
{
...playwright.configs['flat/recommended'],
files: ['tests/e2e/**'],
@@ -916,7 +911,6 @@ export default defineConfig([
},
},
extends: [
// @ts-expect-error
vue.configs['flat/recommended'],
// @ts-expect-error
vueScopedCss.configs['flat/recommended'],

View File

@@ -15,13 +15,13 @@
"@github/relative-time-element": "4.4.8",
"@github/text-expander-element": "2.9.2",
"@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
"@primer/octicons": "19.18.0",
"@primer/octicons": "19.19.0",
"@resvg/resvg-wasm": "2.6.2",
"@silverwind/vue3-calendar-heatmap": "2.0.6",
"@techknowlogick/license-checker-webpack-plugin": "0.3.0",
"add-asset-webpack-plugin": "3.1.1",
"ansi_up": "6.0.6",
"asciinema-player": "3.10.0",
"asciinema-player": "3.12.0",
"chart.js": "4.5.0",
"chartjs-adapter-dayjs-4": "1.0.4",
"chartjs-plugin-zoom": "2.2.0",
@@ -31,22 +31,22 @@
"dayjs": "1.11.18",
"dropzone": "6.0.0-beta.2",
"easymde": "2.20.0",
"esbuild-loader": "4.3.0",
"esbuild-loader": "4.4.0",
"htmx.org": "2.0.7",
"idiomorph": "0.7.4",
"jquery": "3.7.1",
"katex": "0.16.22",
"katex": "0.16.23",
"mermaid": "11.12.0",
"mini-css-extract-plugin": "2.9.4",
"monaco-editor": "0.53.0",
"monaco-editor-webpack-plugin": "7.1.0",
"monaco-editor": "0.54.0",
"monaco-editor-webpack-plugin": "7.1.1",
"online-3d-viewer": "0.16.0",
"pdfobject": "2.3.1",
"perfect-debounce": "2.0.0",
"postcss": "8.5.6",
"postcss-loader": "8.2.0",
"sortablejs": "1.15.6",
"swagger-ui-dist": "5.29.1",
"swagger-ui-dist": "5.29.4",
"tailwindcss": "3.4.17",
"throttle-debounce": "5.0.2",
"tinycolor2": "1.6.0",
@@ -60,13 +60,13 @@
"vue-bar-graph": "2.2.0",
"vue-chartjs": "5.3.2",
"vue-loader": "17.4.2",
"webpack": "5.102.0",
"webpack": "5.102.1",
"webpack-cli": "6.0.1",
"wrap-ansi": "9.0.2"
},
"devDependencies": {
"@eslint-community/eslint-plugin-eslint-comments": "4.5.0",
"@playwright/test": "1.55.1",
"@playwright/test": "1.56.0",
"@stylistic/eslint-plugin": "5.4.0",
"@stylistic/stylelint-plugin": "4.0.0",
"@types/codemirror": "5.60.16",
@@ -79,10 +79,10 @@
"@types/throttle-debounce": "5.0.2",
"@types/tinycolor2": "1.4.6",
"@types/toastify-js": "1.12.4",
"@typescript-eslint/parser": "8.45.0",
"@typescript-eslint/parser": "8.46.0",
"@vitejs/plugin-vue": "6.0.1",
"@vitest/eslint-plugin": "1.3.13",
"eslint": "9.36.0",
"@vitest/eslint-plugin": "1.3.16",
"eslint": "9.37.0",
"eslint-import-resolver-typescript": "4.4.4",
"eslint-plugin-array-func": "5.1.0",
"eslint-plugin-github": "6.0.0",
@@ -102,17 +102,17 @@
"nolyfill": "1.0.44",
"postcss-html": "1.8.0",
"spectral-cli-bundle": "1.0.3",
"stylelint": "16.24.0",
"stylelint": "16.25.0",
"stylelint-config-recommended": "17.0.0",
"stylelint-declaration-block-no-ignored-properties": "2.8.0",
"stylelint-declaration-strict-value": "1.10.11",
"stylelint-value-no-unknown-custom-properties": "6.0.1",
"svgo": "4.0.0",
"typescript-eslint": "8.45.0",
"updates": "16.7.4",
"typescript-eslint": "8.46.0",
"updates": "16.8.0",
"vite-string-plugin": "1.4.6",
"vitest": "3.2.4",
"vue-tsc": "3.1.0"
"vue-tsc": "3.1.1"
},
"browserslist": [
"defaults"

1163
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-1 -1 34 34" class="svg gitea-vscode" width="16" height="16" aria-hidden="true"><path d="M30.9 3.4 24.3.3a2 2 0 0 0-2.3.4L9.4 12.2 3.9 8c-.5-.4-1.2-.4-1.7 0L.4 9.8c-.5.5-.5 1.4 0 2L5.2 16 .4 20.3c-.5.6-.5 1.5 0 2L2.2 24c.5.5 1.2.5 1.7 0l5.5-4L22 31.2a2 2 0 0 0 2.3.4l6.6-3.2a2 2 0 0 0 1.1-1.8V5.2a2 2 0 0 0-1.1-1.8M24 23.3 14.4 16 24 8.7z"/></svg>

Before

Width:  |  Height:  |  Size: 396 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="svg octicon-comment-ai" width="16" height="16" aria-hidden="true"><path d="M7.75 1a.75.75 0 0 1 0 1.5h-5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h2c.199 0 .39.079.53.22.141.14.22.331.22.53v2.19l2.72-2.72a.75.75 0 0 1 .53-.22h4.5a.25.25 0 0 0 .25-.25v-2a.75.75 0 0 1 1.5 0v2c0 .464-.184.909-.513 1.237A1.75 1.75 0 0 1 13.25 12H9.06l-2.573 2.573A1.457 1.457 0 0 1 4 13.543V12H2.75A1.75 1.75 0 0 1 1 10.25v-7.5C1 1.784 1.784 1 2.75 1zm4.519-.837a.248.248 0 0 1 .466 0l.238.648a3.73 3.73 0 0 0 2.218 2.219l.649.238a.249.249 0 0 1 0 .467l-.649.238a3.73 3.73 0 0 0-2.218 2.218l-.238.649a.248.248 0 0 1-.466 0l-.239-.649a3.73 3.73 0 0 0-2.218-2.218l-.649-.238a.249.249 0 0 1 0-.467l.649-.238A3.73 3.73 0 0 0 12.03.811z"/></svg>

After

Width:  |  Height:  |  Size: 790 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="svg octicon-vscode" width="16" height="16" aria-hidden="true"><path d="M12.515.537c1.169-1.215 3.48-.226 3.418 1.534a593 593 0 0 1 .062 11.538c.089 1.938-2.439 3.149-3.827 1.851A643 643 0 0 1 1.312 5.996a.93.93 0 0 1-.308-.609.92.92 0 0 1 .194-.655.87.87 0 0 1 1.232-.136l1.493 1.18a641 641 0 0 1 9.708 7.85c.008.011.036-.018.019-.017a606 606 0 0 1 .057-11.226c-1.308 1.157-2.63 2.275-3.926 3.411-.477.416-.948.831-1.424 1.253a.87.87 0 0 1-1.237-.061.9.9 0 0 1-.231-.641.94.94 0 0 1 .27-.628c.452-.456.902-.905 1.36-1.354 1.324-1.302 2.677-2.558 3.996-3.826M2.986 9.734a.8.8 0 0 1 1.184.06.95.95 0 0 1-.057 1.272l-1.228 1.2a.8.8 0 0 1-1.183-.06.95.95 0 0 1 .055-1.272z"/></svg>

After

Width:  |  Height:  |  Size: 744 B

View File

@@ -6,7 +6,6 @@ package repo
import (
"errors"
"fmt"
"html/template"
"net/http"
"path"
"strconv"
@@ -76,16 +75,24 @@ func prepareOpenWithEditorApps(ctx *context.Context) {
}
for _, app := range apps {
schema, _, _ := strings.Cut(app.OpenURL, ":")
var iconHTML template.HTML
if schema == "vscode" || schema == "vscodium" || schema == "jetbrains" {
iconHTML = svg.RenderHTML("gitea-"+schema, 16)
} else {
iconHTML = svg.RenderHTML("gitea-git", 16) // TODO: it could support user's customized icon in the future
var iconName string
switch schema {
case "vscode":
iconName = "octicon-vscode"
case "vscodium":
iconName = "gitea-vscodium"
case "jetbrains":
iconName = "gitea-jetbrains"
default:
// TODO: it could support user's customized icon in the future
iconName = "gitea-git"
}
tmplApps = append(tmplApps, map[string]any{
"DisplayName": app.DisplayName,
"OpenURL": app.OpenURL,
"IconHTML": iconHTML,
"IconHTML": svg.RenderHTML(iconName, 16),
})
}
ctx.Data["OpenWithEditorApps"] = tmplApps

View File

@@ -38,6 +38,9 @@ const baseOptions: MonacoOpts = {
scrollbar: {horizontalScrollbarSize: 6, verticalScrollbarSize: 6},
scrollBeyondLastLine: false,
automaticLayout: true,
wrappingIndent: 'none',
wordWrapBreakAfterCharacters: '',
wordWrapBreakBeforeCharacters: '',
};
function getEditorconfig(input: HTMLInputElement): EditorConfig | null {

View File

@@ -28,7 +28,6 @@ async function createDropzone(el: HTMLElement, opts: DropzoneOptions) {
export function generateMarkdownLinkForAttachment(file: Partial<CustomDropzoneFile>, {width, dppx}: {width?: number, dppx?: number} = {}) {
let fileMarkdown = `[${file.name}](/attachments/${file.uuid})`;
if (isImageFile(file)) {
fileMarkdown = `!${fileMarkdown}`;
if (width > 0 && dppx > 1) {
// Scale down images from HiDPI monitors. This uses the <img> tag because it's the only
// method to change image size in Markdown that is supported by all implementations.

View File

@@ -53,7 +53,7 @@ function checkAuth() {
}
function checkItems(tokenAuth: boolean) {
let enableItems = false;
let enableItems: boolean;
if (tokenAuth) {
enableItems = token?.value !== '';
} else {

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="-1 -1 34 34"><path d="M30.9 3.4 24.3.3a2 2 0 0 0-2.3.4L9.4 12.2 3.9 8c-.5-.4-1.2-.4-1.7 0L.4 9.8c-.5.5-.5 1.4 0 2L5.2 16 .4 20.3c-.5.6-.5 1.5 0 2L2.2 24c.5.5 1.2.5 1.7 0l5.5-4L22 31.2a2 2 0 0 0 2.3.4l6.6-3.2a2 2 0 0 0 1.1-1.8V5.2a2 2 0 0 0-1.1-1.8zM24 23.3 14.4 16 24 8.7z"/></svg>

Before

Width:  |  Height:  |  Size: 353 B