_spPageContextInfo can be used in a page in a SharePoint-Hosted app. You will get a "squigly" in the editor because it the _spPageContextInfo object is added to the page dynamically so, thus the editor is not aware of it.
Simple example using _spPageContextInfo :