-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Description
When the VS Code MDC extension is enabled, the VS Code ESLint extension does not show any diagnostics for Markdown files that are linted via ESLint v9 flat config with @eslint/markdown. Running ESLint via CLI reports the expected findings. Disabling MDC or switching the editor language mode back to “Markdown” restores diagnostics in the editor.
This looks like an integration conflict between the MDC extension and the VS Code ESLint extension for .md files.
Why I think this is MDC-related
- With MDC installed and active,
.mdbuffers in VS Code show no ESLint diagnostics. - Removing the MDC extension (or changing the language mode to “Markdown” in the status bar) makes diagnostics appear immediately.
- ESLint via CLI continues to report diagnostics regardless of MDC being installed, so the ESLint configuration itself is valid.
Given MDC’s features (syntax highlighting, formatting, document folding, component completions for MDC/Markdown), it may be changing the language id or otherwise taking ownership of .md buffers in a way that prevents the ESLint extension from validating the document.
Reference: the MDC extension provides syntax highlighting, folding, formatting, and suggestions for MDC/Markdown files as described in its README link.
Environment
- ESLint: 9.36.0
- @eslint/markdown: 7.4.0
- VS Code ESLint server runtime: Node 22.9 (from ESLint extension debug output)
- Node (CLI): 22.14.0
- OS: Linux 6.8.0-83-generic
- VS Code MDC: v0.4.2
- VS Code ESLint extension: latest at time of testing
- VS Code: latest stable at time of testing
Minimal Reproduction
- Flat config enabling Markdown language rules (excerpt):
// eslint.config.ts
import eslintPluginMarkdown from '@eslint/markdown';
export default [
{
files: ['**/*.md', '**/*.mdx'],
language: 'markdown/gfm',
plugins: { markdown: eslintPluginMarkdown },
rules: {
// e.g. 'markdown/no-html': 'error'
}
}
];- Install and enable both extensions:
- VS Code ESLint
- VS Code MDC
- Open a
.mdfile that violatesmarkdown/*rules.
- In VS Code: No ESLint diagnostics appear with MDC enabled.
- In CLI:
pnpm eslint README.mdshows the expected diagnostics.
- Workaround checks:
- Disable MDC → diagnostics appear in VS Code.
- Change the editor language mode (status bar) to “Markdown” → diagnostics appear.
- Optional: Add
"eslint.validate": ["mdc", "markdown", "mdx", "javascript", "typescript"]to VS Code settings sometimes restores diagnostics, which suggests the document’s language id may be set tomdcwhen the extension is enabled.
Minimal public repo (used to validate behavior): https://github.com/CyberT33N/markdown-test
Expected behavior
- With MDC enabled, the VS Code ESLint extension should still validate
.mddocuments and surfacemarkdown/*diagnostics in the editor, matching the CLI output.
Actual behavior
- With MDC enabled,
.mddocuments receive no ESLint diagnostics in the editor. - Disabling MDC or switching the language mode back to “Markdown” restores diagnostics.
Hypothesis / Possible cause
- The MDC extension may set the language id of
.mddocuments to a custom id (e.g.,mdc), or otherwise register a grammar/formatter that prevents the ESLint extension from probing/validating markdown buffers. - If the language id is changed, ESLint’s VS Code extension default probing for
markdownwon’t trigger unless users explicitly addmdctoeslint.validate.
Workarounds tried
- Adding
mdcto ESLint validation in VS Code settings:
{
"eslint.validate": ["mdc", "markdown", "mdx", "javascript", "typescript"]
}This can restore editor diagnostics but requires users to know about the mdc language id and adjust their workspace/user settings.
Questions for maintainers
- Does the MDC extension intentionally set a custom language id for
.mdfiles? - Would you consider:
- Not overriding the language id for
.md(using grammar injection intomarkdowninstead), or - Limiting the custom language id to
.mdcfiles only, or - Providing a setting to opt out of changing
.mdlanguage id, or - Documenting that users must add
"mdc"toeslint.validateso ESLint can validate those buffers?
- Not overriding the language id for
- Is there another recommended integration path with the ESLint extension so both can work together seamlessly for
.md?
Thanks a lot for the great extension and for taking a look!
Related: