5

I have Googled and looked through this site everywhere, but I can only find answers for JSHint instead of JSLint. To get rid of the "use function form of use strict" error I add in /*jslint node: true */. But to disable errors for using const and let I can't seem to find anything. JSHint has esversion: 6 but this doesn't work on JSLint.

screenshot

Paul Sweatte
  • 22,871
  • 7
  • 116
  • 244
bdbdbd
  • 350
  • 2
  • 11
  • I've got a theory, but it is too much work to test it. Put code in your question, not pictures of code. – Quentin May 22 '16 at 19:58
  • 1
    The error is saying that you shouldn't `'use strict';` within the global scope. This is a common recommendation as it can enable strict mode for the entire application, possibly breaking other scripts being used. Also: ["*JSLint will recognize the good parts of ES6 with the `es6` option.*"](http://www.jslint.com/help.html#es6) – Jonathan Lonowski May 22 '16 at 19:59
  • @Quentin the entire code is: http://pastebin.com/GcU3vKsE – bdbdbd May 22 '16 at 20:10
  • @JonathanLonowski so I should wrap my entire code into a function? Even when using it in NodeJS? – bdbdbd May 22 '16 at 20:12
  • 1
    @bdbdbd If you're using Node.js, then no. Node will already wrap your files in a function to create its "[*module scope*](https://nodejs.org/dist/latest-v6.x/docs/api/globals.html#globals_global_objects)." – Jonathan Lonowski May 22 '16 at 20:19
  • So apparently JSLint does not support ES6? – Bergi May 22 '16 at 21:20
  • It does. Maybe it's an outdated version. – 1983 May 23 '16 at 01:02

1 Answers1

5

Use the Preferences API:

var PreferencesManager = brackets.getModule("preferences/PreferencesManager");

prefs = PreferencesManager.getExtensionPrefs("jslint");

prefs.set("options.es6", true);

Or set it one of the config files:

  • the brackets.json file of the user directory

or:

  • the .brackets.json file of the project directory:

As such:

{
    "jslint.options": {
        "es6": true
     }
}

References

Paul Sweatte
  • 22,871
  • 7
  • 116
  • 244