CSpell ESLint Plugin support Markdown
It looks like the CSpell ESLint Plugin does not support Markdown files.
Via overrides it's possible to extend ESLint with different parsers. For example for Markdown files. It would be nice if CSpell ESLint Plugin would support that.
Example ESLint config file.
{
"root": true,
"overrides": [
{
"files": ["*.md"],
"parser": "eslint-plugin-markdownlint/parser",
"extends": [
"plugin:markdownlint/recommended",
"plugin:@cspell/recommended"
]
}
]
}
An plugin that supports a different parser is Prettier.
{
"root": true,
"overrides": [
{
"files": ["*.md"],
"parser": "eslint-plugin-markdownlint/parser",
"extends": [
"plugin:markdownlint/recommended",
"plugin:prettier/recommended"
],
"rules": {
"prettier/prettier": ["error", { "parser": "markdown" }]
}
}
]
}
CSpell ESLint Plugin version: v6.8.0 ESLint version: v8.22.0
@jerone,
Thank you for the request. What behavior are you expecting? My understanding of the eslint-plugin-markdownlint/parser plugin is that it only allows ESLint to check JavaScript code blocks.
Are you expecting:
- To spell check just the JavaScript code blocks?
- To spell check the entire Markdown file?
- Something else.
Kind regards, Jason
Hi @Jason3S. I would expect CSpell ESLint Plugin to spell-check the whole Markdown file.
eslint-plugin-markdownlint/parser does indeed only check JavaScript code blocks.
plugin:markdownlint runs on the whole Markdown file.
plugin:prettier with rule config { "parser": "markdown" } runs on the whole Markdown file.
This feature probably requires RFC-0003 Parsing files.
@jerone,
I took a look at this while try to add Yaml support #5741. I thought it would be easy, but it is far more involved than I originally thought. The eslint-plugin-markdown preprocessor filters out everything but supported code blocks. Which is not what you wanted.
Another issue is that ESLint doesn't even call the spell checker plug-in if there isn't a supported code block in the Markdown file.
eslint-plugin-markdown might maybe not the best reference.
eslint-plugin-markdownlint & eslint-plugin-prettier on the other hand do run whole files (with an optional custom parser option set).