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

Cannot read property 'type' of null on for...of destructuring #2326

Closed
csvan opened this issue Jun 24, 2019 · 1 comment
Closed

Cannot read property 'type' of null on for...of destructuring #2326

csvan opened this issue Jun 24, 2019 · 1 comment
Assignees
Labels

Comments

@csvan
Copy link

csvan commented Jun 24, 2019

Seeing this as of 7.14 (possibly 7.13, just recently updated from 7.12). The code itself has not changed the last month and has had consistent green builds until the version bump from 7.12.

Stack trace:

$ eslint --ext .js --ignore-path .gitignore src
TypeError: Cannot read property 'type' of null
Occurred while linting /Users/csvanefalk/IdeaProjects/ccsdk-scripts/src/scripts/webpack/index.js:40
    at Object.VariableDeclarator (/Users/csvanefalk/IdeaProjects/ccsdk-scripts/node_modules/eslint-plugin-react/lib/util/usedPropTypes.js:464:21)
    at updatedRuleInstructions.(anonymous function) (/Users/csvanefalk/IdeaProjects/ccsdk-scripts/node_modules/eslint-plugin-react/lib/util/Components.js:780:47)
    at listeners.(anonymous function).forEach.listener (/Users/csvanefalk/IdeaProjects/ccsdk-scripts/node_modules/eslint/lib/util/safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/csvanefalk/IdeaProjects/ccsdk-scripts/node_modules/eslint/lib/util/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/csvanefalk/IdeaProjects/ccsdk-scripts/node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (/Users/csvanefalk/IdeaProjects/ccsdk-scripts/node_modules/eslint/lib/util/node-event-generator.js:280:22)
    at NodeEventGenerator.enterNode (/Users/csvanefalk/IdeaProjects/ccsdk-scripts/node_modules/eslint/lib/util/node-event-generator.js:294:14)
    at CodePathAnalyzer.enterNode (/Users/csvanefalk/IdeaProjects/ccsdk-scripts/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:632:23)
    at nodeQueue.forEach.traversalInfo (/Users/csvanefalk/IdeaProjects/ccsdk-scripts/node_modules/eslint/lib/linter.js:752:32)

The offending code (file is proprietary so cannot share the full one):

for (const { result, err } of results) {
    if (err) {
      return { error: true, errorText: err };
    }

    if (result.hasErrors()) {
      return {
        error: true,
        errorText: result.toString(),
      };
    }

    if (result.hasWarnings()) {
      warnings.push(
        result.toString({
          chunks: false,
          colors: true,
        }),
      );
    }
  }
@yannickcr yannickcr added the bug label Jun 24, 2019
@yannickcr yannickcr self-assigned this Jun 24, 2019
@golopot
Copy link
Contributor

golopot commented Jun 24, 2019

Minimal reproducible code for (const {a} of b) {}, with react/prop-types: 'error'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants