Don't let check in with “debugger” in Visual Studio 2012

爷,独闯天下 提交于 2019-12-24 07:05:11

问题


I got a tricky question.

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

<script>
debugger;
</script>

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?

Thank you all!


回答1:


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.

JSLint for Visual Studio

JSHint for Visual Studio

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.

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.

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.

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.



来源:https://stackoverflow.com/questions/25447038/dont-let-check-in-with-debugger-in-visual-studio-2012

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!