Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resharper: How to suppress inspection errors resulting from CSS hacks?

Tags:

css

resharper

The code in question is this:

/*fix ie transform offset*/
.adAffiliate.adDeclarationPosition-Right .adAffiliate-header
{
   *left: -20px    !important; /* IE 7 (IE6 also uses this, so put it first) */
   _left: -20px    !important; /* IE 6 */
    left: -20px\0/ !important; /* IE 8-9 */
}

enter image description here

As you can see, the first two lines get recognized as CSS hacks. They do not appear in the solution error list. I just want to get rid of the 3rd line appearing in the solution error list. Unfortunately, "ignore error" does not work across VS restarts. Is there a way to suppress this particular error? Maybe a special "ignore comment"?

This is the only CSS hack I have in 1000s of LOC. I just did not find a way out this time. And I am ok with this hack being there.

like image 961
usr Avatar asked Dec 27 '11 09:12

usr


2 Answers

Just change severity for this type of error by pressing Alt+Enter at the error highlighting, selecting Inspection options... and setting severity to Warning or lower.

This would force the issue to disappear from the Errors in Solution tool window which, obviously, shows only error-level issues. Mind you, inspection severity changes persist across VS restarts.

Of course, this solution implies that whenever your code happens to have a similar issue somewhere else, you won't be able to observe it through Errors in Solution: you'll either have to keep your eye on ReSharper issue highlighting in the code editor (a useful habit anyway) or inspect your code with ReSharper > Inspect > Code Issues in scope

like image 151
Jura Gorohovsky Avatar answered Sep 23 '22 22:09

Jura Gorohovsky


You call it CSS hacks, I call it invalid CSS (and the validator does it too). I recommend to use different css files included by i.e. conditional comments. This is more work, but it is much cleaner.

like image 38
Armin Avatar answered Sep 22 '22 22:09

Armin