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

2207Re: [jslint] possible erroneous warning due to multi-line layout (UNCLASSIFIED)

Expand Messages
  • Cheney, Edward A SSG RES USAR USARC
    May 12, 2011
      Classification: UNCLASSIFIED
      JSLint expects variables in a var keyword list to receive an extra indentation and then for this indentation level to be reverted one count at the conclusion of the keyword list. This is typically an easy practice follow, except for a few rare cases, such as (periods mean indentation):

      var a = function () {
      .var startTime = (function () {
      ..var d = "start";

      This is a pain because line 4 is the closing of a block that is on the same level of indentation as the blocks contents, which would typically be indented an additional count. An additional count of indentation would mean that the third line is indented 3 times instead of 2. Fortunately, JSLint does not care either way, but it is a huge pain in the ass to program software that beautifies in accordance with the white space algorithm. I say its a pain, because the change mentioned here is minor to demonstrate, but is a pain to put into an existing pattern and causes problems with complex object assignments in object literals.

      I do have one complaint/question. Why would you do this:

      var processTheForm;
      processTheForm = function () {...

      Instead you could do this:
      var processTheForm = function () {...

      These are identical to the interpreter. The only exception is if the function is an example of immediate invocation. Immediately invoked functions are the value and type they return instead of type object.

      Austin Cheney, CISSP
      Classification: UNCLASSIFIED
    • Show all 7 messages in this topic