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

Re: node:true masks 'use strict' outside function

Expand Messages
  • Douglas Crockford
    ... This is intended.
    Message 1 of 4 , Jul 14 11:09 AM
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, Marcos Zanona <marcos@...> wrote:
      >
      > 'use strict';
      > function test() {
      > return 2 + 2;}
      >
      > with node: false
      >
      > Error: Problem at line 1 character 1: Use the function form of 'use strict'.
      > 'use strict';
      >
      > with node: true
      >
      > ok

      This is intended.
    • mariuszn3
      As Douglas said, if you turn on node option it means that you re validating file which is CommonJS module, which will not be run in global scope but in it s
      Message 2 of 4 , Jul 14 12:36 PM
      • 0 Attachment
        As Douglas said, if you turn on 'node' option it means that you're validating file which is CommonJS module, which will not be run in global scope but in it's own sandbox (same if it was wrapped with anonymous function) that's why this warning shouldn't appear.

        Anyway it'll be good to have separate 'module' option for that, as CommonJS modules are not specific only to Node.js, but I'll brag about it later in another post :)

        --- In jslint_com@yahoogroups.com, Marcos Zanona <marcos@...> wrote:
        >
        > 'use strict';
        > function test() {
        > return 2 + 2;}
        >
        > with node: false
        >
        > Error: Problem at line 1 character 1: Use the function form of 'use strict'.
        > 'use strict';
        >
        > with node: true
        >
        > ok
        >
        >
        > [Non-text portions of this message have been removed]
        >
      • Marcos Zanona
        that was a good explanation, thanks so much it makes a lot of sense :) [Non-text portions of this message have been removed]
        Message 3 of 4 , Jul 14 12:53 PM
        • 0 Attachment
          that was a good explanation, thanks so much it makes a lot of sense :)


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