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

1362Re: [jslint] Re: Enhancement Request: Identifier length restriction

Expand Messages
  • Cheney, Edward A SSG RES USAR USARC
    Jul 6, 2010
      > For me personally it is exceedingly annoying to encounter code that
      > has nothing but 1 to 2 char identifiers and no or poor documentation.

      Beautify the code using a JSLint white space compatible algorithm. Then
      perform the following replacements:

      For functions:
      - Manually change the name of the function where it is declared
      - Find and replace on the following after ensure that each of the
      following is not in quotes:
      + space + variable name + left paren
      ex: " a("
      + space + variable name + comma
      ex: " a,"
      + space + variable name + right paren
      ex: " a)"
      + space + variable name + right square brace
      ex: " a]"
      + space + variable name + right curly brace
      ex: " a}"

      For arrays:
      - Same as above except find and replace on a left square brace
      instead of opening paren

      For object literals
      - Same as above except find and replace on a left curly brace instead
      of opening paren

      For value literals (strings and numbers)
      - Same as above except find and replace on a space, instead of an
      opening paren

      You could write a JS application to do all of this for you. This would
      be the best bet because you are not going to influence how other people
      write code their own code. The only code that you can effectively
      influence is the code under your own responsibility.

      Austin Cheney
    • Show all 11 messages in this topic