Is MDX TypeScript and Eslint Linting possible?
Unanswered
Happy champ posted this in #help-forum
Hello, I'm using MDX but I'm not getting any linting in VSCode. Is TypeScript/Esint Linting possible with MDX?
6 Replies
good question
You can use this:
https://github.com/mdx-js/eslint-mdx
I normally don't recommend linting your mdx files, it's pain sometimes
https://github.com/mdx-js/eslint-mdx
I normally don't recommend linting your mdx files, it's pain sometimes
have you tried it? @Happy champ
Id say mdx files should be for content only, custom components should be defined in a separate tsx file and imported in mdx (so in mdx you only have imported components and markdown content)
It didn't work on my end. I'm probably doing something wrong. But i'm looking more for typescript support in mdx anyway.
Currently working on a project that requires a bit more complexity in mdx files that uses getStaticProps to fetch data and display graph components
https://info.poxa.io/report/20231009
Seems server components don't work in mdx atm either?
Currently working on a project that requires a bit more complexity in mdx files that uses getStaticProps to fetch data and display graph components
https://info.poxa.io/report/20231009
Seems server components don't work in mdx atm either?
typescript support in mdx anywayDo you mean auto-complete for component props in MDX files? I guess you can use the official vscode plugin maintained by mdx-js: https://github.com/mdx-js/mdx-analyzer
I haven't used it though, I'm not sure if it is what you're looking for.
Seems server components don't work in mdx atm either?Depends on how you render MDX content, for Contentlayer, it doesn't work for server components for now.
The built-in
next/mdx package supports RSC, you can read their guide to set up MDX for App Router.