esformatter-jsx-indent
Esformatter-jsx-indent is a plugin for
esformatter
meant to format jsx files with a correct indent which have return
or declare
expression.
Turn this:
function render(){
const a = (
<span></span>
);
return (
<div>{ a }</div>
);
}
into:
function render(){
const a = (
<span></span>
);
return (
<div>{ a }</div>
);
}
Installation
$ npm install esformatter-jsx-indent --save-dev
Configuration
Add to your esformatter config file:
{
"root": true,
"plugins": [
"esformatter-jsx-indent"
],
"indent": {
// By default is 1
"JSXExpression": 1,
// By default is 0, recursively indent the sub jsx of the expression
// set 1 if without `esformatter-jsx`,
"JSXExpression.Recursive": 0
}
}