 			'(javascript-jshint)))
 
   ;; enable eslint for flycheck when in web-mode
-  (if (equal web-mode-content-type "jsx")
-      (let ((flycheck-add-mode 'javascript-eslint 'web-mode))))
-
   (lambda ()
-            (when (equal web-mode-content-type "html")
-              ;; enable eslint flycheck
-              (flycheck-select-checker 'html-tidy)))
+    (when (equal web-mode-content-type "jsx")
+      (flycheck-select-checker 'javascript-eslint)))
+  
+  (lambda ()
+    (when (equal web-mode-content-type "html")
+      (flycheck-select-checker 'html-tidy)))
 
   ;; remove trailing whitespace
   (add-hook 'local-write-file-hooks
 	    (lambda()
 	      (delete-trailing-whitespace)
 	      nil))
-
-  ;; For Angular, enable M-x imenu for navigation
-  (eval-after-load 'web-mode
-  '(progn
-     ;; angular imenu
-     (add-to-list 'web-mode-imenu-regexp-list
-                  '(" \\(ng-[a-z]*\\)=\"\\([a-zA-Z0-9]*\\)" 1 2 "="))))
-
-  ;; 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 'js-mode-hook (lambda () (tern-mode t)))
-  (eval-after-load 'tern
-    '(progn
-       (require 'tern-auto-complete)
-       (tern-ac-setup)))
-
-  ;; function to kill ther tern process incase it stops responding
-  (defun delete-tern-process ()
-    (interactive)
-    (delete-process "Tern"))
-  )
+  )  
 (add-hook 'web-mode-hook  'gp-web-mode-hook)
 
 
 ;; adjust indents for json-mode to 2 spaces
-(defun my-json-mode-hook ()
+(defun gp-json-mode-hook ()
   "hooks for json-mode."
   (make-local-variable 'js-indent-level)
   (setq js-indent-level 2))
 
 (add-hook 'json-mode-hook 'gp-json-mode-hook)
 
-(gp-setup-web-mode-auto-list)
+(gp-setup-webdev-auto-list)
+(gp-tern-setup)
 
 (provide 'init-webdev)
 ;;; init-jsx.el ends here.


(require 'web-mode)

(defun gp-setup-web-mode-indent (n)
  (setq coffee-tab-width n) ; coffeescript
  (setq javascript-indent-level n) ; javascript-mode
  (setq js-indent-level n) ; js-mode


  ;; enable other modes that we need
  (subword-mode) ;; make things CamelCase aware
  ;;  (js2-minor-mode) ;; use js2 for highlighting
  (tern-mode) ;; use the tern server for refactoring and autocompletion
  (auto-complete-mode) ;; enable autocompleteion

  (setq indent-tabs-mode nil) ;; spaces instead of tabs
  (gp-setup-webdev-indent 2) ;; configure various indentation values

  (setq web-mode-enable-css-colorization t)

