ESLint:Warning: React version not specified in eslint-plugin-react settingsについて

スポンサーリンク

Warning: React version not specified in eslint-plugin-react settingsについて

eslintを実行して「Warning: React version not specified in eslint-plugin-react settings」というメッセージが表示される場合は.eslintrc"settings"->"react"->"version"を追加します。

 

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

 

.eslintrc.jsonの場合

{
  ...
  (その他の設定)  
  ...
  "settings": {
    "react": {
      "version": "detect", // React version. "detect" automatically picks the version you have installed.
                           // You can also use `16.0`, `16.3`, etc, if you want to override the detected value.
                           // It will default to "latest" and warn if missing, and to "detect" in the future
    }
  }
}