求教:jshint只有部分规则起作用
发布于 9 年前 作者 justyeh 5399 次预览 最后一次回复是 9 年前 来自 问答
//js语法检查规则 { “boss”: true, //控制“缺少分号”的警告 “curly”: true, //循环或者条件语句必须使用花括号包围 “undef”: true, //变量未定义 “unused”: true, //变量未使用 “eqeqeq”: true, //强制使用三等号 “latedef”: “nofunc”,//禁止定义之前使用变量,忽略 function 函数声明 “lastsemic”: true, //检查一行代码最后声明后面的分号是否遗漏 “jquery”: true, //定义全局变量 “node”: true } //代码 (function(){ var a function add(a,b){ if(a == b){ return false; } a = a + c; return a; } })();
//控制台输出 E:\grunt_test>grunt my_task_jshint Running “jshint:build” (jshint) task
src/error.js 3 | var a ^ Missing semicolon.
1 error in 1 file Warning: Task “jshint:build” failed. Use --force to continue.
Aborted due to warnings.
很明细我的代码不止一处错误,但jshint只能检查出 boss 条件
4 回复
它提示你
Use --force to continue.@dd1994 ,你好,刚入门,能详细解释一下吗?
Use --force to continue应该是 grunt 发出的 warning 那个 grunt 就别用了吧,已经被时代抛弃了。你在命令行直接用 jshint 试试,或者去用 webstorm@dd1994 谢谢解答!