1

When I save any js file in Sublime text 3 the error pasted below keeps popping up. I have tried a reinstall of eslint, eslint-plugin-import, eslint-config-airbnb, eslint-plugin-react, but no results.

any ideas?

error: Error: C:\Users\user_name\node_modules\eslint-config-airbnb\rules\react.js:
  Configuration for rule "react/jsx-uses-react" is invalid:
  Value "[object Object]" should NOT have more than 0 items.

Referenced from: C:\Users\user_name\node_modules\eslint-config-airbnb\index.js
Referenced from: C:\Users\user_name\.eslintrc
Error: C:\Users\user_name\node_modules\eslint-config-airbnb\rules\react.js:
  Configuration for rule "react/jsx-uses-react" is invalid:
  Value "[object Object]" should NOT have more than 0 items.

Referenced from: C:\Users\user_name\node_modules\eslint-config-airbnb\index.js
Referenced from: C:\Users\user_name\.eslintrc
    at validateRuleOptions (C:\Users\user_name\Dev\node_modules\eslint\lib\config\config-validator.js:113:15)
    at Object.keys.forEach.id (C:\Users\user_name\Dev\node_modules\eslint\lib\config\config-validator.js:153:9)
    at Array.forEach (native)
    at validateRules (C:\Users\user_name\Dev\node_modules\eslint\lib\config\config-validator.js:152:30)
    at Object.validate (C:\Users\user_name\Dev\node_modules\eslint\lib\config\config-validator.js:230:5)
    at loadFromDisk (C:\Users\user_name\Dev\node_modules\eslint\lib\config\config-file.js:549:19)
    at load (C:\Users\user_name\Dev\node_modules\eslint\lib\config\config-file.js:592:20)
    at configExtends.reduceRight.e (C:\Users\user_name\Dev\node_modules\eslint\lib\config\config-file.js:421:36)
    at Array.reduceRight (native)
    at applyExtends (C:\Users\user_name\Dev\node_modules\eslint\lib\config\config-file.js:403:28)
(node:11548) DeprecationWarning: [eslint] The 'ecmaFeatures' config file property is deprecated, and has no effect. (found in C:\Users\user_name\node_modules\eslint-config-airbnb\rules\react.js)
Zumo
  • 510
  • 3
  • 12

1 Answers1

0

I had this problem with Atom. You need to configure eslint to support jsx. Add this to your .eslintrc file. Particularly the parserOptions field! Make sure you have eslint-plugin-react installed properly as well.

eslint-plugin-react on github

{
  "extends": [
    "eslint:recommended",
    "plugin:react/recommended"
  ],
  "parserOptions": {
    "ecmaVersion": 6,
    "ecmaFeatures": {
        "jsx": true
    }
  },
  "plugins": [
    "react"
  ],
}
Tori Huang
  • 527
  • 1
  • 7
  • 25