【发布时间】:2017-11-23 18:02:51
【问题描述】:
我已经正确安装了 vim 的 syntastic 以及 eslint 和 jshint。对于我的大部分 javascript 编程,我更喜欢 jshint。但是,我开始学习 React,并希望将 eslint 与 syntastic 一起使用(eslint 具有出色/适当的 linting 用于反应)。
是否可以将 vim 设置为对 *.js 文件使用 jshint,对 *.jsx 文件使用 eslint?
我从 :help syntastic-checkers 中看到 react 被集中在 javascript 中。链接 linter 也不是我想要的。
【问题讨论】:
-
你可以试试
autocmd BufRead,BufNewFile *.jsx let b:syntastic_checkers = ['eslint']。这可能适用于syntastic_check_on_open,也可能不适用,这取决于您的Vim 选择运行autocmds 的顺序(顺序没有明确定义)。如果它仍然在打开时运行jshint,您可以为*.js添加类似的autocmd,并保留g:syntastic_javascript_checkers未设置。 -
感谢您引导我回答,@lcd047!
标签: vim jshint eslint syntastic