From 5ea28932995c2dfba04e3914833261a3b12454fa Mon Sep 17 00:00:00 2001 From: dc3671 Date: Thu, 5 Oct 2017 00:39:36 +0800 Subject: [PATCH] Add support for global eslint&.eslintrc --- plugin/defaults.vim | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plugin/defaults.vim b/plugin/defaults.vim index 2d5d407..f1c8598 100644 --- a/plugin/defaults.vim +++ b/plugin/defaults.vim @@ -185,6 +185,9 @@ if !exists('g:formatdef_eslint_local') endif " find formatter & config file let l:prog = findfile('node_modules/.bin/eslint', l:path.";") + if empty(l:prog) + let l:prog = findfile('~/.npm-global/bin/eslint') + endif let l:cfg = findfile('.eslintrc.js', l:path.";") if empty(l:cfg) let l:cfg = findfile('.eslintrc.yaml', l:path.";") @@ -198,6 +201,21 @@ if !exists('g:formatdef_eslint_local') if empty(l:cfg) let l:cfg = findfile('.eslintrc', l:path.";") endif + if empty(l:cfg) + let l:cfg = findfile('~/.eslintrc.js') + endif + if empty(l:cfg) + let l:cfg = findfile('~/.eslintrc.yaml') + endif + if empty(l:cfg) + let l:cfg = findfile('~/.eslintrc.yml') + endif + if empty(l:cfg) + let l:cfg = findfile('~/.eslintrc.json') + endif + if empty(l:cfg) + let l:cfg = findfile('~/.eslintrc') + endif if (empty(l:cfg) || empty(l:prog)) if verbose return "(>&2 echo 'No local ESLint program and/or config found')"