make the pattern a string in all-versions so it can be serialized, and regex-ify it during implementation
This commit is contained in:
@@ -49,8 +49,8 @@ const plans = [
|
|||||||
hasNumberedReleases: false,
|
hasNumberedReleases: false,
|
||||||
openApiBaseName: 'github.ae',
|
openApiBaseName: 'github.ae',
|
||||||
miscBaseName: 'ghae',
|
miscBaseName: 'ghae',
|
||||||
allowedFrontmatterPattern: /^issue-\d+?(-and-\d+?)?|next$/,
|
allowedFrontmatterPattern: '^issue-\\d+?(-and-\\d+?)?|next$',
|
||||||
allowedInlinePattern: /^ghae-(issue-\d+?(-and-\d+?)?|next)$/,
|
allowedInlinePattern: '^ghae-(issue-\\d+?(-and-\\d+?)?|next)$',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -265,9 +265,7 @@ function getValidProps(versionObj) {
|
|||||||
|
|
||||||
// If a version has an exception pattern, both '*' and the exception pattern are valid.
|
// If a version has an exception pattern, both '*' and the exception pattern are valid.
|
||||||
if (versionObj.allowedFrontmatterPattern) {
|
if (versionObj.allowedFrontmatterPattern) {
|
||||||
valid.pattern = new RegExp(
|
valid.pattern = new RegExp(`${asteriskPattern.source}|${versionObj.allowedFrontmatterPattern}`)
|
||||||
`${asteriskPattern.source}|${versionObj.allowedFrontmatterPattern.source}`
|
|
||||||
)
|
|
||||||
valid.message = `Must have a value of '*' or ${versionObj.allowedFrontmatterPattern}`
|
valid.message = `Must have a value of '*' or ${versionObj.allowedFrontmatterPattern}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ describe('lint Liquid versioning', () => {
|
|||||||
function validateVersion(version) {
|
function validateVersion(version) {
|
||||||
const isSupported = allowedVersionNames.includes(version)
|
const isSupported = allowedVersionNames.includes(version)
|
||||||
const isException = Object.values(allVersions).some(
|
const isException = Object.values(allVersions).some(
|
||||||
(v) => v.allowedInlinePattern && v.allowedInlinePattern.test(version)
|
(v) => v.allowedInlinePattern && new RegExp(v.allowedInlinePattern).test(version)
|
||||||
)
|
)
|
||||||
const isValid = isSupported || isException
|
const isValid = isSupported || isException
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user