Skip to content

Crash with using private method of class-based component #3043

Closed
@morrighan

Description

@morrighan

Environments

- Version
Node.js 14.17.3
ESLint 7.32.0
eslint-plugin-react 7.24.0

Error stack

TypeError: Cannot read property 'toLowerCase' of undefined
Occurred while linting $PROJECT_DIR/$COMPONENT_FILE:$LINE_NUMBER
    at $PROJECT_DIR/node_modules/eslint-plugin-react/lib/rules/no-typos.js:181:50
    at Array.forEach (<anonymous>)
    at reportErrorIfLifecycleMethodCasingTypo ($PROJECT_DIR/node_modules/eslint-plugin-react/lib/rules/no-typos.js:180:25)
    at Object.MethodDefinition ($PROJECT_DIR/node_modules/eslint-plugin-react/lib/rules/no-typos.js:256:9)
    at updatedRuleInstructions.<computed> ($PROJECT_DIR/node_modules/eslint-plugin-react/lib/util/Components.js:1016:45)
    at $PROJECT_DIR/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit ($PROJECT_DIR/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector ($PROJECT_DIR/node_modules/eslint/lib/linter/node-event-generator.js:293:26)
    at NodeEventGenerator.applySelectors ($PROJECT_DIR/node_modules/eslint/lib/linter/node-event-generator.js:322:22)

Reproducible code

import React from 'react';

export default class Editor extends React.Component {
	#somethingPrivate() {
		// ...
	}

    render() {
		const { value = '' } = this.props;

		return (
			<textarea>
				{value}
			</textarea>
		);
	}
}

Situation description

The whole ESLint watching process has crashed by only just make the method private; write # symbol.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ljharb@morrighan

        Issue actions

          Crash with using private method of class-based component · Issue #3043 · jsx-eslint/eslint-plugin-react