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

mdx/no-unescaped-entities usage issue #217

Closed
JounQin opened this issue Jul 11, 2020 · 3 comments · Fixed by #218
Closed

mdx/no-unescaped-entities usage issue #217

JounQin opened this issue Jul 11, 2020 · 3 comments · Fixed by #218
Labels
💪 phase/solved Post is done 🐛 type/bug This is a problem

Comments

@JounQin
Copy link
Member

JounQin commented Jul 11, 2020

// not work
<div style={{ color: 'white', backgroundColor: 'black', padding: '24px 32px' }}>

<a
  style={{
    color: 'white',
    textDecoration: 'none',
    fontWeight: 'bold',
    fontSize: 32
  }}
  href="https://blacklivesmatters.carrd.co/"
>
  #BlackLivesMatter &rarr;
</a>

</div>

// work
<div style={{ color: 'white', backgroundColor: 'black', padding: '24px 32px' }}>
<a
  style={{
    color: 'white',
    textDecoration: 'none',
    fontWeight: 'bold',
    fontSize: 32
  }}
  href="https://blacklivesmatters.carrd.co/"
>
  #BlackLivesMatter &rarr;
</a>
</div>
@JounQin
Copy link
Member Author

JounQin commented Jul 11, 2020

Because there is no empty line in AST, so after combined into single jsx node, the jsx code actually used by ESLint parser is like following:

<div style={{ color: 'white', backgroundColor: 'black', padding: '24px 32px' }}><a
  style={{
    color: 'white',
    textDecoration: 'none',
    fontWeight: 'bold',
    fontSize: 32
  }}
  href="https://blacklivesmatters.carrd.co/"
>
  #BlackLivesMatter &rarr;
</a></div>

What makes the ESLint AST different with the actual code.

cc @wooorm

@JounQin JounQin added 🌊 blocked/upstream This cannot progress before something external happens first 🙆 yes/confirmed This is confirmed and ready to be worked on and removed 🙉 open/needs-info This needs some more info labels Jul 11, 2020
@wooorm
Copy link
Member

wooorm commented Jul 11, 2020

Yeah, MDX@1 doesn’t like blank lines. That’s the issue, right?. This is something MDX@2 will do very differently, and I believe much better, though?

@JounQin
Copy link
Member Author

JounQin commented Jul 11, 2020

I found a way to skip using node.value instead.

https://github.com/mdx-js/eslint-mdx/pull/218/files#diff-d1b4b2537d369552aca7acbfd12a8d70R29

@JounQin JounQin removed the 🌊 blocked/upstream This cannot progress before something external happens first label Jul 12, 2020
@wooorm wooorm added ⛵️ status/released and removed 🙆 yes/confirmed This is confirmed and ready to be worked on labels Jul 23, 2020
@wooorm wooorm added the 💪 phase/solved Post is done label Dec 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 phase/solved Post is done 🐛 type/bug This is a problem
Development

Successfully merging a pull request may close this issue.

2 participants