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

1998RE: [jslint] Style

Expand Messages
  • Rob Richardson
    Feb 28, 2011
      I have to disagree. If there was a consistent style taught by all and/or
      enforced by all, it would be reasonable to apply it universally to all in a
      tool we all use. However, since we're still in a land of artisans where
      delicately crafted recipes produce works of art, we can't limit matters of

      In cases where accurate execution or legibility of intent are in question,
      no doubt a standard should be adopted.

      In cases where corporate policy or personal preference has created habits
      that don't conform but also don't produce side-effects, the style is likely
      left to what makes the developer most comfortable and thus most productive.

      I'm very glad that JSLint carefully balances this with options such as
      "strict whitespace", "disallow ++ and --", "tolerate continue" that allow us
      to select our preference for conformity to the proposed styles.

      I wish there were more options for this. Resharper's formatting choice
      dialogs could be a great template here, though I grant creating an intuitive
      single-page interface to that depth is tricky.

      Because such options aren't available, I've begun to see competing tools
      emerge that fragment this space and confuse the community:

      Google Closure Linter

      JavaScript Compiler (http://jscompiler.org/)

      JavaScript Memory Leak Detector

      Microsoft Ajax Minifier (http://aspnet.codeplex.com/releases/view/40584)

      Ok, I'll concede the last is more about fixing the problems and less about
      teaching the developer not to make them.


      -----Original Message-----
      From: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] On
      Behalf Of Douglas Crockford
      Sent: Monday, February 28, 2011 11:39 AM
      To: jslint_com@yahoogroups.com
      Subject: [jslint] Style

      The place to express yourself in programming is in the quality of
      your ideas, and the efficiency of execution. The role of style is
      the same as in literature. A great writer doesn't express himself
      by putting the spaces before his commas instead of after, or by
      putting extra spaces inside his parentheses. A great writer will
      slavishly conform to some rules of style, and that in no way
      constrains his power to express himself creatively. See for
      example William Strunk's The Elements of Style

      I think this applies to programming as well. Conforming to a
      consistent style improves readability, and frees you to express
      yourself in ways that matter. JSLint here plays the part of a
      stern but benevolent editor, helping you to get the style right
      so that you can focus your creative energy where it is most needed.
    • Show all 5 messages in this topic