Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSpell ESLint Plugin support Markdown #3464

Open
jerone opened this issue Aug 21, 2022 · 5 comments
Open

CSpell ESLint Plugin support Markdown #3464

jerone opened this issue Aug 21, 2022 · 5 comments

Comments

@jerone
Copy link

jerone commented Aug 21, 2022

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

@Jason3S
Copy link
Collaborator

Jason3S commented Aug 21, 2022

@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:

  1. To spell check just the JavaScript code blocks?
  2. To spell check the entire Markdown file?
  3. Something else.

Kind regards,
Jason

@jerone
Copy link
Author

jerone commented Aug 21, 2022

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.

@jerone
Copy link
Author

jerone commented Feb 4, 2024

This feature probably requires RFC-0003 Parsing files.

@Jason3S
Copy link
Collaborator

Jason3S commented Jun 13, 2024

@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.

@Jason3S Jason3S removed the new issue label Jun 13, 2024
@jerone
Copy link
Author

jerone commented Jun 18, 2024

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants