Skip to content

Commit 8c8eb4b

Browse files
authored
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
1 parent 69e595c commit 8c8eb4b

File tree

7 files changed

+15
-67
lines changed

7 files changed

+15
-67
lines changed

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
"@types/dropzone": "5.7.9",
7676
"@types/jquery": "3.5.33",
7777
"@types/katex": "0.16.7",
78-
"@types/license-checker-webpack-plugin": "0.2.5",
7978
"@types/pdfobject": "2.2.5",
8079
"@types/sortablejs": "1.15.8",
8180
"@types/swagger-ui-dist": "3.30.6",
@@ -111,7 +110,6 @@
111110
"stylelint-declaration-strict-value": "1.10.11",
112111
"stylelint-value-no-unknown-custom-properties": "6.0.1",
113112
"svgo": "4.0.0",
114-
"type-fest": "4.41.0",
115113
"typescript-eslint": "8.43.0",
116114
"updates": "16.7.0",
117115
"vite-string-plugin": "1.4.6",

pnpm-lock.yaml

Lines changed: 0 additions & 57 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

updates.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type {Config} from 'updates';
33
export default {
44
exclude: [
55
'@mcaptcha/vanilla-glue', // breaking changes in rc versions need to be handled
6-
'@stylistic/eslint-plugin-js', // need to migrate to eslint 9
76
'cropperjs', // need to migrate to v2 but v2 is not compatible with v1
87
'tailwindcss', // need to migrate
98
],

web_src/js/components/RepoContributors.vue

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {chartJsColors} from '../utils/color.ts';
2727
import {sleep} from '../utils.ts';
2828
import 'chartjs-adapter-dayjs-4/dist/chartjs-adapter-dayjs-4.esm';
2929
import {fomanticQuery} from '../modules/fomantic/base.ts';
30-
import type {Entries} from 'type-fest';
3130
import {pathEscapeSegments} from '../utils/url.ts';
3231
3332
const customEventListener: Plugin = {
@@ -57,6 +56,13 @@ Chart.register(
5756
customEventListener,
5857
);
5958
59+
type ContributorsData = {
60+
total: {
61+
weeks: Record<string, any>,
62+
},
63+
[other: string]: Record<string, Record<string, any>>,
64+
}
65+
6066
export default defineComponent({
6167
components: {ChartLine, SvgIcon},
6268
props: {
@@ -127,20 +133,20 @@ export default defineComponent({
127133
}
128134
} while (response.status === 202);
129135
if (response.ok) {
130-
const data = await response.json();
131-
const {total, ...rest} = data;
136+
const data = await response.json() as ContributorsData;
137+
const {total, ...other} = data;
132138
// below line might be deleted if we are sure go produces map always sorted by keys
133139
total.weeks = Object.fromEntries(Object.entries(total.weeks).sort());
134140
135-
const weekValues = Object.values(total.weeks) as any;
141+
const weekValues = Object.values(total.weeks);
136142
this.xAxisStart = weekValues[0].week;
137143
this.xAxisEnd = firstStartDateAfterDate(new Date());
138144
const startDays = startDaysBetween(this.xAxisStart, this.xAxisEnd);
139145
total.weeks = fillEmptyStartDaysWithZeroes(startDays, total.weeks);
140146
this.xAxisMin = this.xAxisStart;
141147
this.xAxisMax = this.xAxisEnd;
142148
this.contributorsStats = {};
143-
for (const [email, user] of Object.entries(rest) as Entries<Record<string, Record<string, any>>>) {
149+
for (const [email, user] of Object.entries(other)) {
144150
user.weeks = fillEmptyStartDaysWithZeroes(startDays, user.weeks);
145151
this.contributorsStats[email] = user;
146152
}

web_src/js/modules/observer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {isDocumentFragmentOrElementNode} from '../utils/dom.ts';
2-
import type {Promisable} from 'type-fest';
2+
import type {Promisable} from '../types.ts';
33
import type {InitPerformanceTracer} from './init.ts';
44

55
let globalSelectorObserverInited = false;

web_src/js/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,5 @@ export type FomanticInitFunction = {
6868
};
6969

7070
export type GitRefType = 'branch' | 'tag';
71+
72+
export type Promisable<T> = T | Promise<T>; // stricter than type-fest which uses PromiseLike

web_src/js/utils/dom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {debounce} from 'throttle-debounce';
2-
import type {Promisable} from 'type-fest';
2+
import type {Promisable} from '../types.ts';
33
import type $ from 'jquery';
44
import {isInFrontendUnitTest} from './testhelper.ts';
55

0 commit comments

Comments
 (0)