Skip to content

no-deprecated: Cannot read property 'name' of undefined #3016

Closed

Description

Hello, no-deprecated rule seems to crash in certain cases. This issue was spotted by automated CI run - it is not blocking my development or anything.

AriPerkkio/eslint-remote-tester#189 (comment)

eslint-plugin-react@7.24.0
module.exports = {
    root: true,
    env: {
        es6: true,
        node: true,
    },
    parserOptions: {
        ecmaVersion: 2020,
        sourceType: "module",
        ecmaFeatures: {
            jsx: true,
        },
    },
    settings: {
        react: {
            version: "16.13.1",
        },
    plugins: ["react"],
    rules: {
        "react/no-deprecated": "error",
    },
};

Minimal repro:

import React from "react";

let { default: defaultReactExport, ...allReactExports } = React;
TypeError: Cannot read property 'name' of undefined
Occurred while linting <text>:116
    at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/no-deprecated.js:214:79
    at Array.forEach (<anonymous>)
    at Object.VariableDeclarator (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/no-deprecated.js:213:28)
Crash reports from real projects

Rule: no-deprecated

  • Message: Cannot read property 'name' of undefined Occurred while linting <text>:116
  • Path: reach/reach-ui/website/src/components/mdx-layout.js
  • Link
  114 |   }, []);
  115 |
> 116 |   let {
  117 |     // blerg es modules
  118 |     default: defaultReactExport,
  119 |     ...allReactExports
TypeError: Cannot read property 'name' of undefined
Occurred while linting <text>:116
    at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/no-deprecated.js:214:79
    at Array.forEach (<anonymous>)
    at Object.VariableDeclarator (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/no-deprecated.js:213:28)
    at updatedRuleInstructions.<computed> (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/util/Components.js:1016:45)
    at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/node-event-generator.js:293:26)
    at NodeEventGenerator.applySelectors (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/node-event-generator.js:322:22)
    at NodeEventGenerator.enterNode (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/node-event-generator.js:336:14)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions