2

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

enter image description here

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

enter image description here

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
Cbhihe
  • 511
  • 9
  • 24
Lee.zm
  • 105
  • 1
  • 12

2 Answers2

2

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
elpddev
  • 4,314
  • 4
  • 26
  • 47
  • I hadn't done all my installs with `-g` so it wasn't finding the right packages; getting `eslint test.js` working outside `vim` helped zero in on the issue. Thanks! – dwanderson Sep 15 '17 at 18:36
0

Resolve:

npm install babel-eslint -g

Lee.zm
  • 105
  • 1
  • 12