Add knip linter (#36442)

This adds [knip](https://github.com/webpro-nl/knip), a tool to find
unused files, dependencies and exports in JS. Fixed all discovered
issues.

1. knip apparently has some issue resolving imports from `d.ts` to `.ts`
so I worked around it by moving the two affected types to where they are
used.
2. I don't know why `modules/fomantic/dropdown.ts` had a new typescript
error, but I fixed it.
3. Use named export for `EsbuildPlugin`, I think this was added
recently.
This commit is contained in:
silverwind
2026-01-24 13:52:13 +01:00
committed by GitHub
parent ddc9d29713
commit 12a81d38c1
13 changed files with 314 additions and 31 deletions
+2
View File
@@ -317,11 +317,13 @@ lint-backend-fix: lint-go-fix lint-go-gitea-vet lint-editorconfig ## lint backen
lint-js: node_modules ## lint js files lint-js: node_modules ## lint js files
$(NODE_VARS) pnpm exec eslint --color --max-warnings=0 $(ESLINT_FILES) $(NODE_VARS) pnpm exec eslint --color --max-warnings=0 $(ESLINT_FILES)
$(NODE_VARS) pnpm exec vue-tsc $(NODE_VARS) pnpm exec vue-tsc
$(NODE_VARS) pnpm exec knip --no-progress --cache
.PHONY: lint-js-fix .PHONY: lint-js-fix
lint-js-fix: node_modules ## lint js files and fix issues lint-js-fix: node_modules ## lint js files and fix issues
$(NODE_VARS) pnpm exec eslint --color --max-warnings=0 $(ESLINT_FILES) --fix $(NODE_VARS) pnpm exec eslint --color --max-warnings=0 $(ESLINT_FILES) --fix
$(NODE_VARS) pnpm exec vue-tsc $(NODE_VARS) pnpm exec vue-tsc
$(NODE_VARS) pnpm exec knip --no-progress --cache --fix
.PHONY: lint-css .PHONY: lint-css
lint-css: node_modules ## lint css files lint-css: node_modules ## lint css files
+18
View File
@@ -0,0 +1,18 @@
import type {KnipConfig} from 'knip';
export default {
entry: [
'*.ts',
'tools/**/*.ts',
'tests/e2e/**/*.ts',
],
ignoreDependencies: [
// dependencies used in Makefile or tools
'@primer/octicons',
'markdownlint-cli',
'nolyfill',
'spectral-cli-bundle',
'vue-tsc',
'webpack-cli',
],
} satisfies KnipConfig;
+1
View File
@@ -98,6 +98,7 @@
"globals": "17.1.0", "globals": "17.1.0",
"happy-dom": "20.3.7", "happy-dom": "20.3.7",
"jiti": "2.6.1", "jiti": "2.6.1",
"knip": "5.82.1",
"markdownlint-cli": "0.47.0", "markdownlint-cli": "0.47.0",
"material-icon-theme": "5.31.0", "material-icon-theme": "5.31.0",
"nolyfill": "1.0.44", "nolyfill": "1.0.44",
+265
View File
@@ -297,6 +297,9 @@ importers:
jiti: jiti:
specifier: 2.6.1 specifier: 2.6.1
version: 2.6.1 version: 2.6.1
knip:
specifier: 5.82.1
version: 5.82.1(@types/node@25.0.10)(typescript@5.9.3)
markdownlint-cli: markdownlint-cli:
specifier: 0.47.0 specifier: 0.47.0
version: 0.47.0 version: 0.47.0
@@ -810,6 +813,9 @@ packages:
'@napi-rs/wasm-runtime@0.2.12': '@napi-rs/wasm-runtime@0.2.12':
resolution: {integrity: sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ==} resolution: {integrity: sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ==}
'@napi-rs/wasm-runtime@1.1.1':
resolution: {integrity: sha512-p64ah1M1ld8xjWv3qbvFwHiFVWrq1yFvV4f7w+mzaqiR4IlSgkqhcRdHwsGgomwzBH51sRY4NEowLxnaBjcW/A==}
'@nodelib/fs.scandir@2.1.5': '@nodelib/fs.scandir@2.1.5':
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'} engines: {node: '>= 8'}
@@ -885,6 +891,106 @@ packages:
resolution: {integrity: sha512-3dsKlf4Ma7o+uxLIg5OI1Tgwfet2pE8WTbPjEGWvOe6CSjMtK0skJnnSVHaEVX4N4mYU81To0qDeZOPqjaUotg==} resolution: {integrity: sha512-3dsKlf4Ma7o+uxLIg5OI1Tgwfet2pE8WTbPjEGWvOe6CSjMtK0skJnnSVHaEVX4N4mYU81To0qDeZOPqjaUotg==}
engines: {node: '>=12.4.0'} engines: {node: '>=12.4.0'}
'@oxc-resolver/binding-android-arm-eabi@11.16.4':
resolution: {integrity: sha512-6XUHilmj8D6Ggus+sTBp64x/DUQ7LgC/dvTDdUOt4iMQnDdSep6N1mnvVLIiG+qM5tRnNHravNzBJnUlYwRQoA==}
cpu: [arm]
os: [android]
'@oxc-resolver/binding-android-arm64@11.16.4':
resolution: {integrity: sha512-5ODwd1F5mdkm6JIg1CNny9yxIrCzrkKpxmqas7Alw23vE0Ot8D4ykqNBW5Z/nIZkXVEo5VDmnm0sMBBIANcpeQ==}
cpu: [arm64]
os: [android]
'@oxc-resolver/binding-darwin-arm64@11.16.4':
resolution: {integrity: sha512-egwvDK9DMU4Q8F4BG74/n4E22pQ0lT5ukOVB6VXkTj0iG2fnyoStHoFaBnmDseLNRA4r61Mxxz8k940CIaJMDg==}
cpu: [arm64]
os: [darwin]
'@oxc-resolver/binding-darwin-x64@11.16.4':
resolution: {integrity: sha512-HMkODYrAG4HaFNCpaYzSQFkxeiz2wzl+smXwxeORIQVEo1WAgUrWbvYT/0RNJg/A8z2aGMGK5KWTUr2nX5GiMw==}
cpu: [x64]
os: [darwin]
'@oxc-resolver/binding-freebsd-x64@11.16.4':
resolution: {integrity: sha512-mkcKhIdSlUqnndD928WAVVFMEr1D5EwHOBGHadypW0PkM0h4pn89ZacQvU7Qs/Z2qquzvbyw8m4Mq3jOYI+4Dw==}
cpu: [x64]
os: [freebsd]
'@oxc-resolver/binding-linux-arm-gnueabihf@11.16.4':
resolution: {integrity: sha512-ZJvzbmXI/cILQVcJL9S2Fp7GLAIY4Yr6mpGb+k6LKLUSEq85yhG+rJ9eWCqgULVIf2BFps/NlmPTa7B7oj8jhQ==}
cpu: [arm]
os: [linux]
'@oxc-resolver/binding-linux-arm-musleabihf@11.16.4':
resolution: {integrity: sha512-iZUB0W52uB10gBUDAi79eTnzqp1ralikCAjfq7CdokItwZUVJXclNYANnzXmtc0Xr0ox+YsDsG2jGcj875SatA==}
cpu: [arm]
os: [linux]
'@oxc-resolver/binding-linux-arm64-gnu@11.16.4':
resolution: {integrity: sha512-qNQk0H6q1CnwS9cnvyjk9a+JN8BTbxK7K15Bb5hYfJcKTG1hfloQf6egndKauYOO0wu9ldCMPBrEP1FNIQEhaA==}
cpu: [arm64]
os: [linux]
'@oxc-resolver/binding-linux-arm64-musl@11.16.4':
resolution: {integrity: sha512-wEXSaEaYxGGoVSbw0i2etjDDWcqErKr8xSkTdwATP798efsZmodUAcLYJhN0Nd4W35Oq6qAvFGHpKwFrrhpTrA==}
cpu: [arm64]
os: [linux]
'@oxc-resolver/binding-linux-ppc64-gnu@11.16.4':
resolution: {integrity: sha512-CUFOlpb07DVOFLoYiaTfbSBRPIhNgwc/MtlYeg3p6GJJw+kEm/vzc9lohPSjzF2MLPB5hzsJdk+L/GjrTT3UPw==}
cpu: [ppc64]
os: [linux]
'@oxc-resolver/binding-linux-riscv64-gnu@11.16.4':
resolution: {integrity: sha512-d8It4AH8cN9ReK1hW6ZO4x3rMT0hB2LYH0RNidGogV9xtnjLRU+Y3MrCeClLyOSGCibmweJJAjnwB7AQ31GEhg==}
cpu: [riscv64]
os: [linux]
'@oxc-resolver/binding-linux-riscv64-musl@11.16.4':
resolution: {integrity: sha512-d09dOww9iKyEHSxuOQ/Iu2aYswl0j7ExBcyy14D6lJ5ijQSP9FXcJYJsJ3yvzboO/PDEFjvRuF41f8O1skiPVg==}
cpu: [riscv64]
os: [linux]
'@oxc-resolver/binding-linux-s390x-gnu@11.16.4':
resolution: {integrity: sha512-lhjyGmUzTWHduZF3MkdUSEPMRIdExnhsqv8u1upX3A15epVn6YVwv4msFQPJl1x1wszkACPeDHGOtzHsITXGdw==}
cpu: [s390x]
os: [linux]
'@oxc-resolver/binding-linux-x64-gnu@11.16.4':
resolution: {integrity: sha512-ZtqqiI5rzlrYBm/IMMDIg3zvvVj4WO/90Dg/zX+iA8lWaLN7K5nroXb17MQ4WhI5RqlEAgrnYDXW+hok1D9Kaw==}
cpu: [x64]
os: [linux]
'@oxc-resolver/binding-linux-x64-musl@11.16.4':
resolution: {integrity: sha512-LM424h7aaKcMlqHnQWgTzO+GRNLyjcNnMpqm8SygEtFRVW693XS+XGXYvjORlmJtsyjo84ej1FMb3U2HE5eyjg==}
cpu: [x64]
os: [linux]
'@oxc-resolver/binding-openharmony-arm64@11.16.4':
resolution: {integrity: sha512-8w8U6A5DDWTBv3OUxSD9fNk37liZuEC5jnAc9wQRv9DeYKAXvuUtBfT09aIZ58swaci0q1WS48/CoMVEO6jdCA==}
cpu: [arm64]
os: [openharmony]
'@oxc-resolver/binding-wasm32-wasi@11.16.4':
resolution: {integrity: sha512-hnjb0mDVQOon6NdfNJ1EmNquonJUjoYkp7UyasjxVa4iiMcApziHP4czzzme6WZbp+vzakhVv2Yi5ACTon3Zlw==}
engines: {node: '>=14.0.0'}
cpu: [wasm32]
'@oxc-resolver/binding-win32-arm64-msvc@11.16.4':
resolution: {integrity: sha512-+i0XtNfSP7cfnh1T8FMrMm4HxTeh0jxKP/VQCLWbjdUxaAQ4damho4gN9lF5dl0tZahtdszXLUboBFNloSJNOQ==}
cpu: [arm64]
os: [win32]
'@oxc-resolver/binding-win32-ia32-msvc@11.16.4':
resolution: {integrity: sha512-ePW1islJrv3lPnef/iWwrjrSpRH8kLlftdKf2auQNWvYLx6F0xvcnv9d+r/upnVuttoQY9amLnWJf+JnCRksTw==}
cpu: [ia32]
os: [win32]
'@oxc-resolver/binding-win32-x64-msvc@11.16.4':
resolution: {integrity: sha512-qnjQhjHI4TDL3hkidZyEmQRK43w2NHl6TP5Rnt/0XxYuLdEgx/1yzShhYidyqWzdnhGhSPTM/WVP2mK66XLegA==}
cpu: [x64]
os: [win32]
'@pkgr/core@0.2.9': '@pkgr/core@0.2.9':
resolution: {integrity: sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==} resolution: {integrity: sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==}
engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
@@ -2581,6 +2687,9 @@ packages:
fastq@1.20.1: fastq@1.20.1:
resolution: {integrity: sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==} resolution: {integrity: sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==}
fd-package-json@2.0.0:
resolution: {integrity: sha512-jKmm9YtsNXN789RS/0mSzOC1NUq9mkVd65vbSSVsKdjGvYXBuE4oWe2QOEoFeRmJg+lPuZxpmrfFclNhoRMneQ==}
fdir@6.5.0: fdir@6.5.0:
resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==}
engines: {node: '>=12.0.0'} engines: {node: '>=12.0.0'}
@@ -2633,6 +2742,11 @@ packages:
flatted@3.3.3: flatted@3.3.3:
resolution: {integrity: sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==} resolution: {integrity: sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==}
formatly@0.3.0:
resolution: {integrity: sha512-9XNj/o4wrRFyhSMJOvsuyMwy8aUfBaZ1VrqHVfohyXf0Sw0e+yfKG+xZaY3arGCOMdwFsqObtzVOc1gU9KiT9w==}
engines: {node: '>=18.3.0'}
hasBin: true
fs.realpath@1.0.0: fs.realpath@1.0.0:
resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
@@ -2979,6 +3093,14 @@ packages:
resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
knip@5.82.1:
resolution: {integrity: sha512-1nQk+5AcnkqL40kGQXfouzAEXkTR+eSrgo/8m1d0BMei4eAzFwghoXC4gOKbACgBiCof7hE8wkBVDsEvznf85w==}
engines: {node: '>=18.18.0'}
hasBin: true
peerDependencies:
'@types/node': '>=18'
typescript: '>=5.0.4 <7'
known-css-properties@0.37.0: known-css-properties@0.37.0:
resolution: {integrity: sha512-JCDrsP4Z1Sb9JwG0aJ8Eo2r7k4Ou5MwmThS/6lcIe1ICyb7UBJKGRIUUdqc2ASdE/42lgz6zFUnzAIhtXnBVrQ==} resolution: {integrity: sha512-JCDrsP4Z1Sb9JwG0aJ8Eo2r7k4Ou5MwmThS/6lcIe1ICyb7UBJKGRIUUdqc2ASdE/42lgz6zFUnzAIhtXnBVrQ==}
@@ -3324,6 +3446,9 @@ packages:
resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}
engines: {node: '>= 0.8.0'} engines: {node: '>= 0.8.0'}
oxc-resolver@11.16.4:
resolution: {integrity: sha512-nvJr3orFz1wNaBA4neRw7CAn0SsjgVaEw1UHpgO/lzVW12w+nsFnvU/S6vVX3kYyFaZdxZheTExi/fa8R8PrZA==}
p-limit@2.3.0: p-limit@2.3.0:
resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==}
engines: {node: '>=6'} engines: {node: '>=6'}
@@ -3726,6 +3851,10 @@ packages:
resolution: {integrity: sha512-QlaZEqcAH3/RtNyet1IPIYPsEWAaYyXXv1Krsi+1L/QHppjX4Ifm8MQsBISz9vE8cHicIq3clogsheili5vhaQ==} resolution: {integrity: sha512-QlaZEqcAH3/RtNyet1IPIYPsEWAaYyXXv1Krsi+1L/QHppjX4Ifm8MQsBISz9vE8cHicIq3clogsheili5vhaQ==}
engines: {node: '>= 18'} engines: {node: '>= 18'}
smol-toml@1.6.0:
resolution: {integrity: sha512-4zemZi0HvTnYwLfrpk/CF9LOd9Lt87kAt50GnqhMpyF9U3poDAP2+iukq2bZsO/ufegbYehBkqINbsWxj4l4cw==}
engines: {node: '>= 18'}
solid-js@1.9.11: solid-js@1.9.11:
resolution: {integrity: sha512-WEJtcc5mkh/BnHA6Yrg4whlF8g6QwpmXXRg4P2ztPmcKeHHlH4+djYecBLhSpecZY2RRECXYUwIc/C2r3yzQ4Q==} resolution: {integrity: sha512-WEJtcc5mkh/BnHA6Yrg4whlF8g6QwpmXXRg4P2ztPmcKeHHlH4+djYecBLhSpecZY2RRECXYUwIc/C2r3yzQ4Q==}
@@ -3828,6 +3957,10 @@ packages:
resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==}
engines: {node: '>=8'} engines: {node: '>=8'}
strip-json-comments@5.0.3:
resolution: {integrity: sha512-1tB5mhVo7U+ETBKNf92xT4hrQa3pm0MZ0PQvuDnWgAAGHDsfp4lPSpiS6psrSiet87wyGPh9ft6wmhOMQ0hDiw==}
engines: {node: '>=14.16'}
style-search@0.1.0: style-search@0.1.0:
resolution: {integrity: sha512-Dj1Okke1C3uKKwQcetra4jSuk0DqbzbYtXipzFlFMZtowbF1x7BKJwB9AayVMyFARvU8EDrZdcax4At/452cAg==} resolution: {integrity: sha512-Dj1Okke1C3uKKwQcetra4jSuk0DqbzbYtXipzFlFMZtowbF1x7BKJwB9AayVMyFARvU8EDrZdcax4At/452cAg==}
@@ -4226,6 +4359,10 @@ packages:
typescript: typescript:
optional: true optional: true
walk-up-path@4.0.0:
resolution: {integrity: sha512-3hu+tD8YzSLGuFYtPRb48vdhKMi0KQV5sn+uWr8+7dMEq/2G/dtLrdDinkLjqq5TIbIBjYJ4Ax/n3YiaW7QM8A==}
engines: {node: 20 || >=22}
watchpack@2.5.1: watchpack@2.5.1:
resolution: {integrity: sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg==} resolution: {integrity: sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg==}
engines: {node: '>=10.13.0'} engines: {node: '>=10.13.0'}
@@ -4342,6 +4479,9 @@ packages:
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
engines: {node: '>=10'} engines: {node: '>=10'}
zod@4.3.6:
resolution: {integrity: sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==}
snapshots: snapshots:
'@alloc/quick-lru@5.2.0': {} '@alloc/quick-lru@5.2.0': {}
@@ -4733,6 +4873,13 @@ snapshots:
'@tybys/wasm-util': 0.10.1 '@tybys/wasm-util': 0.10.1
optional: true optional: true
'@napi-rs/wasm-runtime@1.1.1':
dependencies:
'@emnapi/core': 1.8.1
'@emnapi/runtime': 1.8.1
'@tybys/wasm-util': 0.10.1
optional: true
'@nodelib/fs.scandir@2.1.5': '@nodelib/fs.scandir@2.1.5':
dependencies: dependencies:
'@nodelib/fs.stat': 2.0.5 '@nodelib/fs.stat': 2.0.5
@@ -4797,6 +4944,68 @@ snapshots:
dependencies: dependencies:
'@nolyfill/shared': 1.0.44 '@nolyfill/shared': 1.0.44
'@oxc-resolver/binding-android-arm-eabi@11.16.4':
optional: true
'@oxc-resolver/binding-android-arm64@11.16.4':
optional: true
'@oxc-resolver/binding-darwin-arm64@11.16.4':
optional: true
'@oxc-resolver/binding-darwin-x64@11.16.4':
optional: true
'@oxc-resolver/binding-freebsd-x64@11.16.4':
optional: true
'@oxc-resolver/binding-linux-arm-gnueabihf@11.16.4':
optional: true
'@oxc-resolver/binding-linux-arm-musleabihf@11.16.4':
optional: true
'@oxc-resolver/binding-linux-arm64-gnu@11.16.4':
optional: true
'@oxc-resolver/binding-linux-arm64-musl@11.16.4':
optional: true
'@oxc-resolver/binding-linux-ppc64-gnu@11.16.4':
optional: true
'@oxc-resolver/binding-linux-riscv64-gnu@11.16.4':
optional: true
'@oxc-resolver/binding-linux-riscv64-musl@11.16.4':
optional: true
'@oxc-resolver/binding-linux-s390x-gnu@11.16.4':
optional: true
'@oxc-resolver/binding-linux-x64-gnu@11.16.4':
optional: true
'@oxc-resolver/binding-linux-x64-musl@11.16.4':
optional: true
'@oxc-resolver/binding-openharmony-arm64@11.16.4':
optional: true
'@oxc-resolver/binding-wasm32-wasi@11.16.4':
dependencies:
'@napi-rs/wasm-runtime': 1.1.1
optional: true
'@oxc-resolver/binding-win32-arm64-msvc@11.16.4':
optional: true
'@oxc-resolver/binding-win32-ia32-msvc@11.16.4':
optional: true
'@oxc-resolver/binding-win32-x64-msvc@11.16.4':
optional: true
'@pkgr/core@0.2.9': {} '@pkgr/core@0.2.9': {}
'@playwright/test@1.58.0': '@playwright/test@1.58.0':
@@ -6608,6 +6817,10 @@ snapshots:
dependencies: dependencies:
reusify: 1.1.0 reusify: 1.1.0
fd-package-json@2.0.0:
dependencies:
walk-up-path: 4.0.0
fdir@6.5.0(picomatch@4.0.3): fdir@6.5.0(picomatch@4.0.3):
optionalDependencies: optionalDependencies:
picomatch: 4.0.3 picomatch: 4.0.3
@@ -6659,6 +6872,10 @@ snapshots:
flatted@3.3.3: {} flatted@3.3.3: {}
formatly@0.3.0:
dependencies:
fd-package-json: 2.0.0
fs.realpath@1.0.0: {} fs.realpath@1.0.0: {}
fsevents@2.3.2: fsevents@2.3.2:
@@ -6943,6 +7160,23 @@ snapshots:
kind-of@6.0.3: {} kind-of@6.0.3: {}
knip@5.82.1(@types/node@25.0.10)(typescript@5.9.3):
dependencies:
'@nodelib/fs.walk': 1.2.8
'@types/node': 25.0.10
fast-glob: 3.3.3
formatly: 0.3.0
jiti: 2.6.1
js-yaml: 4.1.1
minimist: 1.2.8
oxc-resolver: 11.16.4
picocolors: 1.1.1
picomatch: 4.0.3
smol-toml: 1.6.0
strip-json-comments: 5.0.3
typescript: 5.9.3
zod: 4.3.6
known-css-properties@0.37.0: {} known-css-properties@0.37.0: {}
langium@3.3.1: langium@3.3.1:
@@ -7392,6 +7626,29 @@ snapshots:
type-check: 0.4.0 type-check: 0.4.0
word-wrap: 1.2.5 word-wrap: 1.2.5
oxc-resolver@11.16.4:
optionalDependencies:
'@oxc-resolver/binding-android-arm-eabi': 11.16.4
'@oxc-resolver/binding-android-arm64': 11.16.4
'@oxc-resolver/binding-darwin-arm64': 11.16.4
'@oxc-resolver/binding-darwin-x64': 11.16.4
'@oxc-resolver/binding-freebsd-x64': 11.16.4
'@oxc-resolver/binding-linux-arm-gnueabihf': 11.16.4
'@oxc-resolver/binding-linux-arm-musleabihf': 11.16.4
'@oxc-resolver/binding-linux-arm64-gnu': 11.16.4
'@oxc-resolver/binding-linux-arm64-musl': 11.16.4
'@oxc-resolver/binding-linux-ppc64-gnu': 11.16.4
'@oxc-resolver/binding-linux-riscv64-gnu': 11.16.4
'@oxc-resolver/binding-linux-riscv64-musl': 11.16.4
'@oxc-resolver/binding-linux-s390x-gnu': 11.16.4
'@oxc-resolver/binding-linux-x64-gnu': 11.16.4
'@oxc-resolver/binding-linux-x64-musl': 11.16.4
'@oxc-resolver/binding-openharmony-arm64': 11.16.4
'@oxc-resolver/binding-wasm32-wasi': 11.16.4
'@oxc-resolver/binding-win32-arm64-msvc': 11.16.4
'@oxc-resolver/binding-win32-ia32-msvc': 11.16.4
'@oxc-resolver/binding-win32-x64-msvc': 11.16.4
p-limit@2.3.0: p-limit@2.3.0:
dependencies: dependencies:
p-try: 2.2.0 p-try: 2.2.0
@@ -7772,6 +8029,8 @@ snapshots:
smol-toml@1.5.2: {} smol-toml@1.5.2: {}
smol-toml@1.6.0: {}
solid-js@1.9.11: solid-js@1.9.11:
dependencies: dependencies:
csstype: 3.2.3 csstype: 3.2.3
@@ -7872,6 +8131,8 @@ snapshots:
strip-json-comments@3.1.1: {} strip-json-comments@3.1.1: {}
strip-json-comments@5.0.3: {}
style-search@0.1.0: {} style-search@0.1.0: {}
stylelint-config-recommended@18.0.0(stylelint@17.0.0(typescript@5.9.3)): stylelint-config-recommended@18.0.0(stylelint@17.0.0(typescript@5.9.3)):
@@ -8318,6 +8579,8 @@ snapshots:
optionalDependencies: optionalDependencies:
typescript: 5.9.3 typescript: 5.9.3
walk-up-path@4.0.0: {}
watchpack@2.5.1: watchpack@2.5.1:
dependencies: dependencies:
glob-to-regexp: 0.4.1 glob-to-regexp: 0.4.1
@@ -8448,3 +8711,5 @@ snapshots:
yaml@2.8.2: {} yaml@2.8.2: {}
yocto-queue@0.1.0: {} yocto-queue@0.1.0: {}
zod@4.3.6: {}
+2
View File
@@ -28,6 +28,8 @@ If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly.
['{{$.MentionableTeamsOrg}}/{{.Name}}', {key: '{{$.MentionableTeamsOrg}}/{{.Name}}', value: '{{$.MentionableTeamsOrg}}/{{.Name}}', name: '{{$.MentionableTeamsOrg}}/{{.Name}}', avatar: '{{$.MentionableTeamsOrgAvatar}}'}], ['{{$.MentionableTeamsOrg}}/{{.Name}}', {key: '{{$.MentionableTeamsOrg}}/{{.Name}}', value: '{{$.MentionableTeamsOrg}}/{{.Name}}', name: '{{$.MentionableTeamsOrg}}/{{.Name}}', avatar: '{{$.MentionableTeamsOrgAvatar}}'}],
{{- end -}} {{- end -}}
]).values()), ]).values()),
{{else}}
mentionValues: [],
{{end}} {{end}}
mermaidMaxSourceCharacters: {{MermaidMaxSourceCharacters}}, mermaidMaxSourceCharacters: {{MermaidMaxSourceCharacters}},
{{/* this global i18n object should only contain general texts. for specialized texts, it should be provided inside the related modules by: (1) API response (2) HTML data-attribute (3) PageData */}} {{/* this global i18n object should only contain general texts. for specialized texts, it should be provided inside the related modules by: (1) API response (2) HTML data-attribute (3) PageData */}}
+1 -1
View File
@@ -29,7 +29,7 @@ export async function attachTribute(element: HTMLElement) {
return html`<div class="tribute-item">${htmlRaw(emojiHTML(item.original))}<span>${item.original}</span></div>`; return html`<div class="tribute-item">${htmlRaw(emojiHTML(item.original))}<span>${item.original}</span></div>`;
}, },
}, { // mentions }, { // mentions
values: window.config.mentionValues ?? [], values: window.config.mentionValues,
requireLeadingSpace: true, requireLeadingSpace: true,
menuItemTemplate: (item: TributeItem) => { menuItemTemplate: (item: TributeItem) => {
const fullNameHtml = item.original.fullname && item.original.fullname !== '' ? html`<span class="fullname">${item.original.fullname}</span>` : ''; const fullNameHtml = item.original.fullname && item.original.fullname !== '' ? html`<span class="fullname">${item.original.fullname}</span>` : '';
+20 -1
View File
@@ -49,7 +49,26 @@ interface Element {
} }
interface Window { interface Window {
config: import('./web_src/js/types.ts').Config; config: {
appUrl: string,
appSubUrl: string,
assetVersionEncoded: string,
assetUrlPrefix: string,
runModeIsProd: boolean,
customEmojis: Record<string, string>,
pageData: Record<string, any>,
notificationSettings: Record<string, any>,
enableTimeTracking: boolean,
mentionValues: Array<{
key: string,
value: string,
name: string,
fullname: string,
avatar: string,
}>,
mermaidMaxSourceCharacters: number,
i18n: Record<string, string>,
},
$: typeof import('@types/jquery'), $: typeof import('@types/jquery'),
jQuery: typeof import('@types/jquery'), jQuery: typeof import('@types/jquery'),
htmx: typeof import('htmx.org').default, htmx: typeof import('htmx.org').default,
+1 -1
View File
@@ -11,7 +11,7 @@ export function initMarkupRefIssue(el: HTMLElement) {
}); });
} }
export function showMarkupRefIssuePopup(e: MouseEvent | FocusEvent) { function showMarkupRefIssuePopup(e: MouseEvent | FocusEvent) {
const refIssue = e.currentTarget as HTMLElement; const refIssue = e.currentTarget as HTMLElement;
if (getAttachedTippyInstance(refIssue)) return; if (getAttachedTippyInstance(refIssue)) return;
if (refIssue.classList.contains('ref-external-issue')) return; if (refIssue.classList.contains('ref-external-issue')) return;
+1 -1
View File
@@ -1,7 +1,7 @@
import {generateElemId, queryElemChildren} from '../utils/dom.ts'; import {generateElemId, queryElemChildren} from '../utils/dom.ts';
import {isDarkTheme} from '../utils.ts'; import {isDarkTheme} from '../utils.ts';
export async function loadRenderIframeContent(iframe: HTMLIFrameElement) { async function loadRenderIframeContent(iframe: HTMLIFrameElement) {
const iframeSrcUrl = iframe.getAttribute('data-src')!; const iframeSrcUrl = iframe.getAttribute('data-src')!;
if (!iframe.id) iframe.id = generateElemId('gitea-iframe-'); if (!iframe.id) iframe.id = generateElemId('gitea-iframe-');
+1 -1
View File
@@ -65,7 +65,7 @@ function updateSelectionLabel(label: HTMLElement) {
const deleteIcon = label.querySelector('.delete.icon'); const deleteIcon = label.querySelector('.delete.icon');
if (deleteIcon) { if (deleteIcon) {
deleteIcon.setAttribute('aria-hidden', 'false'); deleteIcon.setAttribute('aria-hidden', 'false');
deleteIcon.setAttribute('aria-label', window.config.i18n.remove_label_str.replace('%s', label.getAttribute('data-value'))); deleteIcon.setAttribute('aria-label', window.config.i18n.remove_label_str.replace('%s', label.getAttribute('data-value')!));
deleteIcon.setAttribute('role', 'button'); deleteIcon.setAttribute('role', 'button');
} }
} }
-23
View File
@@ -1,26 +1,3 @@
export type MentionValue = {
key: string,
value: string,
name: string,
fullname: string,
avatar: string,
};
export type Config = {
appUrl: string,
appSubUrl: string,
assetVersionEncoded: string,
assetUrlPrefix: string,
runModeIsProd: boolean,
customEmojis: Record<string, string>,
pageData: Record<string, any>,
notificationSettings: Record<string, any>,
enableTimeTracking: boolean,
mentionValues?: MentionValue[],
mermaidMaxSourceCharacters: number,
i18n: Record<string, string>,
};
export type IntervalId = ReturnType<typeof setInterval>; export type IntervalId = ReturnType<typeof setInterval>;
export type Intent = 'error' | 'warning' | 'info'; export type Intent = 'error' | 'warning' | 'info';
+1 -1
View File
@@ -35,7 +35,7 @@ export function matchMention(queryText: string): MentionSuggestion[] {
// results is a map of weights, lower is better // results is a map of weights, lower is better
const results = new Map<MentionSuggestion, number>(); const results = new Map<MentionSuggestion, number>();
for (const obj of window.config.mentionValues ?? []) { for (const obj of window.config.mentionValues) {
const index = obj.key.toLowerCase().indexOf(query); const index = obj.key.toLowerCase().indexOf(query);
if (index === -1) continue; if (index === -1) continue;
const existing = results.get(obj); const existing = results.get(obj);
+1 -2
View File
@@ -4,7 +4,7 @@ import LicenseCheckerWebpackPlugin from '@techknowlogick/license-checker-webpack
import MiniCssExtractPlugin from 'mini-css-extract-plugin'; import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin'; import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin';
import {VueLoaderPlugin} from 'vue-loader'; import {VueLoaderPlugin} from 'vue-loader';
import EsBuildLoader from 'esbuild-loader'; import {EsbuildPlugin} from 'esbuild-loader';
import {parse} from 'node:path'; import {parse} from 'node:path';
import webpack, {type Configuration, type EntryObject} from 'webpack'; import webpack, {type Configuration, type EntryObject} from 'webpack';
import {fileURLToPath} from 'node:url'; import {fileURLToPath} from 'node:url';
@@ -13,7 +13,6 @@ import {env} from 'node:process';
import tailwindcss from 'tailwindcss'; import tailwindcss from 'tailwindcss';
import tailwindConfig from './tailwind.config.ts'; import tailwindConfig from './tailwind.config.ts';
const {EsbuildPlugin} = EsBuildLoader;
const {SourceMapDevToolPlugin, DefinePlugin, EnvironmentPlugin} = webpack; const {SourceMapDevToolPlugin, DefinePlugin, EnvironmentPlugin} = webpack;
const formatLicenseText = (licenseText: string) => wrapAnsi(licenseText || '', 80).trim(); const formatLicenseText = (licenseText: string) => wrapAnsi(licenseText || '', 80).trim();