Skip to content

Commit ef17f8a

Browse files
committed
Fix mcdoc version filters for 26.1
1 parent 1f8be81 commit ef17f8a

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

src/app/services/Spyglass.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -420,20 +420,12 @@ const initialize: core.ProjectInitializer = async (ctx) => {
420420
// Duplicate these from spyglass for now, until they are exported separately
421421
function registerAttributes(meta: core.MetaRegistry, release: ReleaseVersion, versions: VersionMeta[]) {
422422
mcdoc.runtime.registerAttribute(meta, 'since', mcdoc.runtime.attribute.validator.string, {
423-
filterElement: (config, ctx) => {
424-
if (!config.startsWith('1.')) {
425-
ctx.logger.warn(`Invalid mcdoc attribute for "since": ${config}`)
426-
return true
427-
}
423+
filterElement: (config, _) => {
428424
return ReleaseVersion.cmp(release, config as ReleaseVersion) >= 0
429425
},
430426
})
431427
mcdoc.runtime.registerAttribute(meta, 'until', mcdoc.runtime.attribute.validator.string, {
432-
filterElement: (config, ctx) => {
433-
if (!config.startsWith('1.')) {
434-
ctx.logger.warn(`Invalid mcdoc attribute for "until": ${config}`)
435-
return true
436-
}
428+
filterElement: (config, _) => {
437429
return ReleaseVersion.cmp(release, config as ReleaseVersion) < 0
438430
},
439431
})
@@ -442,14 +434,10 @@ function registerAttributes(meta: core.MetaRegistry, release: ReleaseVersion, ve
442434
'deprecated',
443435
mcdoc.runtime.attribute.validator.optional(mcdoc.runtime.attribute.validator.string),
444436
{
445-
mapField: (config, field, ctx) => {
437+
mapField: (config, field, _) => {
446438
if (config === undefined) {
447439
return { ...field, deprecated: true }
448440
}
449-
if (!config.startsWith('1.')) {
450-
ctx.logger.warn(`Invalid mcdoc attribute for "deprecated": ${config}`)
451-
return field
452-
}
453441
if (ReleaseVersion.cmp(release, config as ReleaseVersion) >= 0) {
454442
return { ...field, deprecated: true }
455443
}

0 commit comments

Comments
 (0)