jsx-ast-utils: The prop value with an expression type of `MetaProperty` could not be resolved

➜  yarn lint
The prop value with an expression type of MetaProperty could not be resolved. Please file an issue ( https://github.com/jsx-eslint/jsx-ast-utils/issues/new ) to get this fixed immediately.
The prop value with an expression type of MetaProperty could not be resolved. Please file an issue ( https://github.com/jsx-eslint/jsx-ast-utils/issues/new ) to get this fixed immediately.
The prop value with an expression type of MetaProperty could not be resolved. Please file an issue ( https://github.com/jsx-eslint/jsx-ast-utils/issues/new ) to get this fixed immediately.
The prop value with an expression type of MetaProperty could not be resolved. Please file an issue ( https://github.com/jsx-eslint/jsx-ast-utils/issues/new ) to get this fixed immediately.
{
  "extends": ["react-app", "react-app/jest", "prettier"]
}
"jsx-ast-utils@npm:^2.4.1 || ^3.0.0, jsx-ast-utils@npm:^3.3.2":
  version: 3.3.2
  resolution: "jsx-ast-utils@npm:3.3.2"
  dependencies:
    array-includes: ^3.1.5
    object.assign: ^4.1.2
  checksum: 61d4596d44480afc03ae0a7ebb272aa6603dc4c3645805dea0fc8d9f0693542cd0959f3ba7c0c9b16c13dd5a900c7c4310108bada273132a8355efe3fed22064
  languageName: node
  linkType: hard
"eslint-plugin-react@npm:^7.27.1, eslint-plugin-react@npm:^7.29.4":
  version: 7.30.1
  resolution: "eslint-plugin-react@npm:7.30.1"
  dependencies:
    array-includes: ^3.1.5
    array.prototype.flatmap: ^1.3.0
    doctrine: ^2.1.0
    estraverse: ^5.3.0
    jsx-ast-utils: ^2.4.1 || ^3.0.0
    minimatch: ^3.1.2
    object.entries: ^1.1.5
    object.fromentries: ^2.0.5
    object.hasown: ^1.1.1
    object.values: ^1.1.5
    prop-types: ^15.8.1
    resolve: ^2.0.0-next.3
    semver: ^6.3.0
    string.prototype.matchall: ^4.0.7
  peerDependencies:
    eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8
  checksum: 553fb9ece6beb7c14cf6f84670c786c8ac978c2918421994dcc4edd2385302022e5d5ac4a39fafdb35954e29cecddefed61758040c3c530cafcf651f674a9d51
  languageName: node
  linkType: hard

"eslint-plugin-jsx-a11y@npm:^6.5.1":
  version: 6.6.1
  resolution: "eslint-plugin-jsx-a11y@npm:6.6.1"
  dependencies:
    "@babel/runtime": ^7.18.9
    aria-query: ^4.2.2
    array-includes: ^3.1.5
    ast-types-flow: ^0.0.7
    axe-core: ^4.4.3
    axobject-query: ^2.2.0
    damerau-levenshtein: ^1.0.8
    emoji-regex: ^9.2.2
    has: ^1.0.3
    jsx-ast-utils: ^3.3.2
    language-tags: ^1.0.5
    minimatch: ^3.1.2
    semver: ^6.3.0
  peerDependencies:
    eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8
  checksum: baae7377f0e25a0cc9b34dc333a3dc6ead9ee8365e445451eff554c3ca267a0a6cb88127fe90395c578ab1b92cfed246aef7dc8d2b48b603389e10181799e144
  languageName: node
  linkType: hard

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 6
  • Comments: 20 (9 by maintainers)

Commits related to this issue

Most upvoted comments

I was also bumping into this warning. In my case this results in the message:

<a href={import.meta.env.BASE_URL}>

Changing it to:

<a href={`${import.meta.env.BASE_URL}`}>

makes it go away.

@joaofmartinho thanks, that’s a good workaround - it should really be fixed here tho.

Here is a repo to reproduce this issue: https://github.com/receter/meta-property-could-not-be-resolved

The key is that I have replaced the eslint config with just:

module.exports = {
  "extends": ["react-app"],
}

With the original config provided by vite, this does not happen.

My other project was created with Vite 4.2.0 and eslint was added later on manually.

For me the fix will likely be to change my eslint config to what is recommended by Vite.

This error also occurred for me when using import.meta in a typescript project using vite. The eislint parser used is @typescript-eslint/parser and ecmaVersion is set to 2021.