+;;; init-javascript.el  --- initialize javascript environment
+;;;
+;;; Commentary:
+;;;     Init the javascript environment
+;;;
+;;; Code:
+
 (require-package 'json-mode)
 (maybe-require-package 'js2-mode)
 (maybe-require-package 'ac-js2)

  (setq-default js2-mode-show-parse-errors nil
                js2-mode-show-strict-warnings nil)
  ;; ... but enable it if flycheck can't handle javascript
  (autoload 'flycheck-get-checker-for-buffer "flycheck")
  (defun sanityinc/disable-js2-checks-if-flycheck-active ()
    (unless (flycheck-get-checker-for-buffer)
      (set (make-local-variable 'js2-mode-show-parse-errors) t)
      (set (make-local-variable 'js2-mode-show-strict-warnings) t)))
  (add-hook 'js2-mode-hook 'sanityinc/disable-js2-checks-if-flycheck-active)

  (add-hook 'js2-mode-hook (lambda () (setq mode-name "JS2")))

  (setq-default
   js2-basic-offset preferred-javascript-indent-level



(provide 'init-javascript)

;;; init-javascript.el ends here
