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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This experimental syntax requires enabling one of the following parser plugin(s): ‘jsx, flow, typescript’ #50

Open
lucasrmendonca opened this issue Jun 25, 2022 · 0 comments

Comments

@lucasrmendonca
Copy link
Contributor

When linting .jsx files I have the following error:
This experimental syntax requires enabling one of the following parser plugin(s): ‘jsx, flow, typescript’

My .eslintrc.json config file is as follows:

{
  "settings": { "import/extensions": [".js", ".jsx"] },
  "ignorePatterns": ["node_modules/"],
  "parserOptions": {
    "ecmaVersion": "latest",
    "ecmaFeatures": { "jsx": true },
  },
  "extends": ["canonical", "canonical/prettier"],
  "overrides": [
    {
      "files": "*.jsx",
      "extends": ["canonical/react"]
    }
  ]
}

If I install "@babel/preset-react" with npm and add the following property to "parserOptions", the error goes away and .jsx files are then linted normally:

"parserOptions": {
   ...
   "babelOptions": {
      "presets": ["@babel/preset-react"]
   },
   ...
},

However, I'm not sure this is the intended way to use the "canonical/react" config since there's no mention of it in the docs...

If @babel/preset-react is required, shouldn't it already come inside the canonical/react config?
If it's not required, could someone kindly provide a working example using "canonical/react" with ".jsx" instead of ".tsx"?

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

1 participant