gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.27k stars 10.31k forks source link

[gatsby-plugin-mdx] Formatting of JavaScript is weird, tokenization broken? #20542

Closed muuvmuuv closed 4 years ago

muuvmuuv commented 4 years ago

Description

In all of my MDX files I'm using react-helment-async to update a body attribute but somehow it is formatted a little weird, I guess my formatter prettier things it is Markdown(?).

Steps to reproduce

MDX witht he following content.

Expected result

import { Helmet } from 'react-helmet-async'
import SEO from '../components/SEO'

<SEO title="About" />
<Helmet bodyAttributes={{ page: "About" }} />

# About

Actual result

import { Helmet } from 'react-helmet-async'
import SEO from '../components/SEO'

<SEO title="About" />
<Helmet
bodyAttributes={{
page:
"About"
}}
/>

# About

Environment

System: OS: macOS 10.15.2 CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.13.1 - ~/.nvm/versions/node/v12.13.1/bin/node Yarn: 1.21.1 - /usr/local/bin/yarn npm: 6.13.3 - ~/.nvm/versions/node/v12.13.1/bin/npm Languages: Python: 2.7.16 - /usr/bin/python Browsers: Firefox: 70.0.1 Safari: 13.0.4 npmPackages: gatsby: ^2.18.21 => 2.18.21 gatsby-image: ^2.2.38 => 2.2.38 gatsby-plugin-breadcrumb: ^6.3.0 => 6.3.0 gatsby-plugin-canonical-urls: ^2.1.19 => 2.1.19 gatsby-plugin-catch-links: ^2.1.24 => 2.1.24 gatsby-plugin-humans-txt: ^1.1.4 => 1.1.4 gatsby-plugin-layout: ^1.1.21 => 1.1.21 gatsby-plugin-manifest: ^2.2.37 => 2.2.37 gatsby-plugin-mdx: ^1.0.67 => 1.0.67 gatsby-plugin-module-resolver: ^1.0.3 => 1.0.3 gatsby-plugin-postcss: ^2.1.19 => 2.1.19 gatsby-plugin-preact: ^3.1.25 => 3.1.25 gatsby-plugin-purgecss: ^4.0.1 => 4.0.1 gatsby-plugin-react-helmet: ^3.1.21 => 3.1.21 gatsby-plugin-remove-generator: ^1.0.4 => 1.0.4 gatsby-plugin-remove-trailing-slashes: ^2.1.20 => 2.1.20 gatsby-plugin-robots-txt: ^1.5.0 => 1.5.0 gatsby-plugin-sass: ^2.1.27 => 2.1.27 gatsby-plugin-sharp: ^2.3.13 => 2.3.13 gatsby-plugin-sitemap: ^2.2.25 => 2.2.25 gatsby-plugin-webpack-bundle-analyzer: ^1.0.5 => 1.0.5 gatsby-remark-check-links: ^2.1.0 => 2.1.0 gatsby-remark-emoji: 0.0.3 => 0.0.3 gatsby-remark-external-links: 0.0.4 => 0.0.4 gatsby-remark-images: ^3.1.42 => 3.1.42 gatsby-remark-prismjs: ^3.3.30 => 3.3.30 gatsby-source-filesystem: ^2.1.46 => 2.1.46 gatsby-transformer-json: ^2.2.25 => 2.2.25 gatsby-transformer-remark: ^2.6.48 => 2.6.48 gatsby-transformer-sharp: ^2.3.12 => 2.3.12 npmGlobalPackages: gatsby-cli: 2.8.18

LekoArts commented 4 years ago

Thank you for opening this!

This is not an issue with Gatsby or gatsby-plugin-mdx but prettier. Please open an issue on their repository. Thanks!

We're marking this issue as answered and closing it for now but please feel free to comment here if you would like to continue this discussion. We also recommend heading over to our communities if you have questions that are not bug reports or feature requests. We hope we managed to help and thank you for using Gatsby!