不要让"debugger"登录在Visual Studio 2012中 [英] Don't let check in with "debugger" in Visual Studio 2012

查看:119
本文介绍了不要让"debugger"登录在Visual Studio 2012中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个棘手的问题.

在我们的工作中,我们经常使用Js调试器,

In our work we use a lot the Js debuggers, I mean:

<script>
debugger;
</script>

问题是我们不应该将其签入TFS ,所以我想知道是否可以通过某种方式检查我的.js文件以查看是否存在调试器"并停止签入.

The problem is that we are not supposed to check-in it to the TFS, so I'm wondering if there is someway to check my .js files to see if there are "debuggers" and if so stop the check-in.

您有什么神奇的主意吗?

Do you have any magical idea?

谢谢大家!

推荐答案

有几个扩展为您提供了JSLint功能,该功能可以扫描javascript文件中的错误.我使用的两个是JSLint和JSHint.

There are several extensions that give you JSLint functionality that scans your javascript files for errors. Two that I have used are JSLint and JSHint.

用于Visual Studio的JSLint

用于Visual Studio的JSHint

我目前正在上面的链接中使用JSLint,它的效果很好.这是设置/和错误代码的一些屏幕截图.它不会阻止您进行检入,可能需要在TFS服务器上执行检入策略,但是在构建和保存时它将通知您错误.

I'm currently using the JSLint from the link above and it works great. Here are some screen shots of the settings / and my code with an error. It won't prevent you from checking in, there would likely need to be a check-in policy on the TFS server, but it will notify you of the error when you build and save.

这是您可以在其中指定如何显示JSLint验证消息的初始页面.您可以根据自己的喜好设置顶部的所有选项.您可以在构建和/或构建期间取消构建并运行lint进程.

Here is the initial page where you can specify how to display the JSLint validation messages. All of the options across the top you can set to your liking. You can cancel the build and run the lint process during save and / or build.

这些都是您可以打开或关闭的所有特定JSLint规则.我已突出显示您在问题中询问的调试器规则.

These are all of the specific JSLint rules that you can turn on or off. I have highlighted the debugger rule that you asked about in your question.

我在JavaScript中添加了一个调试器语句,以表明它会显示在错误窗口中.

I added a debugger statement to my javascript to show that it will show up in the error window.

捕获调试器语句并将其视为错误的错误窗口.

The error window which has caught the debugger statement and treated it as an error.

这篇关于不要让"debugger"登录在Visual Studio 2012中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