Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Useless/bad error message when forgetting to close an element #2451

Closed
4 tasks done
theRealProHacker opened this issue Mar 5, 2024 · 3 comments
Closed
4 tasks done
Labels
👀 no/external This makes more sense somewhere else

Comments

@theRealProHacker
Copy link

Initial checklist

Affected packages and versions

latest

Link to runnable example

https://mdxjs.com/playground/

Steps to reproduce

Linked issue in astro: withastro/astro#10318

This code

<A>
<B></B>

results in this error message:

1:1: Expected a closing tag for `</B>` (1:1-1:4)

Expected behavior

I would have expected an error that asks me to close the <A> tag/element.

Actual behavior

The error asks me to close the </B> tag, which is itself a closing tag

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

@theRealProHacker theRealProHacker changed the title Useless/bad error message when Useless/bad error message when forgetting to close an element Mar 5, 2024
@ChristianMurphy
Copy link
Member

Welcome @theRealProHacker! 👋
Sorry you ran into some confusion.

The error is not raised in this repo, it comes from https://github.com/syntax-tree/mdast-util-mdx-jsx/blob/bf60d93bdffde6e4d3359324170d438e5ee62a63/lib/index.js#L424-L471
Contributions to improve error reporting are welcome!

Feel free to reach out with questions on how to contribute.

@ChristianMurphy ChristianMurphy added the 👀 no/external This makes more sense somewhere else label Mar 5, 2024
@theRealProHacker
Copy link
Author

theRealProHacker commented Mar 12, 2024

@ChristianMurphy Hi, the issue got fixed in syntax-tree/mdast-util-mdx-jsx#12 and put in a new release (https://github.com/syntax-tree/mdast-util-mdx-jsx/releases/tag/3.1.1). I don't know where exactly, but maybe the dependency should be bumped up in the playground etc.

@ChristianMurphy
Copy link
Member

Thanks @theRealProHacker, it's already fixed in the playground and allowed by released version ranges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 no/external This makes more sense somewhere else
Development

No branches or pull requests

2 participants