Redundant re-assignments
The redefining of this variable in each file was flagged by the use-before-define ESLint rule via Coala/ESLintBear, and has been for a long time.
These assignments never worked as intended. However, the Petra code still worked because these assignments aren't actually needed.
Previously, the structure for each file was like so:
var PETRA = function(m){ m.something = …; … return m; }(PETRA);
The var declaration here is silently ignored as we cannot create PETRA. It already exists as a global variable by this point. And that's good, because if it didn't exist yet, the m.something assignment wouldn't work because you can't assign a property to undefined. Removing this redundant bit, leaves us with the following:
PETRA = function(m){ m.something = …; … return m; }(PETRA);
This creates an unnamed function, then immediately invokes it with the current object reference stored at PETRA, the function then augments that object, returns the same reference, and stores the same reference, in the same var. This is also a no-op.
Remove the assignment as well, and leave only the file-level function wrapper which avoids leaking variables to the global scope. This is known as the "IIFE" pattern. Same as before basically, but without the odd variable indirection which isn't normally part of this pattern, and wasn't helping us with anything.
(function(m){ m.something = …; … }(PETRA));
Ref #5524.
Redundant closures and aliasing
On suggestion by @elexis, I've also gone ahead and removed the closure and the variable alias, thus leaving us with just the part that matters. No boilerplate of any kind:
PETA.something = …;