diff --git a/apps/frontend/src/pages/[type]/[id]/settings/index.vue b/apps/frontend/src/pages/[type]/[id]/settings/index.vue
index a3d60aa0e..f2e1d58a0 100644
--- a/apps/frontend/src/pages/[type]/[id]/settings/index.vue
+++ b/apps/frontend/src/pages/[type]/[id]/settings/index.vue
@@ -255,8 +255,8 @@ import {
} from "@modrinth/assets";
import { Multiselect } from "vue-multiselect";
import { ConfirmModal, Avatar } from "@modrinth/ui";
-import FileInput from "~/components/ui/FileInput.vue";
import { MIN_SUMMARY_CHARS } from "@modrinth/moderation";
+import FileInput from "~/components/ui/FileInput.vue";
const props = defineProps({
project: {
diff --git a/apps/frontend/src/pages/[type]/[id]/settings/links.vue b/apps/frontend/src/pages/[type]/[id]/settings/links.vue
index 1eb5ef3d3..20eafc0c9 100644
--- a/apps/frontend/src/pages/[type]/[id]/settings/links.vue
+++ b/apps/frontend/src/pages/[type]/[id]/settings/links.vue
@@ -14,8 +14,8 @@
{
- if (issuesUrl.value?.trim().length ?? 0 === 0) return true;
+ if (!issuesUrl.value || issuesUrl.value.trim().length === 0) return true;
return isCommonUrl(issuesUrl.value, commonLinkDomains.issues);
});
const isSourceUrlCommon = computed(() => {
- if (sourceUrl.value?.trim().length ?? 0 === 0) return true;
+ if (!sourceUrl.value || sourceUrl.value.trim().length === 0) return true;
return isCommonUrl(sourceUrl.value, commonLinkDomains.source);
});
const isDiscordUrlCommon = computed(() => {
- if (discordUrl.value?.trim().length ?? 0 === 0) return true;
+ if (!discordUrl.value || discordUrl.value.trim().length === 0) return true;
return isCommonUrl(discordUrl.value, commonLinkDomains.discord);
});
diff --git a/packages/moderation/data/nags/description.ts b/packages/moderation/data/nags/description.ts
index a3409738e..fb9b95b02 100644
--- a/packages/moderation/data/nags/description.ts
+++ b/packages/moderation/data/nags/description.ts
@@ -122,7 +122,7 @@ export const descriptionNags: Nag[] = [
{
id: 'minecraft-title-clause',
title: 'Title contains "Minecraft"',
- description: (context: NagContext) =>
+ description: () =>
`Please remove "Minecraft" from your title. You cannot use "Minecraft" in your title for legal reasons.`,
status: 'required',
shouldShow: (context: NagContext) => {
@@ -138,7 +138,7 @@ export const descriptionNags: Nag[] = [
{
id: 'title-contains-technical-info',
title: 'Title contains loader or version info',
- description: (context: NagContext) => {
+ description: () => {
return `Removing these helps keep titles clean and makes your project easier to find. Version and loader information is automatically displayed alongside your project.`
},
status: 'warning',
@@ -147,7 +147,7 @@ export const descriptionNags: Nag[] = [
if (!title) return false
const loaderNames =
- context.tags.loaders?.map((loader: any) => loader.name?.toLowerCase()) || []
+ context.tags.loaders?.map((loader: { name: string }) => loader.name?.toLowerCase()) || []
const hasLoader = loaderNames.some((loader) => loader && title.includes(loader.toLowerCase()))
const versionPatterns = [/\b1\.\d+(\.\d+)?\b/]
const hasVersionPattern = versionPatterns.some((pattern) => pattern.test(title))
@@ -163,7 +163,7 @@ export const descriptionNags: Nag[] = [
{
id: 'summary-same-as-title',
title: 'Summary is project name',
- description: (context: NagContext) =>
+ description: () =>
`Your summary is the same as your project name. Please change it. It's recommended to have a unique summary to provide more context about your project.`,
status: 'required',
shouldShow: (context: NagContext) => {
diff --git a/packages/moderation/data/nags/tags.ts b/packages/moderation/data/nags/tags.ts
index 015d25362..bc5db7354 100644
--- a/packages/moderation/data/nags/tags.ts
+++ b/packages/moderation/data/nags/tags.ts
@@ -1,9 +1,17 @@
+import type { Project } from '@modrinth/utils'
import type { Nag, NagContext } from '../../types/nags'
-function getCategories(project: any, tags: any) {
+function getCategories(
+ project: Project & { actualProjectType: string },
+ tags: {
+ categories?: {
+ project_type: string
+ }[]
+ },
+) {
return (
tags.categories?.filter(
- (category: any) => category.project_type === project.actualProjectType,
+ (category: { project_type: string }) => category.project_type === project.actualProjectType,
) ?? []
)
}
@@ -57,14 +65,20 @@ export const tagsNags: Nag[] = [
id: 'all-tags-selected',
title: 'All tags selected',
description: (context: NagContext) => {
- const categoriesForProjectType = getCategories(context.project, context.tags)
+ const categoriesForProjectType = getCategories(
+ context.project as Project & { actualProjectType: string },
+ context.tags,
+ )
console.log('categoriesForProjectType', categoriesForProjectType)
const totalAvailableTags = categoriesForProjectType.length
return `You've selected all ${totalAvailableTags} available tags. This defeats the purpose of tags, which are meant to help users find relevant projects. Please select only the tags that truly apply to your project.`
},
status: 'required',
shouldShow: (context: NagContext) => {
- const categoriesForProjectType = getCategories(context.project, context.tags)
+ const categoriesForProjectType = getCategories(
+ context.project as Project & { actualProjectType: string },
+ context.tags,
+ )
const totalSelectedTags =
context.project.categories.length + (context.project.additional_categories?.length || 0)
return totalSelectedTags === categoriesForProjectType.length
diff --git a/packages/moderation/types/nags.ts b/packages/moderation/types/nags.ts
index 9b00a0efe..19c5d9cd8 100644
--- a/packages/moderation/types/nags.ts
+++ b/packages/moderation/types/nags.ts
@@ -32,8 +32,10 @@ export interface NagContext {
* The current route in the application.
*/
currentRoute: string
+ /* eslint-disable @typescript-eslint/no-explicit-any */
tags: any
submitProject: (...any: any) => any
+ /* eslint-enable @typescript-eslint/no-explicit-any */
}
/**