Prettier-eslint: Warning: React version not specified in eslint-plugin-react settings, though it is specified

Created on 27 Sep 2018  路  5Comments  路  Source: prettier/prettier-eslint

Versions:

  • prettier-eslint version: 4.7.1
  • node version: v10.5.0
  • npm (or yarn) version: 6.4.1

Have you followed the debugging tips?

Yes

Relevant code or config

{
  "extends": ["prettier"],
  "settings": {
    "react": {
      "pragma": "React",
      "version": "16.5.2"
    }
  },
  "rules": {
    "multiline-comment-style": ["off"],
    "no-warning-comments": ["off"],
    "react/jsx-filename-extension": ["off"],
    "react/jsx-first-prop-new-line": ["off"],
    "react/jsx-max-props-per-line": ["off"],
    "quotes": ["error", "single", { "avoidEscape": true }]
  }
}

What I did:
I have configured my package.json scripts with a formatting script as shown below:

"format": "prettier-eslint.cmd --write \"src/**/*.js\" --log-level trace",

What happened:

When attempting to run the formatting script, I receive the following warning:

Warning: React version not specified in eslint-plugin-react settings. See https://github.com/yannickcr/eslint-plugin-react#configuration.

Reproduction repository:

Unfortunately I cannot create this repository as my proxy disallows the ability to create public Git repositories, though I may be able to provide this later on.

Problem description:

After following the instructions provided in the warning (as shown in my .eslintrc.json above) and including the version of React which I am currently utilizing the warning still pops up. I have confirmed that this shoudl work by performing a trace which displays that the version _is_ being appropriately picked up by prettier-eslint:

React in .eslint config

Suggested solution:

Not sure, as I do not receive this error when simply performing an eslint on the files directly.

released

Most helpful comment

Same issues here. I have set react version but prettier keep saying that it's not
"Warning: React version not specified in eslint-plugin-react settings. See https://github.com/yannickcr/eslint-plugin-react#configuration."

I'm using latest version of "prettier-eslint-cli": "^4.7.1" and with that "prettier-eslint": "8.8.2""

All 5 comments

@cjones26 You are using a pretty old version (4.7.1), although I have the same issue here. Did you fixed your problem ?

Version used :

"devDependencies": {
    "babel-eslint": "10.0.1",
    "babel-preset-flow": "6.23.0",
    "eslint": "5.6.1",
    "eslint-config-google": "0.10.0",
    "eslint-config-prettier": "3.1.0",
    "eslint-plugin-flowtype": "2.50.3",
    "eslint-plugin-import": "2.14.0",
    "eslint-plugin-jsx-a11y": "6.1.1",
    "eslint-plugin-prettier": "3.0.0",
    "eslint-plugin-react": "7.11.1",
    "prettier": "1.14.3",
    "prettier-eslint": "8.8.2",
    "prettier-eslint-cli": "4.7.1",
    "pretty-quick": "1.7.0"
  }

@thetoine -- I have not yet been able to fix the problem, unfortunately.

Same issues here. I have set react version but prettier keep saying that it's not
"Warning: React version not specified in eslint-plugin-react settings. See https://github.com/yannickcr/eslint-plugin-react#configuration."

I'm using latest version of "prettier-eslint-cli": "^4.7.1" and with that "prettier-eslint": "8.8.2""

I have the same issue and context.settings is an empty object here: https://github.com/yannickcr/eslint-plugin-react/blob/master/lib/util/version.js#L14

:tada: This issue has been resolved in version 9.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kentcdodds picture kentcdodds  路  10Comments

sheerun picture sheerun  路  10Comments

JamieYoungman picture JamieYoungman  路  8Comments

tim0991 picture tim0991  路  4Comments

chrisbobbe picture chrisbobbe  路  8Comments