Loading ...
Sorry, an error occurred while loading the content.

jslint feedback - coding style issues

Expand Messages
  • archie172
    Hi, I ve just starting using jslint and it s been very helpful. Thanks for making it available. For better or worse it combines what I d call correctness
    Message 1 of 4 , Jun 30, 2012
    • 0 Attachment
      Hi,

      I've just starting using jslint and it's been very helpful. Thanks for
      making it available.

      For better or worse it combines what I'd call "correctness checks" with
      "coding style checks". As everyone knows, coding style is a matter of
      (strong) opinions. jslint correctly addresses that by providing options.

      However, all of the "coding style" checks are not yet controlled by
      options. So far I've run across two that are tripping me up on some
      existing code.

      #1 We need an option for the required blocks check. This check seems to
      me to fall clearly into the "style" category. For example, the FreeBSD
      project coding style
      <http://www.freebsd.org/cgi/man.cgi?query=style&sektion=9> requires
      blocks to NOT be used for single statements:
      Space after keywords (if, while, for, return, switch). No braces (`{'
      and `}') are used for control statements with zero or only a single
      statement unless that statement is more than a single line in which case
      they are permitted.
      So can a new option blocks be added to control this check?

      #2 The rules for line wrapping indentation are not clearly defined and
      also not controllable via an option. jslint complains about this:
      if (firstReallyLongExpression
      || secondReallyLongExpression) {
      return;
      }
      instead expecting this:
      if (firstReallyLongExpression
      || secondReallyLongExpression) {
      return;
      }
      Again, this is clearly a coding style issue. It would be nice to have a
      wrapindent option to control it (default 8, change to 2 for the first
      example).

      Thanks again for a great tool.

      -Archie





      [Non-text portions of this message have been removed]
    • douglascrockford
      I recommend that you accept JSLint s advice.
      Message 2 of 4 , Jun 30, 2012
      • 0 Attachment
        I recommend that you accept JSLint's advice.
      • archie172
        ... Thanks for the recommendation :-) Not sure what you re saying though... Are you saying It s not a coding style issue or are you saying Everyone should
        Message 3 of 4 , Jun 30, 2012
        • 0 Attachment
          --- In jslint_com@yahoogroups.com, "douglascrockford" <douglas@...> wrote:
          >
          > I recommend that you accept JSLint's advice.
          >

          Thanks for the recommendation :-)

          Not sure what you're saying though...

          Are you saying "It's not a coding style issue" or are you saying "Everyone should accept my idea of coding style and if they don't then too bad" ?

          -Archie
        • douglascrockford
          ... I am saying that I recommend that you accept JSLint s advice. If you have evidence that your style results in a significantly reduced error rate, then I
          Message 4 of 4 , Jun 30, 2012
          • 0 Attachment
            --- In jslint_com@yahoogroups.com, "douglascrockford" <douglas@> wrote:

            > > I recommend that you accept JSLint's advice.

            > Thanks for the recommendation :-)

            > Not sure what you're saying though...

            > Are you saying "It's not a coding style issue" or are you saying "Everyone should accept my idea of coding style and if they don't then too bad" ?


            I am saying that I recommend that you accept JSLint's advice. If you have evidence that your "style" results in a significantly reduced error rate, then I will modify JSLint.
          Your message has been successfully submitted and would be delivered to recipients shortly.