Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLint fixer isn't working #635

Closed
Nicktho opened this issue Jun 8, 2017 · 9 comments
Closed

ESLint fixer isn't working #635

Nicktho opened this issue Jun 8, 2017 · 9 comments
Labels

Comments

@Nicktho
Copy link

Nicktho commented Jun 8, 2017


 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 = 1
let g:ale_lint_on_text_changed = 0
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) ['/usr/local/bin/zsh', '-c', '''/Users/nicholas.matenaar/dev/fe-ops/fe-ops-renderizr/fe-ops-renderizr-bundle/node_modules/eslint/bin/eslint.js'' --fix -f unix --stdin --stdin-filename ''/Users/nicholas.matenaar/dev/fe-ops/fe-ops-renderizr/fe-ops-renderizr-bundle/src/bundlers/client-javascript.js'' < ''/var/folders/rr/_gr672fj7csgdv975dkz89kd319z0r/T/nvimzTR9w6/5/client-javascript.js''']
(finished - exit code 1) ['/usr/local/bin/zsh', '-c', '''/Users/nicholas.matenaar/dev/fe-ops/fe-ops-renderizr/fe-ops-renderizr-bundle/node_modules/eslint/bin/eslint.js'' --fix -f unix --stdin --stdin-filename ''/Users/nicholas.matenaar/dev/fe-ops/fe-ops-renderizr/fe-ops-renderizr-bundle/src/bundlers/client-javascript.js'' < ''/var/folders/rr/_gr672fj7csgdv975dkz89kd319z0r/T/nvimzTR9w6/6/client-javascript.js''']

Exiting vim also gives me:

Error detected while processing function <SNR>150_NeoVimCallback[27]..<SNR>156_HandleExit:
line    8:
E484: Can't open file /var/folders/rr/_gr672fj7csgdv975dkz89kd319z0r/T/nvimzdB0mZ/4/client-javascript.js
E484: Can't open file /var/folders/rr/_gr672fj7csgdv975dkz89kd319z0r/T/nvimzdB0mZ/5/client-javascript.js%

Looks like the temp file isnt being created correctly? prettier works, just not eslint as the fixer

@w0rp w0rp closed this as completed in e93dba3 Jun 8, 2017
@w0rp w0rp added the bug label Jun 8, 2017
@w0rp
Copy link
Member

w0rp commented Jun 8, 2017

I have fixed this bug now. The problem was that jobs weren't being cancelled when fixing was interrupted by fixing files again.

If ESLint still doesn't do anything, check your configuration file. You might have to switch from using nested configuration files to extends, per #634.

@iammerrick
Copy link

I am having this issue currently after running

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

let g:ale_fixers = {
\  'javascript': ['eslint'],
\}
let g:ale_set_highlights = 0
let g:ale_sign_column_always = 1
let g:ale_fix_on_save = 1

nmap <leader>= <Plug>(ale_fix)

ALEInfo


 Current Filetype: javascript.jsx
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 = 1
let g:ale_lint_on_text_changed = 'always'
let g:ale_linter_aliases = {}
let g:ale_linters = {'javascript': ['eslint']}
let g:ale_open_list = 0
let g:ale_set_highlights = 0
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 1
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) ['/usr/local/bin/zsh', '-c', '''eslint'' -f unix --stdin --stdin-filename ''/Users/merrickchristensen/Developer/Text Rocket/server/handlers/blasts/find.js'' < ''/var/folders/x3/nzqyh_pd7xgc_1h_rmb5vx400000gn/T/vDMS3Jz/0/find.js''']
(started) ['/usr/local/bin/zsh', '-c', '''eslint'' -f unix --stdin --stdin-filename ''/Users/merrickchristensen/Developer/Text Rocket/server/handlers/blasts/find.js'' < ''/var/folders/x3/nzqyh_pd7xgc_1h_rmb5vx400000gn/T/vDMS3Jz/1/find.js''']
(finished - exit code 1) ['/usr/local/bin/zsh', '-c', '''eslint'' -f unix --stdin --stdin-filename ''/Users/merrickchristensen/Developer/Text Rocket/server/handlers/blasts/find.js'' < ''/var/folders/x3/nzqyh_pd7xgc_1h_rmb5vx400000gn/T/vDMS3Jz/2/find.js''']

