Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fu! EslintWrapperFix()
- let eslintFilesExist = filereadable('.eslintrc.json') || filereadable('.eslintrc.js') || filereadable('.eslintrc.yml')
- if eslintFilesExist == 0
- echo 'No .eslintrc files found'
- return
- end
- let output = system("eslint --fix " . expand('%'))
- let lines = split(output, '\n')
- " Nothing to fix, let's move along
- if len(lines) == 0
- return
- endif
- if lines[1] =~# "File ignored by default"
- return
- endif
- checktime
- Neomake
- endfu
- autocmd BufWritePost *.js call EslintWrapperFix()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement