Skip to content

Commit aed4810

Browse files
committed
Merge remote-tracking branch 'upstream/main' into pubsub
2 parents 6af641f + 13015bb commit aed4810

File tree

295 files changed

+4197
-2868
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

295 files changed

+4197
-2868
lines changed

.eslintrc.yaml

Lines changed: 161 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,28 @@ ignorePatterns:
66
- /web_src/fomantic
77
- /public/assets/js
88

9+
parser: "@typescript-eslint/parser"
10+
911
parserOptions:
1012
sourceType: module
1113
ecmaVersion: latest
14+
project: true
15+
extraFileExtensions: [".vue"]
16+
parser: "@typescript-eslint/parser" # for vue plugin - https://eslint.vuejs.org/user-guide/#how-to-use-a-custom-parser
17+
18+
settings:
19+
import/extensions: [".js", ".ts"]
20+
import/parsers:
21+
"@typescript-eslint/parser": [".js", ".ts"]
22+
import/resolver:
23+
typescript: true
1224

1325
plugins:
1426
- "@eslint-community/eslint-plugin-eslint-comments"
1527
- "@stylistic/eslint-plugin-js"
28+
- "@typescript-eslint/eslint-plugin"
1629
- eslint-plugin-array-func
30+
- eslint-plugin-deprecation
1731
- eslint-plugin-github
1832
- eslint-plugin-i
1933
- eslint-plugin-no-jquery
@@ -44,10 +58,10 @@ overrides:
4458
worker: true
4559
rules:
4660
no-restricted-globals: [2, addEventListener, blur, close, closed, confirm, defaultStatus, defaultstatus, error, event, external, find, focus, frameElement, frames, history, innerHeight, innerWidth, isFinite, isNaN, length, locationbar, menubar, moveBy, moveTo, name, onblur, onerror, onfocus, onload, onresize, onunload, open, opener, opera, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, print, removeEventListener, resizeBy, resizeTo, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollbars, scrollBy, scrollTo, scrollX, scrollY, status, statusbar, stop, toolbar, top]
47-
- files: ["*.config.*"]
61+
- files: ["*.config.*", "**/*.d.ts"]
4862
rules:
4963
i/no-unused-modules: [0]
50-
- files: ["**/*.test.*", "web_src/js/test/setup.js"]
64+
- files: ["**/*.test.*", "web_src/js/test/setup.ts"]
5165
env:
5266
vitest-globals/env: true
5367
rules:
@@ -100,9 +114,25 @@ overrides:
100114
vitest/valid-describe-callback: [2]
101115
vitest/valid-expect: [2]
102116
vitest/valid-title: [2]
103-
- files: ["web_src/js/modules/fetch.js", "web_src/js/standalone/**/*"]
117+
- files: ["web_src/js/modules/fetch.ts", "web_src/js/standalone/**/*"]
104118
rules:
105119
no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement, SequenceExpression]
120+
- files: ["**/*.vue"]
121+
plugins:
122+
- eslint-plugin-vue
123+
- eslint-plugin-vue-scoped-css
124+
extends:
125+
- plugin:vue/vue3-recommended
126+
- plugin:vue-scoped-css/vue3-recommended
127+
rules:
128+
vue/attributes-order: [0]
129+
vue/html-closing-bracket-spacing: [2, {startTag: never, endTag: never, selfClosingTag: never}]
130+
vue/max-attributes-per-line: [0]
131+
vue/singleline-html-element-content-newline: [0]
132+
- files: ["tests/e2e/**"]
133+
plugins:
134+
- eslint-plugin-playwright
135+
extends: plugin:playwright/recommended
106136

