Skip to content

TypeError: Cannot read property 'type' of null #3220

Closed
@amiramix

Description

@amiramix

Linting this file:

// testrule.jsx
const trackLink = () => {};
const getAnalyticsUiElement = () => {};

const onTextButtonClick = (e, item) => trackLink([, getAnalyticsUiElement(item), item.name], e);

Throws the following error:

Oops! Something went wrong! :(

ESLint: 8.9.0

TypeError: Cannot read property 'type' of null
Occurred while linting /Users/g/work/raptor-ui/packages/rcom-raptor-ui_article/src/components/testrule.jsx:4
Rule: "react/jsx-key"
    at /Users/g/work/raptor-ui/node_modules/eslint-plugin-react/lib/rules/jsx-key.js:111:110
    at Array.filter (<anonymous>)
    at ArrayExpression, JSXElement > JSXElement (/Users/g/work/raptor-ui/node_modules/eslint-plugin-react/lib/rules/jsx-key.js:111:94)
    at ruleErrorHandler (/Users/g/work/raptor-ui/node_modules/eslint/lib/linter/linter.js:1107:28)
    at /Users/g/work/raptor-ui/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/g/work/raptor-ui/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/g/work/raptor-ui/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
    at NodeEventGenerator.applySelectors (/Users/g/work/raptor-ui/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
    at NodeEventGenerator.enterNode (/Users/g/work/raptor-ui/node_modules/eslint/lib/linter/node-event-generator.js:340:14)

Using the following deps:

    "@babel/core": "7.17.4",
    "@babel/eslint-parser": "7.17.0",
    "eslint": "8.9.0",
    "eslint-plugin-cypress": "^2.12.1",
    "eslint-plugin-import": "^2.25.4",
    "eslint-plugin-jest": "^26.1.1",
    "eslint-plugin-json": "^3.1.0",
    "eslint-plugin-jsx-a11y": "^6.5.1",
    "eslint-plugin-react": "^7.28.0",
    "eslint-plugin-react-hooks": "^4.3.0",
  }

This worked in version 7.28.0 so seems to be broken in the new version released today 7.29.0

Metadata

Metadata

Assignees

No one assigned

    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