https://github.com/heavenshell/vim-frontier
My frontend(JavaScript) Vim plugin packs.
https://github.com/heavenshell/vim-frontier
eslint stylelint vim
Last synced: 2 months ago
JSON representation
My frontend(JavaScript) Vim plugin packs.
- Host: GitHub
- URL: https://github.com/heavenshell/vim-frontier
- Owner: heavenshell
- Created: 2016-11-27T14:47:48.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-26T10:22:49.000Z (over 9 years ago)
- Last Synced: 2026-03-06T05:01:00.816Z (4 months ago)
- Topics: eslint, stylelint, vim
- Language: Vim script
- Homepage:
- Size: 2.92 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# vim-frontier
My frontend(JavaScript) Vim plugin packs.

- Eslint
- Run with job and channel
- Stylelint
- Run with job and channel
- Mocha
- Use [vim-quickrun-hook-unittest](https://github.com/heavenshell/vim-quickrun-hook-unittest/)
## Features
- Run eslint realtime
- It detect source code change immediately and upddate results(no need to save buffer).
- Support `eslint --fix`
- Experimental feature
## Settings
- Run Eslint.
- Run [vim-flood](https://github.com/heavenshell/vim-flood).
- Update [QuickfixStatus](https://github.com/dannyob/quickfixstatus/)
- Update [vim-hier(forked version)](https://github.com/cohama/vim-hier)
### Lint at save buffer
Run `eslint`, `flow` and open QuickFix if error exists.
```viml
augroup js_enable_quickfix
autocmd!
function! s:js_quickfix()
" Clear QuickFix.
call setqflist([], 'r')
call frontier#eslint#run('a')
" Run realtime check.
call flood#check_contents#run('a')
endfunction
function! s:frontier_after(...)
if len(getqflist()) > 0
cwindow
endif
endfunction
autocmd BufWritePost *.js,*.jsx silent! call s:js_quickfix()
augroup END
```
### Realtime check
Run `eslint`, `flow`, update QuickFixStatus and Vim-Hier.
```viml
augroup js_enable_quickfix
autocmd!
function! s:js_quickfix()
" Clear QuickFix.
call setqflist([], 'r')
call frontier#eslint#run('a')
" Run realtime check.
call flood#check_contents#run('a')
endfunction
function! s:frontier_after(...)
execute ':QuickfixStatusEnable'
execute ':HierUpdate'
endfunction
let g:frontier_callbacks = {}
let g:frontier_callbacks['eslint'] = {
\ 'after_run': function('s:frontier_after')
\ }
let g:flood_callbacks = {}
let g:flood_callbacks['check_contents'] = {
\ 'after_run': function('s:frontier_after')
\ }
autocmd BufWritePost *.js,*.jsx silent! call s:js_quickfix()
autocmd InsertLeave *.js,*.jsx silent! call s:js_quickfix()
autocmd TextChanged,TextChangedI *.js,*.jsx silent! call s:js_quickfix()
augroup END
```
### Auto fix
Run `eslint --fix` at save buffer.
```viml
augroup js_enable_quickfix
autocmd!
function! s:js_quickfix()
" Clear QuickFix.
call setqflist([], 'r')
" Auto fix.
call frontier#eslint#fix()
" Run realtime check.
call flood#check_contents#run('a')
endfunction
autocmd BufWritePost *.js,*.jsx silent! call s:js_quickfix()
augroup END
```
#### Note
`frontier#eslint#fix()` only support `BufWritePost`.
`eslint --fix` overwrite file. `frontier#eslint#fix()` reload file silently
after executed.
## License
New BSD License