(function(Modules) {
  "use strict";

  Modules.SelectAll = function() {
    var that = this;

    that.start = function(element) {
      function addEventListener() {
        var selectAll = element.find('#select_all');
        if (selectAll != undefined) {
          selectAll.on('change', function(e) {
            var checked = selectAll.prop('checked');
            var checkboxes = $('.select-content-item');
            checkboxes.prop('checked', checked);
          });
        }
      }

      addEventListener();
    }
  };
})(window.GOVUKAdmin.Modules);

(function(Modules) {
  "use strict";

  Modules.SelectAll = function() {
    var that = this;

    that.start = function(element) {
      addEventListener();

      function addEventListener() {
        var selectAll = element.find('#select_all');
        if (selectAll != undefined) {
          selectAll.on('change', function(e) {
            var checked = selectAll.prop('checked');
            var checkboxes = $('.select-content-item');
            checkboxes.prop('checked', checked);
          });
        }
      }
    }
  };
})(window.GOVUKAdmin.Modules);

--- 
+++ 
@@ -5,8 +5,6 @@
     var that = this;
 
     that.start = function(element) {
-      addEventListener();
-
       function addEventListener() {
         var selectAll = element.find('#select_all');
         if (selectAll != undefined) {
@@ -17,6 +15,8 @@
           });
         }
       }
+
+      addEventListener();
     }
   };
 })(window.GOVUKAdmin.Modules);
Fix 'addEventListener' used before it was defined

In JavaScript, prior to ES6, variable and function declarations are hoisted to the top of a scope,
so it's possible to use identifiers before their formal declarations in code.

This can be confusing and some believe it is best to always declare variables and functions before using them.

Source: http://eslint.org/docs/rules/no-use-before-define
