This has been flagged by the `use-before-define` ESLint rule via Coala/ESLintBear for a long time.
These assignments don't work as intended. However, the overall code still worked because these assignments aren't actually needed.
Previously, the structure for each file was like so:
```lang=js
var PETRA = function(m){
m.something = …;
…
return m;
}(PETRA);
```
The `var` declaration wouldhere is silently ignore creation ofd as we cannot create `PETRA`,. because itIt 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, Removing that would lead to:leaves us with the following:
```lang=js
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 itthe assignment as well, and leave only the file-level function wrapper so that we don'twhich avoids leaking variables to the global scope. This is known as the "**[[ https://developer.mozilla.org/en-US/docs/Glossary/IIFE | IIFE ]]**" pattern. Same as before basically, but without the odd variable indirection which isn't normally part of this pattern, but without the odd variable indirection which isn't normally part of this patternand wasn't helping us with anything.
```lang=js
(function(m){
m.something = …;
…
}(PETRA));
```
Ref #5524.