107137
rules:
108138
"@eslint-community/eslint-comments/disable-enable-pair": [2]
@@ -182,6 +212,123 @@ rules:
182212
"@stylistic/js/wrap-iife": [2, inside]
183213
"@stylistic/js/wrap-regex": [0]
184214
"@stylistic/js/yield-star-spacing": [2, after]
215+
"@typescript-eslint/adjacent-overload-signatures": [0]
216+
"@typescript-eslint/array-type": [0]
217+
"@typescript-eslint/await-thenable": [2]
218+
"@typescript-eslint/ban-ts-comment": [2, {'ts-expect-error': false, 'ts-ignore': true, 'ts-nocheck': false, 'ts-check': false}]
219+
"@typescript-eslint/ban-tslint-comment": [0]
220+
"@typescript-eslint/ban-types": [2, {extendDefaults: true, types: {Function: false}}]
221+
"@typescript-eslint/class-literal-property-style": [0]
222+
"@typescript-eslint/class-methods-use-this": [0]
223+
"@typescript-eslint/consistent-generic-constructors": [0]
224+
"@typescript-eslint/consistent-indexed-object-style": [0]
225+
"@typescript-eslint/consistent-return": [0]
226+
"@typescript-eslint/consistent-type-assertions": [2, {assertionStyle: as, objectLiteralTypeAssertions: allow}]
227+
"@typescript-eslint/consistent-type-definitions": [2, type]
228+
"@typescript-eslint/consistent-type-exports": [2, {fixMixedExportsWithInlineTypeSpecifier: false}]
229+
"@typescript-eslint/consistent-type-imports": [2, {prefer: type-imports, fixStyle: separate-type-imports, disallowTypeAnnotations: true}]
230+
"@typescript-eslint/default-param-last": [0]
231+
"@typescript-eslint/dot-notation": [0]
232+
"@typescript-eslint/explicit-function-return-type": [0]
233+
"@typescript-eslint/explicit-member-accessibility": [0]
234+
"@typescript-eslint/explicit-module-boundary-types": [0]
235+
"@typescript-eslint/init-declarations": [0]
236+
"@typescript-eslint/max-params": [0]
237+
"@typescript-eslint/member-ordering": [0]
238+
"@typescript-eslint/method-signature-style": [0]
239+
"@typescript-eslint/naming-convention": [0]
240+
"@typescript-eslint/no-array-constructor": [2]
241+
"@typescript-eslint/no-array-delete": [2]
242+
"@typescript-eslint/no-base-to-string": [0]
243+
"@typescript-eslint/no-confusing-non-null-assertion": [2]
244+
"@typescript-eslint/no-confusing-void-expression": [0]
245+
"@typescript-eslint/no-dupe-class-members": [0]
246+
"@typescript-eslint/no-duplicate-enum-values": [2]
247+
"@typescript-eslint/no-duplicate-type-constituents": [2, {ignoreUnions: true}]
248+
"@typescript-eslint/no-dynamic-delete": [0]
249+
"@typescript-eslint/no-empty-function": [0]
250+
"@typescript-eslint/no-empty-interface": [0]
251+
"@typescript-eslint/no-explicit-any": [0]
252+
"@typescript-eslint/no-extra-non-null-assertion": [2]
253+
"@typescript-eslint/no-extraneous-class": [0]
254+
"@typescript-eslint/no-floating-promises": [0]
255+
"@typescript-eslint/no-for-in-array": [2]
256+
"@typescript-eslint/no-implied-eval": [2]
257+
"@typescript-eslint/no-import-type-side-effects": [0] # dupe with consistent-type-imports
258+
"@typescript-eslint/no-inferrable-types": [0]
259+
"@typescript-eslint/no-invalid-this": [0]
260+
"@typescript-eslint/no-invalid-void-type": [0]
261+
"@typescript-eslint/no-loop-func": [0]
262+
"@typescript-eslint/no-loss-of-precision": [2]
263+
"@typescript-eslint/no-magic-numbers": [0]
264+
"@typescript-eslint/no-meaningless-void-operator": [0]
265+
"@typescript-eslint/no-misused-new": [2]
266+
"@typescript-eslint/no-misused-promises": [2, {checksVoidReturn: {attributes: false, arguments: false}}]
267+
"@typescript-eslint/no-mixed-enums": [0]
268+
"@typescript-eslint/no-namespace": [2]
269+
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": [0]
270+
"@typescript-eslint/no-non-null-asserted-optional-chain": [2]
271+
"@typescript-eslint/no-non-null-assertion": [0]
272+
"@typescript-eslint/no-redeclare": [0]
273+
"@typescript-eslint/no-redundant-type-constituents": [2]
274+
"@typescript-eslint/no-require-imports": [0]
275+
"@typescript-eslint/no-restricted-imports": [0]
276+
"@typescript-eslint/no-shadow": [0]
277+
"@typescript-eslint/no-this-alias": [0] # handled by unicorn/no-this-assignment
278+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": [0]
279+
"@typescript-eslint/no-unnecessary-condition": [0]
280+
"@typescript-eslint/no-unnecessary-qualifier": [0]
281+
"@typescript-eslint/no-unnecessary-template-expression": [0]
282+
"@typescript-eslint/no-unnecessary-type-arguments": [0]
283+
"@typescript-eslint/no-unnecessary-type-assertion": [2]
284+
"@typescript-eslint/no-unnecessary-type-constraint": [2]
285+
"@typescript-eslint/no-unsafe-argument": [0]
286+
"@typescript-eslint/no-unsafe-assignment": [0]
287+
"@typescript-eslint/no-unsafe-call": [0]
288+
"@typescript-eslint/no-unsafe-declaration-merging": [2]
289+
"@typescript-eslint/no-unsafe-enum-comparison": [2]
290+
"@typescript-eslint/no-unsafe-member-access": [0]
291+
"@typescript-eslint/no-unsafe-return": [0]
292+
"@typescript-eslint/no-unsafe-unary-minus": [2]
293+
"@typescript-eslint/no-unused-expressions": [0]
294+
"@typescript-eslint/no-unused-vars": [2, {vars: all, args: all, caughtErrors: all, ignoreRestSiblings: false, argsIgnorePattern: ^_, varsIgnorePattern: ^_, caughtErrorsIgnorePattern: ^_, destructuredArrayIgnorePattern: ^_}]
295+
"@typescript-eslint/no-use-before-define": [0]
296+
"@typescript-eslint/no-useless-constructor": [0]
297+
"@typescript-eslint/no-useless-empty-export": [0]
298+
"@typescript-eslint/no-var-requires": [2]
299+
"@typescript-eslint/non-nullable-type-assertion-style": [0]
300+
"@typescript-eslint/only-throw-error": [2]
301+
"@typescript-eslint/parameter-properties": [0]
302+
"@typescript-eslint/prefer-as-const": [2]
303+
"@typescript-eslint/prefer-destructuring": [0]
304+
"@typescript-eslint/prefer-enum-initializers": [0]
305+
"@typescript-eslint/prefer-find": [2]
306+
"@typescript-eslint/prefer-for-of": [2]
307+
"@typescript-eslint/prefer-function-type": [2]
308+
"@typescript-eslint/prefer-includes": [2]
309+
"@typescript-eslint/prefer-literal-enum-member": [0]
310+
"@typescript-eslint/prefer-namespace-keyword": [0]
311+
"@typescript-eslint/prefer-nullish-coalescing": [0]
312+
"@typescript-eslint/prefer-optional-chain": [2, {requireNullish: true}]
313+
"@typescript-eslint/prefer-promise-reject-errors": [0]
314+
"@typescript-eslint/prefer-readonly": [0]
315+
"@typescript-eslint/prefer-readonly-parameter-types": [0]
316+
"@typescript-eslint/prefer-reduce-type-parameter": [0]
317+
"@typescript-eslint/prefer-regexp-exec": [0]
318+
"@typescript-eslint/prefer-return-this-type": [0]
319+
"@typescript-eslint/prefer-string-starts-ends-with": [2, {allowSingleElementEquality: always}]
320+
"@typescript-eslint/promise-function-async": [0]
321+
"@typescript-eslint/require-array-sort-compare": [0]
322+
"@typescript-eslint/require-await": [0]
323+
"@typescript-eslint/restrict-plus-operands": [2]
324+
"@typescript-eslint/restrict-template-expressions": [0]
325+
"@typescript-eslint/return-await": [0]
326+
"@typescript-eslint/strict-boolean-expressions": [0]
327+
"@typescript-eslint/switch-exhaustiveness-check": [0]
328+
"@typescript-eslint/triple-slash-reference": [2]
329+
"@typescript-eslint/typedef": [0]
330+
"@typescript-eslint/unbound-method": [2]
331+
"@typescript-eslint/unified-signatures": [2]
185332
accessor-pairs: [2]
186333
array-callback-return: [2, {checkForEach: true}]
187334
array-func/avoid-reverse: [2]
@@ -203,6 +350,7 @@ rules:
203350
default-case-last: [2]
204351
default-case: [0]
205352
default-param-last: [0]
353+
deprecation/deprecation: [2]
206354
dot-notation: [0]
207355
eqeqeq: [2]
208356
for-direction: [2]
@@ -264,7 +412,7 @@ rules:
264412
i/no-internal-modules: [0]
265413
i/no-mutable-exports: [0]
266414
i/no-named-as-default-member: [0]
267-
i/no-named-as-default: [2]
415+
i/no-named-as-default: [0]
268416
i/no-named-default: [0]
269417
i/no-named-export: [0]
270418
i/no-namespace: [0]
@@ -274,7 +422,7 @@ rules:
274422
i/no-restricted-paths: [0]
275423
i/no-self-import: [2]
276424
i/no-unassigned-import: [0]
277-
i/no-unresolved: [2, {commonjs: true, ignore: ["\\?.+$", ^vitest/]}]
425+
i/no-unresolved: [2, {commonjs: true, ignore: ["\\?.+$"]}]
278426
i/no-unused-modules: [2, {unusedExports: true}]
279427
i/no-useless-path-segments: [2, {commonjs: true}]
280428
i/no-webpack-loader-syntax: [2]
@@ -294,7 +442,7 @@ rules:
294442
multiline-comment-style: [2, separate-lines]
295443
new-cap: [0]
296444
no-alert: [0]
297-
no-array-constructor: [2]
445+
no-array-constructor: [0] # handled by @typescript-eslint/no-array-constructor
298446
no-async-promise-executor: [0]
299447
no-await-in-loop: [0]
300448
no-bitwise: [0]
@@ -319,7 +467,7 @@ rules:
319467
no-dupe-else-if: [2]
320468
no-dupe-keys: [2]
321469
no-duplicate-case: [2]
322-
no-duplicate-imports: [2]
470+
no-duplicate-imports: [0]
323471
no-else-return: [2]
324472
no-empty-character-class: [2]
325473
no-empty-function: [0]
@@ -338,7 +486,7 @@ rules:
338486
no-global-assign: [2]
339487
no-implicit-coercion: [2]
340488
no-implicit-globals: [0]
341-
no-implied-eval: [2]
489+
no-implied-eval: [0] # handled by @typescript-eslint/no-implied-eval
342490
no-import-assign: [2]
343491
no-inline-comments: [0]
344492
no-inner-declarations: [2]
@@ -444,7 +592,7 @@ rules:
444592
no-lone-blocks: [2]
445593
no-lonely-if: [0]
446594
no-loop-func: [0]
447-
no-loss-of-precision: [2]
595+
no-loss-of-precision: [0] # handled by @typescript-eslint/no-loss-of-precision
448596
no-magic-numbers: [0]
449597
no-misleading-character-class: [2]
450598
no-multi-assign: [0]
@@ -466,12 +614,12 @@ rules:
466614
no-promise-executor-return: [0]
467615
no-proto: [2]
468616
no-prototype-builtins: [2]
469-
no-redeclare: [2]
617+
no-redeclare: [0] # must be disabled for typescript overloads
470618
no-regex-spaces: [2]
471619
no-restricted-exports: [0]
472620
no-restricted-globals: [2, addEventListener, blur, close, closed, confirm, defaultStatus, defaultstatus, error, event, external, find, focus, frameElement, frames, history, innerHeight, innerWidth, isFinite, isNaN, length, location, locationbar, menubar, moveBy, moveTo, name, onblur, onerror, onfocus, onload, onresize, onunload, open, opener, opera, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, print, removeEventListener, resizeBy, resizeTo, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollbars, scrollBy, scrollTo, scrollX, scrollY, self, status, statusbar, stop, toolbar, top, __dirname, __filename]
473621
no-restricted-imports: [0]
474-
no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement, SequenceExpression, {selector: "CallExpression[callee.name='fetch']", message: "use modules/fetch.js instead"}]
622+
no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement, SequenceExpression, {selector: "CallExpression[callee.name='fetch']", message: "use modules/fetch.ts instead"}]
475623
no-return-assign: [0]
476624
no-script-url: [2]
477625
no-self-assign: [2, {props: true}]
@@ -499,7 +647,7 @@ rules:
499647
no-unused-expressions: [2]
500648
no-unused-labels: [2]
501649
no-unused-private-class-members: [2]
502-
no-unused-vars: [2, {args: all, argsIgnorePattern: ^_, varsIgnorePattern: ^_, caughtErrorsIgnorePattern: ^_, destructuredArrayIgnorePattern: ^_, ignoreRestSiblings: false}]
650+
no-unused-vars: [0] # handled by @typescript-eslint/no-unused-vars
503651
no-use-before-define: [2, {functions: false, classes: true, variables: true, allowNamedExports: true}]
504652
no-use-extend-native/no-use-extend-native: [2]
505653
no-useless-backreference: [2]
@@ -614,7 +762,7 @@ rules:
614762
regexp/unicode-escape: [0]
615763
regexp/use-ignore-case: [0]
616764
require-atomic-updates: [0]
617-
require-await: [0]
765+
require-await: [0] # handled by @typescript-eslint/require-await
618766
require-unicode-regexp: [0]
619767
require-yield: [2]
620768
sonarjs/cognitive-complexity: [0]

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
FROM docker.io/library/golang:1.22-alpine3.20 AS build-env
33

