royriojas / esformatter-jsx

esformatter plugin: format jsx files (or js files with Facebook React JSX Syntax)
MIT License
142 stars 25 forks source link

Nested JSX expressions keep indenting with formatJSXExpressions: false #53

Open ckknight opened 8 years ago

ckknight commented 8 years ago

With esformatter 0.9.0 and esformatter-jsx 4.1.2,

no plugins aside from esformatter-jsx, only option is "jsx":{"formatJSXExpressions": false}

Input:

function Component({ items }) {
    return (<ul>
        {items.map(item => (<li key={item.key}>
            {item.value}
        </li>))}
    </ul>);
}

First output:

function Component({ items }) {
    return (<ul>
              { items.map(item => (<li key={ item.key }>
                                    { item.value }
                                </li>)) }
            </ul>);
}

Second output:

function Component({ items }) {
    return (<ul>
              { items.map(item => (<li key={ item.key }>
                                                                  { item.value }
                                                              </li>)) }
            </ul>);
}

Third output:

function Component({ items }) {
    return (<ul>
              { items.map(item => (<li key={ item.key }>
                                                                                                { item.value }
                                                                                            </li>)) }
            </ul>);
}

This phenomenon was not observed when formatJSXExpressions was not set or set to true (the default).

royriojas commented 8 years ago

interesting, let me try to replicate and will comeback to you. thanks for reporting it.

tnrich commented 8 years ago

big +1

Kingles commented 8 years ago

@royriojas Hey Friend! Have you had any luck replicating this issue? Can I provide more information that may help diagnose?

royriojas commented 8 years ago

I did replicated it man, but I have being having a big lack of time nowadays. That said PR welcome! :)

This week will be still a little busy, if nothing is done until the end of the week, I will try to take a look at this and the other issues during the weekend. Thanks for your patient.

ljack commented 8 years ago

Ditto, sometimes it keeps adding the spaces and sometimes it's stop after certain amount of extra identing ;)


const ListComponent = React.createClass({
  render: function() {
    const value = this.props.data;
    return (<span>
                                                                                                                            {value.toString()}
                                                                                                                            </span>);
  }
});

scroll to the right ;) Where to start digging to fix this? EDIT: Hey! I've created public Cloud9 IDE with esformatter-jsx cloned from git, feel free to use it to nail down this issue ;) format-jsx.js is open in the editor here https://ide.c9.io/ljack1/esformatter-jsx

;)

royriojas commented 8 years ago

@ljack

I have added a small demo of esformatter-jsx that should help to fix the issue:

https://github.com/royriojas/esformatter-jsx/commit/f3be6e09300e0d299c482c95333dd17ea3b74d76

So basically there is a folder demo/ inside the repo and it has 2 folders one says entry and the other one says result.

I have added the code you posted there and when running the tool on it, even multiple times, it always yield to same result. So now I believe that might be a configuration issue. Can you share you esformatter configuration?

Also you can play with it to in the directory of the repo just run

npm run exec-demo

You can run it several times to see that the file keeps the formatting correctly.

ckknight commented 8 years ago

This is absolutely still happening. I have run your demo and get the broken result as soon as I copy demo/result/bug-9.js to demo/entry/bug-9.js and re-run.

tnrich commented 8 years ago

Any movement on this one? I'm still seeing it as well, although I'm not 100% positive my Atom plugin is using the latest version of esformatter-jsx.

royriojas commented 8 years ago

@tnrich as I said I cannot replicate this with the latest version. If you have some code that produce the issue will be nice to try to replicate. Let me know if you can share it.

ckknight commented 8 years ago

Definitely replicable:

11:10:01 ckknight@Camerons-MacBook-Pro(~/Development/royriojas)$ git clone https://github.com/royriojas/esformatter-jsx.git
Cloning into 'esformatter-jsx'...
remote: Counting objects: 1156, done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 1156 (delta 4), reused 0 (delta 0), pack-reused 1137
Receiving objects: 100% (1156/1156), 230.67 KiB | 0 bytes/s, done.
Resolving deltas: 100% (698/698), done.
Checking connectivity... done.
11:10:12 ckknight@Camerons-MacBook-Pro(~/Development/royriojas)$ cd esformatter-jsx/
11:10:14 ckknight@Camerons-MacBook-Pro(~/Development/royriojas/esformatter-jsx) (master)$ npm installnpm WARN deprecated lodash@1.2.1: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated graceful-fs@2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN prefer global marked@0.3.5 should be installed with -g

> spawn-sync@1.0.15 postinstall /Users/ckknight/Development/royriojas/esformatter-jsx/node_modules/spawn-sync
> node postinstall

