【发布时间】:2013-01-22 08:41:09
【问题描述】:
在将 Twitter Bootstrap 与其他 3rd-party JS 库一起使用时,我经常遇到这个问题,例如来自 WordPress 的“二十十二”主题的 html5.js,其中构建失败是因为 jshint(或以前版本中的 jslint我认为是 TB)由于第三方 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,因为这会导致以后升级出现问题;是我将第 3 方 JS 文件放入单独文件夹的唯一选择。
有没有办法让 jshint 或 TB 的构建过程忽略某些 JS 文件(也许通过一些我不知道的 .jshintrc 配置?)?
【问题讨论】:
标签: twitter-bootstrap build makefile jslint jshint