0

There has been more than one occasion where I have mistakenly left a debugger keyword in a javascript file, and rather than finding these (or not) in code reviews, I'd quite like the Visual Studio build process to warn me about this so I remember to remove them - especially in a Release Mode build.

Likewise, maybe some warnings about console.log type of code.

How can I generate an MSBuild warning/error for this?

1 Answer 1

1

MSBuild compiler warning for javascript debugger statement

Just like as mentioned in the previously deleted answer, this issue should be more related to the Visual Studio extension rather than MSBuild.

You can use the Visual Studio extensions:

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.

enter image description here

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

Hope this helps.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you - I think this is the way to go with this problem and will no doubt give me a lot more useful warnings too

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.