esformatter-jsx-indent

1.0.1 • Public • Published

esformatter-jsx-indent

NPM version Build status Test coverage Downloads

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
  }
}

License

MIT

Package Sidebar

Install

npm i esformatter-jsx-indent

Weekly Downloads

4

Version

1.0.1

License

MIT

Last publish

Collaborators

  • wenjunxiao