- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Gulp 和 Browserify和 Hintify . standard way捕捉错误似乎是这样的:
browserify({
entries: 'app.js',
transform: [
// Some other transforms
plugins.hintify
]
// A bunch of other settings
}).bundle()
// Error handling
.on('error', function(error) {
util.beep(); // Util is gulp-util
util.log(error);
this.emit('end');
})
.pipe(...)
jshint
我得到这样的东西:
Users/me/Sites/project/client/scripts/app.js: line 11, col 23, Missing semicolon.
jshint
错误停止处理构建。我喜欢检查我的代码是否达到标准,但如果我在函数中有未使用的参数,它不应该阻止构建所有内容。
最佳答案
当前设置对我有用(配置与 here 相同):
var jshint = require('gulp-jshint');
var notify = require('gulp-notify');
var stylish = require('jshint-stylish')
...
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'))
//.pipe(jshint.reporter('fail')) // <- omit a fail reporter
...
...
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'))
.on('error', notify.onError({ message: 'JS hint fail'})) // <- pipe fail to notification
...
...
src\m\typings.js
line 0 col 0 ES5 option is now set per default
line 3 col 18 ['SUCCESS'] is better written in dot notation.
line 4 col 18 ['FAILURE'] is better written in dot notation.
line 5 col 18 ['UNSTABLE'] is better written in dot notation.
line 6 col 18 ['NOT_BUILT'] is better written in dot notation.
line 10 col 26 ['info'] is better written in dot notation.
line 11 col 26 ['success'] is better written in dot notation.
line 12 col 26 ['mark'] is better written in dot notation.
line 13 col 26 ['warn'] is better written in dot notation.
line 14 col 26 ['error'] is better written in dot notation.
line 15 col 26 ['debug'] is better written in dot notation.
line 16 col 26 ['none'] is better written in dot notation.
line 18 col 1 Unnecessary semicolon.
‼ 13 warnings
[10:08:32] src\m\typings.js
src\helper\scaffolding.helper.js
line 0 col 0 ES5 option is now set per default
line 65 col 61 Regular parameters cannot come after default parameters.
line 82 col 79 Expected an assignment or function call and instead saw an expression.
line 84 col 77 Regular parameters cannot come after default parameters.
line 90 col 39 Expected an assignment or function call and instead saw an expression.
line 91 col 21 Missing 'new' prefix when invoking a constructor.
line 91 col 60 Expected an assignment or function call and instead saw an expression.
line 105 col 46 Expected an assignment or function call and instead saw an expression.
line 106 col 29 Missing 'new' prefix when invoking a constructor.
line 106 col 103 Expected an assignment or function call and instead saw an expression.
line 3 col 12 'require' is not defined.
line 4 col 14 'require' is not defined.
line 5 col 11 'require' is not defined.
line 6 col 19 'require' is not defined.
line 7 col 10 'require' is not defined.
line 8 col 13 'require' is not defined.
line 9 col 13 'require' is not defined.
line 33 col 17 'none' is not defined.
line 42 col 13 'color' is not defined.
line 45 col 13 'color' is not defined.
line 48 col 13 'color' is not defined.
line 51 col 13 'color' is not defined.
line 54 col 13 'color' is not defined.
line 57 col 13 'color' is not defined.
line 60 col 13 'color' is not defined.
line 63 col 12 'color' is not defined.
line 85 col 25 'process' is not defined.
× 2 errors
‼ 25 warnings
[10:08:32] src\helper\scaffolding.helper.js
src\helper\scaffolding.server.js
line 0 col 0 ES5 option is now set per default
line 22 col 44 Expected an assignment or function call and instead saw an expression.
line 23 col 25 Missing 'new' prefix when invoking a constructor.
line 23 col 75 Expected an assignment or function call and instead saw an expression.
line 25 col 43 Expected an assignment or function call and instead saw an expression.
line 26 col 25 Missing 'new' prefix when invoking a constructor.
line 26 col 117 Expected an assignment or function call and instead saw an expression.
line 38 col 40 Expected an assignment or function call and instead saw an expression.
line 39 col 21 Missing 'new' prefix when invoking a constructor.
line 39 col 50 Expected an assignment or function call and instead saw an expression.
line 74 col 43 Expected an assignment or function call and instead saw an expression.
line 75 col 25 Missing 'new' prefix when invoking a constructor.
line 75 col 96 Expected an assignment or function call and instead saw an expression.
line 4 col 12 'require' is not defined.
line 5 col 13 'require' is not defined.
line 7 col 13 'require' is not defined.
‼ 16 warnings
[10:08:32] src\helper\scaffolding.server.js
src\server\publish.js
line 0 col 0 ES5 option is now set per default
line 17 col 17 Missing 'new' prefix when invoking a constructor.
line 17 col 54 Expected an assignment or function call and instead saw an expression.
line 29 col 21 Missing 'new' prefix when invoking a constructor.
line 29 col 44 Expected an assignment or function call and instead saw an expression.
line 3 col 12 'require' is not defined.
line 4 col 13 'require' is not defined.
line 7 col 14 'require' is not defined.
line 9 col 12 'require' is not defined.
line 10 col 10 'require' is not defined.
line 11 col 14 'require' is not defined.
line 12 col 13 'require' is not defined.
‼ 12 warnings
[10:08:32] gulp-notify: [Error running Gulp] JS hint fail
[10:08:32] src\server\publish.js
[10:08:32] Finished 'build' after 1.61 s
^1.12.0
关于gulp - 让 Browserify 转换 Hintify 继续出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33358582/
我有 带有插件系统的软件包。每个插件都是一个包 可以通过调用 use 方法来加载插件。并将插件导出作为参数传递: package = require('thePackage').use( requir
我知道 browserify 可以通过转换来使用 UMD 模块,但是当我想使用 browserify 构建一个库时,我该如何构建一个 UMD 模块?我可以使用任何转换吗? 最佳答案 如果您想使用 br
我有 third-party-module-b使用 third_party_module_a全局并拥有 require('third-party-module-a'); 在入口点。 问题是third-
我正在使用 Browserify 和 Grunt 来捆绑我们的 RendrJS webapp。我想分析这个包,看看它包含哪些模块,看看是否有多余的代码。这可能会发生,因为在 Rendr 中,一些 js
在 browserify 手册中,exclude part ,它给出了一个使用排除的例子: $ npm install jquery $ browserify -r jquery --standalo
在我的前端代码中,我使用 require()引入依赖于不同版本的 Underscore.js 的库。结果,当我使用 browserify 将所有内容捆绑在一起时,输出包含多个 Underscore 副
我正在使用 SpineJS(它导出一个 commonjs 模块),它需要在全局范围内可用,因为我在任何地方都使用它,但似乎我必须这样做 Spine = require('spine')在每个使用 Sp
假设我有一个模块,其源代码不是 ECMA 5(例如,它是 Coffescript 或 Typescript 或其他),并且以带有源映射的编译形式分发。如何将此源映射包含在 Browserify 包中?
我想创建一个独立的 browserify 包,它将导出的对象直接附加到 window 对象,而不是嵌套在附加到 window 的包装器对象下。 这样做,browserify 会忽略窗口: browse
当您将代码与 Browserify 捆绑在一起时,您使用的每个模 block 都内联在结果输出中,并标有其本地文件路径。因此,您可以在捆绑代码中看到文件路径字符串。 但理论上,这些字符串都可以重写为“
我需要将一些模块强制放入我的包中,因为它们是通过如下代码动态需要的: var moduleName = "someModule"; var myModule = require(moduleName)
我正在尝试通过使用 browserify-shim 将某些模块从包中填充出来来重构使用 Browserify 的库。具体来说,该库使用 require("codemirror") 但我想提供一个不包含
我在新项目中使用了 browserify。到目前为止,它运行得非常好。 不过我有一个大问题。如何分别调试每个 js 文件。它将所有文件捆绑在一起,并在发生错误时指向捆绑。 我正在使用 chrome 和
来自 watchify 的文档, 我懂了: When creating the browserify instance b you MUST set these properties in the c
使用 browserify,我试图要求一个已经浏览器化的模块,但是包无法解析已经浏览器化的模块。 例如,我有一个文件 bundle-1.js 已与命令捆绑在一起: browserify -r ./bu
关于 external requires 的 Browserify 文档部分展示如何使包中的模块可用于全局环境: browserify -r through -r duplexer -r ./my-f
现在,gulp-browserify is no longer supported我正在寻找一个简单的教程,如何现在使用带有 gulp 的 browserify。 This似乎是一种选择,但它仍然相当
我是 Nodejs 和 browserify 的新手。我从这个开始link . 我有文件 main.js,其中包含此代码 var unique = require('uniq'); var data
我最近从 Grunt 过渡到 Gulp。但是我还是个新手,谁能告诉我使用 Gulp-Browserify 和只使用 Browserify 之间的区别是什么? 我知道 Gulp-Browserify 现
描述:我有 package.json 和 bower.json 用于处理我当前架构中的依赖项。我应该在哪个文件中添加 “jquery.slider(版本 1.1.0)”以及怎么做? 目前,我已经在 b
我是一名优秀的程序员,十分优秀!