dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.58k stars 1.44k forks source link

Ale linter is running but not showing any errors #372

Closed tylerthehaas closed 7 years ago

tylerthehaas commented 7 years ago

I am attempting to get ale running on my new laptop. Looks like from the output of :ALEInfo that ale is running but I am not able to get any indicators in vim. I have the following in my .vimrc

" highlight clear ALEErrorSign " otherwise uses error bg color (typically red)
" highlight clear ALEWarningSign " otherwise uses error bg color (typically red)

let g:ale_linters = {
\  'javascript': ['eslint'],
\}

All of the commented out text is stuff that I've tried to get it working

" let g:ale_sign_error = '💣'
" let g:ale_sign_warning = '🚩'
" let g:ale_statusline_format = ['💣 %d', '🚩 %d', '']

 Current Filetype: javascript
Available Linters: ['eslint', 'flow', 'jscs', 'jshint', 'standard', 'xo']
  Enabled Linters: ['eslint']
 Linter Variables:

let g:ale_javascript_eslint_executable = 'eslint'
let g:ale_javascript_eslint_options = ''
let g:ale_javascript_eslint_use_global = 0
 Global Variables:

let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%s'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_save = 0
let g:ale_lint_on_text_changed = 1
let g:ale_linter_aliases = {}
let g:ale_linters = {'javascript': ['eslint']}
let g:ale_open_list = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_offset = 1000000
let g:ale_sign_warning = '--'
let g:ale_statusline_format = ['%d error(s)', '%d warning(s)', 'OK']
let g:ale_warn_about_trailing_whitespace = 1
  Command History:

(finished - exit code 1) ['/bin/zsh', '-c', 'eslint  -f unix --stdin --stdin-filename /Users/thaas/learning/React/Jest/TestTodo/src/App.js < /var/folders/rv/l95_5q0s3gx2sxdjyxtnlzbn3fd4n8/T/vDRLcMM/3/App.js']
(finished - exit code 1) ['/bin/zsh', '-c', 'eslint  -f unix --stdin --stdin-filename /Users/thaas/learning/React/Jest/TestTodo/src/App.js < /var/folders/rv/l95_5q0s3gx2sxdjyxtnlzbn3fd4n8/T/vDRLcMM/4/App.js']
(finished - exit code 1) ['/bin/zsh', '-c', 'eslint  -f unix --stdin --stdin-filename /Users/thaas/learning/React/Jest/TestTodo/src/App.js < /var/folders/rv/l95_5q0s3gx2sxdjyxtnlzbn3fd4n8/T/vDRLcMM/5/App.js']
w0rp commented 7 years ago

Which vesrion of eslint are you using?

tylerthehaas commented 7 years ago

v3.16.1

w0rp commented 7 years ago

What is the output of eslint -f unix --stdin --stdin-filename /Users/thaas/learning/React/Jest/TestTodo/src/App.js < /Users/thaas/learning/React/Jest/TestTodo/src/App.js from your terminal? Maybe something is wrong there.

w0rp commented 7 years ago

Also, are any other linting plugins installed?

tylerthehaas commented 7 years ago

It actually started working. I'm not actually sure what was wrong or what fixed it but I'll close this issue.

tylerthehaas commented 7 years ago

Turns out I can only get it to work in one project. when I run ALEInfo in the working project I get:


 Current Filetype: javascript
Available Linters: ['eslint', 'flow', 'jscs', 'jshint', 'standard', 'xo']
  Enabled Linters: ['eslint', 'flow', 'jscs', 'jshint', 'standard', 'xo']
 Linter Variables:

let g:ale_javascript_eslint_executable = 'eslint'
let g:ale_javascript_eslint_options = ''
let g:ale_javascript_eslint_use_global = 0
let g:ale_javascript_flow_executable = 'flow'
let g:ale_javascript_flow_use_global = 0
let g:ale_javascript_jshint_executable = 'jshint'
let g:ale_javascript_jshint_use_global = 0
let g:ale_javascript_standard_executable = 'standard'
let g:ale_javascript_standard_options = ''
let g:ale_javascript_standard_use_global = 0
let g:ale_javascript_xo_executable = 'xo'
let g:ale_javascript_xo_options = ''
let g:ale_javascript_xo_use_global = 0
 Global Variables:

let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%s'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_save = 0
let g:ale_lint_on_text_changed = 1
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_open_list = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '💣'
let g:ale_sign_offset = 1000000
let g:ale_sign_warning = '🚩'
let g:ale_statusline_format = ['💣 %d', '🚩 %d', '']
let g:ale_warn_about_trailing_whitespace = 1
  Command History:

