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

2668Re: Can we please lose the trailing whitespace and "this" restriction?

Expand Messages
  • mathew
    Nov 14, 2011
    • 0 Attachment
      >
      > - Trailing whitespace and whitespace on blank lines is not allowed. Again,
      > my product consists of thousands of lines of JavaScript which are updated
      > daily by developers using an editor that doesn't strip trailing whitespace
      > by default.


      Someone else already suggested running a beautifier on the code. Here are
      three more solutions:

      1. Have the unit tests run an EOL whitespace check.

      2. Have a pre-commit hook in your version control system that checks for
      EOL whitespace and abandons the commit if it finds any.

      With those two approaches, developers will either learn to configure their
      text editors, or put up with the annoyance of fixing the files manually
      whenever they cause an error. If that's not acceptable for some reason,
      then:

      3. Have a pre-commit hook that strips EOL whitespace from the JavaScript
      for them.

      In fact, you could use jslint itself as a pre-commit hook, could you not?
      https://github.com/jrburke/dvcs_jslint/


      mathew
      --
      <URL:http://www.pobox.com/~meta/>


      [Non-text portions of this message have been removed]
    • Show all 22 messages in this topic