I got a bunch of these when loading a .ps1 file in VS Code:
$null should be on the left side of equality comparisons. (PSPossibleIncorrectComparisonWithNull)
Since I'm not a fan of the "if( $null -eq $someVar )" order, I'd like to suppress these warnings.
What I have tried:
I found this:
https://github.com/PowerShell/PSScriptAnalyzer#suppressing-rules
...which lead me to try to add the following near the top of my file:
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSPossibleIncorrectComparisonWithNull", Scope="Function", Target="*")]
...but clearly this is not how this is intended to be used, as the warnings don't go away...
Clicking on the "PowerShell" label on the bottom-right of the VS Code editor brings up a popup showing "Configure PS language-based setting", among other things, and in there, searching for "PSScriptAnalyzer", I found that I can enable/disable it altogether ("PowerShell > Script Analysis: Enable"). However, I'd like to disable just this one rule.
Anyone know where I'm supposed to do that?