mdx-js / eslint-mdx

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

`eslint-plugin-mdx` doesn't seems to load `.remarkrc.mjs` #436

Closed JulianCataldo closed 1 year ago

JulianCataldo commented 1 year ago

Initial checklist

Affected packages and versions

All latest

Link to runnable example

https://github.com/JulianCataldo/eslint-mdx-repro

Steps to reproduce

Hello!

Here is a minimal reproduction repository I've made to illustrate this issue:

https://github.com/JulianCataldo/eslint-mdx-repro

Steps to repro. are described in its README.

I've talked about it before here: https://github.com/remarkjs/remark-lint/issues/300

Was not quite sure were in the stack is the culprit (remark? eslint? eslint-mdx? cosmic-config?).

For now, creating a static config file (as YAML or JSON) seems to work fine, so ESLint is good with 100% ESMs remark plugins (through the MDX plugin).

But that means having to maintain two remark-lint config, one for MDX and one for MD.

Maybe I've overlooked something?

Many thanks :)

Expected behavior

.remarkrc.mjs loaded from both remark and eslint

Actual behavior

Module JS configs are not loaded by the ESLint plugin.

JounQin commented 1 year ago

https://github.com/davidtheclark/cosmiconfig#searchplaces

PR welcome to add this support at https://github.com/mdx-js/eslint-mdx/blob/a1998c787f0049ae0cd705fc51f079c63ded75b2/packages/eslint-mdx/src/worker.ts#L60-L62

JounQin commented 1 year ago

Maybe we should migrate to use unified-engine instead.