https://github.com/heavenshell/vim-eslint
An asynchronous Eslint(@typescript-eslint) for Vim.
https://github.com/heavenshell/vim-eslint
Last synced: 6 months ago
JSON representation
An asynchronous Eslint(@typescript-eslint) for Vim.
- Host: GitHub
- URL: https://github.com/heavenshell/vim-eslint
- Owner: heavenshell
- License: bsd-3-clause
- Created: 2019-03-30T13:49:12.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-11-18T22:41:45.000Z (over 1 year ago)
- Last Synced: 2025-03-06T02:12:11.705Z (over 1 year ago)
- Language: Vim Script
- Size: 5.3 MB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vim-eslint

An asynchronous Eslint(@typescript-eslint) for Vim.
Can use with TypeScript + Eslint + Prettier.

## Invoke manually
Open TypeScript file and just execute `:Eslint`.
## Automatically lint on save
```viml
autocmd BufWritePost *.ts,*.tsx call eslint#run('a', win_getid())
```
## Autofix
Execute `:EslintFix` and automatically fix.
## Integrate with Tsuquyomi
You can use Tsuquyomi's `TsuAsyncGeterr` and vim-eslint.
Set followings to your vimrc.
```viml
augroup typescript
function! s:typescript_after(ch, msg)
let cnt = len(getqflist())
if cnt > 0
echomsg printf('[TypeScript] %s errors', cnt)
endif
endfunction
function! s:eslint_callback(qflist, mode)
let list = getqflist() + a:qflist
call setqflist(list, 'r')
endfunction
let g:eslint_callbacks = {
\ 'after_run': function('s:typescript_after')
\ }
let g:tsuquyomi_disable_quickfix = 1
function! s:ts_callback(qflist) abort
call setqflist(a:qflist)
let list = a:qflist + getqflist()
call setqflist(list, 'r')
endfunction
function! s:check()
let winid = win_getid()
call setqflist([], 'r')
call tsuquyomi#registerNotify(function('s:ts_callback'), 'diagnostics')
call tsuquyomi#asyncCreateFixlist()
call eslint#register_notify(function('s:eslint_callback'))
call eslint#run('a', winid)
endfunction
autocmd InsertLeave,BufWritePost *.ts,*.tsx silent! call s:check()
augroup END
```
## License
New BSD License