44
ARG GOPROXY
5-
ENV GOPROXY ${GOPROXY:-direct}
5+
ENV GOPROXY=${GOPROXY:-direct}
66

77
ARG GITEA_VERSION
88
ARG TAGS="sqlite sqlite_unlock_notify"
9-
ENV TAGS "bindata timetzdata $TAGS"
9+
ENV TAGS="bindata timetzdata $TAGS"
1010
ARG CGO_EXTRA_CFLAGS
1111

1212
# Build deps
@@ -72,8 +72,8 @@ RUN addgroup \
7272
git && \
7373
echo "git:*" | chpasswd -e
7474

75-
ENV USER git
76-
ENV GITEA_CUSTOM /data/gitea
75+
ENV USER=git
76+
ENV GITEA_CUSTOM=/data/gitea
7777

7878
VOLUME ["/data"]
7979

Dockerfile.rootless

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
FROM docker.io/library/golang:1.22-alpine3.20 AS build-env
33

44
ARG GOPROXY
5-
ENV GOPROXY ${GOPROXY:-direct}
5+
ENV GOPROXY=${GOPROXY:-direct}
66

77
ARG GITEA_VERSION
88
ARG TAGS="sqlite sqlite_unlock_notify"
9-
ENV TAGS "bindata timetzdata $TAGS"
9+
ENV TAGS="bindata timetzdata $TAGS"
1010
ARG CGO_EXTRA_CFLAGS
1111

