src/RuntimePwsh2.0/CodeChecker.ps1

[CmdletBinding()]
param([string]$scriptText)

$errors = $null
[System.Management.Automation.PSParser]::Tokenize($scriptText, [ref]$errors) | Out-Null
$errors