jscs-dev/node-jscs

Trailing space with JSX (esnext) causes indent fix bug

unformatt opened this issue · 1 comments

OSX 10.10.5
node 5.6.0
jscs 2.10.1

jscs --fix with this code

const a = (
  <div> 
    <div/>
  </div>
)

and these settings

{
    "esnext": true,
    "disallowTrailingWhitespace": true,
}

The trailing space after the <div> causes the next line to be over indented. Here's the result:

const a = (
  <div> 
                                                                                                                                <div/>
  </div>
)

Every time you run jscs fix, the indent gets longer. Eventually jscs crashes when the indent get extremely long:

Security context: 0x11d58de3ac1 <JS Object>
    2: _fix [node_modules/jscs/lib/rules/disallow-trailing-whitespace.js:~81] [pc=0x2eb144609558] (this=0x2d79d4358ca9 <JS Object>,file=0x14aaf8575161 <JS Object>,error=0x14c1f0aecbd9 <an Object with map 0x2ab353e251b1>)
    3: /* anonymous */(aka /* anonymous */) [node_modules/jscs/lib/string-checker.js:136] [pc...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
[1]    54121 abort      node_modules/jscs/bin/jscs --fix

Appears to be fixed in 3.0