Skip to content

Warning: React version not specified in eslint-plugin-react settings (Part 2) #3438

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

Closed
julielouie opened this issue Sep 22, 2022 · 8 comments

Comments

@julielouie
Copy link

Related to #1955

I seem to still be having this issue on v7.31.8, discussed in the above issue, and would love some insight if I'm just setting things up incorrectly.
This is a brand new React/TS project being set up using VS Code and Vite, so what you see is all I have currently.
The eslint library is being loaded in successfully, and I don't have any errors, but I am still getting this warning:
Screen Shot 2022-09-22 at 1 26 35 PM

  • I have tried running eslint via the command line, and am still getting the same warning.

The contents of my .eslintrc.js:

module.exports = {
  root: true,
  env: {
    node: true,
    browser: true
  },
  parser: '@typescript-eslint/parser',
  parserOptions: {
    ecmaVersion: 2022,
    sourceType: 'module',
    ecmaFeatures: {
      jsx: true
    },
    settings: {
      react: {
        version: 'detect'
      },
      'import/resolver': {
        node: {
          paths: ['src'],
          extensions: ['.js', '.jsx', '.ts', '.tsx']
        }
      }
    }
  },
  extends: [
    'eslint:recommended',
    'plugin:react/recommended',
    'plugin:import/recommended',
    'plugin:import/typescript',
    'plugin:@typescript-eslint/recommended',
    'eslint-config-prettier'
  ],
  rules: {
    'react/react-in-jsx-scope': 'off',
    semi: [2, 'always']
  }
};

Here is a repro repo where I'm currently having the issue:
https://github.com/juliehchung/test-dash

@MidKnightXI
Copy link

MidKnightXI commented Sep 22, 2022

Can you put

  react: {
    version: "detect"
  },
}

Outside of parserOptions ?

@MidKnightXI
Copy link

Outside of your stuff maybe ?

What do you mean outside of my stuff?

Sorry if I'm not clear, just edited the message

@julielouie
Copy link
Author

Sorry if I'm not clear, just edited the message

Dang, that was really all it was.. I must have been looking at some outdated references. Appreciate this a lot!

@ljharb
Copy link
Member

ljharb commented Sep 22, 2022

Glad you figured it out!

@ljharb ljharb closed this as not planned Won't fix, can't repro, duplicate, stale Sep 22, 2022
@javiercastaneda303
Copy link

insert this code at at .eslintrc.json
{
...
settings: {
react: {
version: 'detect'
},
}
...
}

@MidKnightXI
Copy link

insert this code at at .eslintrc.json { ... settings: { react: { version: 'detect' }, } ... }

It would actually be like that for json format:

"settings": {
  "react": {
    "version": "detect"
  },
}

mateus-azevedo added a commit to mateus-azevedo/trackmob-frontend-test that referenced this issue Feb 8, 2023
Juris710 added a commit to appnavi/appnavi-works that referenced this issue Mar 6, 2023
@pkpardeep482
Copy link

pkpardeep482 commented Aug 8, 2024

Its not working even after putting

"settings": {
"react": {
"version": "detect"
},
}

@ljharb
Copy link
Member

ljharb commented Aug 9, 2024

@pkpardeep482 if you upgrade to the latest version and it's still not working, please file a new issue.

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

No branches or pull requests

5 participants