最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to disable JSLint ES6 errors with const and let in Adobe Brackets? - Stack Overflow

programmeradmin8浏览0评论

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.

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.

Share Improve this question edited May 12, 2017 at 12:58 Paul Sweatte 24.6k7 gold badges131 silver badges268 bronze badges asked May 22, 2016 at 19:53 bdbdbdbdbdbd 5036 silver badges16 bronze badges 7
  • I've got a theory, but it is too much work to test it. Put code in your question, not pictures of code. – Quentin Commented May 22, 2016 at 19:58
  • 1 The error is saying that you shouldn't 'use strict'; within the global scope. This is a mon remendation 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." – Jonathan Lonowski Commented May 22, 2016 at 19:59
  • @Quentin the entire code is: pastebin./GcU3vKsE – bdbdbd Commented May 22, 2016 at 20:10
  • @JonathanLonowski so I should wrap my entire code into a function? Even when using it in NodeJS? – bdbdbd Commented May 22, 2016 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." – Jonathan Lonowski Commented May 22, 2016 at 20:19
 |  Show 2 more ments

1 Answer 1

Reset to default 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

  • brackets: .brackets.json

  • brackets: jslint extension - main.js

  • brackets wiki: Preferences Overview

  • PreferencesManager - Brackets API

发布评论

评论列表(0)

  1. 暂无评论