ESLint configuration

{
   "parser": "babel-eslint",
   "extends":[
      "prettier",
      "prettier/react",
      "plugin:react/recommended"
   ],
   "plugins":[
      "prettier",
      "react"
   ],
   "parserOptions":{
      "ecmaVersion":2016,
      "sourceType":"module",
      "ecmaFeatures":{
         "jsx":true
      }
   },
   "env":{
      "es6":true,
      "node":true
   },
   "rules":{
      "prettier/prettier":"error",
      "no-unused-vars": "error",
      "react/prop-types": 0,
      "react/display-name": 0
   }
}

@w0rp
Copy link
Member

w0rp commented Jul 3, 2017

Have you tried running eslint from the command line with --fix to see if it reports any errors?

@iammerrick
Copy link

Yes I can fix on CLI. I also see errors in the UI. Only fixers are giving me trouble.

@iammerrick
Copy link

P.S. Thank you for the quick reply!

@w0rp
Copy link
Member

w0rp commented Jul 3, 2017

Could you create a repository containing an example project which repeats the same issue?

@mgenov
Copy link

mgenov commented Nov 5, 2017

I'm encountering the same issue with: https://github.com/saschajullmann/gatsby-starter-gatsbythemes


 Current Filetype: javascript.jsx
Available Linters: ['eslint', 'flow', 'jscs', 'jshint', 'standard', 'xo', '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_suppress_eslintignore = 0
let g:ale_javascript_eslint_suppress_missing_config = 0
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_jscs_executable = 'jscs'
let g:ale_javascript_jscs_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_fix_on_save = 1
let g:ale_fixers = {'javascript.jsx': ['eslint'], 'javascript': ['eslint']}
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 = 1
let g:ale_lint_on_text_changed = 'always'
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 error(s)', '%d warning(s)', 'OK']
let g:ale_warn_about_trailing_whitespace = 1
  Command History:

(executable check - success) /Users/mgenov/workspaces/js/web-page/node_modules/eslint/bin/eslint.js
(started) ['/bin/zsh', '-c', '''/Users/mgenov/workspaces/js/web-page/node_modules/eslint/bin/eslint.js'' -f unix --stdin --stdin-filename ''/Users/mgenov/workspaces/js/web-page/src/utils/colors.js'' < ''/var/folders/7c/_n0ttv0s42g8z4r003wmzl340000gn/T/nvimIWca0S/3/colors.js''']
(executable check - failure) flow
(executable check - failure) jscs
(executable check - failure) jshint
(executable check - failure) standard
(executable check - failure) xo
(finished - exit code 0) ['/bin/zsh', '-c', '''/Users/mgenov/workspaces/js/web-page/node_modules/eslint/bin/eslint.js'' -f unix --stdin --stdin-filename ''/Users/mgenov/workspaces/js/web-page/src/utils/colors.js'' < ''/var/folders/7c/_n0ttv0s42g8z4r003wmzl340000gn/T/nvimIWca0S/4/colors.js''']

<<<NO OUTPUT RETURNED>>>

(executable check - failure) flow
(executable check - failure) jscs
(executable check - failure) jshint
(executable check - failure) standard
(executable check - failure) xo

The following command is fixing file as expected:

node_modules/.bin/eslint --fix src/utils/colors.js

When I try to edit src/utils/colors.js vim is replacing '' with "" which is the opposite of how prettier was configured.

@mgenov
Copy link

mgenov commented Nov 5, 2017

Here is a record from my screen:

output

I suppose it's somehow related with #947 as in my case eslint is not installed globally. I've tried with adding of ./node_modules/bin to PATH but it doesn't work.

@kubek2k
Copy link

kubek2k commented Feb 8, 2018

@mgenov make sure that executable in node_modules/eslint/bin has execution permissions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants