dominickm / jupiter_broadcasting_mobile_community

The Jupiter Broadcasting community project.
Other
100 stars 17 forks source link

Flags for JSLint #19

Closed ShaneQful closed 11 years ago

ShaneQful commented 11 years ago

I generally run JSLint with the "++ and --" flag off because I don't think crockcroft's reasoning for it is as good as the rest of lint and I don't use really silly looking statements like i++ + ++i; which are bound to confuse people. I was wondering if anyone had any suggestions on standardized flag for jslint and if I could get permission to turn the "++ and --" flag on at least in the case of for loops where i += 1 looks silly other wise I'll probably use jquery each to get around the flag.

ghost commented 11 years ago

Personally I don't see a problem with it. It is valid Ecma 262 code.

Also you may want to validate your code with JShint instead which is a fork of jslint. It doesn't care about ++. The google guide doesn't mention it so I think it's assumed to be OK.

However, may I suggest that the expression should be on the left hand side as it is written in Ecma 262 standard:

PostfixExpression : LeftHandSideExpression [no LineTerminator here] ++

For example write it: i++; and not ++i;

You raise a good point about flags. I believe that the JSlint and JShint tool should assume browser, development(console etc...), jQuery and Ecmascript.

We should discuss what is acceptable flags further and include our decisions in the style guide for future contributors. I also think that we should create our own style convention and put it in the style guide.