fix: lint issues
This commit is contained in:
1 parent
debcb57f47
commit
2f1627c000
5 files changed
+31
-15
No files matched your search
@@ -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) => {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user