VIM version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jan 8 2020 00:57:48)
macOS version
Operating System: macOS Mojave 10.14.6
I am currently working in a folder with three indepedent repos, each with their own node_modules/eslint installation and .eslintrc. The folder structure looks something like this:
root/
โโโ repo1/
โ โโโ .eslintrc
โ โโโ node_modules/
โ โ โโโ eslint
โโโ repo2/
โ โโโ .eslintrc
โ โโโ node_modules/
โ โ โโโ eslint
โโโ repo3/
โ โโโ .eslintrc
โ โโโ node_modules/
โ โ โโโ eslint
What I'm having trouble with, is that if I run vim from root, ALEFix doesn't work on 2/3 repositories. One of them for some reason works fine. ALELint works fine on all of the repos like this.
If I start vim from any of the repositories and not from the root, everything works.
I have looked through a lot of past similar issues like #995 or #897 and tried the solutions, such as using extend in the .eslintrc files but nothing seems to solve it. I have also tried glob-based fixing as recommended before to no avail.
The weirdest part for me is that it works fine on 1/3 repositories. I have tried comparing the configs of the other 2 with this repo but there isn't anything real noticeable that would cause this.
Here is the ALEInfo for the repo where ALEFix is working properly:
Current Filetype: javascript
Available Linters: ['eslint', 'fecs', 'flow', 'flow-language-server', 'jscs', 'jshint', 'standard', 'tsserver', 'xo']
Enabled Linters: ['eslint', 'flow-language-server']
Suggested Fixers:
'eslint' - Apply eslint --fix to a file.
'fecs' - Apply fecs format to a file.
'importjs' - automatic imports for javascript
'prettier' - Apply prettier to a file.
'prettier_eslint', 'prettier-eslint' - Apply prettier-eslint to a file.
'prettier_standard', 'prettier-standard' - Apply prettier-standard to a file.
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'standard' - Fix JavaScript files using standard --fix
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
'xo' - Fix JavaScript/TypeScript files using xo --fix.
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_importjs_executable = 'importjs'
Global Variables:
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 1
let g:ale_fixers = {'json': ['prettier', 'fixjson'], 'javascript': ['eslint', 'importjs'], 'python': ['autopep8']}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 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_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {'vim': ['ale_custom_linting_rules'], 'json': ['jsonlint'], 'javascript': ['eslint', 'flow-language-server'], 'python': ['flake8']}
let g:ale_linters_explicit = 1
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_lsp_root = {}
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_set_balloons = 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_info = 'โ ๏ธ'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = 'โ'
let g:ale_sign_style_warning = 'โ ๏ธ'
let g:ale_sign_warning = 'โ ๏ธ'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:
(executable check - success) /Users/wongm/DJRepos/data-provider/node_modules/eslint/bin/eslint.js
(finished - exit code 0) ['sh', '-c', 'cd ''/Users/wongm/DJRepos/data-provider'' && ''/Users/wongm/DJRepos/data-provider/node_modules/eslint/bin/eslint.js'' -f json --stdin --stdin-filename ''/Users/wongm/DJRepos/data-provider/index.js'' < ''/var/folders/0q/3hxy33qs1m93xl32bg2lxnp40000gq/T/vUXXquv/4/index.js''']
<<<OUTPUT STARTS>>>
[{"filePath":"/Users/wongm/DJRepos/data-provider/index.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0}]
<<<OUTPUT ENDS>>>
(finished - exit code 1) ['/bin/zsh', '-c', 'cd ''/Users/wongm/DJRepos/data-provider'' && ''/Users/wongm/DJRepos/data-provider/node_modules/eslint/bin/eslint.js'' -f json --stdin --stdin-filename ''/Users/wongm/DJRepos/data-provider/index.js'' < ''/var/folders/0q/3hxy33qs1m93xl32bg2lxnp40000gq/T/vUXXquv/5/index.js''']
<<<OUTPUT STARTS>>>
[{"filePath":"/Users/wongm/DJRepos/data-provider/index.js","messages":[{"ruleId":"indent","severity":2,"message":"Expected indentation of 0 spaces but found 4.","line":1,"column":1,"nodeType":"Identifier","messageId":"wrongIndentation","endLine":1,"endColumn":5,"fix":{"range":[0,4],"text":""}}],"errorCount":1,"warningCount":0,"fixableErrorCount":1,"fixableWarningCount":0,"source":" module.exports = require('./lib/index');\n"}]
<<<OUTPUT ENDS>>>
(finished - exit code 0) ['/bin/zsh', '-c', '''/Users/wongm/DJRepos/data-provider/node_modules/eslint/bin/eslint.js'' --version']
<<<OUTPUT STARTS>>>
v5.15.1
<<<OUTPUT ENDS>>>
(finished - exit code 0) ['/bin/zsh', '-c', '''/Users/wongm/DJRepos/data-provider/node_modules/eslint/bin/eslint.js'' --stdin-filename ''/Users/wongm/DJRepos/data-provider/index.js'' --stdin --fix-dry-run --format=json < ''/var/folders/0q/3hxy33qs1m93xl32bg2lxnp40000gq/T/vUXXquv/6/index.js''']
(finished - exit code 0) ['/bin/zsh', '-c', 'cd ''/Users/wongm/DJRepos/data-provider'' && ''/Users/wongm/DJRepos/data-provider/node_modules/eslint/bin/eslint.js'' -f json --stdin --stdin-filename ''/Users/wongm/DJRepos/data-provider/index.js'' < ''/var/folders/0q/3hxy33qs1m93xl32bg2lxnp40000gq/T/vUXXquv/7/index.js''']
<<<OUTPUT STARTS>>>
[{"filePath":"/Users/wongm/DJRepos/data-provider/index.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0}]
<<<OUTPUT ENDS>>>
And for one of the repos not working properly:
Current Filetype: javascript
Available Linters: ['eslint', 'fecs', 'flow', 'flow-language-server', 'jscs', 'jshint', 'standard', 'tsserver', 'xo']
Enabled Linters: ['eslint', 'flow-language-server']
Suggested Fixers:
'eslint' - Apply eslint --fix to a file.
'fecs' - Apply fecs format to a file.
'importjs' - automatic imports for javascript
'prettier' - Apply prettier to a file.
'prettier_eslint', 'prettier-eslint' - Apply prettier-eslint to a file.
'prettier_standard', 'prettier-standard' - Apply prettier-standard to a file.
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'standard' - Fix JavaScript files using standard --fix
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
'xo' - Fix JavaScript/TypeScript files using xo --fix.
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_importjs_executable = 'importjs'
Global Variables:
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 1
let g:ale_fixers = {'json': ['prettier', 'fixjson'], 'javascript': ['eslint', 'importjs'], 'python': ['autopep8']}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 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_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {'vim': ['ale_custom_linting_rules'], 'json': ['jsonlint'], 'javascript': ['eslint', 'flow-language-server'], 'python': ['flake8']}
let g:ale_linters_explicit = 1
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_lsp_root = {}
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_set_balloons = 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_info = 'โ ๏ธ'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = 'โ'
let g:ale_sign_style_warning = 'โ ๏ธ'
let g:ale_sign_warning = 'โ ๏ธ'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:
(finished - exit code 0) ['sh', '-c', 'cd ''/Users/wongm/DJRepos/web-ui'' && ''/Users/wongm/DJRepos/web-ui/node_modules/eslint/bin/eslint.js'' -f json --stdin --stdin-filename ''/Users/wongm/DJRepos/web-ui/componentProvider.js'' < ''/var/folders/0q/3hxy33qs1m93xl32bg2lxnp40000gq/T/vJlpCOc/31/componentProvider.js''']
<<<OUTPUT STARTS>>>
[{"filePath":"/Users/wongm/DJRepos/web-ui/componentProvider.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0}]
<<<OUTPUT ENDS>>>
(finished - exit code 1) ['/bin/zsh', '-c', 'cd ''/Users/wongm/DJRepos/web-ui'' && ''/Users/wongm/DJRepos/web-ui/node_modules/eslint/bin/eslint.js'' -f json --stdin --stdin-filename ''/Users/wongm/DJRepos/web-ui/componentProvider.js'' < ''/var/folders/0q/3hxy33qs1m93xl32bg2lxnp40000gq/T/vJlpCOc/32/componentProvider.js''']
<<<OUTPUT STARTS>>>
[{"filePath":"/Users/wongm/DJRepos/web-ui/componentProvider.js","messages":[{"ruleId":"indent","severity":2,"message":"Expected indentation of 0 spaces but found 4.","line":2,"column":1,"nodeType":"Keyword","messageId":"wrongIndentation","endLine":2,"endColumn":5,"fix":{"range":[38,42],"text":""}}],"errorCount":1,"warningCount":0,"fixableErrorCount":1,"fixableWarningCount":0,"source":"// Is only true in development builds\n const env = process && process.env ? process.env : {};\nif (module.hot) {\n module.exports = require('./lib/componentProvider');\n}\n// Web-UI code compiled for node.js usage.\n// TODO: Move all es5/server transpiling to app's webpack config.\nelse {\n module.exports = require('./es5/componentProvider');\n}\n"}]
<<<OUTPUT ENDS>>>
(finished - exit code 0) ['/bin/zsh', '-c', '''/Users/wongm/DJRepos/web-ui/node_modules/eslint/bin/eslint.js'' --version']
<<<OUTPUT STARTS>>>
v6.8.0
<<<OUTPUT ENDS>>>
(finished - exit code 2) ['/bin/zsh', '-c', '''/Users/wongm/DJRepos/web-ui/node_modules/eslint/bin/eslint.js'' --stdin-filename ''/Users/wongm/DJRepos/web-ui/componentProvider.js'' --stdin --fix-dry-run --format=json < ''/var/folders/0q/3hxy33qs1m93xl32bg2lxnp40000gq/T/vJlpCOc/33/componentProvider.js''']
(finished - exit code 1) ['/bin/zsh', '-c', 'cd ''/Users/wongm/DJRepos/web-ui'' && ''/Users/wongm/DJRepos/web-ui/node_modules/eslint/bin/eslint.js'' -f json --stdin --stdin-filename ''/Users/wongm/DJRepos/web-ui/componentProvider.js'' < ''/var/folders/0q/3hxy33qs1m93xl32bg2lxnp40000gq/T/vJlpCOc/34/componentProvider.js''']
<<<OUTPUT STARTS>>>
[{"filePath":"/Users/wongm/DJRepos/web-ui/componentProvider.js","messages":[{"ruleId":"indent","severity":2,"message":"Expected indentation of 0 spaces but found 4.","line":2,"column":1,"nodeType":"Keyword","messageId":"wrongIndentation","endLine":2,"endColumn":5,"fix":{"range":[38,42],"text":""}}],"errorCount":1,"warningCount":0,"fixableErrorCount":1,"fixableWarningCount":0,"source":"// Is only true in development builds\n const env = process && process.env ? process.env : {};\nif (module.hot) {\n module.exports = require('./lib/componentProvider');\n}\n// Web-UI code compiled for node.js usage.\n// TODO: Move all es5/server transpiling to app's webpack config.\nelse {\n module.exports = require('./es5/componentProvider');\n}\n"}]
<<<OUTPUT ENDS>>>
I have the same issue here.
(finished - exit code 2) ['/bin/zsh', '-c', '''/path-to-my-repo/api/node_modules/eslint/bin/eslint.js'' --stdin-filename ''/path-to-my-repo/api/src/index.ts'' --stdin --fix
-dry-run --format=json < ''/var/folders/px/48qkg8ls2gd64zx2603j425m0000gp/T/nvimMqu1av/27/index.ts''']
(finished - exit code 2) ['/bin/zsh', '-c', '''/path-to-my-repo/api/node_modules/eslint/bin/eslint.js'' --stdin-filename ''/path-to-my-repo/api/src/index.ts'' --stdin --fix
-dry-run --format=json < ''/var/folders/px/48qkg8ls2gd64zx2603j425m0000gp/T/nvimMqu1av/28/index.ts''']
I have the same issue, prettier exiting with code 2 and not formatting JS or TS.
Possibly the same issue: https://github.com/dense-analysis/ale/issues/3143
Fixed in #3096
Most helpful comment
I have the same issue here.