I ran ESLint v5.16.0 locally on the `ai/petra/` directory, and then let `eslint --fix` automatically fix all errors,
except for `curly` which was the most common one and wasn't sure whether that's wanted or not it could fix.
Then I did some minor clean ups afterwards to either re-format or remove commented out codeIn addition to the automatic fixes, this commit also:
* Restores formatting of some commented-out code.
* Remove some redundant commented-out code.
* Fix the last remaining warning (`use-before-define` about the `PETRA` variable) which couldn't be fixed automatically. The previous structure for these files had some extra indirection with variable overrides that didn't actually work (as ESLint correctly flagged), and this turned out to be redundant anyhow, so I removed it.