New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 618235 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit 29 days ago
Closed: Jul 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug-Regression



Sign in to add a comment

after formatting jshint complains with Bad line breaking before ','.

Reported by chrissow...@gmail.com, Jun 8 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36

Steps to reproduce the problem:
1. open a js file in the sources tab and define many vars on one line. e.g like this:

var window_height = window.innerHeight, 
footer_elem = $("footer[data-role='contentinfo']"), 
margin_push = 0;

2. use the format bottom that looks like this:  {}
3. This will format the js into something that looks like this:

var window_height = window.innerHeight
  , 
footer_elem = $("footer[data-role='contentinfo']")
  , 
margin_push = 0;

This will cause jshint to warn with:
Comma warnings can be turned off with 'laxcomma'.
Bad line breaking before ','.

This just makes it hart to keep your code nice while your using workspaces as your IDE.

What is the expected behavior?
it should not put the comma on another line and should not indent it.

What went wrong?
I guess the start of the comma is seen as a new line making it go onto a new line.

Did this work before? N/A 

Chrome version: 50.0.2661.102  Channel: stable
OS Version: 10.0
Flash Version: Shockwave Flash 21.0 r0

i like cheese.
 
Just noticed that every time i hit the format button {}

it will add another line e.g: 
var window_height = window.innerHeight
  , 

footer_elem = $("footer[data-role='contentinfo']")
  , 

margin_push = 0;

If i use the format button again:

var window_height = window.innerHeight
  , 


footer_elem = $("footer[data-role='contentinfo']")
  , 


margin_push = 0;

and it keeps adding more lines for each time i use the format button.
also it messes with function semicolons:
this:

var click_actions = function() {
// stuff
};


to this:

var click_actions = function() {
// stuff
}
;
Labels: -OS-Windows -Type-Bug -Pri-2 OS-All Pri-1 Type-Bug-Regression
Owner: lushnikov@chromium.org
Status: Untriaged (was: Unconfirmed)
Putting the samples into a snippet and prettifying it reveals the issue. Confirmed in version 53.0.2756.0. As this is a regression marking it as a P1 issue.

Example input:
var window_height = window.innerHeight, 
footer_elem = $("footer[data-role='contentinfo']"), 
margin_push = 0;

var click_actions = function() {
// stuff
};


Example output:
var window_height = window.innerHeight
  , footer_elem = $("footer[data-role='contentinfo']")
  , margin_push = 0;
var click_actions = function() {// stuff
}
;
Labels: -Pri-1 Pri-3
Status: Assigned (was: Untriaged)
#1: this is fixed in Chrome 51.
#2: indeed, the semicolon is handled a little bit weird
#3: the behavior is expected, this is not a regression.
Status: Started (was: Assigned)
Started: https://codereview.chromium.org/2103323006/#
Status: Fixed (was: Started)

Sign in to add a comment