我正在尝试使用 Angular 和 Browserify 构建一个项目。我的controllers.js
文件看起来像这样...
'use strict';
module.exports.testController = function($scope){
$scope.message = 'Controller 1';
console.log( 'hello' );
};
如您所料,这会产生三个 linting 错误。
- 使用 Strict 的函数形式
- “模块”未定义
- “控制台”未定义
我确实在这里找到了一些解决方案,它使 JSHint 能够通过jslint node: true
像这样放在文件顶部来处理 Node.js 文件
/*jslint node: true */
'use strict';
module.exports.testController = function($scope){
$scope.message = 'Controller 1';
console.log( 'hello' );
};
但是,这显然解决了太多问题;'console.log(...)' 仍应未定义。
有谁知道如何将 JSHint 与 Browserify 一起使用?