Skip to content

astro-eslint-parser fails to parse react-toastify module: parser.parse is not a function #452

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

Open
2 tasks done
corneliusroemer opened this issue Nov 19, 2024 · 2 comments

Comments

@corneliusroemer
Copy link

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

8.57.0

What version of eslint-plugin-astro are you using?

1.3.1

What did you do?

  1. Clone the repository: loculus-project/loculus.
  2. Checkout the commit: 654535a.
  3. Run cd website && npm ci.
  4. Run the linting command: npm run check-format.

What did you expect to happen?

No errors

What actually happened?

Error while parsing /Users/corneliusromer/code/loculus/website/node_modules/react-toastify/dist/react-toastify.esm.mjs
Line 4, column 0: Unknown token at 15459, expected: "}", actual: ""
`parseForESLint` from parser `/Users/corneliusromer/code/loculus/website/node_modules/astro-eslint-parser/lib/index.js` is invalid and will just be ignored

Error while parsing /Users/corneliusromer/code/loculus/website/node_modules/react-toastify/dist/react-toastify.esm.mjs
Line 4, column 0: Unknown token at 15459, expected: "}", actual: ""
`parseForESLint` from parser `/Users/corneliusromer/code/loculus/website/node_modules/astro-eslint-parser/lib/index.js` is invalid and will just be ignored

/Users/corneliusromer/code/loculus/website/src/layouts/BaseLayout.astro
  3:32  warning  Parse errors in imported module 'react-toastify': parser.parse is not a function (undefined:undefined)  import/no-deprecated

Link to Minimal Reproducible Example

loculus-project/loculus@654535a

Additional comments

I do'nt quite know why this error surfaced only now. It happens when I upgrade eslint-plugin-import from 2.29.1 to 2.31.0 - many components seem to come together here creating a strange end result.

Here's the dependabot PR that first surfaced this: loculus-project/loculus#3231

Let me know if I should file an issue elsewhere, for now there is at least some strange parsing going on here?

@gambolputty
Copy link

I had a similar error and the solution was to tell ESLint which parser to use for *.mjs files because it was missing in my config:

"import/parsers": {
  "@typescript-eslint/parser": [".ts", ".tsx", ".mjs"],
  "astro-eslint-parser": [".astro"],
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants