JSHint 无法 find/interpret .jshintrc 文件
JSHint unable to find/interpret .jshintrc file
我正在使用我用来创建项目的 WebStorm IDE and created my angularJS project. I am also using grunt
, and am using grunt-contrib-jshint
. I had some options preconfigured in my .jshintrc
file which were already in the angular-seed 存储库:
{
"strict": "global",
"node": true,
"globals": {
// Angular
"angular": false,
// Angular mocks
"module": false,
"inject": false,
// Jasmine
"jasmine": false,
"describe": false,
"beforeEach": false,
"afterEach": false,
"it": false,
"expect": false,
// Protractor
"browser": false,
"element": false,
"by": false
}
}
当我在终端上 运行 grunt jshint
时,我收到很多错误,所有这些错误都与选项设置不正确时出现的错误有关。然而,当我复制这些选项并将它们放入我的 Gruntfile
时,一切都非常有效。
jshint: {
files: ['Gruntfile.js', 'app/**/*.js'],
options: {
// options here to override JSHint defaults
node: true,
globals: {
// Angular
angular: false,
// Angular mocks
module: false,
inject: false,
// Jasmine
jasmine: false,
describe: false,
beforeEach: false,
afterEach: false,
it: false,
expect: false,
// Protractor
browser: false,
element: false,
by: false
}
}
},
基本上,我的理解是 jshint
不是从 .jshintrc
文件中读取选项。我该如何解决这个问题?
将 jshint
任务的选项 jshintrc
设置为 true
。
If set to true, no config will be sent to JSHint and JSHint will search for .jshintrc files relative to the files being linted.
我正在使用我用来创建项目的 WebStorm IDE and created my angularJS project. I am also using grunt
, and am using grunt-contrib-jshint
. I had some options preconfigured in my .jshintrc
file which were already in the angular-seed 存储库:
{
"strict": "global",
"node": true,
"globals": {
// Angular
"angular": false,
// Angular mocks
"module": false,
"inject": false,
// Jasmine
"jasmine": false,
"describe": false,
"beforeEach": false,
"afterEach": false,
"it": false,
"expect": false,
// Protractor
"browser": false,
"element": false,
"by": false
}
}
当我在终端上 运行 grunt jshint
时,我收到很多错误,所有这些错误都与选项设置不正确时出现的错误有关。然而,当我复制这些选项并将它们放入我的 Gruntfile
时,一切都非常有效。
jshint: {
files: ['Gruntfile.js', 'app/**/*.js'],
options: {
// options here to override JSHint defaults
node: true,
globals: {
// Angular
angular: false,
// Angular mocks
module: false,
inject: false,
// Jasmine
jasmine: false,
describe: false,
beforeEach: false,
afterEach: false,
it: false,
expect: false,
// Protractor
browser: false,
element: false,
by: false
}
}
},
基本上,我的理解是 jshint
不是从 .jshintrc
文件中读取选项。我该如何解决这个问题?
将 jshint
任务的选项 jshintrc
设置为 true
。
If set to true, no config will be sent to JSHint and JSHint will search for .jshintrc files relative to the files being linted.