esformatter-jsx@6.0.0 /Users/ckknight/Development/royriojas/esformatter-jsx
├─┬ babylon@6.1.21 
│ └─┬ babel-runtime@5.8.38 
│   └── core-js@1.2.6 
├─┬ changelogx@1.0.19 
│ ├─┬ clix@2.0.15 
│ │ ├─┬ clix-logger@0.1.3 
│ │ │ └── extend@3.0.0 
│ │ ├── extend@3.0.0 
│ │ ├─┬ glob-expand@0.1.0 
│ │ │ ├── glob@4.4.2 
│ │ │ └── lodash@1.2.1 
│ │ ├── jq-trim@0.1.2 
│ │ ├── optionator@0.6.0 
│ │ ├── os-homedir@1.0.1 
│ │ └── path-is-absolute@1.0.0 
│ ├── es6-promise@2.3.0 
│ ├─┬ git-toplevel@1.1.1 
│ │ └── es6-promise@3.2.1 
│ ├── github-url-from-git@1.4.0 
│ ├─┬ lodash.capitalize@3.1.2 
│ │ └── lodash._basetostring@3.0.1 
│ ├── marked@0.3.5 
│ ├── moment@2.13.0 
│ ├─┬ read-file@0.1.2 
│ │ ├── async@0.7.0 
│ │ ├── file-normalize@0.1.1 
│ │ └── graceful-fs@2.0.3 
│ ├── stringformat@0.0.5 
│ ├─┬ twig@0.8.9 
│ │ ├─┬ minimatch@3.0.0 
│ │ │ └─┬ brace-expansion@1.1.4 
│ │ │   ├── balanced-match@0.4.1 
│ │ │   └── concat-map@0.0.1 
│ │ └─┬ walk@2.3.9 
│ │   └── foreachasync@3.0.0 
│ └── write@0.1.1 
├─┬ esbeautifier@3.2.0 
│ ├─┬ clix@1.1.5 
│ │ ├─┬ chalk@1.1.0 
│ │ │ ├── ansi-styles@2.1.0 
│ │ │ ├── escape-string-regexp@1.0.3 
│ │ │ ├─┬ has-ansi@2.0.0 
│ │ │ │ └── ansi-regex@2.0.0 
│ │ │ ├── strip-ansi@3.0.0 
│ │ │ └── supports-color@2.0.0 
│ │ ├── extend@3.0.0 
│ │ ├─┬ optionator@0.5.0 
│ │ │ ├── deep-is@0.1.3 
│ │ │ ├── fast-levenshtein@1.0.6 
│ │ │ ├── levn@0.2.5 
│ │ │ ├── prelude-ls@1.1.2 
│ │ │ ├── type-check@0.3.1 
│ │ │ └── wordwrap@0.0.3 
│ │ └─┬ read-json-sync@1.1.0 
│ │   └── graceful-fs@3.0.8 
│ ├─┬ dispatchy@1.0.3 
│ │ └── is-null-like@1.0.2 
│ ├─┬ esformatter@0.7.1 
│ │ ├── debug@0.7.4 
│ │ ├─┬ disparity@2.0.0 
│ │ │ └── diff@1.4.0 
│ │ ├── espree@1.12.3 
│ │ ├─┬ glob@5.0.13 
│ │ │ ├─┬ inflight@1.0.4 
│ │ │ │ └── wrappy@1.0.1 
│ │ │ ├── inherits@2.0.1 
│ │ │ ├─┬ minimatch@2.0.8 
│ │ │ │ └─┬ brace-expansion@1.1.0 
│ │ │ │   ├── balanced-match@0.2.0 
│ │ │ │   └── concat-map@0.0.1 
│ │ │ ├─┬ once@1.3.2 
│ │ │ │ └── wrappy@1.0.1 
│ │ │ └── path-is-absolute@1.0.0 
│ │ ├── minimist@1.1.1 
│ │ ├── mout@0.11.0 
│ │ ├─┬ npm-run@1.1.1 
│ │ │ ├─┬ npm-path@1.0.2 
│ │ │ │ └─┬ which@1.1.1 
│ │ │ │   └─┬ is-absolute@0.1.7 
│ │ │ │     └── is-relative@0.1.3 
│ │ │ ├─┬ serializerr@1.0.1 
│ │ │ │ └── protochain@1.0.3 
│ │ │ └── sync-exec@0.5.0 
│ │ ├── resolve@1.1.6 
│ │ ├─┬ rocambole@0.6.0 
│ │ │ └── esprima@2.4.1 
│ │ ├─┬ rocambole-indent@2.0.4 
│ │ │ └─┬ debug@2.2.0 
│ │ │   └── ms@0.7.1 
│ │ ├─┬ rocambole-linebreak@1.0.1 
│ │ │ ├─┬ debug@2.2.0 
│ │ │ │ └── ms@0.7.1 
│ │ │ └── semver@4.3.6 
│ │ ├── rocambole-node@1.0.0 
│ │ ├── rocambole-token@1.2.1 
│ │ ├─┬ rocambole-whitespace@1.0.0 
│ │ │ ├─┬ debug@2.2.0 
│ │ │ │ └── ms@0.7.1 
│ │ │ └── repeat-string@1.5.2 
│ │ ├── semver@2.2.1 
│ │ ├── stdin@0.0.1 
│ │ ├── strip-json-comments@0.1.3 
│ │ ├── supports-color@1.3.1 
│ │ └─┬ user-home@2.0.0 
│ │   └── os-homedir@1.0.0 
│ ├─┬ esformatter-collapse-objects@0.4.1 
│ │ ├─┬ defaults-deep@0.2.2 
│ │ │ ├─┬ for-own@0.1.3 
│ │ │ │ └── for-in@0.1.4 
│ │ │ └─┬ is-plain-object@2.0.1 
│ │ │   └── isobject@1.0.1 
│ │ └─┬ rocambole@0.5.1 
│ │   └── esprima@2.4.1 
│ ├─┬ esformatter-eol-last@1.0.0 
│ │ └── string.prototype.endswith@0.2.0 
│ ├─┬ esformatter-jsx@1.3.0 
│ │ ├─┬ falafel-espree@1.1.0 
│ │ │ └── espree@2.1.0 
│ │ └─┬ js-beautify@1.5.10 
│ │   ├─┬ config-chain@1.1.9 
│ │   │ ├── ini@1.3.4 
│ │   │ └── proto-list@1.2.4 
│ │   ├─┬ mkdirp@0.5.1 
│ │   │ └── minimist@0.0.8 
│ │   └─┬ nopt@3.0.3 
│ │     └── abbrev@1.0.7 
│ ├── esformatter-quotes@1.0.2 
│ ├── extend@2.0.1 
│ ├─┬ file-entry-cache@1.0.1 
│ │ ├─┬ flat-cache@1.0.3 
│ │ │ ├─┬ del@1.2.0 
│ │ │ │ ├─┬ each-async@1.1.1 
│ │ │ │ │ ├── onetime@1.0.0 
│ │ │ │ │ └── set-immediate-shim@1.0.1 
│ │ │ │ ├─┬ globby@2.1.0 
│ │ │ │ │ ├─┬ array-union@1.0.1 
│ │ │ │ │ │ └── array-uniq@1.0.2 
│ │ │ │ │ ├── async@1.3.0 
│ │ │ │ │ ├─┬ glob@5.0.13 
│ │ │ │ │ │ ├─┬ inflight@1.0.4 
│ │ │ │ │ │ │ └── wrappy@1.0.1 
│ │ │ │ │ │ ├── inherits@2.0.1 
│ │ │ │ │ │ ├─┬ minimatch@2.0.8 
│ │ │ │ │ │ │ └─┬ brace-expansion@1.1.0 
│ │ │ │ │ │ │   ├── balanced-match@0.2.0 
│ │ │ │ │ │ │   └── concat-map@0.0.1 
│ │ │ │ │ │ ├─┬ once@1.3.2 
│ │ │ │ │ │ │ └── wrappy@1.0.1 
│ │ │ │ │ │ └── path-is-absolute@1.0.0 
│ │ │ │ │ └── object-assign@3.0.0 
│ │ │ │ ├── is-path-cwd@1.0.0 
│ │ │ │ ├─┬ is-path-in-cwd@1.0.0 
│ │ │ │ │ └─┬ is-path-inside@1.0.0 
│ │ │ │ │   └── path-is-inside@1.0.1 
│ │ │ │ ├── object-assign@2.1.1 
│ │ │ │ └─┬ rimraf@2.4.1 
│ │ │ │   └─┬ glob@4.5.3 
│ │ │ │     ├─┬ inflight@1.0.4 
│ │ │ │     │ └── wrappy@1.0.1 
│ │ │ │     ├── inherits@2.0.1 
│ │ │ │     ├─┬ minimatch@2.0.8 
│ │ │ │     │ └─┬ brace-expansion@1.1.0 
│ │ │ │     │   ├── balanced-match@0.2.0 
│ │ │ │     │   └── concat-map@0.0.1 
│ │ │ │     └─┬ once@1.3.2 
│ │ │ │       └── wrappy@1.0.1 
│ │ │ ├── graceful-fs@3.0.8 
│ │ │ └─┬ write@0.1.1 
│ │ │   └─┬ mkdirp@0.5.1 
│ │ │     └── minimist@0.0.8 
│ │ └─┬ lodash.assign@3.2.0 
│ │   ├─┬ lodash._baseassign@3.2.0 
│ │   │ └── lodash._basecopy@3.0.1 
│ │   ├─┬ lodash._createassigner@3.1.1 
│ │   │ ├── lodash._bindcallback@3.0.1 
│ │   │ ├── lodash._isiterateecall@3.0.9 
│ │   │ └── lodash.restparam@3.6.1 
│ │   └─┬ lodash.keys@3.1.2 
│ │     ├── lodash._getnative@3.9.1 
│ │     ├── lodash.isarguments@3.0.4 
│ │     └── lodash.isarray@3.0.4 
│ ├─┬ glob-expand@0.1.0 
│ │ ├─┬ glob@4.4.2 
│ │ │ ├─┬ inflight@1.0.4 
│ │ │ │ └── wrappy@1.0.1 
│ │ │ ├── inherits@2.0.1 
│ │ │ ├─┬ minimatch@2.0.8 
│ │ │ │ └─┬ brace-expansion@1.1.0 
│ │ │ │   ├── balanced-match@0.2.0 
│ │ │ │   └── concat-map@0.0.1 
│ │ │ └─┬ once@1.3.2 
│ │ │   └── wrappy@1.0.1 
│ │ └── lodash@1.2.1 
│ ├─┬ optionator@0.6.0 
│ │ ├── deep-is@0.1.3 
│ │ ├── fast-levenshtein@1.0.6 
│ │ ├── levn@0.2.5 
│ │ ├── prelude-ls@1.1.2 
│ │ ├── type-check@0.3.1 
│ │ └── wordwrap@0.0.3 
│ ├─┬ read-file@0.1.2 
│ │ ├── async@0.7.0 
│ │ ├── file-normalize@0.1.1 
│ │ └── graceful-fs@2.0.3 
│ ├── stringformat@0.0.5 
│ └─┬ write@0.2.0 
│   └─┬ mkdirp@0.5.1 
│     └── minimist@0.0.8 
├─┬ esformatter@0.9.4 
│ ├── acorn-to-esprima@2.0.8 
│ ├─┬ babel-traverse@6.9.0 
│ │ ├─┬ babel-code-frame@6.8.0 
│ │ │ ├─┬ babel-runtime@6.9.2 
│ │ │ │ └── core-js@2.4.0 
│ │ │ └── js-tokens@1.0.3 
│ │ ├─┬ babel-messages@6.8.0 
│ │ │ └─┬ babel-runtime@6.9.2 
│ │ │   └── core-js@2.4.0 
│ │ ├─┬ babel-runtime@6.9.2 
│ │ │ ├── core-js@2.4.0 
│ │ │ └── regenerator-runtime@0.9.5 
│ │ ├─┬ babel-types@6.9.1 
│ │ │ ├─┬ babel-runtime@6.9.2 
│ │ │ │ └── core-js@2.4.0 
│ │ │ ├── lodash@4.13.1 
│ │ │ └── to-fast-properties@1.0.2 
│ │ ├── babylon@6.8.0 
│ │ ├─┬ debug@2.2.0 
│ │ │ └── ms@0.7.1 
│ │ ├── globals@8.18.0 
│ │ ├─┬ invariant@2.2.1 
│ │ │ └── loose-envify@1.2.0 
│ │ └── lodash@4.13.1 
│ ├─┬ babylon@6.8.0 
│ │ └─┬ babel-runtime@6.9.2 
│ │   └── core-js@2.4.0 
│ ├── debug@0.7.4 
│ ├─┬ disparity@2.0.0 
│ │ ├── ansi-styles@2.2.1 
│ │ └── diff@1.4.0 
│ ├─┬ glob@5.0.15 
│ │ ├── inflight@1.0.5 
│ │ ├── inherits@2.0.1 
│ │ └── minimatch@2.0.10 
│ ├── minimist@1.2.0 
│ ├── mout@1.0.0 
│ ├─┬ npm-run@2.0.0 
│ │ ├── minimist@1.2.0 
│ │ ├── npm-path@1.1.0 
│ │ ├── npm-which@2.0.0 
│ │ ├─┬ serializerr@1.0.2 
│ │ │ └── protochain@1.0.3 
│ │ ├─┬ spawn-sync@1.0.15 
│ │ │ └── os-shim@0.1.3 
│ │ └── sync-exec@0.5.0 
│ ├── resolve@1.1.7 
│ ├─┬ rocambole@0.7.0 
│ │ └── esprima@2.7.2 
│ ├─┬ rocambole-indent@2.0.4 
│ │ ├── debug@2.2.0 
│ │ └── mout@0.11.1 
│ ├─┬ rocambole-linebreak@1.0.2 
│ │ ├── debug@2.2.0 
│ │ └── semver@4.3.6 
│ ├── rocambole-node@1.0.0 
│ ├── rocambole-token@1.2.1 
│ ├─┬ rocambole-whitespace@1.0.0 
│ │ ├── debug@2.2.0 
│ │ └── repeat-string@1.5.4 
│ ├── stdin@0.0.1 
│ ├── strip-json-comments@0.1.3 
│ ├── supports-color@1.3.1 
│ └── user-home@2.0.0 
├── esformatter-ignore@0.1.3 
├─┬ eslinter@3.2.1 
│ ├─┬ babel-eslint@4.1.8 
│ │ ├── acorn-to-esprima@1.0.7 
│ │ ├─┬ babel-core@5.8.38 
│ │ │ ├── babel-plugin-constant-folding@1.0.1 
│ │ │ ├── babel-plugin-dead-code-elimination@1.0.2 
│ │ │ ├── babel-plugin-eval@1.0.1 
│ │ │ ├── babel-plugin-inline-environment-variables@1.0.1 
│ │ │ ├── babel-plugin-jscript@1.0.4 
│ │ │ ├── babel-plugin-member-expression-literals@1.0.1 
│ │ │ ├── babel-plugin-property-literals@1.0.1 
│ │ │ ├─┬ babel-plugin-proto-to-assign@1.0.4 
│ │ │ │ └── lodash@3.10.1 
│ │ │ ├── babel-plugin-react-constant-elements@1.0.3 
│ │ │ ├── babel-plugin-react-display-name@1.0.3 
│ │ │ ├── babel-plugin-remove-console@1.0.1 
│ │ │ ├── babel-plugin-remove-debugger@1.0.1 
│ │ │ ├── babel-plugin-runtime@1.0.7 
│ │ │ ├─┬ babel-plugin-undeclared-variables-check@1.0.2 
│ │ │ │ └── leven@1.0.2 
│ │ │ ├── babel-plugin-undefined-to-void@1.1.6 
│ │ │ ├── babylon@5.8.38 
│ │ │ ├── bluebird@2.10.2 
│ │ │ ├── convert-source-map@1.2.0 
│ │ │ ├── debug@2.2.0 
│ │ │ ├─┬ detect-indent@3.0.1 
│ │ │ │ ├── get-stdin@4.0.1 
│ │ │ │ └── minimist@1.2.0 
│ │ │ ├── fs-readdir-recursive@0.1.2 
│ │ │ ├── globals@6.4.1 
│ │ │ ├─┬ home-or-tmp@1.0.0 
│ │ │ │ ├── os-tmpdir@1.0.1 
│ │ │ │ └── user-home@1.1.1 
│ │ │ ├─┬ is-integer@1.0.6 
│ │ │ │ └─┬ is-finite@1.0.1 
│ │ │ │   └── number-is-nan@1.0.0 
│ │ │ ├── js-tokens@1.0.1 
│ │ │ ├── json5@0.4.0 
│ │ │ ├── lodash@3.10.1 
│ │ │ ├── output-file-sync@1.1.1 
│ │ │ ├── path-exists@1.0.0 
│ │ │ ├── private@0.1.6 
│ │ │ ├─┬ regenerator@0.8.40 
│ │ │ │ ├─┬ commoner@0.10.4 
│ │ │ │ │ ├─┬ detective@4.3.1 
│ │ │ │ │ │ └── defined@1.0.0 
│ │ │ │ │ ├── glob@5.0.15 
│ │ │ │ │ ├── iconv-lite@0.4.13 
│ │ │ │ │ └── q@1.4.1 
│ │ │ │ ├─┬ defs@1.1.1 
│ │ │ │ │ ├─┬ alter@0.2.0 
│ │ │ │ │ │ └── stable@0.1.5 
│ │ │ │ │ ├── ast-traverse@0.1.1 
│ │ │ │ │ ├── breakable@1.0.0 
│ │ │ │ │ ├── esprima-fb@15001.1001.0-dev-harmony-fb 
│ │ │ │ │ ├── simple-fmt@0.1.0 
│ │ │ │ │ ├── simple-is@0.2.0 
│ │ │ │ │ ├── stringmap@0.2.2 
│ │ │ │ │ ├── stringset@0.2.1 
│ │ │ │ │ ├── tryor@0.1.2 
│ │ │ │ │ └─┬ yargs@3.27.0 
│ │ │ │ │   ├─┬ os-locale@1.4.0 
│ │ │ │ │   │ └─┬ lcid@1.0.0 
│ │ │ │ │   │   └── invert-kv@1.0.0 
│ │ │ │ │   ├── window-size@0.1.4 
│ │ │ │ │   └── y18n@3.2.1 
│ │ │ │ ├── esprima-fb@15001.1001.0-dev-harmony-fb 
│ │ │ │ └─┬ recast@0.10.33 
│ │ │ │   ├── ast-types@0.8.12 
│ │ │ │   └── esprima-fb@15001.1001.0-dev-harmony-fb 
│ │ │ ├─┬ regexpu@1.3.0 
│ │ │ │ ├── regenerate@1.3.0 
│ │ │ │ ├── regjsgen@0.2.0 
│ │ │ │ └─┬ regjsparser@0.1.5 
│ │ │ │   └── jsesc@0.5.0 
│ │ │ ├── repeating@1.1.3 
│ │ │ ├── shebang-regex@1.0.0 
│ │ │ ├── slash@1.0.0 
│ │ │ ├── source-map@0.5.6 
│ │ │ ├─┬ source-map-support@0.2.10 
│ │ │ │ └── source-map@0.1.32 
│ │ │ ├── trim-right@1.0.1 
│ │ │ └── try-resolve@1.0.1 
│ │ ├─┬ lodash.assign@3.2.0 
│ │ │ ├─┬ lodash._baseassign@3.2.0 
│ │ │ │ └── lodash._basecopy@3.0.1 
│ │ │ ├─┬ lodash._createassigner@3.1.1 
│ │ │ │ └── lodash._isiterateecall@3.0.9 
│ │ │ └── lodash.keys@3.1.2 
│ │ └─┬ lodash.pick@3.1.0 
│ │   ├── lodash._baseflatten@3.1.4 
│ │   ├── lodash._bindcallback@3.0.1 
│ │   ├── lodash._pickbyarray@3.0.2 
│ │   ├─┬ lodash._pickbycallback@3.0.0 
│ │   │ └── lodash._basefor@3.0.3 
│ │   └── lodash.restparam@3.6.1 
│ ├─┬ dispatchy@1.0.3 
│ │ └── is-null-like@1.0.3 
│ ├─┬ eslint@1.10.3 
│ │ ├─┬ chalk@1.1.3 
│ │ │ ├── has-ansi@2.0.0 
│ │ │ ├── strip-ansi@3.0.1 
│ │ │ └── supports-color@2.0.0 
│ │ ├─┬ concat-stream@1.5.1 
│ │ │ ├─┬ readable-stream@2.0.6 
│ │ │ │ ├── core-util-is@1.0.2 
│ │ │ │ ├── isarray@1.0.0 
│ │ │ │ ├── process-nextick-args@1.0.7 
│ │ │ │ ├── string_decoder@0.10.31 
│ │ │ │ └── util-deprecate@1.0.2 
│ │ │ └── typedarray@0.0.6 
│ │ ├── debug@2.2.0 
│ │ ├─┬ doctrine@0.7.2 
│ │ │ └── esutils@1.1.6 
│ │ ├── escape-string-regexp@1.0.5 
│ │ ├─┬ escope@3.6.0 
│ │ │ ├─┬ es6-map@0.1.3 
│ │ │ │ ├── d@0.1.1 
│ │ │ │ ├── es5-ext@0.10.11 
│ │ │ │ ├── es6-iterator@2.0.0 
│ │ │ │ ├── es6-set@0.1.4 
│ │ │ │ ├── es6-symbol@3.0.2 
│ │ │ │ └── event-emitter@0.3.4 
│ │ │ ├── es6-weak-map@2.0.1 
│ │ │ └─┬ esrecurse@4.1.0 
│ │ │   └── estraverse@4.1.1 
│ │ ├── espree@2.2.5 
│ │ ├── estraverse@4.2.0 
│ │ ├── estraverse-fb@1.3.1 
│ │ ├── esutils@2.0.2 
│ │ ├── glob@5.0.15 
│ │ ├─┬ inquirer@0.11.4 
│ │ │ ├── ansi-escapes@1.4.0 
│ │ │ ├── ansi-regex@2.0.0 
│ │ │ ├─┬ cli-cursor@1.0.2 
│ │ │ │ └─┬ restore-cursor@1.0.1 
│ │ │ │   └── exit-hook@1.1.1 
│ │ │ ├── cli-width@1.1.1 
│ │ │ ├── figures@1.7.0 
│ │ │ ├── lodash@3.10.1 
│ │ │ ├─┬ readline2@1.0.1 
│ │ │ │ ├── code-point-at@1.0.0 
│ │ │ │ ├── is-fullwidth-code-point@1.0.0 
│ │ │ │ └── mute-stream@0.0.5 
│ │ │ ├── run-async@0.1.0 
│ │ │ ├── rx-lite@3.1.2 
│ │ │ ├── string-width@1.0.1 
│ │ │ └── through@2.3.8 
│ │ ├─┬ is-my-json-valid@2.13.1 
│ │ │ ├── generate-function@2.0.0 
│ │ │ ├─┬ generate-object-property@1.2.0 
│ │ │ │ └── is-property@1.0.2 
│ │ │ ├── jsonpointer@2.0.0 
│ │ │ └── xtend@4.0.1 
│ │ ├─┬ is-resolvable@1.0.0 
│ │ │ └── tryit@1.0.2 
│ │ ├─┬ json-stable-stringify@1.0.1 
│ │ │ └── jsonify@0.0.0 
│ │ ├─┬ lodash.clonedeep@3.0.2 
│ │ │ └── lodash._baseclone@3.3.0 
│ │ ├─┬ lodash.merge@3.3.2 
│ │ │ ├── lodash._arraycopy@3.0.0 
│ │ │ ├── lodash._arrayeach@3.0.0 
│ │ │ ├── lodash._getnative@3.9.1 
│ │ │ ├── lodash.isarguments@3.0.8 
│ │ │ ├── lodash.isarray@3.0.4 
│ │ │ ├── lodash.isplainobject@3.2.0 
│ │ │ ├── lodash.istypedarray@3.0.6 
│ │ │ ├── lodash.keysin@3.0.8 
│ │ │ └── lodash.toplainobject@3.0.0 
│ │ ├─┬ lodash.omit@3.1.0 
│ │ │ ├── lodash._arraymap@3.0.0 
│ │ │ └─┬ lodash._basedifference@3.0.3 
│ │ │   ├── lodash._baseindexof@3.1.0 
│ │ │   ├── lodash._cacheindexof@3.0.2 
│ │ │   └── lodash._createcache@3.1.2 
│ │ ├── minimatch@3.0.0 
│ │ ├── object-assign@4.1.0 
│ │ ├── path-is-inside@1.0.1 
│ │ ├── shelljs@0.5.3 
│ │ ├── strip-json-comments@1.0.4 
│ │ ├── text-table@0.2.0 
│ │ └── xml-escape@1.0.0 
│ ├─┬ eslint-friendly-formatter@1.2.2 
│ │ └── extend@3.0.0 
│ ├── eslint-plugin-react@3.16.1 
│ ├── extend@3.0.0 
│ └─┬ optionator@0.5.0 
│   ├── deep-is@0.1.3 
│   ├── fast-levenshtein@1.0.7 
│   ├── levn@0.2.5 
│   ├── prelude-ls@1.1.2 
│   ├── type-check@0.3.2 
│   └── wordwrap@0.0.3 
├── extend@2.0.1 
├─┬ fresh-falafel@1.2.0 
│ ├── acorn@1.2.2 
│ ├── foreach@2.0.5 
│ ├── isarray@0.0.1 
│ └── object-keys@1.0.9 
├─┬ istanbul@0.3.22 
│ ├── abbrev@1.0.7 
│ ├── async@1.5.2 
│ ├─┬ escodegen@1.7.1 
│ │ ├── esprima@1.2.5 
│ │ ├── estraverse@1.9.3 
│ │ ├── optionator@0.5.0 
│ │ └─┬ source-map@0.2.0 
│ │   └── amdefine@1.0.0 
│ ├── esprima@2.5.0 
│ ├─┬ fileset@0.2.1 
│ │ └── glob@5.0.15 
│ ├─┬ handlebars@4.0.5 
│ │ ├── async@1.5.2 
│ │ ├── optimist@0.6.1 
│ │ ├── source-map@0.4.4 
│ │ └─┬ uglify-js@2.6.2 
│ │   ├── async@0.2.10 
│ │   ├── uglify-to-browserify@1.0.2 
│ │   └─┬ yargs@3.10.0 
│ │     ├── camelcase@1.2.1 
│ │     ├─┬ cliui@2.1.0 
│ │     │ ├─┬ center-align@0.1.3 
│ │     │ │ ├─┬ align-text@0.1.4 
│ │     │ │ │ ├─┬ kind-of@3.0.3 
│ │     │ │ │ │ └── is-buffer@1.1.3 
│ │     │ │ │ └── longest@1.0.1 
│ │     │ │ └── lazy-cache@1.0.4 
│ │     │ ├── right-align@0.1.3 
│ │     │ └── wordwrap@0.0.2 
│ │     ├── decamelize@1.2.0 
│ │     └── window-size@0.1.0 
│ ├─┬ js-yaml@3.4.5 
│ │ └─┬ argparse@1.0.7 
│ │   └── sprintf-js@1.0.3 
│ ├─┬ mkdirp@0.5.1 
│ │ └── minimist@0.0.8 
│ ├── nopt@3.0.6 
│ ├─┬ once@1.3.3 
│ │ └── wrappy@1.0.2 
│ ├─┬ supports-color@3.1.2 
│ │ └── has-flag@1.0.0 
│ ├─┬ which@1.2.9 
│ │ └── isexe@1.1.2 
│ └── wordwrap@1.0.0 
├─┬ js-beautify@1.6.2 
│ └─┬ config-chain@1.1.10 
│   ├── ini@1.3.4 
│   └── proto-list@1.2.4 
├─┬ mocha-runner@1.1.2 
│ ├─┬ chai@1.10.0 
│ │ ├── assertion-error@1.0.0 
│ │ └─┬ deep-eql@0.1.3 
│ │   └── type-detect@0.1.1 
│ ├── chai-fuzzy@1.6.1 
│ ├── extend@3.0.0 
│ ├─┬ file-entry-cache@1.2.4 
│ │ └─┬ flat-cache@1.0.10 
│ │   ├─┬ del@2.2.0 
│ │   │ ├─┬ globby@4.1.0 
│ │   │ │ ├── arrify@1.0.1 
│ │   │ │ └── glob@6.0.4 
│ │   │ ├── pify@2.3.0 
│ │   │ └─┬ pinkie-promise@2.0.1 
│ │   │   └── pinkie@2.0.4 
│ │   └── write@0.2.1 
│ ├─┬ mocha@2.5.3 
│ │ ├── commander@2.3.0 
│ │ ├── debug@2.2.0 
│ │ ├── escape-string-regexp@1.0.2 
│ │ ├─┬ glob@3.2.11 
│ │ │ └─┬ minimatch@0.3.0 
│ │ │   ├── lru-cache@2.7.3 
│ │ │   └── sigmund@1.0.1 
│ │ ├── growl@1.9.2 
│ │ ├─┬ jade@0.26.3 
│ │ │ ├── commander@0.6.1 
│ │ │ └── mkdirp@0.3.0 
│ │ ├── supports-color@1.2.0 
│ │ └── to-iso-string@0.0.2 
│ ├── obj-util@1.0.0 
│ ├─┬ sinon@1.17.4 
│ │ ├── formatio@1.1.1 
│ │ ├── lolex@1.3.2 
│ │ ├── samsam@1.1.2 
│ │ └── util@0.10.3 
│ ├── sinon-chai@2.8.0 
│ └── underscore@1.8.3 
├─┬ precommit@1.2.0 
│ └─┬ del@1.2.1 
│   ├─┬ each-async@1.1.1 
│   │ ├── onetime@1.1.0 
│   │ └── set-immediate-shim@1.0.1 
│   ├─┬ globby@2.1.0 
│   │ ├─┬ array-union@1.0.1 
│   │ │ └── array-uniq@1.0.2 
│   │ ├── async@1.5.2 
│   │ └── glob@5.0.15 
│   ├── is-path-cwd@1.0.0 
│   ├─┬ is-path-in-cwd@1.0.0 
│   │ └── is-path-inside@1.0.0 
│   ├── object-assign@3.0.0 
│   └─┬ rimraf@2.5.2 
│     └── glob@7.0.3 
├─┬ prepush@3.1.9 
│ └─┬ del@1.2.1 
│   ├─┬ globby@2.1.0 
│   │ ├── async@1.5.2 
│   │ └── glob@5.0.15 
│   └── object-assign@3.0.0 
├─┬ proxyquire@1.7.9 
│ ├─┬ fill-keys@1.0.2 
│ │ ├── is-object@1.0.1 
│ │ └── merge-descriptors@1.0.1 
│ └── module-not-found-error@1.0.1 
├─┬ read-json-sync@1.1.1 
│ └── graceful-fs@4.1.4 
└─┬ watch-spawn@1.0.6 
  ├─┬ commander@2.9.0 
  │ └── graceful-readlink@1.0.1 
  ├─┬ gaze@0.5.2 
  │ └─┬ globule@0.1.0 
  │   ├─┬ glob@3.1.21 
  │   │ ├── graceful-fs@1.2.3 
  │   │ └── inherits@1.0.2 
  │   ├── lodash@1.0.2 
  │   └── minimatch@0.2.14 
  └─┬ spawnly@1.0.1 
