Reputation: 27803
Visual studio seems intent that my javascript code is bad, mostly because it has no knowledge of jquery or some plugins I am using. Therefore, every time I compile my product it gives me a lot of warnings, most of them are incorrect ($ is not defined, window is not defined, etc...).
I have /// <reference path="" />
tags setup in my javascript with intellisense working properly so I know these are just not real issues.
How can I disable these warnings?
edit to be clear, I need these disabled because it's causing 100+ warnings that are making me lose sight of REAL c# warnings.
Upvotes: 6
Views: 2453
Reputation: 1781
I had the exact same issue you were having: 100s of incorrect errors every save. For me the issue was with Chirpy, which was a prerequisite for another extension. For whatever reason on my end, Chirpy was not in my Extension Manager so it took me a while to find.
Check and see if you have it installed. If so disable JSHint.
Upvotes: 5
Reputation: 297
What about this one?
To disable a single compiler warning
With a project selected in Solution Explorer, on the Project menu, click Properties.
Click the Compile tab.
In the Warning configurations table, set the Notification value for the warning to None.
or perhaps this one
Tools > Options > Text Editor > JScript > Misc > Show errors as warnings( uncheck only this )
Upvotes: 0
Reputation: 973
Interesting I am not able to reproduce your issue in neither VS2010 "website" project nor vs2010 "web application" project. It has to do with the add-ons that you installed. Probably you may have a setting in that add-on (who ever is causing this) to disable warnings.
To me the warning sounds like the add-on (who ever is causing this) is not intelligent enough. Try the below changes and see if that helps.
Thanks,
Esen
Upvotes: 0
Reputation: 2921
try this and let me know if it works.
Enter the options through Tools > Options.
In the tree to the left, choose Text Editor > JScript > Miscellaneous. Uncheck "Show syntax errors".
Upvotes: 4
Reputation: 3167
I don't have a javascript source file on the computer I'm on at the moment to test this, but you may be able to use the #pragma command to disable particular warnings:
#pragma warning disable
will disable all warnings, and #pragma warning restore
will restore all warnings when placed at the end of your code block. You can also tell it to disable only particular warnings, such as #pragma warning disable 0219,0168
.
Upvotes: 1