mdx-js / eslint-mdx

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

Parsing error on Windows #389

Closed r-hede closed 2 years ago

r-hede commented 2 years ago

Initial checklist

Affected packages and versions

2.0.0-next.2

Link to runnable example

No response

Steps to reproduce

  1. npm init && npm i eslint eslint-plugin-mdx@next
  2. Configure the ESLint config file for eslint >= 6.4.0:
    {
    "extends": ["plugin:mdx/recommended"],
    // optional, if you want to lint code blocks at the same time
    "settings": {
    "mdx/code-blocks": true,
    // optional, if you want to disable language mapper, set it to `false`
    // if you want to override the default language mapper inside, you can provide your own
    "mdx/language-mapper": {}
    }
    }
  3. Make sure ESLint knows to run on .md or .mdx files: "scripts": { "eslint": "eslint . --ext js,md,mdx" },
  4. Add mdx file without any error to the app.

Expected behavior

No error

Actual behavior

0:0 error Parsing error: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

Runtime

Node v16

Package manager

npm v8

OS

Windows

Build and bundle tools

No response

JounQin commented 2 years ago

Please provide reproduction...

r-hede commented 2 years ago

Please provide reproduction...

I can't send you a reproduction on codesandbox or stackblitz because you have to be on a Windows environment to reproduce the error.

Here is the files : https://github.com/r-hede/eslint-mdx-parsing-error-on-windows

JounQin commented 2 years ago

@r-hede Can you add GitHub Actions with Windows? I don't have Windows machine.

JounQin commented 2 years ago

This could be an issue from synckit, I'll take a look.

JounQin commented 2 years ago

@r-hede

# yarn 1
yarn add https://pkg.csb.dev/rx-ts/synckit/commit/75d177a6/synckit
# yarn 2, 3
yarn add synckit@https://pkg.csb.dev/rx-ts/synckit/commit/75d177a6/synckit/_pkg.tgz
# npm
npm i https://pkg.csb.dev/rx-ts/synckit/commit/75d177a6/synckit

Can you try a new version of synckit?

JounQin commented 2 years ago

@r-hede

Please try

# yarn 1
yarn add https://pkg.csb.dev/mdx-js/eslint-mdx/commit/2bc2a3fa/eslint-mdx https://pkg.csb.dev/mdx-js/eslint-mdx/commit/2bc2a3fa/eslint-plugin-mdx
# yarn 2, 3
yarn add eslint-mdx@https://pkg.csb.dev/mdx-js/eslint-mdx/commit/2bc2a3fa/eslint-mdx/_pkg.tgz eslint-plugin-mdx@https://pkg.csb.dev/mdx-js/eslint-mdx/commit/2bc2a3fa/eslint-plugin-mdx/_pkg.tgz
# npm
npm i https://pkg.csb.dev/mdx-js/eslint-mdx/commit/2bc2a3fa/eslint-mdx https://pkg.csb.dev/mdx-js/eslint-mdx/commit/2bc2a3fa/eslint-plugin-mdx

It should work now, I've tested on a Windows VM.

r-hede commented 2 years ago

Sorry for the delay, I was also able to test on Windows and I confirm that it works correctly.

Do you plan to release a new version including this fix?

JounQin commented 2 years ago

@wooorm A new next version is ready.

wooorm commented 2 years ago

Now? Or do you first want to land the other PR?

JounQin commented 2 years ago

Now? Or do you first want to land the other PR?

Let's wait for the other PR.