How to disable javascript warning compilation in VS 2010?

Visual studio seems intentional that my javascript code is bad, mainly because it does not know jquery or some of the plugins that I use. Therefore, every time I compile my product, it gives me a lot of warnings, most of them are incorrect ($ not defined, window not defined, etc.).

I have /// <reference path="" /> tags in my javascript with intellisense working correctly, so I know that these are just unrealistic problems.

How to disable these warnings?

edit, to be clear, I need these disabled because it triggers over 100 warnings that make me lose sight of REAL C # warnings.

+6
source share
5 answers

I had the same problem you encountered: 100 with error errors. For me, the problem was in Chirpy, which was a prerequisite for another extension. For some reason at my end, Chirpy was not in my Extension Manager, so it took me a while to find.

Check and check if it is installed. If so disable JSHint.

  • Tool → Options
  • Chirpy → JSHint
  • Uncheck the box: Run the JS prompt
+5
source

try this and let me know if it works.

Enter the options through Tools> Options.

In the tree on the left, select Text Editor> JScript> Miscellaneous. Uncheck the box next to "Show syntax errors."

+4
source

I do not have the javascript source file on the computer that I am currently working on to verify this, but you can use the #pragma command to disable certain warnings:

#pragma warning disable will disable all warnings, and #pragma warning restore restore all warnings placed at the end of your code block. You can also tell him to disable only certain alerts, such as #pragma warning disable 0219,0168 .

http://abhijitjana.net/2010/08/27/how-to-suppress-complier-warning-using-pragma-warning-directives-in-visual-studio/

+1
source

Interestingly, I can not reproduce your problem in either the VS2010 website project or the vs2010 website application. This is due to the add-ons you installed. Perhaps you may have a setting in this add-on (who ever calls this) to turn off alerts.

For me, the warning sounds like an addition (who ever calls it) is not intelligent enough. Try the following changes and see if this helps.

  • If you have a master page, try moving the jquery * .js script link from the master page to your actual page
  • Move all your javascript code to js file instead of writing it to script tag

Thanks,

Esen

0
source

How about this?

To disable the 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 maybe this

Tools> Options> Text editor> JScript> Miscellaneous> Show errors as warnings (uncheck this box only)

0
source

Source: https://habr.com/ru/post/914234/


All Articles