Linters,禁止使用 jquery

Linters, forbid the use of jquery

我们正在开发一个带有网络视图的 android 应用程序。我们将为该 webviews 配备第三方开发人员,但我们希望禁止他们使用某些库来强制使用我们自己的库。在这种情况下,我们要禁止使用 jQuery,以及其他禁止。理想情况下,这种禁止应该集成到 linter 工具中。我对 linters 了解不多,所以如果你能指导我一些关于使用什么 linter 工具或任何其他类型的帮助,那将非常有帮助。

我不知道最好的方法,也许正在寻找一个正则表达式来找到 src="*jquery*" 并将此搜索集成到 jshint 补丁中?

谢谢!

jQuery 在其源代码中定义了两个全局变量。您可以使用 jsHint rule undef to disallow the use of undeclared variables in the code. This would mean that if they used $ or jQuery in their code then it would fail jsHint linting. For you to be able to use globals yourself you would then need to use the globals rule 给自己一个允许的全局变量的白名单。