From 8104470e27ddb5bc279561b9304b400a45a4c908 Mon Sep 17 00:00:00 2001 From: Tyler Brazier Date: Thu, 16 Apr 2020 21:54:39 -0500 Subject: [PATCH] eslint compiler improvements Use `npx` instead of assuming eslint is installed globally. (`npx` ships with `npm` since 5.2.0) Exclude `%` from the `makeprg` command so that whole directories (or the whole project) can be linted with `:make .` (the current file can still be linted with `:make %`). Use unix format since it's already included in the default `errorformat`. Automatically set compiler to eslint when editing a javascript file. --- after/ftplugin/javascript.vim | 2 ++ compiler/eslint.vim | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/after/ftplugin/javascript.vim b/after/ftplugin/javascript.vim index c6c42d60..e247d078 100644 --- a/after/ftplugin/javascript.vim +++ b/after/ftplugin/javascript.vim @@ -3,6 +3,8 @@ " Maintainer: vim-javascript community " URL: https://github.com/pangloss/vim-javascript +compiler eslint + setlocal iskeyword+=$ suffixesadd+=.js if exists('b:undo_ftplugin') diff --git a/compiler/eslint.vim b/compiler/eslint.vim index 7695a072..0724bbaf 100644 --- a/compiler/eslint.vim +++ b/compiler/eslint.vim @@ -12,5 +12,5 @@ if exists(":CompilerSet") != 2 command! -nargs=* CompilerSet setlocal endif -CompilerSet makeprg=eslint\ -f\ compact\ % -CompilerSet errorformat=%f:\ line\ %l\\,\ col\ %c\\,\ %m +CompilerSet makeprg=npx\ -q\ eslint\ -f\ unix +CompilerSet errorformat&