Opened 12 years ago

Closed 12 years ago

#1326 closed task (fixed)

Style Guide: semicolons after }

Reported by: ray Owned by: gogo
Priority: normal Milestone: 0.96
Component: Xinha Core Version: trunk
Severity: normal Keywords:


Im just JSlinting the code and it complains about missing semicolons behind }s.

I know in the core we (should) have semicolons after every function.

I am now requesting a decision how exactly to handle this in the core and plugins.

Change History (4)

comment:1 Changed 12 years ago by douglas

Well I'm definitely for them. I can see why they'd be left off, with regards to looks but the problem is demonstrated in this code block:

var foo = function() {
var bar = function() {

If I try to compress that into a single line I end up with the problem line:

} var bar = function() {

Which doesn't compile. If there was a semicolon after the brace, however, that would be valid javascript...

comment:2 Changed 12 years ago by mokhet

Please, always use them (semicolons) every time needed. Don't rely on automatic semicolons completion, it is IMO a buggy design in ECMAscript.

comment:3 Changed 12 years ago by nicholasbs

Agreed. We should always use semicolons after curly brackets.

On a related note, as far as I know Xinha doesn't have an official style guide, so I've started a stub page for one here?. I've put the guideline from this ticket on that page, as well as a couple of others (always use var and indent code using two spaces, which I believe is the current practice in most of the code base).

comment:4 Changed 12 years ago by ray

  • Resolution set to fixed
  • Status changed from new to closed

I have extended the wiki page to cover more cases, linked it from the Documentation page, and added a note in XinhaCore?.js (rev [1120])

I now close the ticket and declare the wiki page imperative ;)

Note: See TracTickets for help on using tickets.