covariants
covariants copied to clipboard
Update MDX usage
We use mdx 1.6, the current version is 3. The migration seems to not be straightforward however, which is why we kept it at version 1.6 so far. Usage of mdx seems to have changed.
One can also implement linting for mdx files, which I could not get to work so far. Here is how far I got:
- Install eslint-plugin-mdx
- Adding the mdx config and file extension in
eslint.config.mjs:
import * as mdx from 'eslint-plugin-mdx'
...
importPlugin.flatConfigs.warnings,
importPlugin.flatConfigs.typescript,
jsxA11Y.flatConfigs.recommended,
mdx.flat,
...
parserOptions: {
ecmaFeatures: {
jsx: true,
},
project: ['./tsconfig.eslint.json'],
warnOnUnsupportedTypeScriptVersion: true,
extraFileExtensions: ['.md', '.mdx'],
},
- Adding file extensions to
tsconfig.eslint.json:
"include": ["**/*.ts", "**/*.js", "**/*.tsx", "**/*.jsx", "**/*.mjs", "**/*.md", "**/*.mdx"]
=> eslint runs put results in parsing errors for .md and .mdx files.
Additionally, all our "mdx" files actually have a .md file extension, which we should probably change.
It seems one also needs to import and add the mdx parser
import * as mdx from eslint-mdx
languageOptions:
parser: mdx.parser
but this leads to more error mesages
I did get mdx to work, just the linting remains.