Cleanups in formattingScanner.ts (#18599)
Cleanups in formattingScanner.ts (#18599)

* Cleanups in formattingScanner.ts

* Move switch statement to function

* Fix assertions

TukekeSoft/TypeScript,nojvek/TypeScript,RyanCavanaugh/TypeScript,donaldpipowitch/TypeScript,basarat/TypeScript,basarat/TypeScript,SaschaNaz/TypeScript,donaldpipowitch/TypeScript,alexeagle/TypeScript,kpreisser/TypeScript,Microsoft/TypeScript,Eyas/TypeScript,Microsoft/TypeScript,weswigham/TypeScript,weswigham/TypeScript,SaschaNaz/TypeScript,synaptek/TypeScript,Eyas/TypeScript,basarat/TypeScript,kpreisser/TypeScript,kitsonk/TypeScript,microsoft/TypeScript,basarat/TypeScript,donaldpipowitch/TypeScript,donaldpipowitch/TypeScript,minestarks/TypeScript,nojvek/TypeScript,alexeagle/TypeScript,SaschaNaz/TypeScript,kitsonk/TypeScript,Eyas/TypeScript,RyanCavanaugh/TypeScript,synaptek/TypeScript,microsoft/TypeScript,RyanCavanaugh/TypeScript,kitsonk/TypeScript,nojvek/TypeScript,SaschaNaz/TypeScript,nojvek/TypeScript,minestarks/TypeScript,synaptek/TypeScript,kpreisser/TypeScript,microsoft/TypeScript,Eyas/TypeScript,TukekeSoft/TypeScript,Microsoft/TypeScript,minestarks/TypeScript,alexeagle/TypeScript,TukekeSoft/TypeScript,synaptek/TypeScript,weswigham/TypeScript