(finished - exit code 0) ['/bin/zsh', '-c', '/Users/thaas/Projects/Monsanto/capacity-ontap-ui/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /Users/thaas/Projects/Monsanto/capacity-ontap-ui/src/components/presentation/holds/create.jsx < /var/folders/rv/l95_5q0s3gx2sxdjyxtnlzbn3fd4n8/T/vbafxKz/3/create.jsx']
(finished - exit code 1) ['/bin/zsh', '-c', '/Users/thaas/Projects/Monsanto/capacity-ontap-ui/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /Users/thaas/Projects/Monsanto/capacity-ontap-ui/src/components/presentation/holds/create.jsx < /var/folders/rv/l95_5q0s3gx2sxdjyxtnlzbn3fd4n8/T/vbafxKz/4/create.jsx']
(finished - exit code 0) ['/bin/zsh', '-c', '/Users/thaas/Projects/Monsanto/capacity-ontap-ui/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /Users/thaas/Projects/Monsanto/capacity-ontap-ui/src/components/presentation/holds/create.jsx < /var/folders/rv/l95_5q0s3gx2sxdjyxtnlzbn3fd4n8/T/vbafxKz/5/create.jsx']

you'll notice the first line goes to a path of '/usres/thaas/Projects/Monsanto/capacity-ontap-ui/node_modules/.bin/eslint' In other projects which arent working I do not get that line. That is the only difference between projects that I have been able to find. Here is the output from a nonworking directory.


 Current Filetype: javascript
Available Linters: ['eslint', 'flow', 'jscs', 'jshint', 'standard', 'xo']
  Enabled Linters: ['eslint', 'flow', 'jscs', 'jshint', 'standard', 'xo']
 Linter Variables:

let g:ale_javascript_eslint_executable = 'eslint'
let g:ale_javascript_eslint_options = ''
let g:ale_javascript_eslint_use_global = 0
let g:ale_javascript_flow_executable = 'flow'
let g:ale_javascript_flow_use_global = 0
let g:ale_javascript_jshint_executable = 'jshint'
let g:ale_javascript_jshint_use_global = 0
let g:ale_javascript_standard_executable = 'standard'
let g:ale_javascript_standard_options = ''
let g:ale_javascript_standard_use_global = 0
let g:ale_javascript_xo_executable = 'xo'
let g:ale_javascript_xo_options = ''
let g:ale_javascript_xo_use_global = 0
 Global Variables:

let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%s'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_save = 0
let g:ale_lint_on_text_changed = 1
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_open_list = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '💣'
let g:ale_sign_offset = 1000000
let g:ale_sign_warning = '🚩'
let g:ale_statusline_format = ['💣 %d', '🚩 %d', '']
let g:ale_warn_about_trailing_whitespace = 1
  Command History:

(finished - exit code 1) ['/bin/zsh', '-c', 'eslint  -f unix --stdin --stdin-filename /Users/thaas/learning/React/Jest/TestTodo/src/App.jsx < /var/folders/rv/l95_5q0s3gx2sxdjyxtnlzbn3fd4n8/T/vM31svw/3/App.jsx']
(finished - exit code 1) ['/bin/zsh', '-c', 'eslint  -f unix --stdin --stdin-filename /Users/thaas/learning/React/Jest/TestTodo/src/App.jsx < /var/folders/rv/l95_5q0s3gx2sxdjyxtnlzbn3fd4n8/T/vM31svw/4/App.jsx']
(finished - exit code 1) ['/bin/zsh', '-c', 'eslint  -f unix --stdin --stdin-filename /Users/thaas/learning/React/Jest/TestTodo/src/App.jsx < /var/folders/rv/l95_5q0s3gx2sxdjyxtnlzbn3fd4n8/T/vM31svw/5/App.jsx']
(started) ['/bin/zsh', '-c', 'eslint  -f unix --stdin --stdin-filename /Users/thaas/learning/React/Jest/TestTodo/src/App.jsx < /var/folders/rv/l95_5q0s3gx2sxdjyxtnlzbn3fd4n8/T/vM31svw/6/App.jsx']
(finished - exit code 1) ['/bin/zsh', '-c', 'eslint  -f unix --stdin --stdin-filename /Users/thaas/learning/React/Jest/TestTodo/src/App.jsx < /var/folders/rv/l95_5q0s3gx2sxdjyxtnlzbn3fd4n8/T/vM31svw/7/App.jsx']
mvolkmann commented 7 years ago

I'm curious what happens if you add this to your .vimrc to restrict the JavaScript linters to just eslint and flow:

let g:ale_linters = {
\  'javascript': ['eslint', 'flow'],
\}
tylerthehaas commented 7 years ago

Still doesn't work Mark. I did find out that there wasn't an eslint in my node_modules/.bin on my local project. I added it through npm instead of yarn (there is a issue with putting yarn packages in your bin right now) and the output now matches what was being outputted from capacaty-ontap-ui directory (the working one).

here is the new output with the changes mark suggested:


 Current Filetype: javascript
