From 21d5ddbc52953ed0a6768888da62c65e61ce54a9 Mon Sep 17 00:00:00 2001 From: scott2449 Date: Sat, 20 Oct 2012 22:08:37 -0400 Subject: [PATCH] jslint happy default and comma first :smile: --- JsFormat.sublime-settings | 2 +- jsbeautifier/__init__.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/JsFormat.sublime-settings b/JsFormat.sublime-settings index 3a95bea..a3a9732 100644 --- a/JsFormat.sublime-settings +++ b/JsFormat.sublime-settings @@ -1,6 +1,6 @@ { "brace_style": "collapse", - "jslint_happy": false, + "jslint_happy": true, "keep_array_indentation": false, "max_preserve_newlines": 4, "preserve_newlines": true, diff --git a/jsbeautifier/__init__.py b/jsbeautifier/__init__.py index 8ec98ff..3528b07 100644 --- a/jsbeautifier/__init__.py +++ b/jsbeautifier/__init__.py @@ -475,6 +475,7 @@ def get_next_token(self): if self.wanted_newline and \ self.last_type != 'TK_OPERATOR' and\ self.last_type != 'TK_EQUALS' and\ + self.last_type != 'TK_COMMA' and\ not self.flags.if_line and \ (self.opts.preserve_newlines or self.last_text != 'var'): self.append_newline() @@ -1011,8 +1012,9 @@ def handle_comma(self, token_text): self.append(' ') else: if self.flags.mode == 'OBJECT': - self.append(token_text) self.append_newline() + self.append(token_text) + self.append(' ') else: # EXPR or DO_BLOCK self.append(token_text)