Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error parsing useEffects hooks dependency array #13421

Closed
leandrowilliam opened this issue Jun 16, 2020 · 3 comments
Closed

Error parsing useEffects hooks dependency array #13421

leandrowilliam opened this issue Jun 16, 2020 · 3 comments
Labels
3rd party plugin This is an issue related to a 3rd party plugin, config, or parser archived due to age This issue has been archived; please open a new issue for any further discussion

Comments

@leandrowilliam
Copy link

  • **ESLint Version:**7.2.0
  • **Node Version:**12.16.3
  • **npm Version:**6.14.5

What parser (default, Babel-ESLint, etc.) are you using?
@typescript-eslint/parser

Please show your full configuration:

Configuration
{
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "jsx": true,
    "useJSXTextNode": true
  },
  "extends": [
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:react/recommended", // Uses the recommended rules from @eslint-plugin-react
    "prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
    "plugin:prettier/recommended" // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
  ],
  "plugins": ["@typescript-eslint", "react-hooks", "react", "sort-imports-es6-autofix"],
  "rules": {
    "sort-imports-es6-autofix/sort-imports-es6": [
      1,
      {
        "ignoreCase": true,
        "ignoreMemberSort": false,
        "memberSyntaxSortOrder": ["none", "all", "multiple", "single"]
      }
    ],
    "@typescript-eslint/explicit-function-return-type": "off",
    "@typescript-eslint/no-use-before-define": "off",
    "no-unused-vars": "off",
    "@typescript-eslint/no-unused-vars": [
      "error",
      {
        "argsIgnorePattern": "^_",
        "vars": "local",
        "args": "after-used",
        "ignoreRestSiblings": true
      }
    ],
    "react-hooks/rules-of-hooks": "error",
    "react-hooks/exhaustive-deps": "warn",
    "react/prop-types": "off",
    "react/display-name": "off",
    "import/no-unresolved": "off"
  },
  "settings": {
    "react": {
      "version": "detect" // Tells eslint-plugin-react to automatically detect the version of React to use
    }
  }
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

useEffect(loadFamilyHistories, [, loadFamilyHistories])
eslint --ext .jsx,.js,.tsx,.ts .

What did you expect to happen?
Show an error|warn on vscode (other ide/editor) and/or bring error on the cli after run the eslint command

What actually happened? Please include the actual, raw output from ESLint.
image

eslint --ext .jsx,.js,.tsx,.ts .

Oops! Something went wrong! :(

ESLint: 7.2.0

TypeError: Cannot read property 'type' of null
Occurred while linting /home/leandrow/dev/wenlogic/ehr-app/app/js/modules/family-history/knowledge-area/KAFamilyHistoryContainer.tsx:21 at /home/leandrow/dev/wenlogic/ehr-app/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js:839:23
at Array.some ()
at visitCallExpression (/home/leandrow/dev/wenlogic/ehr-app/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js:838:86)
at /home/leandrow/dev/wenlogic/ehr-app/node_modules/eslint/lib/linter/safe-emitter.js:45:58
at Array.forEach ()
at Object.emit (/home/leandrow/dev/wenlogic/ehr-app/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (/home/leandrow/dev/wenlogic/ehr-app/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
at NodeEventGenerator.applySelectors (/home/leandrow/dev/wenlogic/ehr-app/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
at NodeEventGenerator.enterNode (/home/leandrow/dev/wenlogic/ehr-app/node_modules/eslint/lib/linter/node-event-generator.js:297:14) at CodePathAnalyzer.enterNode (/home/leandrow/dev/wenlogic/ehr-app/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:635:23)

Are you willing to submit a pull request to fix this bug?
Could be

@leandrowilliam leandrowilliam added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Jun 16, 2020
@mdjermanovic mdjermanovic added 3rd party plugin This is an issue related to a 3rd party plugin, config, or parser and removed bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Jun 17, 2020
@mdjermanovic
Copy link
Member

Hi @leandrowilliam, thanks for the issue!

By the provided call stack it seems to be a problem in third-party plugin eslint-plugin-react-hooks.

Can you please report the bug here: https://github.com/facebook/react

@yeonjuan
Copy link
Member

yeonjuan commented Jun 17, 2020

@leandrowilliam
As @mdjermanovic mentioned, It's a bug in react.
I made a PR for fixing it. - facebook/react#19145

@leandrowilliam
Copy link
Author

leandrowilliam commented Jun 17, 2020

thanks @mdjermanovic @yeonjuan

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Dec 15, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Dec 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3rd party plugin This is an issue related to a 3rd party plugin, config, or parser archived due to age This issue has been archived; please open a new issue for any further discussion
Projects
None yet
Development

No branches or pull requests

3 participants