   :hook (cmake-mode . cmake-font-lock-activate))
 
 ;; Node
-(defun find-js-format-style ()
-  (let* ((package-json-dir
-          (locate-dominating-file (buffer-file-name) "package.json"))
-
-         (package-json
-          (if package-json-dir
-              (json-read-file (concat
-                               (expand-file-name package-json-dir)
-                               "package.json"))
-            nil))
-
-         (devDependencies
-          (if package-json
-              (alist-get 'devDependencies package-json)
-            nil))
-
-         (formatter-styles
-          '((prettier            . prettier)
-            (eslint              . eslint)
-            (esformatter         . esfmt)
-            (babel-preset-airbnb . airbnb)
-            (standard            . standard))))
-
-    (autoload 'map-filter "map")
-    (autoload 'map-contains-key "map")
-    (cdr (car (map-filter
-               (lambda (package _)
-                 (map-contains-key devDependencies package))
-               formatter-styles)))))
-
-
 (use-package add-node-modules-path
   :commands add-node-modules-path
   :init
+  (defun find-js-format-style ()
+    (let* ((package-json-dir
+            (locate-dominating-file (buffer-file-name) "package.json"))
+
+           (package-json
+            (if package-json-dir
+                (json-read-file (concat
+                                 (expand-file-name package-json-dir)
+                                 "package.json"))
+              nil))
+
+           (devDependencies
+            (if package-json
+                (alist-get 'devDependencies package-json)
+              nil))
+
+           (formatter-styles
+            '((prettier            . prettier)
+              (eslint              . eslint)
+              (esformatter         . esfmt)
+              (babel-preset-airbnb . airbnb)
+              (standard            . standard))))
+
+      (autoload 'map-filter "map")
+      (autoload 'map-contains-key "map")
+      (when devDependencies
+        (cdr (car (map-filter
+                   (lambda (package _)
+                     (map-contains-key devDependencies package))
+                   formatter-styles))))
+      nil))
+
   (defun setup-modules-path-and-linter ()
     (add-node-modules-path)
     (let ((style (find-js-format-style)))
-      (cond ((eq style 'prettier)
+      (cond ((null style))
+            ((eq style 'prettier)
              (use-package prettier-js
                :delight
                :config

;; Static Analysis
(use-package lsp-mode
  :init (require 'lsp-clients)
  :hook (((css-mode web-mode go-mode tuareg-mode reason-mode caml-mode js-mode) . lsp))
  :config
  (add-hook 'lsp-after-open-hook
            (lambda ()
              (when (lsp--capability "definitionProvider")
                (bind-key "M-." 'lsp-find-definition lsp-mode-map)))))

(use-package lsp-ui
  :hook (lsp-mode . lsp-ui-mode))

;; LSP debugging support

  :config
  (add-hook 'rust-mode-hook
            (lambda ()
              (use-package cargo
                :delight
                :config (cargo-minor-mode)))))
