-
I am trying to configure 'eslint-plugin-mdx' in an Astro project to lint mdx files with YAML frontmatter. But don't get it working. My // @ts-check
import * as mdx from 'eslint-plugin-mdx'
/** @typedef { import("eslint").Linter.Config } FlatConfig */
/** @type {FlatConfig[]} */
export default [
{
...mdxPlugin.flatCodeBlocks,
files: ["src/**/*.{md,mdx}"],
processor: mdx.createRemarkProcessor({
lintCodeBlocks: true,
}),
},
]; When I execute
So I guess the frontmatter is parsed wrong. Any hints are greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
@sebthom have you enabled the frontmatter plugin in your remark config file? /cc @JounQin |
Beta Was this translation helpful? Give feedback.
-
A runnable reproduction is required to check. |
Beta Was this translation helpful? Give feedback.
-
Here is a reproducer: https://stackblitz.com/edit/withastro-astro-bpwbfw1j
But running
|
Beta Was this translation helpful? Give feedback.
mdx.flatCodeBlocks
is for virtual filenames like*/.mdx/0_x.js
, mostly you don't need to override it, see source codes here https://github.com/mdx-js/eslint-mdx/blob/d6fc093fb32ab58fb226e8cf42ac77399b8a4758/packages/eslint-plugin-mdx/src/configs/code-blocks.ts#L3-L34Please use according the document https://github.com/mdx-js/eslint-mdx#flat-config