【问题标题】:How to disable the Missing "use strict" statement by jshint in Sublime 3?如何在 Sublime 3 中禁用 jshint 缺少的“use strict”语句?
【发布时间】:2015-11-16 09:24:50
【问题描述】:

我已将"strict": false 添加到默认.jshintrc,但Sublime 3 仍然显示“缺少'use strict'”编辑器内警告。

任何帮助如何禁用此警告?

这是我完整的.jshintrc

{ // 详情:https://github.com/victorporof/Sublime-JSHint#using-your-own-jshintrc-options // 示例:https://github.com/jshint/jshint/blob/master/examples/.jshintrc // 文档:http://www.jshint.com/docs/ “浏览器”:是的, “驼峰”:是的, "devel": true, // 抑制 'console' 和 'alert' “esnext”:是的, //"eqnull": true, "expr": true, // 此选项抑制有关使用表达式的警告 “全局”:{ “_“: 错误的, “角”:假 }, “全球严格”:假, “严格”:错误, “预定义”:[“角度”], “引号”:是的, “智能标签”:是的, “尾随”:是的, “undef”:是的, “未使用”:真 }

【问题讨论】:

  • 上面的配置应该可以工作,如果你想在单个文件上禁用/启用严格模式,你可以写:/* jshint strict: false */
  • 好像other people have had this issue。你使用的是最新版本的 Sublime Linter 吗?

标签: javascript ide sublimetext3 jshint


【解决方案1】:

您需要转到 sublime text3 > 首选项 > 包设置 > jshint gutter > 设置 linting 首选项,并在此文件中的 .jshintrc 更改选项“strict”:“false”。然后重启你的 sublimeText3

【讨论】:

    【解决方案2】:

    正如 andlrc 所说,最简单的解决方案是指定 jshint 通过在文件顶部添加来跳过对该文件的严格限制:

    /* jshint strict: false */

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-22
      • 1970-01-01
      • 2018-09-14
      • 2013-08-27
      • 2015-05-13
      • 2016-07-11
      • 2015-11-29
      • 2012-02-15
      相关资源
      最近更新 更多