运行 jshint 时解析配置文件时出错
Error parsing config file when running jshint
我在尝试 运行 jshint 时总是得到以下输出:
C:\Users\foo\Source\
λ jshint -c .glados-jshintrc gulpfile.js
ERROR: Can't parse config file: .glados-jshintrc
Error:SyntaxError: Unexpected token
我的 jshint 配置文件非常简单,我直接从 jshint 文档中复制了它:
{
"undef": true,
"unused": true,
"predef": [ "MY_GLOBAL" ]
}
任何能够实现此功能的想法都将不胜感激。
我发现问题是由 Visual Studio 引起的。当我在 VS 中创建 jshint 配置文件时,它创建为带有前缀 BOM(字节顺序标记)的 UTF-8。这似乎破坏了配置文件解析器。为了解决这个问题,我访问了文件菜单:
File -> Advanced Save Options
并相应地更改了编码:
我在尝试 运行 jshint 时总是得到以下输出:
C:\Users\foo\Source\
λ jshint -c .glados-jshintrc gulpfile.js
ERROR: Can't parse config file: .glados-jshintrc
Error:SyntaxError: Unexpected token
我的 jshint 配置文件非常简单,我直接从 jshint 文档中复制了它:
{
"undef": true,
"unused": true,
"predef": [ "MY_GLOBAL" ]
}
任何能够实现此功能的想法都将不胜感激。
我发现问题是由 Visual Studio 引起的。当我在 VS 中创建 jshint 配置文件时,它创建为带有前缀 BOM(字节顺序标记)的 UTF-8。这似乎破坏了配置文件解析器。为了解决这个问题,我访问了文件菜单:
File -> Advanced Save Options
并相应地更改了编码: