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

[feat] support linting markdown syntaxes like eslint-plugin-mdx via remark-lint #179

Closed
JounQin opened this issue Mar 13, 2021 · 19 comments
Closed
Labels
Projects

Comments

@btmills
Copy link
Member

btmills commented Mar 18, 2021

Can you describe the problem that you're trying to solve in detail?

@JounQin
Copy link
Contributor Author

JounQin commented Mar 18, 2021

eslint-plugin-markdown now only lints code blocks, markdown content can be linted too by integrating with remark-lint in a single tool ESLint.

@btmills
Copy link
Member

btmills commented Mar 18, 2021

So right now you have two tools, ESLint that lints JS and ```js code blocks inside Markdown files and remark-lint that lints all the Markdown content around the code blocks. You want to have a single tool so that running eslint . would report results from both ESLint and remark-lint rules. Is that correct? If so, doesn't eslint-plugin-mdx's remark rule already do that?

@btmills btmills added this to Needs Triage in Triage via automation Mar 18, 2021
@btmills btmills moved this from Needs Triage to Triaging in Triage Mar 18, 2021
@JounQin
Copy link
Contributor Author

JounQin commented Mar 18, 2021

If so, doesn't eslint-plugin-mdx's remark rule already do that?

Yes, it does. But as @wooorm suggested at mdx-js/eslint-mdx#283 (comment), he thinks linting markdown content should belong eslint-plugin-markdown, which sounds reasonable to me. If you add remark-lint support here, I can remove it from eslint-plugin-mdx then.

@JounQin
Copy link
Contributor Author

JounQin commented Mar 18, 2021

Here is a related plugin wants this function too.
https://github.com/leo-buneev/eslint-plugin-md

@JounQin
Copy link
Contributor Author

JounQin commented Apr 22, 2021

@btmills Any idea?

@Airkro
Copy link

Airkro commented Apr 27, 2021

Just in my own preference is, keep the status quo.

Use eslint-plugin-markdown for js code block in markdown.

I prefer using remark-lint directly. Or Create a new plugin like eslint-plugin-remark.

@JounQin
Copy link
Contributor Author

JounQin commented Apr 27, 2021

@Airkro

ESLint is much beyond for js syntaxes, it'll be the universal linter for all languages.

eslint/rfcs#56

And this feature can be optional.

eslint-plugin-markdown is all for markdown, it should include markdown syntaxes linting IMO.

@JounQin
Copy link
Contributor Author

JounQin commented Apr 27, 2021

I was thinking about eslint-plugin-remark too, but eslint-plugin-mdx has already supported it actually, and integration here is preferred.

I just want to migrate it from mdx to markdown instead.

@Airkro
Copy link

Airkro commented Apr 27, 2021

It's an "easy way or right way" problem.

What if some people don't want to use remark-lint in eslint?
What if someone prefers markdownlint to remark-lint?

@JounQin
Copy link
Contributor Author

JounQin commented Apr 27, 2021

@Airkro

And this feature can be optional.

And this package is using remark inside already.

@Airkro
Copy link

Airkro commented Apr 27, 2021

@JounQin

It's not about package size, some people just don't like remark rules, or maybe they have some special rule/plugin that requires a different remark version.

@Airkro
Copy link

Airkro commented Apr 27, 2021

My selfish opinion is "one plugin do one thing" might solve these problem. for reference only.

@Airkro
Copy link

Airkro commented Apr 27, 2021

Because remark is really powerful, many people have special rules/plugins.

A standalone eslint-plugin-remark might be better.

@JounQin
Copy link
Contributor Author

JounQin commented Apr 27, 2021

It's not about package size, some people just don't like remark rules

I'm not talking about it too. And I've said several times that And this feature can be optional.

Just a new option/setting or just a new rule is needed to specific whether to enable remark-lint in eslint-plugin-markdown. And it can be disabled by default.

My selfish opinion is "one plugin do one thing" might solve these problem. for reference only.

That's OK, but IMO markdown syntaxes is the thing for eslint-plugin-markdown considering the generic ASTs in ESLint's future.

@btmills
Copy link
Member

btmills commented Apr 30, 2021

Thanks for the discussion above. This plugin has always focused on linting code in fenced code blocks. The back story is that I built it to exercise ESLint's processor API. Going beyond that to lint portions other than fenced code blocks would be a significant expansion of scope. That's a wonderful opportunity for other plugins to offer users the choice of exactly how they want to lint their Markdown files. This plugin doesn't need to be a single all-encompassing solution for Markdown linting.

@btmills btmills closed this as completed Apr 30, 2021
Triage automation moved this from Triaging to Complete Apr 30, 2021
@JounQin
Copy link
Contributor Author

JounQin commented Apr 30, 2021

That's OK.

@GitMurf
Copy link

GitMurf commented Jun 20, 2023

Is it now 2 years later and is there still not a great option for eslint markdown plugin other than the mdx plugin (which has some issues)? It is a bummer that the plugin named eslint-plugin-markdown (which I thought was exactly what I wanted haha) doesn't actually lint markdown syntax and just lints JS codeblocks within a markdown file (if I am understanding it correctly)? We all know naming things is the hardest part of coding ;-) but I agree with @JounQin that it would be very nice if this plugin linted markdown as well. And if not, I wonder if the plugin could change names to something like eslint-plugin-md-code or something like that? I was very confused for a while when trying to get eslint-plugin-markdown to work when I finally realized it only lints fenced code blocks. If anyone has any good advice or recommendations for a good eslint markdown setup (integrated with Prettier so rules don't overlap), would be greatly appreciated.

@JounQin
Copy link
Contributor Author

JounQin commented Dec 3, 2023

is there still not a great option for eslint markdown plugin other than the mdx plugin (which has some issues)?

@GitMurf If you have any issue, you should post a new issue with reproduction instead of talking about it outside so that as the plugin author, me, doesn't know it at all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Triage
Complete
Development

No branches or pull requests

4 participants