• Stars
    star
    139
  • Rank 255,539 (Top 6 %)
  • Language
    Emacs Lisp
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Adds the node_modules/.bin directory to the buffer exec_path. E.g. support project local eslint installations.

add-node-modules-path

MELPA

This file provides add-node-modules-path, which searches the current files parent directories for the node_modules/.bin/ directory and adds it to the buffer local exec-path. This allows Emacs to find project based installs of e.g. eslint.

Usage

M-x add-node-modules-path

To automatically run it when opening a new buffer: (Choose depending on your favorite mode.)

(eval-after-load 'js-mode
  '(add-hook 'js-mode-hook #'add-node-modules-path))

Monorepo Support

In a monorepo scenario it might make sense to add multiple directories. To achieve this, additional commands can be specified:

(use-package add-node-modules-path
  :custom
  (add-node-modules-path-command '("pnpm bin" "pnpm bin -w")))