Vim Awesome lists ESLint as a plugin: https://vimawesome.com/plugin/eslint. However, also on that page it says "...your plugins (and ESLint) are ..." implying ESLint is not a Vim plugin.
I am trying to work out how to apply ESLint to JavaScript files I am writing in Vim. I would like to do so (at least initially) without any plugins. I think it might help me to achieve this if I knew whether or not ESLint is a Vim plugin or not.
No. It is a general linter for javascript. See https://eslint.org/
If you want to use ESLint in Vim, you can use a vim plugin (such as ALE or the eslint vim plugin) to help you. Or you can use the command line interface eslint offers if you don't want to use plugins.
Related
I am using a vim/nvim plugin asyncrun that enables an API call that works fine in nvim if I implement it in ~/.config/nvim/init.vim using a line:
call asyncrun#run("", "cwd", "firefox")
Now this same line does not work for vim if I try to use it inside ~/.vimrc. I always get a warning:
Unknown finction: asyncrun#run
What needs to be changed in order for this to also work for vim?
Following the #doopNudles comment I also clarify that vim plugin is manually installed in the folder ~/.vim/pack/my-plugins/start/vim-asyncrun/asyncrun.vim/plugin/asyncrun.vim. I install all my vim plugins the same way (using the vim v8 native ability to detect plugins).
The problem was that ~/.vim/pack/my-plugins/start/vim-asyncrun/asyncrun.vim/plugin/asyncrun.vim has one extra folder!
It works if I delete the extra folder asyncrun.vim like this ~/.vim/pack/my-plugins/start/vim-asyncrun/plugin/asyncrun.vim
I have vim's syntastic installed properly along with eslint and jshint. I prefer jshint for most of my javascript programming. However, I'm starting to learn React, and would like to use eslint with syntastic (eslint has superior/proper linting for react).
Is it possible to set vim to use jshint for *.js files, and eslint for *.jsx files?
I see from :help syntastic-checkers that react gets lumped in javascript. Chaining the linters is not what I want, either.
Found it! You were very close #lcd047, but your comment lead me down the right path! To enable eslint on only *jsx files, putting the following in my .vimrc works:
au BufEnter *.jsx let b:syntastic_checkers = ['eslint']
In my case, syntastic will use jshint on javascript by default even if a checker is not set in .vimrc. Setting the above works even if g:syntastic_javascript_checkers is unset or even if it is set, in my case, to jshint.
Yes, I've checked the other similar questions.
I manually installed the schlepp plugin. It's in the bundle directory, next to plugins that are working. In fact, I also put it in the plugin directory.
I put the runtime line in my .vimrc, and verified in vim that it's working. I even did vim -V, and saw that vim is looking in the schlepp folder. And yet, if I do ":help schlepp", it says, "Sorry, no help for schlepp."
If you read the documentation for the plugin, you'll find the instructions for manual installation, which hint quite distinctly at using a plugin manager.
Presuming you have indeed copied the plugin correctly, I guess you forgot :helptags doc.
The plugin seems rather unmaintained. Why not have a look at vim-move instead?
I use the same .vimrc file on lots of systems. I'd like to bypass vundle installing some modules that I know won't work if 'if_lua' is not present.
Is there a vim script way of conditionally doing
Bundle 'Shougo/neocomplete.vim'
only if vim was compiled with lua to avoid the start up error:
$ vim myprogram.c
neocomplete does not work this version of Vim.
It requires Vim 7.3.885 or above and "if_lua" enabled Vim.
Press ENTER or type command to continue
thx
if has('lua')
Bundle 'Shougo/neocomplete.vim'
end
To enable effective code formatting, I need to set the following in my .vimrc file
filetype plugin indent on
If I do that, code formatting (gg=G) works perfectly. However, I get the following error when I load up javascript files:
Error detected while parsing function <SNR>78_JSLint:
line 25
could not invoke JSLint
and I have to set it back to
filetype on
Now Javascript Lint works (I don't know why it says 'JSLint', I have Syntastic set up to work with Javascript Lint), but code formatting is now less reliable. How do I make it so I can run Javascript Lint (via Syntastic) and proper code formatting, without one interfering with the other.
You probably have another JS linting plugin somewhere (maybe jslint.vim?) that conflicts with syntastic or you don't have said plugin anymore but there's stil an autocmd in your .vimrc.
Search your ~/.vim folder for "JSLint" with
$ grep JSLint ~/.vim
to see where it's invoked.
Either way, your problem has nothing to do with indenting.