1212
#Build deps
@@ -75,14 +75,14 @@ COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_au
7575

7676
# git:git
7777
USER 1000:1000
78-
ENV GITEA_WORK_DIR /var/lib/gitea
79-
ENV GITEA_CUSTOM /var/lib/gitea/custom
80-
ENV GITEA_TEMP /tmp/gitea
81-
ENV TMPDIR /tmp/gitea
78+
ENV GITEA_WORK_DIR=/var/lib/gitea
79+
ENV GITEA_CUSTOM=/var/lib/gitea/custom
80+
ENV GITEA_TEMP=/tmp/gitea
81+
ENV TMPDIR=/tmp/gitea
8282

8383
# TODO add to docs the ability to define the ini to load (useful to test and revert a config)
84-
ENV GITEA_APP_INI /etc/gitea/app.ini
85-
ENV HOME "/var/lib/gitea/git"
84+
ENV GITEA_APP_INI=/etc/gitea/app.ini
85+
ENV HOME="/var/lib/gitea/git"
8686
VOLUME ["/var/lib/gitea", "/etc/gitea"]
8787
WORKDIR /var/lib/gitea
8888

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ GOFUMPT_PACKAGE ?= mvdan.cc/[email protected]
3131
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/[email protected]
3232
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
3333
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/[email protected]
34-
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@db51e79a0e37c572d8b59ae0c58bf2bbbbe53285
34+
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0
3535
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
3636
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1
3737
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1
@@ -144,7 +144,7 @@ TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMAN
144144
GO_DIRS := build cmd models modules routers services tests
145145
WEB_DIRS := web_src/js web_src/css
146146

