Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: isModuleDeclaration has been deprecated, please migrate to isImportOrExportDeclaration #15466

Closed
1 task
kiran-chauhan-rapidops opened this issue Mar 1, 2023 · 7 comments
Labels
i: needs triage outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@kiran-chauhan-rapidops
Copy link

kiran-chauhan-rapidops commented Mar 1, 2023

馃捇

  • Would you like to work on a fix?

How are you using Babel?

Other (Next.js, Gatsby, vue-cli, ...)

Input code

Stack trace

`isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration`
  at isModuleDeclaration (/home/project/node_modules/@babel/types/lib/validators/generated/index.js:3940:35)
  at NodePath.<computed> [as isModuleDeclaration] (/home/project/node_modules/@babel/traverse/lib/path/index.js:241:12)
  at PluginPass.addHelper (/home/project/node_modules/@babel/core/lib/transformation/plugin-pass.js:36:22)
  ...
  ...
  ...
  at buildCreateElementOpeningElementAttributes (/home/project/node_modules/@babel/plugin-transform-react-jsx/lib/create-plugin.js:507:144)
  at buildCreateElementCall (/home/project/node_modules/@babel/plugin-transform-react-jsx/lib/create-plugin.js:446:64)
  at PluginPass.exit (/home/project/node_modules/@babel/plugin-transform-react-jsx/lib/create-plugin.js:189:26)

Configuration file name

No response

Configuration

No response

Current and expected behavior

This warning should not come.

Environment

  • Node: 16.16.0
  • npm: 8.11.0
  • eslint: 8.14.0

Possible solution

No response

Additional context

This error is coming in one of the existing React project created using create-react-app. Following is the chain of the packages depends on -

eslint-config-react-app > babel-preset-react-app > @babel/preset-react > @babel/plugin-transform-react-jsx > @babel/types

@babel-bot
Copy link
Collaborator

Hey @kiran-chauhan-rapidops! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

@nicolo-ribaudo
Copy link
Member

Could you share your lockfile, to know the versions of the various Babel packages?

@nicolo-ribaudo
Copy link
Member

Also, make sure that you have at least version 7.20.7 of @babel/traverse and @babel/helpers, when we removed usage of the deprecated function. If they are older, delete these two packages from your package-lock.json/yarn.lock/pnpm-lock.yaml file and re-install your deps.

@zeroimpl
Copy link

I just had same issue after installing @babel/preset-typescript to an existing project, but then doing npm update resolved it.

@liuxingbaoyu
Copy link
Member

#15484 should fixed this.

@benomatis
Copy link

benomatis commented May 7, 2023

I still see the warning on core v7.21.8 where the changes in #15484 are supposed to be...

"@babel/core": "^7.21.8",
"@babel/eslint-parser": "^7.21.8",
"@babel/preset-react": "^7.18.6",

@nicolo-ribaudo
Copy link
Member

The warning still appears in case third party code (i.e. not code controlled by us, either now or in the past) uses the deprecated API.

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Aug 8, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: needs triage outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

6 participants