feat: run tsc in CI (#9574)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9574
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
Gusted 2025-10-10 15:48:45 +02:00 committed by 0ko
parent 39f389eb17
commit b529b80132
6 changed files with 28 additions and 14 deletions

View file

@ -432,7 +432,7 @@ lint: lint-frontend lint-backend
lint-fix: lint-frontend-fix lint-backend-fix
.PHONY: lint-frontend
lint-frontend: lint-js lint-css
lint-frontend: lint-js tsc lint-css
.PHONY: lint-frontend-fix
lint-frontend-fix: lint-js-fix lint-css-fix
@ -516,6 +516,10 @@ lint-disposable-emails-fix:
security-check:
$(GO) run $(GOVULNCHECK_PACKAGE) -show color ./...
.PHONY: tsc
tsc: node_modules
npx tsc --noEmit
###
# Development and testing targets
###

View file

@ -58,7 +58,14 @@ export default tseslint.config(
sourceType: 'module',
},
rules: {
'@typescript-eslint/no-unused-vars': 'off', // TODO: enable this rule again
'@typescript-eslint/no-unused-vars': [2, {
args: 'all',
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
ignoreRestSiblings: false,
}],
'@eslint-community/eslint-comments/disable-enable-pair': [2],
'@eslint-community/eslint-comments/no-aggregating-enable': [2],
@ -539,14 +546,7 @@ export default tseslint.config(
'no-unused-labels': [2],
'no-unused-private-class-members': [2],
'no-unused-vars': [2, {
args: 'all',
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
ignoreRestSiblings: false,
}],
'no-unused-vars': [0],
'no-use-before-define': [2, {
functions: false,

View file

@ -24,7 +24,7 @@ test('Relative time after htmx swap', async ({page}, workerInfo) => {
const body = page.locator('body');
await body.evaluate(
(element) =>
new Promise((resolve) =>
new Promise<void>((resolve) =>
element.addEventListener('htmx:afterSwap', () => {
resolve();
}),

View file

@ -1,7 +1,7 @@
import {expect, type Page, type Locator} from '@playwright/test';
// returns element that should be covered before taking the screenshot
async function masks(page: Page) : Array<Locator> {
async function masks(page: Page) : Promise<Locator[]> {
return [
page.locator('.ui.avatar'),
page.locator('.sha'),
@ -44,7 +44,7 @@ async function screenshot_prepare(page: Page) {
// attachment IDs in text areas, required for issue-comment-dropzone.
// playwright does not (yet?) support filtering for content in input elements, see https://github.com/microsoft/playwright/issues/36166
await page.locator('textarea.markdown-text-editor').evaluateAll((nodes) => {
await page.locator('textarea.markdown-text-editor').evaluateAll((nodes: HTMLTextAreaElement[]) => {
for (const node of nodes) node.value = node.value.replaceAll(/attachments\/[a-f0-9-]+/g, '/attachments/c1ee9740-dad3-4747-b489-f6fb2e3dfcec');
});

View file

@ -23,7 +23,7 @@ test('User: Profile settings', async ({browser}, workerInfo) => {
await pronounsInput.click();
const pronounsList = page.locator('datalist#pronouns');
const pronounsOptions = pronounsList.locator('option');
const pronounsValues = await pronounsOptions.evaluateAll((opts) => opts.map((opt) => opt.value));
const pronounsValues = await pronounsOptions.evaluateAll((opts) => opts.map((opt: HTMLOptionElement) => opt.value));
expect(pronounsValues).toEqual(['he/him', 'she/her', 'they/them', 'it/its', 'any pronouns']);
await pronounsInput.fill('she/her');

10
web_src/js/types.d.ts vendored Normal file
View file

@ -0,0 +1,10 @@
interface Window {
config?: {
appUrl: string;
}
}
declare module '*.vue' {
import Vue from 'vue';
export default Vue;
}