pkelly-rh

pkelly-rh

Member Since 2 months ago

Experience Points
0
follower
Lessons Completed
0
follow
Best Reply Awards
1
repos

5 contributions in the last year

Pinned
Activity
Oct
28
1 month ago
Activity icon
issue

pkelly-rh issue comment facebook/react

pkelly-rh
pkelly-rh

Bug: Rules with suggestions must set the `meta.hasSuggestions` property to `true`

I'm basically running into an issue where eslint is asking me to set meta.hasSuggestions to true. When I use "react-hooks/exhaustive-deps": "error". Is there something I'm doing wrong or is this a dep version thing?

React version:

Steps To Reproduce

  1. Have my eslint config:
{
  "env": {
    "browser": true,
    "es2021": true
  },
  "extends": [
    "eslint:recommended",
    "plugin:react/recommended",
    "plugin:react-hooks/recommended",
    "plugin:@typescript-eslint/recommended",
    "prettier"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": 13,
    "sourceType": "module"
  },
  "plugins": ["react", "react-hooks", "@typescript-eslint"],
  "rules": {
    "react-hooks/exhaustive-deps": "error",
  },
  "settings": {
    "react": {
      "version": "detect"
    }
  }
}

Here's my deps from package.json

{
"dependecies": {
    "eslint": "^8.0.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-react": "^7.26.1",
    "eslint-plugin-react-hooks": "^4.2.0",
}

If I try to remove the react-hook plugin and extension this happens: Definition for rule 'react-hooks/exhaustive-deps' was not found

Link to code example:

The current behavior

The expected behavior

pkelly-rh
pkelly-rh
Oct
12
1 month ago
Activity icon
issue

pkelly-rh issue comment facebook/react

pkelly-rh
pkelly-rh

Bug: Rules with suggestions must set the `meta.hasSuggestions` property to `true`

I'm basically running into an issue where eslint is asking me to set meta.hasSuggestions to true. When I use "react-hooks/exhaustive-deps": "error". Is there something I'm doing wrong or is this a dep version thing?

React version:

Steps To Reproduce

  1. Have my eslint config:
{
  "env": {
    "browser": true,
    "es2021": true
  },
  "extends": [
    "eslint:recommended",
    "plugin:react/recommended",
    "plugin:react-hooks/recommended",
    "plugin:@typescript-eslint/recommended",
    "prettier"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": 13,
    "sourceType": "module"
  },
  "plugins": ["react", "react-hooks", "@typescript-eslint"],
  "rules": {
    "react-hooks/exhaustive-deps": "error",
  },
  "settings": {
    "react": {
      "version": "detect"
    }
  }
}

Here's my deps from package.json

{
"dependecies": {
    "eslint": "^8.0.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-react": "^7.26.1",
    "eslint-plugin-react-hooks": "^4.2.0",
}

If I try to remove the react-hook plugin and extension this happens: Definition for rule 'react-hooks/exhaustive-deps' was not found

Link to code example:

The current behavior

The expected behavior

pkelly-rh
pkelly-rh

Straight from the horses mouth. This fixed it helped me fix it: https://lifesaver.codes/answer/eslint-feedback-for-exhaustive-deps-lint-rule

Install: npm install [email protected]

And changed the eslint config to:

{
  "env": {
    "browser": true,
    "es2021": true
  },
  "extends": [
    "eslint:recommended",
    "plugin:react/recommended",
    "plugin:@typescript-eslint/recommended",
    "prettier"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": 13,
    "sourceType": "module"
  },
  "plugins": ["react", "react-hooks", "@typescript-eslint"],
  "rules": {
    "react-hooks/exhaustive-deps": "error",
  },
  "settings": {
    "react": {
      "version": "detect"
    }
  }
}

@gaearon why didn't this just work out of the box?

Activity icon
issue

pkelly-rh issue facebook/react

pkelly-rh
pkelly-rh

Bug: Rules with suggestions must set the `meta.hasSuggestions` property to `true`

I'm basically running into an issue where eslint is asking me to set meta.hasSuggestions to true. When I use "react-hooks/exhaustive-deps": "error". Is there something I'm doing wrong or is this a dep version thing?

React version:

Steps To Reproduce

  1. Have my eslint config:
{
  "env": {
    "browser": true,
    "es2021": true
  },
  "extends": [
    "eslint:recommended",
    "plugin:react/recommended",
    "plugin:react-hooks/recommended",
    "plugin:@typescript-eslint/recommended",
    "prettier"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": 13,
    "sourceType": "module"
  },
  "plugins": ["react", "react-hooks", "@typescript-eslint"],
  "rules": {
    "react-hooks/exhaustive-deps": "error",
  },
  "settings": {
    "react": {
      "version": "detect"
    }
  }
}

Here's my deps from package.json

{
"dependecies": {
    "eslint": "^8.0.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-react": "^7.26.1",
    "eslint-plugin-react-hooks": "^4.2.0",
}

Link to code example:

The current behavior

The expected behavior