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

Parsing error: Unexpected token, expected "}" #334

Closed
chenxsan opened this issue Aug 15, 2021 · 3 comments · Fixed by #335
Closed

Parsing error: Unexpected token, expected "}" #334

chenxsan opened this issue Aug 15, 2021 · 3 comments · Fixed by #335
Labels
🐛 type/bug This is a problem 🙆 yes/confirmed This is confirmed and ready to be worked on

Comments

@chenxsan
Copy link
Contributor

chenxsan commented Aug 15, 2021

Subject of the issue

Here's the content of a mdx file:

<div>
  <img />
</div>

```js
module.exports = {
  plugins: [],
};
```

And eslint would report an error shown below:

error

Now if I prepend a paragraph, e.g.,

hello world.

<div>
  <img />
</div>

```js
module.exports = {
  plugins: [],
};
```

Now the error would be fixed.

Your environment

  • OS:
  • Packages:
  • Env:

Steps to reproduce

  1. clone code from https://github.com/webpack/webpack.js.org/pull/5298
  2. add a src/content/mdx.mdx file with below content:
<div>
  <img />
</div>

```js
module.exports = {
  plugins: [],
};
```
  1. run npx eslint src/content/mdx.mdx

Expected behaviour

No error.

Actual behaviour

An error shown.

@chenxsan chenxsan added 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Aug 15, 2021
@JounQin JounQin added 🙆 yes/confirmed This is confirmed and ready to be worked on and removed 🙉 open/needs-info This needs some more info labels Aug 15, 2021
@JounQin
Copy link
Member

JounQin commented Aug 15, 2021

Thank you, I can reproduce it locally.

Workaround temporarily:

<div>

<img />

</div>

@JounQin
Copy link
Member

JounQin commented Aug 15, 2021

@chenxsan Please try

yarn add -D https://pkg.csb.dev/mdx-js/eslint-mdx/commit/a2199654/eslint-plugin-mdx

@chenxsan
Copy link
Contributor Author

@JounQin Works fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 type/bug This is a problem 🙆 yes/confirmed This is confirmed and ready to be worked on
Development

Successfully merging a pull request may close this issue.

2 participants