I have JSLint and Atom-beautify (which I believe is a front-end for jsbeautify) installed in Atom. Generally that's pretty dandy, except that they bicker about ternary operators (I think that's the right term). So if I do
var theWindow = (thisObj instanceof Panel)? thisObj: new Window("palette", thisObj.scriptTitle, undefined, {resizeable: true});
JSBeautify will make it look like:
var theWindow = (thisObj instanceof Panel)
? thisObj
: new Window("palette", thisObj.scriptTitle, undefined, {resizeable: true});
And then JSLint will complain about bad line breaking.
I had a look at the JSBeautify documentation and the JSLint documentation, but I can't find any option for changing either's behaviour regarding ternary syntax. Can anyone tell me how I can change it so I don't have to manually reformat all my ternary functions every time I beautify my code? I don't mind which one prevails as long as they agree.
Simply add option "preserve_ternary_lines":true
in .jsbeautifyrc
The ternary line expression will no more be broken.
Related change from atom-beautify: atom-beautify/pull/726