简体   繁体   中英

'quickfix' for js syntax not working with 'eslint' in 'syntastic'

All:

I'm having a problem.

I use syntastic for javascript syntax check. but quickfix is not working.

let g:syntastic_mode_map = { 'mode': 'active',
                          \ 'active_filetypes': ['python', 'javascript'],
                          \ 'passive_filetypes': [] }

let g:syntastic_auto_loc_list = 1 " 自动拉起窗口,不需要手动调用:Errors
let g:syntastic_check_on_open = 1 " 打开文件的时候检查
let g:syntastic_error_symbol = '✗' " 错误显示的字符
let g:syntastic_warning_symbol = '⚠' " 警告显示的字符
let g:go_list_type = "quickfix" " 选择quick'fix
let g:syntastic_check_on_wq = 0 " 保存退出时不检查语法
let g:syntastic_javascript_checkers = ['eslint']
let s:eslint_path =system('PATH=$(npm bin):$PATH && which eslint') "定义eslint_path变量
let b:syntastic_javascript_eslint_exec = substitute(s:eslint_path, '^\n*\s*\(.\{-}\)\n*\s*$', '\1', '')

when i use jslint has this: npm install -g jslint

在此处输入图片说明

when i use eslint has this: npm install eslint -g and touch ~/.eslintrc give some options.

在此处输入图片说明

Where is the error. show E42: No Errors

Issuing cmd :SyntasticInfo in buffer, I see:

Syntastic version: 3.7.0-180 (Vim 704, Darwin)
Info for filetype: javascript
Global mode: active
Filetype javascript is active
The current file will be checked automatically
Available checkers: eslint jshint jslint
Currently enabled checker: eslint

For me, there was a need to do:

eslint --init

That generates an .eslintrc.js configuration file describing the rules to check for the specific project. Running eslint on the cli outside of vim gave the message for that need.

$ eslint test.js

Oops! Something went wrong! :(

ESLint couldn't find a configuration file. To set up a configuration file for this project, please run:

    eslint --init

解决:

npm install babel-eslint -g

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM