   :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

            ((and (memq style '(esfmt airbnb standard)) (derived-mode-p '(js-mode)))
             (use-package js-format
               :config
               (js-format-setup (symbol-name (find-js-format-style)))
               :bind (:map js-mode-map
                           ("C-c f" . js-format-buffer)))))))
  :hook ((css-mode web-mode js-mode scss-mode yaml-mode markdown-mode) . setup-modules-path-and-linter))

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