mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 10:56:10 +01: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:
		| @@ -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; | ||||
|           } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user