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

Re: jslint as a CommonJS module

Expand Messages
  • AJ ONeal
    And it would also be nice to have - a simple example jslint commandline utility for Node.JS - other examples for other interpreters - some example javascript
    Message 1 of 3 , Mar 29, 2011
      And it would also be nice to have

      - a simple example jslint commandline utility for Node.JS
      - other examples for other interpreters
      - some example javascript files showing a suggested use for JSLINT and
      it's options


      Example of an Example:

      /*global global:false */
      var MYMODULE;
      (function () {
      "use strict";
      /*jslint bitwise: true*/

      function floor(num) {
      /*jslint bitwise: false*/
      return num >> 0;
      }

      MYMODULE = stringToZero
      if (global.module) {
      global.module = MYMODULE;
      }
      }());

      AJ ONeal

      On Tue, Mar 29, 2011 at 2:41 PM, AJ ONeal <coolaj86@...> wrote:

      > Doug,
      >
      > I saw that someone tried to push a commit with the CommonJS export and it
      > was rejected.
      >
      > However, since your JSLINT file can't be exported as a module there are at
      > least 6 different node-xyz-jslint projects on github with over 24 forks.
      > Can we discuss a simple change that would make your jslint a module and
      > hence lead to less fragmentation in the community?
      >
      > Here's a decent, valid JavaScript solution that makes no crazy assumptions:
      >
      > var global = global || (function () { return this; }());
      > (function () {
      > "use strict";
      >
      > //
      > // your current code as is
      > //
      >
      > if (global.window) {
      > global.window.JSLINT = JSLINT;
      > }
      > if (global.module) {
      > global.module.exports = JSLINT;
      > }
      > }());
      >
      > Do you have a better suggestion?
      >
      > What would be acceptable to you?
      >
      > AJ ONeal
      >


      [Non-text portions of this message have been removed]
    • AJ ONeal
      Mr. Crockford, What s your stance on this? Are you opposed to making any changes at all or is this something that you re considering? ... [Non-text portions of
      Message 2 of 3 , Apr 5, 2011
        Mr. Crockford,

        What's your stance on this?

        Are you opposed to making any changes at all or is this something that
        you're considering?


        On Tue, Mar 29, 2011 at 2:41 PM, AJ ONeal <coolaj86@...> wrote:

        > Doug,
        >
        > I saw that someone tried to push a commit with the CommonJS export and it
        > was rejected.
        >
        > However, since your JSLINT file can't be exported as a module there are at
        > least 6 different node-xyz-jslint projects on github with over 24 forks.
        > Can we discuss a simple change that would make your jslint a module and
        > hence lead to less fragmentation in the community?
        >
        > Here's a decent, valid JavaScript solution that makes no crazy assumptions:
        >
        > var global = global || (function () { return this; }());
        > (function () {
        > "use strict";
        >
        > //
        > // your current code as is
        > //
        >
        > if (global.window) {
        > global.window.JSLINT = JSLINT;
        > }
        > if (global.module) {
        > global.module.exports = JSLINT;
        > }
        > }());
        >
        > Do you have a better suggestion?
        >
        > What would be acceptable to you?
        >
        > AJ ONeal
        >


        [Non-text portions of this message have been removed]
      Your message has been successfully submitted and would be delivered to recipients shortly.