0

I'm trying to use ESLint + Airbnb and I'm receiving the error message:

Failed to load plugin react: Cannot find module 'eslint-plugin-react'

But I'm not using eslint-plugin-react see above my .eslintrc.js

module.exports = {
  extends: 'airbnb-base',
  rules: {
    'no-console': 0,
    'linebreak-style': [2, 'windows'],
    'no-new': 0,
    'eslint eol-last': ['error', 'never'],
  },
};

But unfortunately I'm receiving the error message before mentioned. I have no idea about the error. I'm not using eslint-plugin-react. Tell me why this plugin its required

TylerH
  • 20,799
  • 66
  • 75
  • 101
ivomarsan
  • 103
  • 1
  • 4

2 Answers2

1

According to their thread on git, add { "extends": "airbnb/base" } to your config.

edit: the above is deprecated. The same thread recommends to use this package: https://www.npmjs.com/package/eslint-config-airbnb-base

kngroo
  • 432
  • 3
  • 9
1

The same thing happened to me, and I found out that there was a global .eslintrc which included react!

enter image description here

This is possibly because I had ESLint installed globally before and/or some generator tool created that global config. Although you're running ESLint locally now, it always looks for global configuration.
Of course, deleting the global config resolved the problem.
It's in your user directory (e.g.: C:\Users\<username>)
Be careful and check whether any other projects depend on the global config.

Wickramaranga
  • 943
  • 2
  • 19
  • 35