1
1
mirror of https://github.com/go-gitea/gitea synced 2025-09-15 21:28:15 +00:00

Clean up npm dependencies (#35484)

- `type-fest` is replaced by our own types
- `@stylistic/eslint-plugin-js` is no longer in use, it was replaced
with `@stylistic/eslint-plugin`
- `@types/license-checker-webpack-plugin` does not apply to our forked
version and has a type stub
This commit is contained in:
silverwind
2025-09-15 16:34:54 +02:00
committed by GitHub
parent 69e595cdd8
commit 8c8eb4b6f9
7 changed files with 15 additions and 67 deletions

View File

@@ -27,7 +27,6 @@ import {chartJsColors} from '../utils/color.ts';
import {sleep} from '../utils.ts';
import 'chartjs-adapter-dayjs-4/dist/chartjs-adapter-dayjs-4.esm';
import {fomanticQuery} from '../modules/fomantic/base.ts';
import type {Entries} from 'type-fest';
import {pathEscapeSegments} from '../utils/url.ts';
const customEventListener: Plugin = {
@@ -57,6 +56,13 @@ Chart.register(
customEventListener,
);
type ContributorsData = {
total: {
weeks: Record<string, any>,
},
[other: string]: Record<string, Record<string, any>>,
}
export default defineComponent({
components: {ChartLine, SvgIcon},
props: {
@@ -127,12 +133,12 @@ export default defineComponent({
}
} while (response.status === 202);
if (response.ok) {
const data = await response.json();
const {total, ...rest} = data;
const data = await response.json() as ContributorsData;
const {total, ...other} = data;
// below line might be deleted if we are sure go produces map always sorted by keys
total.weeks = Object.fromEntries(Object.entries(total.weeks).sort());
const weekValues = Object.values(total.weeks) as any;
const weekValues = Object.values(total.weeks);
this.xAxisStart = weekValues[0].week;
this.xAxisEnd = firstStartDateAfterDate(new Date());
const startDays = startDaysBetween(this.xAxisStart, this.xAxisEnd);
@@ -140,7 +146,7 @@ export default defineComponent({
this.xAxisMin = this.xAxisStart;
this.xAxisMax = this.xAxisEnd;
this.contributorsStats = {};
for (const [email, user] of Object.entries(rest) as Entries<Record<string, Record<string, any>>>) {
for (const [email, user] of Object.entries(other)) {
user.weeks = fillEmptyStartDaysWithZeroes(startDays, user.weeks);
this.contributorsStats[email] = user;
}

View File

@@ -1,5 +1,5 @@
import {isDocumentFragmentOrElementNode} from '../utils/dom.ts';
import type {Promisable} from 'type-fest';
import type {Promisable} from '../types.ts';
import type {InitPerformanceTracer} from './init.ts';
let globalSelectorObserverInited = false;

View File

@@ -68,3 +68,5 @@ export type FomanticInitFunction = {
};
export type GitRefType = 'branch' | 'tag';
export type Promisable<T> = T | Promise<T>; // stricter than type-fest which uses PromiseLike

View File

@@ -1,5 +1,5 @@
import {debounce} from 'throttle-debounce';
import type {Promisable} from 'type-fest';
import type {Promisable} from '../types.ts';
import type $ from 'jquery';
import {isInFrontendUnitTest} from './testhelper.ts';