Available Linters: ['eslint', 'flow', 'jscs', 'jshint', 'standard', 'xo']
  Enabled Linters: ['eslint']
 Linter Variables:

let g:ale_javascript_eslint_executable = 'eslint'
let g:ale_javascript_eslint_options = ''
let g:ale_javascript_eslint_use_global = 0
 Global Variables:

let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%s'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_save = 0
let g:ale_lint_on_text_changed = 1
let g:ale_linter_aliases = {}
let g:ale_linters = {'javascript': ['eslint']}
let g:ale_open_list = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '💣'
let g:ale_sign_offset = 1000000
let g:ale_sign_warning = '🚩'
let g:ale_statusline_format = ['💣 %d', '🚩 %d', '']
let g:ale_warn_about_trailing_whitespace = 1
  Command History:

(finished - exit code 1) ['/bin/zsh', '-c', '/Users/thaas/learning/React/Jest/TestTodo/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /Users/thaas/learning/React/Jest/TestTodo/src/App.jsx < /var/folders/rv/l95_5q0s3gx2sxdjyxtnlzbn3fd4n8/T/viCFu6X/3/App.jsx']
(finished - exit code 1) ['/bin/zsh', '-c', '/Users/thaas/learning/React/Jest/TestTodo/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /Users/thaas/learning/React/Jest/TestTodo/src/App.jsx < /var/folders/rv/l95_5q0s3gx2sxdjyxtnlzbn3fd4n8/T/viCFu6X/4/App.jsx']
(finished - exit code 1) ['/bin/zsh', '-c', '/Users/thaas/learning/React/Jest/TestTodo/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /Users/thaas/learning/React/Jest/TestTodo/src/App.jsx < /var/folders/rv/l95_5q0s3gx2sxdjyxtnlzbn3fd4n8/T/viCFu6X/5/App.jsx']
tylerthehaas commented 7 years ago

also when I run eslint -f unix --stdin --stdin-filename /Users/thaas/learning/React/Jest/TestTodo/src/App.jsx < /var/folders/rv/l95_5q0s3gx2sxdjyxtnlzbn3fd4n8/T/vM31svw/3/App.jsx in the terminal I get

no such file or directory: /var/folders/rv/l95_5q0s3gx2sxdjyxtnlzbn3fd4n8/T/vM31svw/3/App.jsx

tylerthehaas commented 7 years ago

I was able to get it to work correctly when there is a local .eslintrc.json file but if it has to rely on my global one then it stops working.

tylerthehaas commented 7 years ago

This was an error in my .eslintrc.json throwing an error.

w0rp commented 7 years ago

I might see if I can get the handler for eslint to parse broken configuration file errors, and then report those in files. That might help with configuring eslint.

decko commented 7 years ago

Got the same here. Without setting eslint as my JS default linter, I get jslint reports, but forcing ale to use eslint returns nothing.

 Current Filetype: javascript
Available Linters: ['eslint', 'flow', 'jscs', 'jshint', 'standard', 'xo']
  Enabled Linters: ['eslint']
 Linter Variables:

let g:ale_javascript_eslint_executable = 'eslint'
let g:ale_javascript_eslint_options = ''
let g:ale_javascript_eslint_use_global = 0
 Global Variables:

let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_enabled = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_save = 0
let g:ale_lint_on_text_changed = 1
let g:ale_linter_aliases = {}
let g:ale_linters = {'javascript': ['eslint']}
let g:ale_open_list = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_offset = 1000000
let g:ale_sign_warning = '--'
let g:ale_statusline_format = ['%d error(s)', '%d warning(s)', 'OK']
let g:ale_warn_about_trailing_whitespace = 1
  Command History:

(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/713/vinculacao.controller.js'
(started) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/714/vinculacao.controller.js'
(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/715/vinculacao.controller.js'
(started) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/716/vinculacao.controller.js'
(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/717/vinculacao.controller.js'
(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/721/vinculacao.controller.js'
(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/722/vinculacao.controller.js'
(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/724/vinculacao.controller.js'
(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/726/vinculacao.controller.js'
(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/751/vinculacao.controller.js'
(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/752/vinculacao.controller.js'
(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/753/vinculacao.controller.js'
(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/754/vinculacao.controller.js'
(started) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/755/vinculacao.controller.js'
(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/756/vinculacao.controller.js'
(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/757/vinculacao.controller.js'
(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/758/vinculacao.controller.js'
(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/759/vinculacao.controller.js'
(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/761/vinculacao.controller.js'
(finished - exit code 1) '/home/decko/node_modules/.bin/eslint  -f unix --stdin --stdin-filename /home/decko/dev/epracas-frontend/src/js/praca/vinculacao.controller.js < /tmp/nvimsxUj7R/774/vinculacao.controller.js'
w0rp commented 7 years ago

If you pull master again for ALE and try again, you might start seeing some errors about problems with your eslint configuration file. I just implemented #386.