mdx-js / eslint-mdx

ESLint Parser/Plugin for MDX
https://npmjs.org/eslint-plugin-mdx
MIT License
263 stars 32 forks source link

Please document how to make the linter fixable #467

Open Zemnmez opened 1 year ago

Zemnmez commented 1 year ago

Initial checklist

Problem

The current readme.md says this:

possible fixable depends on your remark plugins:

But it doesn't elaborate on what needs to be done to make the lint fixable. For example, currently, applying this plugin for me removed all my markdown line-wraps.

I've made the line length an error, but it doesn't appear to expose a fixer. The remark lint documentation describes some steps to achieve this, but they involve instrumenting remark-cli, something the eslint-mdx docs do not cover.

Thanks!

Solution

Markdown files should be automatically fixed.

Alternatives

Use remark-cli directly.

JounQin commented 1 year ago

Can you provide a reproduction that eslint --fix doesn't work but remark-cli works?

Zemnmez commented 1 year ago

I just tried using the config example that remark-lint uses and notices it fixes some things.

Maybe we could just amend the documentation to say "not all remark-lint rules have automatic fixers"?

ChristianMurphy commented 1 year ago

@Zemnmez That is how I would interpret the existing comment in the documentation, but if you believe it can be worded for more clarity, feel free to open a PR. remark-lint rules by themselves do not have fixers https://github.com/remarkjs/remark-lint/issues/82 But some stylistic ones can be fixed by indirectly, through the remark/mdx stringifier options.