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

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

Closed
morrighan opened this issue Aug 16, 2021 · 3 comments
Closed

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

morrighan opened this issue Aug 16, 2021 · 3 comments
Labels

Comments

@morrighan
Copy link

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.

@ljharb
Copy link
Member

ljharb commented Aug 16, 2021

What's your eslint config that allows that to parse?

@morrighan
Copy link
Author

I just using Airbnb's configuration.

@ljharb ljharb closed this as completed in c66c073 Aug 20, 2021
@ljharb ljharb added the bug label Aug 20, 2021
@morrighan
Copy link
Author

🙌🏻 @ljharb 🎉

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

2 participants