Closed salazarr-js closed 3 weeks ago
This is indeed out of scope for eslint-plugin-vue. That the Vue parser chokes on Markdown files is expected.
However, you can indeed use @eslint/markdown
's processor
config, which creates virtual .js
or .ts
files for code blocks in Markdown files, which in turn can then be linted by eslint-plugin-vue.
@FloEdelmann thanks for your response, I understand that we can use the @eslint/markdown's processor
to lint code blocks from .md
files, but what about the script
tag with vue logic like
# Vue script in `.md` files aren't linted
some markdown content
<LintedComponent />
```ts
console.warn(`code blocks can be linted`)
~But that is not md
but mdx
, right?~ Nevermind, it isn't.
I've never heard about this use case. Is it supported/endorsed specifically by Vitepress, or do you know of other frameworks that allow/execute/transform <script>
tags in Markdown files?
Vitepress brings the ability to use Vue component logic in .md
files out of the box, vuepress
did this before, and I found that SveltKit
provides this feature too but through a preprocessor. For a moment I thought astro
did the same, but I realized they use the .astro
file extension
Vitepress - Using Vue in Markdown Vuepress - Using Vue in Markdown MDsveX - Markdown preprocessor for Svelte
⁉️ Not sure if you mean only vue frameworks or frameworks in general
@ota-meshi Do you think this is worth supporting?
I am not sure if it's worth mentioning that vuejs/language-tools
support .md
files.
It would be great to have both IntelliSense and linting support for vitepress
and vuepress
projects
I think it would be interesting for the ESLint plugin to support VitePress markdown, but I think that would need to be a separate plugin from this plugin.
Okay, I'll close this as won't fix then. But feel free to share any additional information as comments :slightly_smiling_face:
Not sure if this is in the scope of
eslint-plugin-vue
or is more a responsibility ofvitepress
itself, but there is no mention on the docs of how to lint.md
files when you are usingvitepress
Checklist
Tell us about your environment
^9.12.0
^9.28.0
^3.5.11
^1.4.0
v20.17.0
Microsoft Windows 11 Pro Version 10.0.22631 Build 22631
Please show your full configuration:
What did you do?
I use the custom parser config example, but the plugin ignores all the
.md
files, if I add the.md
globs to the files config, the lint script throws anerror Parsing error: Invalid character
type of errorNot sure if I could use and set a custom parser from
@eslint/markdown
ormarked
for this use case. All the.ts
and.vue
files are correctly lintedWhat did you expect to happen?
The
eslint-plugin-vue
should be able to lint the vue components in.md
filesWhat actually happened?
Repository to reproduce this issue
https://github.com/salazarr-js/vitepress-eslint