Merge pull request #219 from gohxs/eslint-configuration-file
choose the closest eslintrc based on filename length
This commit is contained in:
commit
dacf435019
@ -189,19 +189,27 @@ if !exists('g:formatdef_eslint_local')
|
||||
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.";")
|
||||
"initial
|
||||
let l:cfg = fnamemodify(findfile('.eslintrc.js', l:path.";"),':p')
|
||||
|
||||
let l:tcfg = fnamemodify(findfile('.eslintrc.yaml', l:path.";"),':p')
|
||||
if len(l:tcfg) > len(l:cfg)
|
||||
let l:cfg = l:tcfg
|
||||
endif
|
||||
if empty(l:cfg)
|
||||
let l:cfg = findfile('.eslintrc.yml', l:path.";")
|
||||
let l:tcfg = fnamemodify(findfile('.eslintrc.yml', l:path.";"),':p')
|
||||
if len(l:tcfg) > len(l:cfg)
|
||||
let l:cfg = l:tcfg
|
||||
endif
|
||||
if empty(l:cfg)
|
||||
let l:cfg = findfile('.eslintrc.json', l:path.";")
|
||||
let l:tcfg = fnamemodify(findfile('.eslintrc.json', l:path.";"),':p')
|
||||
if len(l:tcfg) > len(l:cfg)
|
||||
let l:cfg = l:tcfg
|
||||
endif
|
||||
if empty(l:cfg)
|
||||
let l:cfg = findfile('.eslintrc', l:path.";")
|
||||
let l:tcfg = fnamemodify(findfile('.eslintrc', l:path.";"),':p')
|
||||
if len(l:tcfg) > len(l:cfg)
|
||||
let l:cfg = l:tcfg
|
||||
endif
|
||||
|
||||
" This is in case we are outside home folder
|
||||
if empty(l:cfg)
|
||||
let l:cfg = findfile('~/.eslintrc.js')
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user