- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Brackets 1.2和扩展 brackets-jshint .这是我项目根目录中的 .jshintrc
:
{
'bitwise': true,
'boss': true,
'camelcase': true,
'curly': true,
'devel': true,
'eqeqeq': true,
'eqnull': true,
'expr': true,
'forin': true,
'iterator': false,
'latedef': true,
'multistr': false,
'nocomma': true,
'noarg': true,
'noempty': true,
'nonbsp': true,
'nonew': true,
'quotmark': 'single',
'undef': true,
'unused': true,
'globals': {
'$': true,
'document': true,
'jQuery': true,
'window': true
}
}
globals
选项无效,全局变量白名单仍在被 JSHint 警告。
我也试过这些:
globals: true
jquery: true
devel: true
但没有成功,$
、jquery
、window
、document
和alert
仍然被警告。
最佳答案
您必须在 .jshintrc
中将 single 引号替换为 double :) 这个答案很简短,所以我要添加一个小解释......
只需打开Debug » Developers tools 尝试验证一些 JavaScript 文件——您可以在调试控制台中看到
JSHint: error parsing /project/path/.jshintrc. Details: SyntaxError: Unexpected token '
负责读取 .jshintrc 的方法如下所示:
try {
config = JSON.parse(removeComments(content));
} catch (e) {
console.error("JSHint: error parsing " + file.fullPath + ". Details: " + e);
result.reject(e);
return;
}
JSON.parse 实现 http://www.ietf.org/rfc/rfc4627.txt - 根据 ECMAScript Specification '
没有位置。
来自 rfc 4627 描述 JSON 的唯一有效结构是
string = quotation-mark *char quotation-mark
char = unescaped /
escape (
%x22 / ; " quotation mark U+0022
%x5C / ; \ reverse solidus U+005C
%x2F / ; / solidus U+002F
%x62 / ; b backspace U+0008
%x66 / ; f form feed U+000C
%x6E / ; n line feed U+000A
%x72 / ; r carriage return U+000D
%x74 / ; t tab U+0009
%x75 4HEXDIG ) ; uXXXX U+XXXX
escape = %x5C ; \
quotation-mark = %x22 ; "
关于javascript - JSHint 全局选项在 .jshintrc 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29778409/
我正在使用 JSHint 在 Ionic 框架项目上检查我的 ES6 代码。我需要配置 list 才能使用 ES6。似乎当我运行 linter 时,通过使用一个小脚本,它不会读取配置文件 .jshin
我已经使用 JSLint 一段时间了,最近发现了 JSHint。阅读docs我了解到它可以使用 .jshintrc 文件进行配置,但我找不到是否可以使用 CLI 生成此文件。 . CLI 中是否有
如今,我使用 AMD 模块来组织我的 JS 是相当普遍的。所以我在每个项目中相应地配置了一个 .jshintrc: { "predef": [ "define",
将它们都放在 .jshintrc 中有什么区别和目的?当我想添加一个要忽略的变量时,我应该使用哪一个最好?我在 http://www.jshint.com/docs/options/ 中也找不到 'p
如何使用 .jshintrc 禁用项目中整个文件夹的 jshint 我在项目中的每个文件中都收到 jshint 错误。对于那个特定的项目,我不需要 jshint。 如何使用 .jshintrc 禁用
我正在使用 Brackets 1.2和扩展 brackets-jshint .这是我项目根目录中的 .jshintrc: { 'bitwise': true, 'boss': true
我的项目根目录中有一个 .jshintrc,配置如下: { "node": true, "smarttabs": true, "undef": true, "unused": true
我想在 Atom 编辑器上设置我的 JSHint。我应该将 .jshintrc 文件放在 Atom 中的什么位置? 这是我的 .jshintrc 文件 "globals": { "$": fa
用谷歌搜索了这个问题并找不到太多需要的信息。 我是 MEAN 世界的新手,第一次遇到 .bowerrc当我想将 bower_components 定位到除默认位置以外的某个指定文件夹时,请使用该文件。
我一直在各种 IDE 中开发许多小型 Web 开发项目,发现自己费力地输入 jslint 配置 header 以使 JSLint 静音。它的警告和错误都是有效的,我想在我的工作周期中保留 JSLint
我想在 mt .jshintrc 文件中禁用 jshint 的“失败”检查器。但是,检查器似乎默认启用。 http://jshint.com/docs/#options 默认情况下当您在 switch
我目前正在尝试将一个 grunt 项目迁移到一个 gulp 项目。实际上,在我的 gruntfile 中(对于 jshint 任务)是这样的: jshint:{ 选项: { 尾随:真, 邪恶:假, 缩
我不知道我是否遗漏了一些东西(可能),但我在 jshintrc 文件中尝试了 "esnext": true 和 "esnext": false ,但当我尝试使用时,我仍然在 Sublime Text
我正在使用 atom,我尝试了几个不同的 jshint 包,它们都给出了一个警告,上面写着 "template literal syntax' is only available in ES6 (us
我是 Cloud9 (c9.io) 的新用户,我花了一个上午的时间在网上搜索,但似乎无法找到有关 Cloud9 需要做什么才能识别我的 lint 配置文件的答案。它们目前在我的工作区/项目根目录中,但
我已将“Web Essentials”扩展安装到 Visual Studio 2013 中。我现在在“消息”部分下的“错误列表”窗口中收到 JSHint 警告。然而,它提示一些它认为没有定义的全局变量
我正在使用由 yeomen 的 Angular 生成器生成的一组文件。当涉及到通过 Git 进行版本控制时,这两个文件(“.jshintrc”和“karma.conf.js”)不包含在内,我想知道它们
我是一名优秀的程序员,十分优秀!