Repository: mtscout6/syntastic-local-eslint.vim Branch: master Commit: fd5da4df8ba0 Files: 3 Total size: 2.5 KB Directory structure: gitextract_if1aaika/ ├── LICENSE ├── README.md └── ftplugin/ └── javascript.vim ================================================ FILE CONTENTS ================================================ ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Matt Smith Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # syntastic-local-eslint.vim Prefer local repo install of eslint over global install with syntastic Installation Instructions ------------------------- Using [vim plugged](https://github.com/junegunn/vim-plug) you just need to add: ``` Plug 'mtscout6/syntastic-local-eslint.vim' ``` Inspired By ----------- Inspired by http://blog.pixelastic.com/2015/10/05/use-local-eslint-in-syntastic/ ================================================ FILE: ftplugin/javascript.vim ================================================ " return full path with the trailing slash " or an empty string if we're not in an npm project fun! s:GetNodeModulesAbsPath () let lcd_saved = fnameescape(getcwd()) silent! exec "lcd" expand('%:p:h') let path = finddir('node_modules', '.;') exec "lcd" lcd_saved " fnamemodify will return full path with trailing slash; " if no node_modules found, we're safe return path is '' ? '' : fnamemodify(path, ':p') endfun " return full path of local eslint executable " or an empty string if no executable found fun! s:GetEslintExec (node_modules) let eslint_guess = a:node_modules is '' ? '' : a:node_modules . '.bin/eslint' return exepath(eslint_guess) endfun " if eslint_exec found successfully, set it for the current buffer fun! s:LetEslintExec (eslint_exec) if a:eslint_exec isnot '' let b:syntastic_javascript_eslint_exec = a:eslint_exec endif endfun fun! s:main () let node_modules = s:GetNodeModulesAbsPath() let eslint_exec = s:GetEslintExec(node_modules) call s:LetEslintExec(eslint_exec) endfun call s:main()