Eslint-plugin-react: Definition for rule "jsx-curly-spacing" was not found

Created on 20 Jun 2016  路  5Comments  路  Source: yannickcr/eslint-plugin-react

I'm having an issue getting the jsx curly spacing rule to work. The rest of the rules work fine, except I get the error above when I'm trying to lint.

{
    "extends": ["plugin:meteor/recommended","airbnb"],
    "env": {
        "browser": true,
        "node": true,
        "es6": true,
        "jquery": true,
        "mongo": true,
        "meteor": true
    },

    "plugins": [
        "react",
        "meteor"
    ],
    "rules":{
      "prefer-const": 0,
      "new-cap": 0,
      "one-var": 0,
      "array-bracket-spacing": [2, "always"],
      "jsx-curly-spacing": [2, "always"],
      "func-names": 0,
      "no-else-return": 0,
      "no-underscore-dangle": 0,
      "import/no-unresolved": [
        2, { "ignore": ["^meteor/"] }
      ],
      }
}

Most helpful comment

A rule from a plugin must be prefixed by the plugin name, see ESLint documentation about rules configuration.

In your case:

"rules":{
      ...
      "react/jsx-curly-spacing": [2, "always"]
      ...
}

All 5 comments

Are you running a global or local eslint? What does npm ls print out?

i'm trying to run it within atom which I would assume means local. Here's what I have installed via npm

  "devDependencies": {
    "eslint": "^2.8.0",
    "eslint-config-airbnb": "^8.0.0",
    "eslint-plugin-import": "^1.6.0",
    "eslint-plugin-jsx-a11y": "^1.0.3",
    "eslint-plugin-meteor": "^3.5.2",
    "eslint-plugin-react": "^5.2.1"
  },

A rule from a plugin must be prefixed by the plugin name, see ESLint documentation about rules configuration.

In your case:

"rules":{
      ...
      "react/jsx-curly-spacing": [2, "always"]
      ...
}

That fixed it, thank you. Would it be possible to update this page https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md; so, that could be more clear?

just update : "react-scripts": "^3.1.2" and "eslint": "^6.5.0",
This problems is solved

Was this page helpful?
0 / 5 - 0 ratings