I have a few Neomake definitions which work well for me, but one thing I can't quite get my head around is automatic lint fixes with standard --fix
. Here's what I have:
let g:neomake_javascript_standardfix_maker = {
\ 'exe': 'standard',
\ 'args': '--fix',
\ 'errorformat': '%-G%.%#'
\ }
let g:neomake_javascript_enabled_makers = ['standardfix', 'jest', 'standard']
call neomake#configure#automake('w')
set autoread
au FocusGained *.js :checktime
Unfortunately, the buffer doesn't update after standard --fix
runs (although I've confirmed it does write the correct file with fixed syntax).
I suppose my ideal behaviour would be: linter fixes what it can fix, and location list pops open as it does now but with only those issues that --fix
doesn't take care of automatically, like unused variables.
I'm going to post an answer with my workaround solution (using ALE) in case it helps anyone else, but will accept any other answer that more directly addresses the question.
My main issue is that I don't use Neomake solely for linting: to take the example of JavaScript, it's being used as a test runner on save and I could see launching staging build tasks from it too (React Native test builds, for example). I think I have ALE and Neomake cooperating, at least to be going on with:
My
vim-jest.json
contains any Jest config I need per project, at minimum this:jest-simple-reporter is a very rough reporter I cooked up to distill Jest's rather rangy output down to one line per fixture. It does need to be installed in the current project's
devDependencies
though, because of the separate config for Vim, it doesn't need to be used in thetest
script or project Jest config.Interestingly, when I turn off
ale_fix_on_save
, Neomake's warning/error signs seem to take precedence in the gutter. Only after I have the test passing do the linter's signs appear. Works pretty nicely, errors are fixed on save and those that can't be fixed are indicated, co-existing nicely with test failure signage.