flymake-eslint
flymake-eslint copied to clipboard
Allow running ESLint using npx
Currently, ESLint needs to be in executable-path
, which means that ESLint must be installed globally or executable-path
has to be configured per project. It would be nice if flymake-eslint
would offer the possibility to run ESLint through NPM's npx command instead (npx eslint
), which would automatically pick up the ESLint version installed in the project's node_modules
, and only runs the globally installed version as a fallback.
thanks for raising an issue. until I get some time to work on this again (and it needs a lot of work!), would updating the buffer-local value of exec-path
be an acceptable solution? if so then you should be able to do something like this (untested) to put the closest node_modules/.bin
at the front of your path:
(push
(file-name-concat
(locate-dominating-file
(buffer-file-name)
"package.json")
"node_modules" ".bin")
exec-path)
(flymake-eslint-enable)
that should first try node_modules/.bin/eslint
then fall back to any globally-installed eslint
.
Thanks for your reply! That sounds like a workable solution, thanks for the tip! 👍
codesuki/add-node-modules-path might help.
found this code snippet:
(use-package flymake-eslint
:custom
(flymake-eslint-executable-name "npx"))