JSX rules for JSCS
What Is It
Currently, this plugin provides a single rule to help enforce spacing inside of JSX expression containers.
Usage
To enable this plugin, your JSCS configuration would need to include:
{
"plugins": [ "jscs-jsx-rules" ]
}
Rules
disallowSpacesInsideJsxExpressionContainers
Disallows spaces after the opening curly brace and before the closing curly brace of a JSX expression container.
Type: Boolean
Value: true
Example
"disallowSpacesInsideJsxExpressionContainers": true
Valid
function render() {
return <div>{this.props.name}</div>;
}
Invalid
function render() {
return <div>{ this.props.name }</div>;
}
requireSpacesInsideJsxExpressionContainers
Requires that there are spaces after the opening curly brace and before the closing curly brace of a JSX expression container.
Type: Boolean
Value: true
Example
"requireSpacesInsideJsxExpressionContainers": true
Valid
function render() {
return <div>{ this.props.name }</div>;
}
Invalid
function render() {
return <div>{this.props.name}</div>;
}