Skip to content

Latest commit

 

History

History
37 lines (28 loc) · 650 Bytes

no-duplicated-chains.md

File metadata and controls

37 lines (28 loc) · 650 Bytes

Prohibits the duplication of long chains like this.props.user.name

Long chains of object calls should be assigned to a variable or destructured if used multiple times.

Rule Details

The following pattern is considered a warning:

render() {
	return (<div className={this.props.className}>
		<p>{this.props.text}</p>
	<div>)
}

The following patterns are not considered warnings:

render() {
	const { className, text } = this.props;

	return (<div className={className}>
		<p>{text}</p>
	<div>)
}
render() {
	const props = this.props;

	return (<div className={props.className}>
		<p>{props.text}</p>
	<div>)
}