Skip to content

Commit

Permalink
Fix error message if name is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
remcohaszing committed Feb 1, 2024
1 parent 7d97da9 commit 71b2895
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/remark-mdx-frontmatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const remarkMdxFrontmatter: Plugin<[RemarkMdxFrontmatterOptions?], Root> = ({
parsers
} = {}) => {
if (!isIdentifierName(name)) {
throw new Error(`Name this should be a valid identifier, got: ${JSON.stringify(name)}`)
throw new Error(`Name should be a valid identifier, got: ${JSON.stringify(name)}`)
}

const allParsers: FrontmatterParsers = {
Expand Down
2 changes: 1 addition & 1 deletion src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ test('invalid name', () => {
remarkPlugins: [remarkFrontmatter, [remarkMdxFrontmatter, { name: 'Not valid' }]],
jsx: true
}),
'If name is specified, this should be a valid identifier name, got: "Not valid"'
/Name should be a valid identifier, got: "Not valid"/
)
})

0 comments on commit 71b2895

Please sign in to comment.