twitter-bootstrap – 有jshint忽略某些文件时,建立Twitter Boot
发布时间:2020-12-17 20:54:05  所属栏目:安全  来源:网络整理 
            导读:我经常遇到这个问题,当使用Twitter的Bootstrap与其他第三方的JS库,如html5.js从WordPress的“二十二”主题,其中构建失败,因为jshint(或以前的TB版本的jslint我认为)抛出一个由于第三方JS库导致的错误,例如 n#########################################
                
                
                
            | 
 我经常遇到这个问题,当使用Twitter的Bootstrap与其他第三方的JS库,如html5.js从WordPress的“二十二”主题,其中构建失败,因为jshint(或以前的TB版本的jslint我认为)抛出一个由于第三方JS库导致的错误,例如 
  
  
  n##################################################
Building Bootstrap...
##################################################n
js/html5.js: line 3,col 122,Expected ')' to match '(' from line 3 and instead
  saw ','.
js/html5.js: line 3,col 140,Expected an identifier and instead saw ')'.
js/html5.js: line 4,col 101,eval is evil.
js/html5.js: line 6,col 369,Confusing use of '!'.
js/html5.js: line 6,col 422,Confusing use of '!'.
js/html5.js: line 7,col 61,'b' is already defined.
js/theme-customizer.js: line 26,col 26,Use '===' to compare with ''.
7 errors
make: *** [build] Error 1我想避免修改第三方库或修改TB的Makefile,因为这将导致未来的升级问题;是我唯一的选择,将第三方JS文件放入一个单独的文件夹。 有没有办法让jshint或TB的构建过程忽略某些JS文件(可能通过一些.jshintrc配置我不知道?)? 解决方法
 所以有一个选项忽略jshint中的文件,但它不是在.jshintrc中设置,而是一个单独的文件.jshintignore,这是有道理的。但是,虽然jshint将在项目的子目录中查找.jshintrc,.jshintignore需要位于项目根目录中。所以使用Twitter Bootstrap,.jshintrc在/ js中,而.jshintignore需要放在/。 
  
  所以解决问题在我的问题/.jshintignore需要包含: js/html5.js js/theme-customizer.js 就是这样! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! | 
