-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Parsing error: Cannot use 'in' operator to search for 'ast' in undefined #356
Comments
Please provide a minimal and runnable reproduction. |
here's the repro. it starts throwing this error when Yarn PnP is used. https://github.com/bencmbrook/mdx-bug
|
Sorry, I'm not familiar with yarn pnp and don't know how to debug original node_modules inside. And reference how to debug your error? |
After This is caused by The current workaround is And use module.exports = {
parserOptions: {
parser: require('espree'),
},
} Why? ES syntaxes like
See also https://github.com/mdx-js/eslint-mdx#parser-options But for yarn pnp, it seems broken, maybe |
Thank you @JounQin - that's helpful. What's odd is I'm using typescript and imports are working outside of MDX, but I'll try out As for debugging PnP, VSCode ZipFS can be helpful to explore the node modules (which are under |
https://github.com/bencmbrook/mdx-bug/blob/main/test.mdx?plain=1#L1 This is ES syntax in |
# yarn 1
yarn add https://pkg.csb.dev/mdx-js/eslint-mdx/commit/abdc9db9/eslint-mdx https://pkg.csb.dev/mdx-js/eslint-mdx/commit/abdc9db9/eslint-plugin-mdx
# yarn 2, 3
yarn add eslint-mdx@https://pkg.csb.dev/mdx-js/eslint-mdx/commit/abdc9db9/eslint-mdx/_pkg.tgz eslint-plugin-mdx@https://pkg.csb.dev/mdx-js/eslint-mdx/commit/abdc9db9/eslint-plugin-mdx/_pkg.tgz
# npm
npm i https://pkg.csb.dev/mdx-js/eslint-mdx/commit/abdc9db9/eslint-mdx https://pkg.csb.dev/mdx-js/eslint-mdx/commit/abdc9db9/eslint-plugin-mdx Please help us to test the fresh new version. |
Subject of the issue
When using eslint-mdx, I get the following error (full stack trace collapsed below):
`eslint --debug` full stack trace
This points to
program
being undefined on this line:eslint-mdx/packages/eslint-mdx/src/parser.ts
Line 243 in 6c8e3be
Your environment
Node v14.17.3
Yarn v3.0.2
Steps to reproduce
Tell us how to reproduce this issue. Please provide a working and simplified example.
eslintrc.json:
.vscode/settings.json:
Expected behaviour
mdx files successfully lint.
Actual behaviour
All .mdx files get the same Parsing error on line 1.
The text was updated successfully, but these errors were encountered: