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

no-typos: Cannot read property 'toLowerCase' of undefined #2870

Closed
AriPerkkio opened this issue Dec 7, 2020 · 0 comments
Closed

no-typos: Cannot read property 'toLowerCase' of undefined #2870

AriPerkkio opened this issue Dec 7, 2020 · 0 comments
Assignees

Comments

@AriPerkkio
Copy link
Contributor

Hello, no-typos rule seems to crash in certain cases. This issue was spotted by automated CI run - it is not blocking my development or anything. https://github.com/AriPerkkio/eslint-remote-tester/runs/1506856587?check_suite_focus=true

"eslint-plugin-react": "^7.21.5"
"extends": ["plugin:react/all"]

Minimal repro:

import React from 'react';

const A = { B: 'C' };

export default class MyComponent extends React.Component {
  [A.B] () {
    return null
  }
}
Crash reports from real-world examples

Rule: no-typos

Message: Cannot read property 'toLowerCase' of undefined
Path: zooniverse/front-end-monorepo/packages/lib-classifier/src/components/Classifier/components/TaskArea/components/Tasks/Tasks.js
Link

  }
}

class Tasks extends React.Component {
  [asyncStates.initialized] () {
    return null
  }

  [asyncStates.loading] () {
    return (<Paragraph>{counterpart('Tasks.loading')}</Paragraph>)
Error:
TypeError: Cannot read property 'toLowerCase' of undefined
Occurred while linting <text>:32
    at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/no-typos.js:155:41
    at Array.forEach (<anonymous>)
    at reportErrorIfLifecycleMethodCasingTypo (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/no-typos.js:154:32)
    at Object.MethodDefinition (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/no-typos.js:232:9)
    at updatedRuleInstructions.<computed> (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/util/Components.js:986:45)
    at /home/runner/work/eslint-remote-tester/eslint-remote-tester/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/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/home/runner/work/eslint-remote-tester/eslint-remote-tester/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (/home/runner/work/eslint-remote-tester/eslint-remote-tester/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants