title: Using jshint with AngularJS and Controllers
body: <p>I am trying to incorporate JSHint into my build process. The app that I'm building uses AngularJS. Currently, I have a conflict that I'm not sure how to resolve. When I build my app, I get a JSHint error that says:</p>
  
  <pre><code>   src\app\app.js
        3 |var myApp = angular.module('myApp', []);
               ^ Redefinition of 'myApp'.
  
  &gt;&gt; 1 error in 2 files
  Warning: Task "jshint:source" failed. Use --force to continue.
  </code></pre>
  
  <p>I get this error because in my .jshintrc file, I have the following:</p>
  
  <p>"predef": ["angular", "myApp"],</p>
  
  <p>If I remove "myApp", I get a different error that says:</p>
  
  <pre><code>src\app\account\welcome.html.js
     3 |myApp.controller('WelcomeController', ['$scope', function($scope) {
        ^ 'myApp' is not defined.
  
  1 error in 2 files
  </code></pre>
  
  <p>The reason I am defining a controller like that is because according to the <a href="https://docs.angularjs.org/guide/controller" rel="noreferrer">AngularJS documentation</a>, you should not define controllers in the global scope. As you can see, its like I'm damned if I do, and damned if I don't. How do I follow the AngularJS best recommendations while still including JSHint in my build process?</p>
  
  <p>Thank you!</p>