Closed sudosilico closed 2 years ago
Thanks for reproduction, I'll take a look soon.
https://github.com/mdx-js/eslint-mdx/issues/403#issuecomment-1167926793 same problem
workaround yarn add -D unist-util-visit vifile
I'll raise a PR to fix it soon.
@sudosilico Please try for testing https://ci.codesandbox.io/status/mdx-js/eslint-mdx/pr/405/builds/265745
I can confirm it's working as expected now:
gitpod /workspace/eslint-mdx-visit-issue (main) $ yarn add -D https://pkg.csb.dev/mdx-js/eslint-mdx/commit/98013f6e/eslint-plugin-mdx
gitpod /workspace/eslint-mdx-visit-issue (main) $ yarn lint
yarn run v1.22.19
$ eslint --ext .ts,.tsx,.js,.jsx,.mdx src
/workspace/eslint-mdx-visit-issue/src/App.tsx
1:10 warning 'useState' is defined but never used @typescript-eslint/no-unused-vars
5:5 error 'React' must be in scope when using JSX react/react-in-jsx-scope
6:7 error 'React' must be in scope when using JSX react/react-in-jsx-scope
7:9 error 'React' must be in scope when using JSX react/react-in-jsx-scope
/workspace/eslint-mdx-visit-issue/src/stories/Button.stories.mdx
1:24 warning 'Story' is defined but never used @typescript-eslint/no-unused-vars
✖ 5 problems (3 errors, 2 warnings)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
gitpod /workspace/eslint-mdx-visit-issue (main) $
Initial checklist
Affected packages and versions
2.0.0
Link to runnable example
https://github.com/sudosilico/eslint-mdx-visit-issue
Steps to reproduce
Minimal Example
Minimal repository producing this issue with a fresh Vite / TypeScript / React / Storybook project.
Seems to be the same issue as (#403).
Steps taken:
Creating a new project with Vite, TypeScript, React, and Storybook, and then configuring eslint and
eslint-plugin-mdx@2.0.0
results in aParsing error: visit is not a function
.Environment:
M1 MacBook Air 16GB, macOS Monterey 12.3
Expected behavior
.mdx
file should should be linted without parsing errors.Actual behavior
ESLint gives a parsing error for
.mdx
files:Runtime
Node v17
Package manager
yarn v1
OS
macOS
Build and bundle tools
Vite
Workaround:
Downgrading to
eslint-plugin-mdx
version1.17.0
as seen in commits that reference the above issue seems to resolve this.