147-
ESLINT_FILES := web_src/js tools *.js tests/e2e
147+
ESLINT_FILES := web_src/js tools *.js *.ts tests/e2e
148148
STYLELINT_FILES := web_src/css web_src/js/components/*.vue
149149
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) docs/content templates options/locale/locale_en-US.ini .github $(filter-out CHANGELOG.md, $(wildcard *.go *.js *.md *.yml *.yaml *.toml))
150150
EDITORCONFIG_FILES := templates .github/workflows options/locale/locale_en-US.ini
@@ -375,11 +375,13 @@ lint-backend-fix: lint-go-fix lint-go-vet lint-editorconfig
375375

376376
.PHONY: lint-js
377377
lint-js: node_modules
378-
npx eslint --color --max-warnings=0 --ext js,vue $(ESLINT_FILES)
378+
npx eslint --color --max-warnings=0 --ext js,ts,vue $(ESLINT_FILES)
379+
# npx tsc
379380

380381
.PHONY: lint-js-fix
381382
lint-js-fix: node_modules
382-
npx eslint --color --max-warnings=0 --ext js,vue $(ESLINT_FILES) --fix
383+
npx eslint --color --max-warnings=0 --ext js,ts,vue $(ESLINT_FILES) --fix
384+
# npx tsc
383385

384386
.PHONY: lint-css
385387
lint-css: node_modules
@@ -967,7 +969,7 @@ generate-gitignore:
967969

968970
.PHONY: generate-images
969971
generate-images: | node_modules
970-
npm install --no-save fabric@6.0.0-beta20 imagemin-zopfli@7
972+
npm install --no-save fabric@6 imagemin-zopfli@7
971973
node tools/generate-images.js $(TAGS)
972974

973975
.PHONY: generate-manpage

0 commit comments

Comments
 (0)