11:11:49 ckknight@Camerons-MacBook-Pro(~/Development/royriojas/esformatter-jsx) (master)$ npm run exec-demo

> esformatter-jsx@6.0.0 exec-demo /Users/ckknight/Development/royriojas/esformatter-jsx
> cd demo && node runner.js

/Users/ckknight/Development/royriojas/esformatter-jsx/demo/runner.js:45
    throw new Error( 'Expected ' + file + ' to reformat to the same result' );
    ^

Error: Expected bug-9.js to reformat to the same result
    at /Users/ckknight/Development/royriojas/esformatter-jsx/demo/runner.js:45:11
    at Array.forEach (native)
    at Object.<anonymous> (/Users/ckknight/Development/royriojas/esformatter-jsx/demo/runner.js:9:7)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:140:18)
    at node.js:1001:3

npm ERR! Darwin 15.0.0
npm ERR! argv "/Users/ckknight/.nvm/versions/node/v5.6.0/bin/node" "/Users/ckknight/.nvm/versions/node/v5.6.0/bin/npm" "run" "exec-demo"
npm ERR! node v5.6.0
npm ERR! npm  v3.6.0
npm ERR! code ELIFECYCLE
npm ERR! esformatter-jsx@6.0.0 exec-demo: `cd demo && node runner.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the esformatter-jsx@6.0.0 exec-demo script 'cd demo && node runner.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the esformatter-jsx package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     cd demo && node runner.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs esformatter-jsx
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls esformatter-jsx
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/ckknight/Development/royriojas/esformatter-jsx/npm-debug.log
royriojas commented 8 years ago

@ckknight not sure I follow your log,

So you basically are saying that as soon as you clone, pull master and run the demo it crashes?

Cause that's definitively not happening to me :(

Will try on another laptop to see if I can reproduce.

ckknight commented 8 years ago

Yes, immediately after cloning, running npm install, and then running npm run exec-demo, it errors.

royriojas commented 8 years ago

I was finally able to reproduce. I removed my npm modules and the issue start to happen. Not sure why.

In any case I see the reason now, there are some tags that js-beautify just leave as unformatted, span is one then. A workaround is to remove span from the list of unformatted in the htmlOptions section. But it won't be perfect. I will try to see if a proper fix can be implemented.

Thanks for helping to reproduce @ckknight