 
 (setq-default js2-global-externs '("require"))
 
-(defun gp-js2-mode-hook ()
+(defun gp/js2-mode-hook ()
   "Setup js2-mode as I like it."
   (tern-mode)
   (subword-mode)
   ;;(rainbow-identifiers-mode)
   (origami-mode)
   (setq indent-tabs-mode nil)
-  (gp-setup-webdev-indent 2)
+  (gp/setup-webdev-indent 2)
   (setq js2-bounce-indent-p t)
   (setq js2-highlight-external-variables nil)
   (setq js2-mode-show-parse-errors nil)
+  (add-hook 'flycheck-mode-hook #'gp/use-eslint-from-node-modules)
   (flycheck-add-mode 'javascript-eslint 'js2-mode)
-  (flycheck-select-checker 'javascript-eslint)
   (setq-default flycheck-disabled-checkers
                 (append flycheck-disabled-checkers '(json-jsonlist)))
   (setq-default flycheck-disabled-checkers

                    '(" \\(ng-[a-z]*\\)=\"\\([a-zA-Z0-9]*\\)" 1 2 "="))))  
  )

(defun gp-tern-setup ()
  "Setup tern.
Don't forget to create a .tern-project file in the root of your
javascript project.
http://ternjs.net/doc/manual.html#configuration"
  (add-hook 'js2-mode-hook (lambda () (gp-js2-mode-hook)))

  ;; function to kill ther tern process incase it stops responding
  (defun delete-tern-process ()

  (setq sass-indent-ffset n) ; sass-mode
  )

(defun gp/setup-webdev-auto-list ()
  "Configure file mode mapping for web-mode and js2-mode."
  (add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
  (add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
